diff options
author | Rob Clark <[email protected]> | 2019-04-16 11:10:01 -0700 |
---|---|---|
committer | Rob Clark <[email protected]> | 2019-04-25 14:13:31 -0700 |
commit | 96d2e4ab8ad394a4c3e8d315880b7af7a0cc824c (patch) | |
tree | 3f1775c7f6011db797701b36579765b4faed5e1a /src/gallium/drivers/freedreno/freedreno_context.c | |
parent | 650391868935ce047b7108f1c4f25f97323f8031 (diff) |
freedreno: add robustness support
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/freedreno_context.c')
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_context.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c index 4e86d099974..bf26d00bc1e 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.c +++ b/src/gallium/drivers/freedreno/freedreno_context.c @@ -208,6 +208,39 @@ fd_set_debug_callback(struct pipe_context *pctx, memset(&ctx->debug, 0, sizeof(ctx->debug)); } +static uint32_t +fd_get_reset_count(struct fd_context *ctx, bool per_context) +{ + uint64_t val; + enum fd_param_id param = + per_context ? FD_CTX_FAULTS : FD_GLOBAL_FAULTS; + int ret = fd_pipe_get_param(ctx->pipe, param, &val); + debug_assert(!ret); + return val; +} + +static enum pipe_reset_status +fd_get_device_reset_status(struct pipe_context *pctx) +{ + struct fd_context *ctx = fd_context(pctx); + int context_faults = fd_get_reset_count(ctx, true); + int global_faults = fd_get_reset_count(ctx, false); + enum pipe_reset_status status; + + if (context_faults != ctx->context_reset_count) { + status = PIPE_GUILTY_CONTEXT_RESET; + } else if (global_faults != ctx->global_reset_count) { + status = PIPE_INNOCENT_CONTEXT_RESET; + } else { + status = PIPE_NO_RESET; + } + + ctx->context_reset_count = context_faults; + ctx->global_reset_count = global_faults; + + return status; +} + /* TODO we could combine a few of these small buffers (solid_vbuf, * blit_texcoord_vbuf, and vsc_size_mem, into a single buffer and * save a tiny bit of memory @@ -304,6 +337,11 @@ fd_context_init(struct fd_context *ctx, struct pipe_screen *pscreen, ctx->screen = screen; ctx->pipe = fd_pipe_new2(screen->dev, FD_PIPE_3D, prio); + if (fd_device_version(screen->dev) >= FD_VERSION_ROBUSTNESS) { + ctx->context_reset_count = fd_get_reset_count(ctx, true); + ctx->global_reset_count = fd_get_reset_count(ctx, false); + } + ctx->primtypes = primtypes; ctx->primtype_mask = 0; for (i = 0; i < PIPE_PRIM_MAX; i++) @@ -321,6 +359,7 @@ fd_context_init(struct fd_context *ctx, struct pipe_screen *pscreen, pctx->flush = fd_context_flush; pctx->emit_string_marker = fd_emit_string_marker; pctx->set_debug_callback = fd_set_debug_callback; + pctx->get_device_reset_status = fd_get_device_reset_status; pctx->create_fence_fd = fd_create_fence_fd; pctx->fence_server_sync = fd_fence_server_sync; pctx->texture_barrier = fd_texture_barrier; |