aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/etnaviv/etnaviv_context.c
diff options
context:
space:
mode:
authorChristian Gmeiner <[email protected]>2019-02-23 16:15:19 +0100
committerChristian Gmeiner <[email protected]>2019-03-01 08:08:56 +0100
commit64813541d575c4244293c6cbcd9739b12a22a76f (patch)
tree1c38ccda0971694c7d747e6d7a50bfb38c71b731 /src/gallium/drivers/etnaviv/etnaviv_context.c
parentf1061fa5771496ae95f195c1aa590736cd209414 (diff)
etnaviv: fix resource usage tracking across different pipe_context's
A pipe_resource can be shared by all the pipe_context's hanging off the same pipe_screen. Changes from v2 -> v3: - add locking with mtx_*() to resource and screen (Marek) Changes from v3 -> v4: - drop rsc->lock, just use screen->lock for the entire serialization (Marek) - simplify etna_resource_used() flush condition, which also prevents potentially flushing resources twice (Marek) - don't remove resouces from screen->used_resources in etna_cmd_stream_reset_notify(), they may still be used in other contexts and may need flushing there later on (Marek) Changes from v4 -> v5: - Fix coding style issues reported by Guido Changes from v5 -> v6: - Add missing locking in etna_transfer_map(..) (Boris) Signed-off-by: Christian Gmeiner <[email protected]> Signed-off-by: Marek Vasut <[email protected]> Signed-off-by: Boris Brezillon <[email protected]> Tested-by: Marek Vasut <[email protected]> Reviewed-by: Boris Brezillon <[email protected]> Tested-by: Boris Brezillon <[email protected]>
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_context.c')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_context.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c
index 44b50925a4f..83a703f7cc2 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
+++ b/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"
@@ -329,7 +330,8 @@ 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;
+ struct set_entry *entry;
etna_set_state(stream, VIVS_GL_API_MODE, VIVS_GL_API_MODE_OPENGL);
etna_set_state(stream, VIVS_GL_VERTEX_ELEMENT_CONFIG, 0x00000001);
@@ -384,16 +386,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 +441,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);