[Mesa-dev] [PATCH 04/11] pipe-loader-drm: use pipe_screen_unreference to destroy screen
Rob Herring
robh at kernel.org
Thu Jun 23 23:58:03 UTC 2016
Use pipe_screen_unreference as it will call pipe_screen->destroy() when
the pipe_screen is no longer referenced.
The pipe_screen referencing is done within create_screen() functions
as drivers (like amdgpu) may have special needs for ref counting.
Signed-off-by: Rob Herring <robh at kernel.org>
Cc: Emil Velikov <emil.l.velikov at gmail.com>
---
src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
index d1a6276..52d082e 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
@@ -45,6 +45,7 @@
#include "util/u_memory.h"
#include "util/u_dl.h"
#include "util/u_debug.h"
+#include "util/u_screen.h"
#define DRM_RENDER_NODE_DEV_NAME_FORMAT "%s/renderD%d"
#define DRM_RENDER_NODE_MAX_NODES 63
@@ -277,17 +278,17 @@ pipe_loader_drm_release(struct pipe_loader_device **dev)
pipe_mutex_lock(loader_mutex);
- pscreen->destroy(pscreen);
-
+ if (pipe_screen_unreference(pscreen, ddev->fd)) {
#ifndef GALLIUM_STATIC_TARGETS
- if (ddev->lib)
- util_dl_close(ddev->lib);
+ if (ddev->lib)
+ util_dl_close(ddev->lib);
#endif
- close(ddev->fd);
- FREE(ddev->base.driver_name);
- FREE(ddev);
- *dev = NULL;
+ close(ddev->fd);
+ FREE(ddev->base.driver_name);
+ FREE(ddev);
+ *dev = NULL;
+ }
pipe_mutex_unlock(loader_mutex);
}
--
2.9.0
More information about the mesa-dev
mailing list