return false;
}
- if (notify_reset) {
- *dri_ctx_error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
- return false;
- }
-
struct brw_context *brw = rzalloc(NULL, struct brw_context);
if (!brw) {
printf("%s: failed to alloc context\n", __FUNCTION__);
brw_init_driver_functions(brw, &functions);
+ if (notify_reset)
+ functions.GetGraphicsResetStatus = brw_get_graphics_reset_status;
+
struct gl_context *ctx = &brw->ctx;
if (mesaVis == NULL) {
brw_process_intel_debug_variable(brw);
brw_initialize_context_constants(brw);
+ ctx->Const.ResetStrategy = notify_reset
+ ? GL_LOSE_CONTEXT_ON_RESET_ARB : GL_NO_RESET_NOTIFICATION_ARB;
+
/* Reinitialize the context point state. It depends on ctx->Const values. */
_mesa_init_point(ctx);
}
}
+ /* Notification of GPU resets requires hardware contexts and a kernel new
+ * enough to support DRM_IOCTL_I915_GET_RESET_STATS.
+ */
+ if (notify_reset &&
+ (brw->hw_ctx == NULL
+ || drm_intel_get_reset_stats(brw->hw_ctx, &brw->reset_count, NULL,
+ NULL))) {
+ /* This is the wrong error code, but the correct error code (one that
+ * will cause EGL to generate EGL_BAD_MATCH) doesn't seem to exist.
+ */
+ *dri_ctx_error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+ intelDestroyContext(driContextPriv);
+ return false;
+ }
+
brw_init_surface_formats(brw);
if (brw->is_g4x || brw->gen >= 5) {