[Mesa-dev] [PATCH] egl/dri: Don't invoke dri2_dpy->flush if it's NULL.

Kristian Høgsberg krh at bitplanet.net
Wed Feb 6 13:33:12 PST 2013


On Wed, Feb 6, 2013 at 4:30 PM, Kristian Høgsberg <krh at bitplanet.net> wrote:
> On Tue, Feb 5, 2013 at 8:43 AM,  <jfonseca at vmware.com> wrote:
>> From: José Fonseca <jfonseca at vmware.com>
>>
>> I'd like to test Mesa OpenGL ES along side with NVIDIA libGL drivers. But
>> without this change, I get a NULL pointer dereference.
>
> Which DRI driver doesn't support the flush extension?  EGL is expected
> to flush before swap buffer (and we can't rely on glFLush since that
> may be optimized to not do anything) so we have to have this DRI
> driver entry point.  The EGL DRI loader shouldn't load a DRI driver
> that doesn't support the flush extension in the first place, of
> course.

And looking at the code, the EGL DRI2 loader doesn't load drivers that
doesn't have the flush extension, so it sounds like the driver in
question claims is supports the extension, but passes an extension
struct with a NULL pointer in the flush function pointer.

> Kristian
>
>> ---
>>  src/egl/drivers/dri2/egl_dri2.c |    3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
>> index 351fbf4..01e6302 100644
>> --- a/src/egl/drivers/dri2/egl_dri2.c
>> +++ b/src/egl/drivers/dri2/egl_dri2.c
>> @@ -970,7 +970,8 @@ dri2_wait_client(_EGLDriver *drv, _EGLDisplay *disp, _EGLContext *ctx)
>>     /* FIXME: If EGL allows frontbuffer rendering for window surfaces,
>>      * we need to copy fake to real here.*/
>>
>> -   (*dri2_dpy->flush->flush)(dri2_surf->dri_drawable);
>> +   if (dri2_dpy->flush != NULL)
>> +      (*dri2_dpy->flush->flush)(dri2_surf->dri_drawable);
>>
>>     return EGL_TRUE;
>>  }
>> --
>> 1.7.9.5
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list