Mesa (master): egl_dri2: Compare configs before matching them

Kristian Høgsberg krh at kemper.freedesktop.org
Sun Jun 12 05:58:49 PDT 2011


Module: Mesa
Branch: master
Commit: 16e30276e843b6f788aee75547136ea24e4a4248
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=16e30276e843b6f788aee75547136ea24e4a4248

Author: Benjamin Franzke <benjaminfranzke at googlemail.com>
Date:   Sat Jun 11 23:00:40 2011 +0200

egl_dri2: Compare configs before matching them

This compares attribs like buffer size, and will prevent merging
unequal configs because of match criterion is e.g. ATLEAST.

---

 src/egl/drivers/dri2/egl_dri2.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index a943005..3d5827e 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -97,6 +97,18 @@ EGLint dri2_to_egl_attribute_map[] = {
    0,				/* __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE */
 };
 
+static EGLBoolean
+dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria)
+{
+   if (_eglCompareConfigs(conf, criteria, NULL, EGL_FALSE) != 0)
+      return EGL_FALSE;
+
+   if (!_eglMatchConfig(conf, criteria))
+      return EGL_FALSE;
+
+   return EGL_TRUE;
+}
+
 struct dri2_egl_config *
 dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
 		int depth, EGLint surface_type, const EGLint *attr_list)
@@ -190,7 +202,7 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
    base.ConfigID    = EGL_DONT_CARE;
    base.SurfaceType = EGL_DONT_CARE;
    num_configs = _eglFilterArray(disp->Configs, (void **) &matching_config, 1,
-                                 (_EGLArrayForEach) _eglMatchConfig, &base);
+                                 (_EGLArrayForEach) dri2_match_config, &base);
 
    if (num_configs == 1) {
       conf = (struct dri2_egl_config *) matching_config;



More information about the mesa-commit mailing list