r100,r200: Don't assume glVisual is non-NULL during context creation
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 25 May 2017 05:14:44 +0000 (22:14 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 1 Jun 2017 04:14:44 +0000 (21:14 -0700)
Thanks to EGL_MESA_configless_context, the visual pointer can be NULL.

Fixes a segfault (or assertion failure) in piglit's
egl-configless-context test.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/r200/r200_context.c
src/mesa/drivers/dri/radeon/radeon_common_context.c
src/mesa/drivers/dri/radeon/radeon_context.c

index 8f354c15b3c085c378153ff8732428ac980ca870..aaa9b9317df95f8b3616a5ff13b7ea3ecef87221 100644 (file)
@@ -199,7 +199,6 @@ GLboolean r200CreateContext( gl_api api,
       return false;
    }
 
-   assert(glVisual);
    assert(driContextPriv);
    assert(screen);
 
index f0c2dfa6ba3974294da29370ab9a92e306560bab..77894353761c2ed1c95e3cb7659c6cd60b75605a 100644 (file)
@@ -182,7 +182,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon,
         radeon->texture_depth = driQueryOptioni (&radeon->optionCache,
                                                "texture_depth");
         if (radeon->texture_depth == DRI_CONF_TEXTURE_DEPTH_FB)
-                radeon->texture_depth = ( glVisual->rgbBits > 16 ) ?
+                radeon->texture_depth = (glVisual == NULL || glVisual->rgbBits > 16) ?
                DRI_CONF_TEXTURE_DEPTH_32 : DRI_CONF_TEXTURE_DEPTH_16;
 
        radeon->texture_row_align = 32;
index 5e15b46fb32b1de22318b1bb2876e1566c0971fe..11afe20c6a0dcdb0a8890c9470d09196acc3f21e 100644 (file)
@@ -165,7 +165,6 @@ r100CreateContext( gl_api api,
       return false;
    }
 
-   assert(glVisual);
    assert(driContextPriv);
    assert(screen);