summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-01-05 23:21:07 -0800
committerZhenyu Wang <zhenyu.z.wang@intel.com>2009-01-07 18:52:01 +0800
commitbb415fd714323f36199a9bef890d885733f2e046 (patch)
treebaa087efb1da66cf7b3a74e7d449309c2484082a /src
parentca3e9afdeeb2ef7d145330cbc696afb8d9324dce (diff)
Fix pin leakage with EXA GTT-mapping shortcut, and crash with UXA on KMS.
(cherry picked from commit 342120be0956bfc12822d1ffbfbd8aaabf3e922f)
Diffstat (limited to 'src')
-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 aeffedd8..29445aca 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -785,14 +785,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;
@@ -801,6 +802,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) {
@@ -808,10 +811,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)