summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2015-12-08 16:35:57 +0000
committerEmil Velikov <emil.l.velikov@gmail.com>2016-01-08 12:05:25 +0200
commitbdf289e7fbc030651394cecc3bae43565380d591 (patch)
tree9d80908e88cb03f70608f3fa935be30a9816274c
parentab0b96a939b8eb48f203b8726ca5440a593716da (diff)
i965: Fix crash when calling glViewport with no surface bound
If EGL_KHR_surfaceless_context is used then glViewport can be called with NULL for the draw and read surfaces. This was previously causing a crash because the i965 driver tries to use this point to invalidate the surfaces and it was derferencing the NULL pointer. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93257 Cc: Nanley Chery <nanley.g.chery@intel.com> Cc: "11.1" <mesa-stable@lists.freedesktop.org> Tested-by: Nanley Chery <nanley.g.chery@intel.com> Reviewed-by: Nanley Chery <nanley.g.chery@intel.com> (cherry picked from commit 8c5310da9d1cbf2272f72d3ed4264544456a4683)
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 5e2c369be5..b0e6e8cf5b 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -158,8 +158,10 @@ intel_viewport(struct gl_context *ctx)
__DRIcontext *driContext = brw->driContext;
if (_mesa_is_winsys_fbo(ctx->DrawBuffer)) {
- dri2InvalidateDrawable(driContext->driDrawablePriv);
- dri2InvalidateDrawable(driContext->driReadablePriv);
+ if (driContext->driDrawablePriv)
+ dri2InvalidateDrawable(driContext->driDrawablePriv);
+ if (driContext->driReadablePriv)
+ dri2InvalidateDrawable(driContext->driReadablePriv);
}
}