Mesa (main): i915: Prevent invalid framebuffer usage

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 25 22:17:09 UTC 2021


Module: Mesa
Branch: main
Commit: 6a0c0d0da9b27d2868f993dcd71220bf2bd7e18f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6a0c0d0da9b27d2868f993dcd71220bf2bd7e18f

Author: Philippe Normand <philn at igalia.com>
Date:   Sun Apr 11 13:27:56 2021 +0100

i915: 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 at redhat.com>
Reviewed-by: Eleni Maria Stea <estea at igalia.com>

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

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11459>

---

 src/mesa/drivers/dri/i915/intel_buffers.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_buffers.c b/src/mesa/drivers/dri/i915/intel_buffers.c
index 83d59edb6fa..a4340fff6bb 100644
--- a/src/mesa/drivers/dri/i915/intel_buffers.c
+++ b/src/mesa/drivers/dri/i915/intel_buffers.c
@@ -62,7 +62,8 @@ intelDrawBuffer(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(intel->driContext->driDrawablePriv);
+      if (intel->driContext->driDrawablePriv)
+         dri2InvalidateDrawable(intel->driContext->driDrawablePriv);
    }
 
    intel_draw_buffer(ctx);
@@ -79,7 +80,8 @@ intelReadBuffer(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(intel->driContext->driReadablePriv);
+      if (intel->driContext->driReadablePriv)
+         dri2InvalidateDrawable(intel->driContext->driReadablePriv);
    }
 }
 



More information about the mesa-commit mailing list