i965: Prevent invalid framebuffer usage

When a surfaceless context is in use, driDrawablePriv might be NULL, so needs to
be checked before calling dri2InvalidateDrawable. Same for read calls.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eleni Maria Stea <estea@igalia.com>

See https://gitlab.freedesktop.org/mesa/mesa/-/issues/778

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11459>
This commit is contained in:
Miguel Gomez 2021-06-03 16:44:30 +02:00 committed by Marge Bot
parent 6a0c0d0da9
commit 7b89e4d104

View file

@ -42,7 +42,8 @@ brw_drawbuffer(struct gl_context *ctx)
* time, invalidate our DRI drawable so we'll ask for new buffers
* (including the fake front) before we start rendering again.
*/
dri2InvalidateDrawable(brw->driContext->driDrawablePriv);
if (brw->driContext->driDrawablePriv)
dri2InvalidateDrawable(brw->driContext->driDrawablePriv);
brw_prepare_render(brw);
}
}
@ -58,7 +59,8 @@ brw_readbuffer(struct gl_context * ctx, GLenum mode)
* time, invalidate our DRI drawable so we'll ask for new buffers
* (including the fake front) before we start reading again.
*/
dri2InvalidateDrawable(brw->driContext->driReadablePriv);
if (brw->driContext->driDrawablePriv)
dri2InvalidateDrawable(brw->driContext->driReadablePriv);
brw_prepare_render(brw);
}
}