[Mesa-dev] [PATCH mesa] egl: properly count configs
Eric Engestrom
eric at engestrom.ch
Thu Jun 15 23:55:59 UTC 2017
dri2_conf represents a similar config (which shouldn't be counted)
if its config has the ID EGL_DONT_CARE.
Reported-by: Liu Zhiquan <zhiquan.liu at intel.com>
Signed-off-by: Eric Engestrom <eric at engestrom.ch>
---
Re-implemented Liu Zhiquan's fix, without all the unnecessary changes,
and applied to all platforms, but with one major change: compare against
the one value that means the config shouldn't be counted.
---
src/egl/drivers/dri2/platform_android.c | 3 ++-
src/egl/drivers/dri2/platform_drm.c | 3 ++-
src/egl/drivers/dri2/platform_surfaceless.c | 3 ++-
src/egl/drivers/dri2/platform_wayland.c | 3 ++-
src/egl/drivers/dri2/platform_x11.c | 6 ++++--
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 5550f580a8..f560d8ab40 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -1061,7 +1061,8 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
dri2_conf = dri2_add_config(dpy, dri2_dpy->driver_configs[i],
count + 1, surface_type, config_attrs, visuals[j].rgba_masks);
if (dri2_conf) {
- count++;
+ if (dri2_conf->base.ConfigID != EGL_DONT_CARE)
+ count++;
format_count[j]++;
}
}
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index 8b0562c75d..9731d6ea19 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -631,7 +631,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 != EGL_DONT_CARE)
+ count++;
format_count[j]++;
}
}
diff --git a/src/egl/drivers/dri2/platform_surfaceless.c b/src/egl/drivers/dri2/platform_surfaceless.c
index 0eb3fb7505..e17002806b 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 != EGL_DONT_CARE)
+ count++;
format_count[j]++;
}
}
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index f746f0bfd1..bb1bb6067d 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1131,7 +1131,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 != EGL_DONT_CARE)
+ count++;
format_count[j]++;
}
}
diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c
index 74d3a164b6..a3ff33edeb 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -773,7 +773,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 != EGL_DONT_CARE)
+ 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
@@ -788,7 +789,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 != EGL_DONT_CARE)
+ count++;
}
}
}
--
Cheers,
Eric
More information about the mesa-dev
mailing list