[Intel-gfx] [PATCH] Free front buffer bo when X exit
Shuang He
shuang.he at intel.com
Sat Apr 18 05:48:08 CEST 2009
It's needed when KMS or DRI2 is enabled, or there will be memory leak
---
src/i830_driver.c | 6 ++++++
src/i830_exa.c | 6 ++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 48e2351..0233da9 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3713,6 +3713,12 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
pI830->uxa_driver = NULL;
}
#endif
+ if (pI830->front_buffer) {
+ i830_set_pixmap_bo(pScreen->GetScreenPixmap(pScreen), NULL);
+ i830_free_memory(pScrn, pI830->front_buffer);
+ pI830->front_buffer = NULL;
+ }
+
xf86_cursors_fini (pScreen);
i830_allocator_fini(pScrn);
diff --git a/src/i830_exa.c b/src/i830_exa.c
index 39011bc..9c8a8af 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -812,7 +812,8 @@ i830_set_pixmap_bo(PixmapPtr pixmap, dri_bo *bo)
dri_bo_unreference (old_bo);
#if I830_USE_UXA
if (i830->accel == ACCEL_UXA) {
- dri_bo_reference(bo);
+ if (bo != NULL)
+ dri_bo_reference(bo);
dixSetPrivate(&pixmap->devPrivates, &uxa_pixmap_index, bo);
}
#endif
@@ -821,7 +822,8 @@ i830_set_pixmap_bo(PixmapPtr pixmap, dri_bo *bo)
struct i830_exa_pixmap_priv *driver_priv =
exaGetPixmapDriverPrivate(pixmap);
if (driver_priv) {
- dri_bo_reference(bo);
+ if (bo != NULL)
+ dri_bo_reference(bo);
driver_priv->bo = bo;
}
}
--
1.6.0.3
More information about the Intel-gfx
mailing list