summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-01-05 23:21:07 -0800
committerEric Anholt <eric@anholt.net>2009-01-06 11:20:08 -0800
commit342120be0956bfc12822d1ffbfbd8aaabf3e922f (patch)
tree087ae7d2ffcc88beac3fa12d56ceefb1037ff15f
parent9a5082d2920c1a212fe935b5a093013e8035c321 (diff)
Fix pin leakage with EXA GTT-mapping shortcut, and crash with UXA on KMS.
-rw-r--r--src/i830_exa.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/i830_exa.c b/src/i830_exa.c
index b300fdc0..df48dbf4 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -811,14 +811,15 @@ i830_uxa_prepare_access (PixmapPtr pixmap, uxa_access_t access)
i830->need_sync = FALSE;
}
- if (drm_intel_bo_pin(bo, 4096) != 0) {
- /* happen in vt switched */
- if (dri_bo_map(bo, access == UXA_ACCESS_RW) != 0)
+ if (pScrn->vtSema && !pI830->use_drm_mode) {
+ if (drm_intel_bo_pin(bo, 4096) != 0)
return FALSE;
- pixmap->devPrivate.ptr = bo->virtual;
- } else {
drm_intel_gem_bo_start_gtt_access(bo, access == UXA_ACCESS_RW);
pixmap->devPrivate.ptr = pI830->FbBase + bo->offset;
+ } else {
+ if (dri_bo_map(bo, access == UXA_ACCESS_RW) != 0)
+ return FALSE;
+ pixmap->devPrivate.ptr = bo->virtual;
}
}
return TRUE;
@@ -827,6 +828,8 @@ i830_uxa_prepare_access (PixmapPtr pixmap, uxa_access_t access)
static void
i830_uxa_finish_access (PixmapPtr pixmap)
{
+ ScrnInfoPtr pScrn = xf86Screens[pixmap->drawable.pScreen->myNum];
+ I830Ptr pI830 = I830PTR(pScrn);
dri_bo *bo = i830_get_pixmap_bo (pixmap);
if (bo) {
@@ -834,10 +837,10 @@ i830_uxa_finish_access (PixmapPtr pixmap)
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
I830Ptr i830 = I830PTR(scrn);
- if (bo->virtual)
- dri_bo_unmap(bo);
- else
+ if (pScrn->vtSema && !pI830->use_drm_mode)
drm_intel_bo_unpin(bo);
+ else
+ dri_bo_unmap(bo);
pixmap->devPrivate.ptr = NULL;
if (bo == i830->front_buffer->bo)