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 (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;
}
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);