[Intel-gfx] [PATCH] UXA: Add support for tiled front/back/depth by cutting over to the GTT map.

Eric Anholt eric at anholt.net
Thu Nov 13 22:20:49 CET 2008


---
 src/i830_exa.c |   32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/src/i830_exa.c b/src/i830_exa.c
index 9fcda51..1147c1d 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -94,6 +94,11 @@ i830_pixmap_tiled(PixmapPtr pPixmap)
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
     I830Ptr pI830 = I830PTR(pScrn);
     unsigned long offset;
+    dri_bo *bo;
+
+    bo = i830_get_pixmap_bo(pPixmap);
+    if ((bo != NULL) && bo == pI830->front_buffer->bo)
+	return pI830->front_buffer->tiling != TILE_NONE;
 
     offset = intel_get_pixmap_offset(pPixmap);
     if (offset == pI830->front_buffer->offset &&
@@ -747,6 +752,8 @@ i830_uxa_set_pixmap_bo (PixmapPtr pixmap, dri_bo *bo)
 static Bool
 i830_uxa_prepare_access (PixmapPtr pixmap, uxa_access_t access)
 {
+    ScrnInfoPtr pScrn = xf86Screens[pixmap->drawable.pScreen->myNum];
+    I830Ptr pI830 = I830PTR(pScrn);
     dri_bo *bo = i830_get_pixmap_bo (pixmap);
 
     if (bo) {
@@ -755,10 +762,25 @@ i830_uxa_prepare_access (PixmapPtr pixmap, uxa_access_t access)
 	I830Ptr i830 = I830PTR(scrn);
 	
 	intel_batch_flush(scrn, FALSE);
+	/* XXX: dri_bo_map should handle syncing for us, what's the deal? */
 	if (i830->need_sync) {
 	    I830Sync(scrn);
 	    i830->need_sync = FALSE;
 	}
+
+	/* For tiled front buffer, short-circuit to the GTT mapping. */
+	if (bo == pI830->front_buffer->bo &&
+	    pI830->front_buffer->tiling != TILE_NONE) {
+
+	    if (access == UXA_ACCESS_RW)
+		drm_intel_gem_bo_start_gtt_write(bo);
+	    else
+		dri_bo_wait_rendering(bo);
+
+	    pixmap->devPrivate.ptr = pI830->FbBase + bo->offset;
+	    return TRUE;
+	}
+
 	if (dri_bo_map (bo, access == UXA_ACCESS_RW) != 0)
 	    return FALSE;
         pixmap->devPrivate.ptr = bo->virtual;
@@ -769,14 +791,20 @@ 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) {
 	ScreenPtr screen = pixmap->drawable.pScreen;
 	ScrnInfoPtr scrn = xf86Screens[screen->myNum];
 	I830Ptr i830 = I830PTR(scrn);
-	
-	dri_bo_unmap (bo);
+
+	/* If we used the GTT map, skip the unmap. */
+	if (bo != pI830->front_buffer->bo ||
+	    pI830->front_buffer->tiling == TILE_NONE)
+	    dri_bo_unmap(bo);
+
 	pixmap->devPrivate.ptr = NULL;
 	if (bo == i830->front_buffer->bo)
 	    i830->need_flush = TRUE;
-- 
1.5.6.5




More information about the Intel-gfx mailing list