summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_gl2.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c
index f3c1c0d7af..f61ad57396 100644
--- a/libvo/vo_gl2.c
+++ b/libvo/vo_gl2.c
@@ -640,6 +640,18 @@ static int choose_glx_visual(Display *dpy, int scr, XVisualInfo *res_vi)
w += val;
/* and finally, prefer DirectColor-ed visuals to allow color corrections */
if (vi_list[i].class != DirectColor) w += 100;
+
+ // avoid bad-looking visual with less that 8bit per color
+ res = glXGetConfig(dpy, vi_list + i, GLX_RED_SIZE, &val);
+ if (res) continue;
+ if (val < 8) w += 50;
+ res = glXGetConfig(dpy, vi_list + i, GLX_GREEN_SIZE, &val);
+ if (res) continue;
+ if (val < 8) w += 70;
+ res = glXGetConfig(dpy, vi_list + i, GLX_BLUE_SIZE, &val);
+ if (res) continue;
+ if (val < 8) w += 50;
+
if (w < best_weight) {
best_weight = w;
best_i = i;