diff options
author | Lukas Hejtmanek <xhejtman@ics.muni.cz> | 2009-03-04 17:33:27 -0500 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2009-03-04 17:33:27 -0500 |
commit | d4c64f01b9429a8fb314e43f40d1f02bb8aab30f (patch) | |
tree | 700dba77f37aae19868c080c1b0ed7d6fa5f7c76 | |
parent | 095a001f755201d3c19335b67a84c57b1d080a83 (diff) |
Fix serious memory leak at Enter/LeaveVT
This fixes huge memory leak at each VT switch (about 600 BOs + 6MB
of RSS of Xserver).
-rw-r--r-- | src/i965_render.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/i965_render.c b/src/i965_render.c index de1c8b32..ab7f7d22 100644 --- a/src/i965_render.c +++ b/src/i965_render.c @@ -1715,7 +1715,7 @@ gen4_render_state_cleanup(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); struct gen4_render_state *render_state= pI830->gen4_render_state; - int i; + int i, j, k, l, m; if (render_state->vertex_buffer_bo) { dri_bo_unreference (render_state->vertex_buffer_bo); @@ -1728,12 +1728,23 @@ gen4_render_state_cleanup(ScrnInfoPtr pScrn) render_state->sf_state_bo = NULL; drm_intel_bo_unreference(render_state->sf_mask_state_bo); render_state->sf_mask_state_bo = NULL; - drm_intel_bo_unreference(render_state->cc_state_bo); - render_state->cc_state_bo = NULL; + 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++) { + 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; } |