When add config, dri_config is double or single. Should only add EGL_WINDOW_BIT to surface_type for double dri_config, Should only add EGL_PBUFFER_BIT EGL_PIXMAP_BIT to surface_type for single dri_config. This avoid crash when operate on wrong surface_type which dri_double_config or dri_single_config is null.
Signed-off-by: Liu Zhiquan <zhiquan....@intel.com> Signed-off-by: Long, Zhifang <zhifang.l...@intel.com> --- src/egl/drivers/dri2/egl_dri2.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index ac231d0..60b24ad 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -287,6 +287,11 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id, return NULL; } + if (surface_type & (double_buffer ? EGL_WINDOW_BIT : (EGL_PBUFFER_BIT | EGL_PIXMAP_BIT))) + surface_type &= ~(!double_buffer ? EGL_WINDOW_BIT : (EGL_PBUFFER_BIT | EGL_PIXMAP_BIT)); + else + return NULL; + config_id = base.ConfigID; base.ConfigID = EGL_DONT_CARE; base.SurfaceType = EGL_DONT_CARE; @@ -325,10 +330,6 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id, return NULL; } - if (double_buffer) { - surface_type &= ~EGL_PIXMAP_BIT; - } - conf->base.SurfaceType |= surface_type; return conf; -- 1.9.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev