summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorPhilipp Zabel <[email protected]>2017-04-27 18:44:02 +0200
committerEmil Velikov <[email protected]>2017-05-05 19:35:08 +0100
commitff27a478077f54ea7731b41ce6fed09601ad7018 (patch)
tree2b0f6887e3b97c8094cb26becf1a349199265323 /src/gallium
parent63d75fbfe31bc5a0227d2036d24f37d4aa941fa2 (diff)
renderonly: drop resources on destroy
The renderonly_scanout holds a reference on its prime pipe resource, which should be released when it is destroyed. If it was created by renderonly_create_kms_dumb_buffer_for_resource, the dumb BO also has to be destroyed. Fixes: 848b49b288f ("gallium: add renderonly library") CC: <[email protected]> Signed-off-by: Philipp Zabel <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Christian Gmeiner <[email protected]> (cherry picked from commit cd8ee259c8e9b1c16b5c3214595b91eb31e7de19)
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/renderonly/renderonly.c11
-rw-r--r--src/gallium/auxiliary/renderonly/renderonly.h3
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_resource.c2
3 files changed, 13 insertions, 3 deletions
diff --git a/src/gallium/auxiliary/renderonly/renderonly.c b/src/gallium/auxiliary/renderonly/renderonly.c
index e17c32886d2..f377c368e57 100644
--- a/src/gallium/auxiliary/renderonly/renderonly.c
+++ b/src/gallium/auxiliary/renderonly/renderonly.c
@@ -34,6 +34,7 @@
#include "state_tracker/drm_driver.h"
#include "pipe/p_screen.h"
+#include "util/u_inlines.h"
#include "util/u_memory.h"
struct renderonly *
@@ -65,8 +66,16 @@ renderonly_scanout_for_prime(struct pipe_resource *rsc, struct renderonly *ro)
}
void
-renderonly_scanout_destroy(struct renderonly_scanout *scanout)
+renderonly_scanout_destroy(struct renderonly_scanout *scanout,
+ struct renderonly *ro)
{
+ struct drm_mode_destroy_dumb destroy_dumb = { };
+
+ pipe_resource_reference(&scanout->prime, NULL);
+ if (ro->kms_fd != -1) {
+ destroy_dumb.handle = scanout->handle;
+ ioctl(ro->kms_fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb);
+ }
FREE(scanout);
}
diff --git a/src/gallium/auxiliary/renderonly/renderonly.h b/src/gallium/auxiliary/renderonly/renderonly.h
index 28989f202d9..d5430732982 100644
--- a/src/gallium/auxiliary/renderonly/renderonly.h
+++ b/src/gallium/auxiliary/renderonly/renderonly.h
@@ -77,7 +77,8 @@ struct renderonly_scanout *
renderonly_scanout_for_prime(struct pipe_resource *rsc, struct renderonly *ro);
void
-renderonly_scanout_destroy(struct renderonly_scanout *scanout);
+renderonly_scanout_destroy(struct renderonly_scanout *scanout,
+ struct renderonly *ro);
static inline boolean
renderonly_get_handle(struct renderonly_scanout *scanout,
diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.c b/src/gallium/drivers/etnaviv/etnaviv_resource.c
index db9acacae20..bcb5e33141f 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.c
@@ -308,7 +308,7 @@ etna_resource_destroy(struct pipe_screen *pscreen, struct pipe_resource *prsc)
etna_bo_del(rsc->ts_bo);
if (rsc->scanout)
- renderonly_scanout_destroy(rsc->scanout);
+ renderonly_scanout_destroy(rsc->scanout, etna_screen(pscreen)->ro);
list_delinit(&rsc->list);