}
}
- /* 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) {
};
static const __DRIextension *intelScreenExtensions[] = {
+ &intelTexBufferExtension.base,
+ &intelFlushExtension.base,
+ &intelImageExtension.base,
+ &intelRendererQueryExtension.base,
+ &dri2ConfigQueryExtension.base,
+ NULL
+};
+
+static const __DRIextension *intelRobustScreenExtensions[] = {
&intelTexBufferExtension.base,
&intelFlushExtension.base,
&intelImageExtension.base,
set_max_gl_versions(intelScreen);
- psp->extensions = intelScreenExtensions;
+ /* Notification of GPU resets requires hardware contexts and a kernel new
+ * enough to support DRM_IOCTL_I915_GET_RESET_STATS. If the ioctl is
+ * supported, calling it with a context of 0 will either generate EPERM or
+ * no error. If the ioctl is not supported, it always generate EINVAL.
+ * Use this to determine whether to advertise the __DRI2_ROBUSTNESS
+ * extension to the loader.
+ */
+ struct drm_i915_reset_stats stats;
+ memset(&stats, 0, sizeof(stats));
+
+ const int ret = drmIoctl(psp->fd, DRM_IOCTL_I915_GET_RESET_STATS, &stats);
+
+ psp->extensions = (ret == -1 && errno == EINVAL)
+ ? intelScreenExtensions : intelRobustScreenExtensions;
return (const __DRIconfig**) intel_screen_make_configs(psp);
}