summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/iris/iris_context.c
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2019-05-07 22:26:22 -0700
committerKenneth Graunke <[email protected]>2019-05-09 16:49:07 -0700
commit343f41781c17a9db37f8872f1c4018cd58330417 (patch)
tree9a17f7d5cd8720c34ec804454ad489a1f93d80ed /src/gallium/drivers/iris/iris_context.c
parentc5c12bdd004994abfe0f5723e2d285cc69706b1a (diff)
iris: Hook up device reset callbacks
This mechanism lets the driver inform the state tracker about GPU resets, say for destroying a robust API context and reporting a "device lost" error to the application, making it take action to deal with this.
Diffstat (limited to 'src/gallium/drivers/iris/iris_context.c')
-rw-r--r--src/gallium/drivers/iris/iris_context.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/gallium/drivers/iris/iris_context.c b/src/gallium/drivers/iris/iris_context.c
index 7ed4fdcd8d7..5d4d27edf4e 100644
--- a/src/gallium/drivers/iris/iris_context.c
+++ b/src/gallium/drivers/iris/iris_context.c
@@ -102,6 +102,18 @@ iris_lost_context_state(struct iris_batch *batch)
}
static void
+iris_set_device_reset_callback(struct pipe_context *ctx,
+ const struct pipe_device_reset_callback *cb)
+{
+ struct iris_context *ice = (struct iris_context *)ctx;
+
+ if (cb)
+ ice->reset = *cb;
+ else
+ memset(&ice->reset, 0, sizeof(ice->reset));
+}
+
+static void
iris_get_sample_position(struct pipe_context *ctx,
unsigned sample_count,
unsigned sample_index,
@@ -210,6 +222,7 @@ iris_create_context(struct pipe_screen *pscreen, void *priv, unsigned flags)
ctx->destroy = iris_destroy_context;
ctx->set_debug_callback = iris_set_debug_callback;
+ ctx->set_device_reset_callback = iris_set_device_reset_callback;
ctx->get_sample_position = iris_get_sample_position;
ice->shaders.urb_size = devinfo->urb.size;
@@ -250,7 +263,7 @@ iris_create_context(struct pipe_screen *pscreen, void *priv, unsigned flags)
for (int i = 0; i < IRIS_BATCH_COUNT; i++) {
iris_init_batch(&ice->batches[i], screen, &ice->vtbl, &ice->dbg,
- ice->batches, (enum iris_batch_name) i,
+ &ice->reset, ice->batches, (enum iris_batch_name) i,
I915_EXEC_RENDER, priority);
}