[Intel-gfx] PATCH fix leak of composite_op

Zdenek Kabelac zdenek.kabelac at gmail.com
Tue Mar 24 01:57:28 CET 2009


Hi

I think I've discovered yet another leak in LeaveVT, when the last
composite_op is not being released.
Patch also completely free gen4_render_state - so it's clean at exit
and safes few lines of code.

>From 69e6aa95a6eedaba883b710de0f52aa098bad390 Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac at redhat.com>
Date: Tue, 24 Mar 2009 01:46:36 +0100
Subject: [PATCH] * fixes1


Signed-off-by: Zdenek Kabelac <zkabelac at redhat.com>
---

diff --git a/src/i965_render.c b/src/i965_render.c
index c123a36..610f03e 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -1717,34 +1720,30 @@ gen4_render_state_cleanup(ScrnInfoPtr pScrn)
     struct gen4_render_state *render_state= pI830->gen4_render_state;
     int i, j, k, l, m;

-    if (render_state->vertex_buffer_bo) {
+    gen4_composite_op *composite_op = &render_state->composite_op;
+    if (composite_op)
+	drm_intel_bo_unreference(composite_op->binding_table_bo);
+
+    if (render_state->vertex_buffer_bo)
 	dri_bo_unreference (render_state->vertex_buffer_bo);
-	render_state->vertex_buffer_bo = NULL;
-    }

     drm_intel_bo_unreference(render_state->vs_state_bo);
-    render_state->vs_state_bo = NULL;
     drm_intel_bo_unreference(render_state->sf_state_bo);
-    render_state->sf_state_bo = NULL;
     drm_intel_bo_unreference(render_state->sf_mask_state_bo);
-    render_state->sf_mask_state_bo = NULL;

-    for (i = 0; i < WM_KERNEL_COUNT; i++) {
+    for (i = 0; i < WM_KERNEL_COUNT; i++)
 	drm_intel_bo_unreference(render_state->wm_kernel_bo[i]);
-	render_state->wm_kernel_bo[i] = NULL;
-    }

     for (i = 0; i < SAMPLER_STATE_FILTER_COUNT; i++)
 	for (j = 0; j < SAMPLER_STATE_EXTEND_COUNT; j++)
 	    for (k = 0; k < SAMPLER_STATE_FILTER_COUNT; k++)
 		for (l = 0; l < SAMPLER_STATE_EXTEND_COUNT; l++)
-		    for (m = 0; m < WM_KERNEL_COUNT; m++) {
+		    for (m = 0; m < WM_KERNEL_COUNT; m++)
 			drm_intel_bo_unreference(render_state->wm_state_bo[m][i][j][k][l]);
-			render_state->wm_state_bo[m][i][j][k][l] = NULL;
-		    }

     drm_intel_bo_unreference(render_state->cc_state_bo);
-    render_state->cc_state_bo = NULL;
     drm_intel_bo_unreference(render_state->sip_kernel_bo);
-    render_state->sip_kernel_bo = NULL;
+
+    free(pI830->gen4_render_state);
+    pI830->gen4_render_state = NULL;
 }
-- 
1.6.2



More information about the Intel-gfx mailing list