radeon: Move gfx/dma cs cleanup to r600_common_context_cleanup
authorAaron Watry <awatry@gmail.com>
Tue, 7 Jan 2014 20:45:41 +0000 (14:45 -0600)
committerAaron Watry <awatry@gmail.com>
Thu, 16 Jan 2014 16:10:04 +0000 (10:10 -0600)
The radeonsi code was not cleaning up either of these items leading to
leaked memory.

v2: Move cleanup to r600_common_context_cleanup instead of duplicating
    the logic for SI

CC: "10.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/radeon/r600_pipe_common.c

index 74e007b227906256c35ec084d054e39caef9a24f..e7d586223fd1f77a5e7f47f67ef3d9cab2ac4252 100644 (file)
@@ -185,13 +185,6 @@ static void r600_destroy_context(struct pipe_context *context)
 
        r600_release_command_buffer(&rctx->start_cs_cmd);
 
-       if (rctx->b.rings.gfx.cs) {
-               rctx->b.ws->cs_destroy(rctx->b.rings.gfx.cs);
-       }
-       if (rctx->b.rings.dma.cs) {
-               rctx->b.ws->cs_destroy(rctx->b.rings.dma.cs);
-       }
-
        FREE(rctx->start_compute_cs_cmd.buf);
 
        r600_common_context_cleanup(&rctx->b);
index 28921beea821b3b68f99cdfb9d39f3c14aa60cf9..07bf383f74dc757c1a44832383897b2c593a5ce7 100644 (file)
@@ -250,6 +250,13 @@ bool r600_common_context_init(struct r600_common_context *rctx,
 
 void r600_common_context_cleanup(struct r600_common_context *rctx)
 {
+       if (rctx->rings.gfx.cs) {
+               rctx->ws->cs_destroy(rctx->rings.gfx.cs);
+       }
+       if (rctx->rings.dma.cs) {
+               rctx->ws->cs_destroy(rctx->rings.dma.cs);
+       }
+
        if (rctx->uploader) {
                u_upload_destroy(rctx->uploader);
        }