diff options
author | Christian Gmeiner <[email protected]> | 2019-02-23 16:15:19 +0100 |
---|---|---|
committer | Christian Gmeiner <[email protected]> | 2019-03-01 08:08:56 +0100 |
commit | 64813541d575c4244293c6cbcd9739b12a22a76f (patch) | |
tree | 1c38ccda0971694c7d747e6d7a50bfb38c71b731 /src/gallium/drivers/etnaviv/etnaviv_screen.c | |
parent | f1061fa5771496ae95f195c1aa590736cd209414 (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_screen.c')
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_screen.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index ee32a499fb5..62b6f1c80fa 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -38,6 +38,7 @@ #include "etnaviv_resource.h" #include "etnaviv_translate.h" +#include "util/hash_table.h" #include "util/os_time.h" #include "util/u_math.h" #include "util/u_memory.h" @@ -82,6 +83,9 @@ etna_screen_destroy(struct pipe_screen *pscreen) { struct etna_screen *screen = etna_screen(pscreen); + _mesa_set_destroy(screen->used_resources, NULL); + mtx_destroy(&screen->lock); + if (screen->perfmon) etna_perfmon_del(screen->perfmon); @@ -1019,8 +1023,16 @@ etna_screen_create(struct etna_device *dev, struct etna_gpu *gpu, if (screen->drm_version >= ETNA_DRM_VERSION_PERFMON) etna_pm_query_setup(screen); + mtx_init(&screen->lock, mtx_recursive); + screen->used_resources = _mesa_set_create(NULL, _mesa_hash_pointer, + _mesa_key_pointer_equal); + if (!screen->used_resources) + goto fail2; + return pscreen; +fail2: + mtx_destroy(&screen->lock); fail: etna_screen_destroy(pscreen); return NULL; |