[Mesa-dev] [PATCH v5 04/12] gallium: use pipe_screen_unreference to destroy screen in debug wrappers

Rob Herring robh at kernel.org
Mon Aug 7 22:58:03 UTC 2017


Use pipe_screen_unreference as it will call pipe_screen->destroy() when
the pipe_screen is no longer referenced.

Signed-off-by: Rob Herring <robh at kernel.org>
---
 src/gallium/drivers/ddebug/dd_screen.c | 3 ++-
 src/gallium/drivers/noop/noop_pipe.c   | 3 ++-
 src/gallium/drivers/rbug/rbug_screen.c | 3 ++-
 src/gallium/drivers/trace/tr_screen.c  | 3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/ddebug/dd_screen.c b/src/gallium/drivers/ddebug/dd_screen.c
index 14e6f6b011f7..806846573234 100644
--- a/src/gallium/drivers/ddebug/dd_screen.c
+++ b/src/gallium/drivers/ddebug/dd_screen.c
@@ -28,6 +28,7 @@
 #include "dd_pipe.h"
 #include "dd_public.h"
 #include "util/u_memory.h"
+#include "util/u_screen.h"
 #include <stdio.h>
 
 
@@ -314,7 +315,7 @@ dd_screen_destroy(struct pipe_screen *_screen)
    struct dd_screen *dscreen = dd_screen(_screen);
    struct pipe_screen *screen = dscreen->screen;
 
-   screen->destroy(screen);
+   pipe_screen_unreference(screen);
    FREE(dscreen);
 }
 
diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c
index d1e795dab163..28c095058a36 100644
--- a/src/gallium/drivers/noop/noop_pipe.c
+++ b/src/gallium/drivers/noop/noop_pipe.c
@@ -29,6 +29,7 @@
 #include "util/u_memory.h"
 #include "util/u_inlines.h"
 #include "util/u_format.h"
+#include "util/u_screen.h"
 #include "util/u_upload_mgr.h"
 #include "noop_public.h"
 
@@ -431,7 +432,7 @@ static void noop_destroy_screen(struct pipe_screen *screen)
    struct noop_pipe_screen *noop_screen = (struct noop_pipe_screen*)screen;
    struct pipe_screen *oscreen = noop_screen->oscreen;
 
-   oscreen->destroy(oscreen);
+   pipe_screen_unreference(oscreen);
    FREE(screen);
 }
 
diff --git a/src/gallium/drivers/rbug/rbug_screen.c b/src/gallium/drivers/rbug/rbug_screen.c
index b12f029b3ea1..dc36425cc45f 100644
--- a/src/gallium/drivers/rbug/rbug_screen.c
+++ b/src/gallium/drivers/rbug/rbug_screen.c
@@ -30,6 +30,7 @@
 #include "pipe/p_state.h"
 #include "util/u_memory.h"
 #include "util/u_debug.h"
+#include "util/u_screen.h"
 #include "util/simple_list.h"
 
 #include "rbug_public.h"
@@ -45,7 +46,7 @@ rbug_screen_destroy(struct pipe_screen *_screen)
    struct rbug_screen *rb_screen = rbug_screen(_screen);
    struct pipe_screen *screen = rb_screen->screen;
 
-   screen->destroy(screen);
+   pipe_screen_unreference(screen);
 
    FREE(rb_screen);
 }
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index e56434c5bda6..697854185d54 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -27,6 +27,7 @@
 
 #include "util/u_format.h"
 #include "util/u_memory.h"
+#include "util/u_screen.h"
 #include "util/simple_list.h"
 
 #include "tr_dump.h"
@@ -488,7 +489,7 @@ trace_screen_destroy(struct pipe_screen *_screen)
    trace_dump_arg(ptr, screen);
    trace_dump_call_end();
 
-   screen->destroy(screen);
+   pipe_screen_unreference(screen);
 
    FREE(tr_scr);
 }
-- 
2.11.0



More information about the mesa-dev mailing list