summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShuang He <shuang.he@intel.com>2009-04-18 11:48:08 +0800
committerEric Anholt <eric@anholt.net>2009-04-24 16:48:25 -0700
commit9748aa5594a8357754c06dd82108b131260b1a71 (patch)
tree83ee51027f31f7cd3b79398ad733b4de1a1fffeb
parentb8ca146b060e6f76bf048f1f6cf6ee89d38d015e (diff)
Free front buffer bo when X exit
It's needed when KMS or DRI2 is enabled, or there will be memory leak. Also fixes a segfault at startup with fake bufmgr. Signed-off-by: Eric Anholt <eric@anholt.net>
-rw-r--r--src/i830_driver.c6
-rw-r--r--src/i830_exa.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 276132e7..b4e17375 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -3694,6 +3694,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 5199cefc..9896d433 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -788,7 +788,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
@@ -797,7 +798,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;
}
}