summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Engestrom <eric@engestrom.ch>2017-06-21 21:55:56 +0100
committerAndres Gomez <agomez@igalia.com>2017-06-28 20:15:04 +0300
commitbf425b48eabb67dc98daa78d4d4640bd6d07d810 (patch)
treedbea3e149ba5cab78951060f7ed523982c83cbb0
parent83c15002fbc9bf3938411c65fec87d16d24e1501 (diff)
egl: properly count configs
dri2_conf represents another config (which shouldn't be counted) if it doesn't have the requested ID. Reported-by: Liu Zhiquan <zhiquan.liu@intel.com> Signed-off-by: Eric Engestrom <eric@engestrom.ch> Cc: <mesa-stable@lists.freedesktop.org> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> (cherry picked from commit c87f73724efbec493d0149738d3a7ea11bfab222)
-rw-r--r--src/egl/drivers/dri2/platform_android.c3
-rw-r--r--src/egl/drivers/dri2/platform_drm.c3
-rw-r--r--src/egl/drivers/dri2/platform_surfaceless.c3
-rw-r--r--src/egl/drivers/dri2/platform_wayland.c3
-rw-r--r--src/egl/drivers/dri2/platform_x11.c6
5 files changed, 12 insertions, 6 deletions
diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index d5c9d38853f..d675cdcfcd7 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -1035,7 +1035,8 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
dri2_conf = dri2_add_config(dpy, dri2_dpy->driver_configs[j],
count + 1, surface_type, config_attrs, visuals[i].rgba_masks);
if (dri2_conf) {
- count++;
+ if (dri2_conf->base.ConfigID == count + 1)
+ count++;
format_count[i]++;
}
}
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index be0b8a44beb..b178eaa1886 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -630,7 +630,8 @@ drm_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *disp)
dri2_conf = dri2_add_config(disp, dri2_dpy->driver_configs[i],
count + 1, EGL_WINDOW_BIT, attr_list, NULL);
if (dri2_conf) {
- count++;
+ if (dri2_conf->base.ConfigID == count + 1)
+ count++;
format_count[j]++;
}
}
diff --git a/src/egl/drivers/dri2/platform_surfaceless.c b/src/egl/drivers/dri2/platform_surfaceless.c
index 7e887de09da..3e191695660 100644
--- a/src/egl/drivers/dri2/platform_surfaceless.c
+++ b/src/egl/drivers/dri2/platform_surfaceless.c
@@ -212,7 +212,8 @@ surfaceless_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
count + 1, EGL_PBUFFER_BIT, NULL, visuals[j].rgba_masks);
if (dri2_conf) {
- count++;
+ if (dri2_conf->base.ConfigID == count + 1)
+ count++;
format_count[j]++;
}
}
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 7a8c194ca49..b8af6ef2531 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1128,7 +1128,8 @@ dri2_wl_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *disp)
dri2_conf = dri2_add_config(disp, dri2_dpy->driver_configs[i],
count + 1, EGL_WINDOW_BIT, NULL, visuals[j].rgba_masks);
if (dri2_conf) {
- count++;
+ if (dri2_conf->base.ConfigID == count + 1)
+ count++;
format_count[j]++;
}
}
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 2f1086e28f0..3c1fafb5e4f 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -772,7 +772,8 @@ dri2_x11_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
dri2_conf = dri2_add_config(disp, config, count + 1, surface_type,
config_attrs, rgba_masks);
if (dri2_conf)
- count++;
+ if (dri2_conf->base.ConfigID == count + 1)
+ count++;
/* Allow a 24-bit RGB visual to match a 32-bit RGBA EGLConfig.
* Otherwise it will only match a 32-bit RGBA visual. On a
@@ -787,7 +788,8 @@ dri2_x11_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
dri2_conf = dri2_add_config(disp, config, count + 1, surface_type,
config_attrs, rgba_masks);
if (dri2_conf)
- count++;
+ if (dri2_conf->base.ConfigID == count + 1)
+ count++;
}
}
}