[Mesa-dev] [PATCH 4/6] radeonsi/compute: Free program and program.kernels on shutdown

Aaron Watry awatry at gmail.com
Wed Nov 6 14:49:22 PST 2013


v2: Fix indentation

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>
---
 src/gallium/drivers/radeonsi/radeonsi_compute.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/radeonsi_compute.c b/src/gallium/drivers/radeonsi/radeonsi_compute.c
index 265dbd7..32d2487 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_compute.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_compute.c
@@ -236,7 +236,21 @@ static void radeonsi_launch_grid(
 }
 
 
-static void si_delete_compute_state(struct pipe_context *ctx, void* state){}
+static void si_delete_compute_state(struct pipe_context *ctx, void* state){
+	struct si_pipe_compute *program = (struct si_pipe_compute *)state;
+
+	if (!state) {
+		return;
+	}
+
+	if (program->kernels) {
+		FREE(program->kernels);
+	}
+
+	//And then free the program itself.
+	FREE(program);
+}
+
 static void si_set_compute_resources(struct pipe_context * ctx_,
 		unsigned start, unsigned count,
 		struct pipe_surface ** surfaces) { }
-- 
1.8.3.2



More information about the mesa-dev mailing list