summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2020-08-26 15:32:08 +0200
committerMarge Bot <eric+marge@anholt.net>2021-03-11 14:41:48 +0000
commit2229328cf9213bfbfac2e0e5cc411a41bcaae695 (patch)
treed393de23ee6f28a300410877060b7edbbb5a7640
parent187218395d7c9e8257ac17c7cbf1cc7add5c9363 (diff)
renderonly: close the gpu fd when destroying renderonly
Currently the screen destruction closes the dup'ed fd, but not the original renderonly gpu fd, which is kept around for the lifetime of the renderonly. Squashed revert of "vc4: Don't leak the GPU fd for renderonly usage." (commit 99ef66c325a99b3e191987d8327e7e4cd4aafcd7) as requested by Eric. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Guido G√ľnther <agx@sigxcpu.org> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com> Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6983>
-rw-r--r--src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c3
-rw-r--r--src/gallium/winsys/vc4/drm/vc4_drm_winsys.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c b/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c
index 9000a6ac3ed..790ed7d69e9 100644
--- a/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c
+++ b/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c
@@ -40,6 +40,9 @@
static void kmsro_ro_destroy(struct renderonly *ro)
{
+ if (ro->gpu_fd >= 0)
+ close(ro->gpu_fd);
+
FREE(ro);
}
diff --git a/src/gallium/winsys/vc4/drm/vc4_drm_winsys.c b/src/gallium/winsys/vc4/drm/vc4_drm_winsys.c
index a507821a940..ae409923afe 100644
--- a/src/gallium/winsys/vc4/drm/vc4_drm_winsys.c
+++ b/src/gallium/winsys/vc4/drm/vc4_drm_winsys.c
@@ -61,5 +61,5 @@ struct pipe_screen *
vc4_drm_screen_create_renderonly(struct renderonly *ro,
const struct pipe_screen_config *config)
{
- return vc4_screen_create(ro->gpu_fd, ro);
+ return vc4_screen_create(fcntl(ro->gpu_fd, F_DUPFD_CLOEXEC, 3), ro);
}