aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/etnaviv/etnaviv_screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_screen.c')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_screen.c12
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;