diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-01-22 02:49:53 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2020-01-22 02:49:53 +0000 |
commit | d264279e28002d81821c883795911844a4c01a2c (patch) | |
tree | b0481616eda55b543a0dc1487d096c3239885c41 /lib/mesa/src/gallium/drivers/etnaviv/etnaviv_context.c | |
parent | fdcc03929065b5bf5dd93553db219ea3e05c8c34 (diff) |
Merge Mesa 19.2.8
Diffstat (limited to 'lib/mesa/src/gallium/drivers/etnaviv/etnaviv_context.c')
-rw-r--r-- | lib/mesa/src/gallium/drivers/etnaviv/etnaviv_context.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/lib/mesa/src/gallium/drivers/etnaviv/etnaviv_context.c b/lib/mesa/src/gallium/drivers/etnaviv/etnaviv_context.c index 44b50925a..6919d1367 100644 --- a/lib/mesa/src/gallium/drivers/etnaviv/etnaviv_context.c +++ b/lib/mesa/src/gallium/drivers/etnaviv/etnaviv_context.c @@ -36,6 +36,7 @@ #include "etnaviv_query.h" #include "etnaviv_query_hw.h" #include "etnaviv_rasterizer.h" +#include "etnaviv_resource.h" #include "etnaviv_screen.h" #include "etnaviv_shader.h" #include "etnaviv_state.h" @@ -309,27 +310,32 @@ etna_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence, enum pipe_flush_flags flags) { struct etna_context *ctx = etna_context(pctx); + struct etna_screen *screen = ctx->screen; int out_fence_fd = -1; + mtx_lock(&screen->lock); + list_for_each_entry(struct etna_hw_query, hq, &ctx->active_hw_queries, node) etna_hw_query_suspend(hq, ctx); etna_cmd_stream_flush2(ctx->stream, ctx->in_fence_fd, - (flags & PIPE_FLUSH_FENCE_FD) ? &out_fence_fd : - NULL); + (flags & PIPE_FLUSH_FENCE_FD) ? &out_fence_fd : + NULL); list_for_each_entry(struct etna_hw_query, hq, &ctx->active_hw_queries, node) etna_hw_query_resume(hq, ctx); if (fence) *fence = etna_fence_create(pctx, out_fence_fd); + + mtx_unlock(&screen->lock); } static void etna_cmd_stream_reset_notify(struct etna_cmd_stream *stream, void *priv) { struct etna_context *ctx = priv; - struct etna_resource *rsc, *rsc_tmp; + struct etna_screen *screen = ctx->screen; etna_set_state(stream, VIVS_GL_API_MODE, VIVS_GL_API_MODE_OPENGL); etna_set_state(stream, VIVS_GL_VERTEX_ELEMENT_CONFIG, 0x00000001); @@ -341,8 +347,6 @@ etna_cmd_stream_reset_notify(struct etna_cmd_stream *stream, void *priv) etna_set_state(stream, VIVS_PA_VIEWPORT_UNK00A80, 0x38a01404); etna_set_state(stream, VIVS_PA_VIEWPORT_UNK00A84, fui(8192.0)); etna_set_state(stream, VIVS_PA_ZFARCLIPPING, 0x00000000); - etna_set_state(stream, VIVS_PE_ALPHA_COLOR_EXT0, 0x00000000); - etna_set_state(stream, VIVS_PE_ALPHA_COLOR_EXT1, 0x00000000); etna_set_state(stream, VIVS_RA_HDEPTH_CONTROL, 0x00007000); etna_set_state(stream, VIVS_PE_STENCIL_CONFIG_EXT2, 0x00000000); etna_set_state(stream, VIVS_PS_CONTROL_EXT, 0x00000000); @@ -355,7 +359,6 @@ etna_cmd_stream_reset_notify(struct etna_cmd_stream *stream, void *priv) etna_set_state(stream, VIVS_RA_UNK00E0C, 0x00000000); } if (ctx->specs.halti >= 3) { /* Only on HALTI3+ */ - etna_set_state(stream, VIVS_PE_MEM_CONFIG, 0x00000000); /* TODO: cache modes */ etna_set_state(stream, VIVS_PS_HALTI3_UNK0103C, 0x76543210); } if (ctx->specs.halti >= 4) { /* Only on HALTI4+ */ @@ -366,7 +369,7 @@ etna_cmd_stream_reset_notify(struct etna_cmd_stream *stream, void *priv) if (ctx->specs.halti >= 5) { /* Only on HALTI5+ */ etna_set_state(stream, VIVS_NTE_DESCRIPTOR_UNK14C40, 0x00000001); etna_set_state(stream, VIVS_FE_HALTI5_UNK007D8, 0x00000002); - etna_set_state(stream, VIVS_FE_HALTI5_UNK007C4, 0x00000000); + etna_set_state(stream, VIVS_FE_HALTI5_ID_CONFIG, 0x00000000); etna_set_state(stream, VIVS_PS_SAMPLER_BASE, 0x00000000); etna_set_state(stream, VIVS_VS_SAMPLER_BASE, 0x00000020); etna_set_state(stream, VIVS_SH_CONFIG, VIVS_SH_CONFIG_RTNE_ROUNDING); @@ -384,16 +387,18 @@ etna_cmd_stream_reset_notify(struct etna_cmd_stream *stream, void *priv) ctx->dirty = ~0L; ctx->dirty_sampler_views = ~0L; - /* go through all the used resources and clear their status flag */ - LIST_FOR_EACH_ENTRY_SAFE(rsc, rsc_tmp, &ctx->used_resources, list) - { - debug_assert(rsc->status != 0); - rsc->status = 0; - rsc->pending_ctx = NULL; - list_delinit(&rsc->list); - } + /* + * Go through all _resources_ associated with this _screen_, pending + * in this _context_ and mark them as not pending in this _context_ + * anymore, since they were just flushed. + */ + mtx_lock(&screen->lock); + set_foreach(screen->used_resources, entry) { + struct etna_resource *rsc = (struct etna_resource *)entry->key; - assert(LIST_IS_EMPTY(&ctx->used_resources)); + _mesa_set_remove_key(rsc->pending_ctx, ctx); + } + mtx_unlock(&screen->lock); } static void @@ -437,8 +442,6 @@ etna_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) /* need some sane default in case state tracker doesn't set some state: */ ctx->sample_mask = 0xffff; - list_inithead(&ctx->used_resources); - /* Set sensible defaults for state */ etna_cmd_stream_reset_notify(ctx->stream, ctx); |