[Mesa-dev] [PATCH] i965: Properly reject __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS when __DRI2_ROBUSTNESS is not enabled
Ian Romanick
idr at freedesktop.org
Tue Nov 26 17:11:38 PST 2013
From: Ian Romanick <ian.d.romanick at intel.com>
Only allow __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS in brwCreateContext if
intelInitScreen2 also enabled __DRI2_ROBUSTNESS (thereby enabling
GLX_ARB_create_context).
This fixes a regression in the piglit test
"glx/GLX_ARB_create_context/invalid flag"
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reported-by: Paul Berry <stereotype441 at gmail.com>
Cc: "10.0" <mesa-stable at lists.freedesktop.org>
---
The patch that causes the regression (9b1c686) hasn't been picked to
10.0 yet, so this patch should get squashed with it when they're both
picked.
src/mesa/drivers/dri/i965/brw_context.c | 13 ++++++++++---
src/mesa/drivers/dri/i965/intel_screen.c | 4 +++-
src/mesa/drivers/dri/i965/intel_screen.h | 5 +++++
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 67ac01c..948f3bd 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -558,9 +558,16 @@ brwCreateContext(gl_api api,
struct dd_function_table functions;
struct gl_config visual;
- if (flags & ~(__DRI_CTX_FLAG_DEBUG
- | __DRI_CTX_FLAG_FORWARD_COMPATIBLE
- | __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS)) {
+ /* Only allow the __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS flag if the kernel
+ * provides us with context reset notifications.
+ */
+ uint32_t allowed_flags = __DRI_CTX_FLAG_DEBUG
+ | __DRI_CTX_FLAG_FORWARD_COMPATIBLE;
+
+ if (/*false &&*/ screen->has_context_reset_notification)
+ allowed_flags |= __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS;
+
+ if (flags & ~allowed_flags) {
*dri_ctx_error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
return false;
}
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 051c000..39c2f35 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -1344,7 +1344,9 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
const int ret = drmIoctl(psp->fd, DRM_IOCTL_I915_GET_RESET_STATS, &stats);
- psp->extensions = (ret == -1 && errno == EINVAL)
+ intelScreen->has_context_reset_notification = (ret != -1 || errno != EINVAL);
+
+ psp->extensions = !intelScreen->has_context_reset_notification
? intelScreenExtensions : intelRobustScreenExtensions;
return (const __DRIconfig**) intel_screen_make_configs(psp);
diff --git a/src/mesa/drivers/dri/i965/intel_screen.h b/src/mesa/drivers/dri/i965/intel_screen.h
index 2e3043e..924e1f2 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.h
+++ b/src/mesa/drivers/dri/i965/intel_screen.h
@@ -50,6 +50,11 @@ struct intel_screen
bool hw_has_swizzling;
+ /**
+ * Does the kernel support context reset notifications?
+ */
+ bool has_context_reset_notification;
+
dri_bufmgr *bufmgr;
/**
--
1.8.1.4
More information about the mesa-dev
mailing list