diff options
Diffstat (limited to 'src/gallium/drivers/iris/iris_context.c')
-rw-r--r-- | src/gallium/drivers/iris/iris_context.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/gallium/drivers/iris/iris_context.c b/src/gallium/drivers/iris/iris_context.c index 5d4d27edf4e..b56e746ea76 100644 --- a/src/gallium/drivers/iris/iris_context.c +++ b/src/gallium/drivers/iris/iris_context.c @@ -101,6 +101,40 @@ iris_lost_context_state(struct iris_batch *batch) memset(ice->state.last_grid, 0, sizeof(ice->state.last_grid)); } +static enum pipe_reset_status +iris_get_device_reset_status(struct pipe_context *ctx) +{ + struct iris_context *ice = (struct iris_context *)ctx; + + enum pipe_reset_status worst_reset = PIPE_NO_RESET; + + /* Check the reset status of each batch's hardware context, and take the + * worst status (if one was guilty, proclaim guilt). + */ + for (int i = 0; i < IRIS_BATCH_COUNT; i++) { + /* This will also recreate the hardware contexts as necessary, so any + * future queries will show no resets. We only want to report once. + */ + enum pipe_reset_status batch_reset = + iris_batch_check_for_reset(&ice->batches[i]); + + if (batch_reset == PIPE_NO_RESET) + continue; + + if (worst_reset == PIPE_NO_RESET) { + worst_reset = batch_reset; + } else { + /* GUILTY < INNOCENT < UNKNOWN */ + worst_reset = MIN2(worst_reset, batch_reset); + } + } + + if (worst_reset != PIPE_NO_RESET && ice->reset.reset) + ice->reset.reset(ice->reset.data, worst_reset); + + return worst_reset; +} + static void iris_set_device_reset_callback(struct pipe_context *ctx, const struct pipe_device_reset_callback *cb) @@ -223,6 +257,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_device_reset_status = iris_get_device_reset_status; ctx->get_sample_position = iris_get_sample_position; ice->shaders.urb_size = devinfo->urb.size; |