[Mesa-dev] [PATCH] egl/android: config id increase one by one

Liu Zhiquan zhiquan.liu at intel.com
Thu Jan 12 07:38:07 UTC 2017


when dri2_add_config, driver_configs may add to exist dri2_conf,
the config id should not increase in this case.
In the code, when ConfigID equal to count+1, it's mean a new config,
config_count will increase. otherwise it's a exist config.

Signed-off-by: Liu Zhiquan <zhiquan.liu at intel.com>
Signed-off-by: Long, Zhifang <zhifang.long at intel.com>
---
 src/egl/drivers/dri2/platform_android.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c
index 1c880f9..5bf6fd5 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -950,9 +950,9 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
      EGL_NONE
    };
    unsigned int format_count[ARRAY_SIZE(visuals)] = { 0 };
-   int count, i, j;
+   int config_count, i, j;
 
-   count = 0;
+   config_count = 0;
    for (i = 0; dri2_dpy->driver_configs[i]; i++) {
       const EGLint surface_type = EGL_WINDOW_BIT | EGL_PBUFFER_BIT;
       struct dri2_egl_config *dri2_conf;
@@ -962,9 +962,10 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
          config_attrs[3] = visuals[j].format;
 
          dri2_conf = dri2_add_config(dpy, dri2_dpy->driver_configs[i],
-               count + 1, surface_type, config_attrs, visuals[j].rgba_masks);
+               config_count + 1, surface_type, config_attrs, visuals[j].rgba_masks);
          if (dri2_conf) {
-            count++;
+            if (dri2_conf->base.ConfigID == (config_count + 1))
+               config_count++;
             format_count[j]++;
          }
       }
@@ -977,7 +978,7 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
       }
    }
 
-   return (count != 0);
+   return (config_count != 0);
 }
 
 static int
-- 
1.9.1



More information about the mesa-dev mailing list