[Mesa-dev] [PATCH 41/43] gallium/targets/d3dadapter9: Release the pipe_screen at destruction.

Axel Davy axel.davy at ens.fr
Fri Jan 30 12:34:40 PST 2015


We weren't releasing hal and ref, causing some issues (threads not released, etc)

Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
 src/gallium/targets/d3dadapter9/drm.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/gallium/targets/d3dadapter9/drm.c b/src/gallium/targets/d3dadapter9/drm.c
index bdc402f..f054654 100644
--- a/src/gallium/targets/d3dadapter9/drm.c
+++ b/src/gallium/targets/d3dadapter9/drm.c
@@ -79,14 +79,20 @@ struct d3dadapter9drm_context
 static void
 drm_destroy( struct d3dadapter9_context *ctx )
 {
+    if (ctx->ref)
+        ctx->ref->destroy(ctx->ref);
+    /* because ref is a wrapper around hal, freeing ref frees hal too. */
+    else if (ctx->hal)
+        ctx->hal->destroy(ctx->hal);
 #if !GALLIUM_STATIC_TARGETS
-    struct d3dadapter9drm_context *drm = (struct d3dadapter9drm_context *)ctx;
+    {
+        struct d3dadapter9drm_context *drm = (struct d3dadapter9drm_context *)ctx;
 
-    /* pipe_loader_sw destroys the context */
-    if (drm->swdev)
-        pipe_loader_release(&drm->swdev, 1);
-    if (drm->dev)
-        pipe_loader_release(&drm->dev, 1);
+        if (drm->swdev)
+            pipe_loader_release(&drm->swdev, 1);
+        if (drm->dev)
+            pipe_loader_release(&drm->dev, 1);
+    }
 #endif
 
     FREE(ctx);
-- 
2.1.0



More information about the mesa-dev mailing list