summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2016-05-23 22:49:51 -0700
committerKristian Høgsberg Kristensen <[email protected]>2016-05-25 09:41:44 -0700
commit85008db1d51f923113832394d7f8d6b1868be882 (patch)
tree1d033fbf1ecc53d8f0d0699fae9de52cc7965345 /src/mesa/drivers
parentf036eea2cf3012b6b7f9e1c7b317dd78811a1a3a (diff)
i965: Enable GL_KHR_robustness
GL_KHR_robustness adds the GL_CONTEXT_LOST error and five new entry points that we already implement. This patch adds a new dispatch table that returns GL_CONTEXT_LOST from all entry points and implements the GL_LOSE_CONTEXT_ON_RESET strategy by setting that table when we learn that we've lost the context. With the GL_CONTEXT_LOST reporting in place and dispatch for the new entry points we can turn on GL_KHR_robustness. Signed-off-by: Kristian Høgsberg Kristensen <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Acked-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_reset.c20
-rw-r--r--src/mesa/drivers/dri/i965/intel_batchbuffer.c3
-rw-r--r--src/mesa/drivers/dri/i965/intel_extensions.c1
4 files changed, 26 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 51554757f5b..4b2220126a1 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1704,6 +1704,8 @@ gen7_emit_urb_state(struct brw_context *brw,
/* brw_reset.c */
extern GLenum
brw_get_graphics_reset_status(struct gl_context *ctx);
+void
+brw_check_for_reset(struct brw_context *brw);
/* brw_compute.c */
extern void
diff --git a/src/mesa/drivers/dri/i965/brw_reset.c b/src/mesa/drivers/dri/i965/brw_reset.c
index e3182b1474f..df734e5f0fb 100644
--- a/src/mesa/drivers/dri/i965/brw_reset.c
+++ b/src/mesa/drivers/dri/i965/brw_reset.c
@@ -20,6 +20,9 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
+
+#include "main/context.h"
+
#include "brw_context.h"
/**
@@ -73,3 +76,20 @@ brw_get_graphics_reset_status(struct gl_context *ctx)
return GL_NO_ERROR;
}
+
+void
+brw_check_for_reset(struct brw_context *brw)
+{
+ uint32_t reset_count;
+ uint32_t active;
+ uint32_t pending;
+ int err;
+
+ err = drm_intel_get_reset_stats(brw->hw_ctx, &reset_count, &active,
+ &pending);
+ if (err)
+ return;
+
+ if (active > 0 || pending > 0)
+ _mesa_set_context_lost_dispatch(&brw->ctx);
+}
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index f220311842a..5a0db9f5db3 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -368,6 +368,9 @@ do_flush_locked(struct brw_context *brw)
if (unlikely(INTEL_DEBUG & DEBUG_BATCH))
do_batch_dump(brw);
+ if (brw->ctx.Const.ResetStrategy == GL_LOSE_CONTEXT_ON_RESET_ARB)
+ brw_check_for_reset(brw);
+
if (ret != 0) {
fprintf(stderr, "intel_do_flush_locked failed: %s\n", strerror(-ret));
exit(1);
diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
index feea6cac5f2..b8d75170d94 100644
--- a/src/mesa/drivers/dri/i965/intel_extensions.c
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c
@@ -246,6 +246,7 @@ intelInitExtensions(struct gl_context *ctx)
ctx->Extensions.EXT_texture_sRGB_decode = true;
ctx->Extensions.EXT_texture_swizzle = true;
ctx->Extensions.EXT_vertex_array_bgra = true;
+ ctx->Extensions.KHR_robustness = true;
ctx->Extensions.AMD_seamless_cubemap_per_texture = true;
ctx->Extensions.APPLE_object_purgeable = true;
ctx->Extensions.ATI_separate_stencil = true;