xf86-video-intel: 3 commits - src/i830_accel.c src/i830_uxa.c uxa/uxa.h uxa/uxa-render.c

Eric Anholt anholt at kemper.freedesktop.org
Wed Jul 22 09:35:00 PDT 2009


 src/i830_accel.c |    3 ---
 src/i830_uxa.c   |   21 +++++++++++++++------
 uxa/uxa-render.c |   42 +++++++++++++++++++++++-------------------
 uxa/uxa.h        |   10 ++++++++++
 4 files changed, 48 insertions(+), 28 deletions(-)

New commits:
commit 6b7728491c3b771bcba2c7ffd75330c0a0b37f44
Author: Eric Anholt <eric at anholt.net>
Date:   Wed Jul 15 16:38:07 2009 -0700

    Only align DRI2 tiled pixmaps to the DRI2 tiled pixmap alignment requirement.
    
    This should save significant amounts of memory for glyph and other small
    pixmap storage.
    
    Bug #21387

diff --git a/src/i830_accel.c b/src/i830_accel.c
index 96a7bde..abefa55 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -232,9 +232,6 @@ I830AccelInit(ScreenPtr pScreen)
 	pI830->accel_max_x = 2048;
 	pI830->accel_max_y = 2048;
     }
-    /* Bump the pitch so that we can tile any pixmap we create. */
-    if (pI830->directRenderingType >= DRI_DRI2)
-	pI830->accel_pixmap_pitch_alignment = 512;
 
     return i830_uxa_init(pScreen);
 }
diff --git a/src/i830_uxa.c b/src/i830_uxa.c
index 3212582..3a476a7 100644
--- a/src/i830_uxa.c
+++ b/src/i830_uxa.c
@@ -597,14 +597,20 @@ i830_uxa_create_pixmap (ScreenPtr screen, int w, int h, int depth, unsigned usag
     {
 	unsigned int size;
 	uint32_t tiling = I915_TILING_NONE;
+	int pitch_align;
 
-	stride = ROUND_TO((w * pixmap->drawable.bitsPerPixel + 7) / 8,
-			  i830->accel_pixmap_pitch_alignment);
-
-	if (usage == INTEL_CREATE_PIXMAP_TILING_X)
+	if (usage == INTEL_CREATE_PIXMAP_TILING_X) {
 	    tiling = I915_TILING_X;
-	else if (usage == INTEL_CREATE_PIXMAP_TILING_Y)
+	    pitch_align = 512;
+	} else if (usage == INTEL_CREATE_PIXMAP_TILING_Y) {
 	    tiling = I915_TILING_Y;
+	    pitch_align = 512;
+	} else {
+	    pitch_align = i830->accel_pixmap_pitch_alignment;
+	}
+
+	stride = ROUND_TO((w * pixmap->drawable.bitsPerPixel + 7) / 8,
+			  pitch_align);
 
 	if (tiling == I915_TILING_NONE) {
 	    size = stride * h;
commit 22f7cbc32b70a89d55c79bbea39fb10c50a310ec
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Jul 9 23:56:22 2009 -0700

    uxa: Tell the driver when we're just going to immediately map the pixmap.
    
    This lets the driver allocate a nice idle buffer object instead of a
    busy one, reducing runtime of firefox-20090601 on my G45 from 50.7 (+/- .41%)
    to 48.4 (+/- 1.1%).

diff --git a/src/i830_uxa.c b/src/i830_uxa.c
index 2050c48..3212582 100644
--- a/src/i830_uxa.c
+++ b/src/i830_uxa.c
@@ -635,7 +635,10 @@ i830_uxa_create_pixmap (ScreenPtr screen, int w, int h, int depth, unsigned usag
 	    return NullPixmap;
 	}
 
-	bo = drm_intel_bo_alloc_for_render(i830->bufmgr, "pixmap", size, 0);
+	if (usage == UXA_CREATE_PIXMAP_FOR_MAP)
+	    bo = drm_intel_bo_alloc(i830->bufmgr, "pixmap", size, 0);
+	else
+	    bo = drm_intel_bo_alloc_for_render(i830->bufmgr, "pixmap", size, 0);
 	if (!bo) {
 	    fbDestroyPixmap (pixmap);
 	    return NullPixmap;
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 02373b0..13128ed 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -822,7 +822,8 @@ uxa_create_alpha_picture (ScreenPtr     pScreen,
     }
 
     pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
-					pPictFormat->depth, 0);
+					pPictFormat->depth,
+					UXA_CREATE_PIXMAP_FOR_MAP);
     if (!pPixmap)
 	return 0;
     pPicture = CreatePicture (0, &pPixmap->drawable, pPictFormat,
diff --git a/uxa/uxa.h b/uxa/uxa.h
index 8f6f896..d5f5b9c 100644
--- a/uxa/uxa.h
+++ b/uxa/uxa.h
@@ -505,6 +505,16 @@ typedef struct _UxaDriver {
 
 /** @} */
 
+/** @name UXA CreatePixmap hint flags
+ * @{
+ */
+/**
+ * Flag to hint that the first operation on the pixmap will be a
+ * prepare_access.
+ */
+#define UXA_CREATE_PIXMAP_FOR_MAP	0x20000000
+/** @} */
+
 uxa_driver_t *
 uxa_driver_alloc(void);
 
commit 5ef3db45e059df136162584d00d4b0b511456a33
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Jul 9 19:24:38 2009 -0700

    uxa: Skip fill of temporary alpha picture that just gets copied over.
    
    This was needed when we were doing the mask computations in this pixmap,
    but now they're done in a temporary and then uploaded later.
    
    This reduces runtime of firefox-20090601 from 52.6 (+/- .96%) to 50.7
    (+/- .41%) seconds on my G45.

diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 33af636..02373b0 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -806,9 +806,7 @@ uxa_create_alpha_picture (ScreenPtr     pScreen,
 {
     PixmapPtr	    pPixmap;
     PicturePtr	    pPicture;
-    GCPtr	    pGC;
     int		    error;
-    xRectangle	    rect;
 
     if (width > 32767 || height > 32767)
 	return 0;
@@ -827,19 +825,6 @@ uxa_create_alpha_picture (ScreenPtr     pScreen,
 					pPictFormat->depth, 0);
     if (!pPixmap)
 	return 0;
-    pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
-    if (!pGC)
-    {
-	(*pScreen->DestroyPixmap) (pPixmap);
-	return 0;
-    }
-    ValidateGC (&pPixmap->drawable, pGC);
-    rect.x = 0;
-    rect.y = 0;
-    rect.width = width;
-    rect.height = height;
-    uxa_check_poly_fill_rect (&pPixmap->drawable, pGC, 1, &rect);
-    FreeScratchGC (pGC);
     pPicture = CreatePicture (0, &pPixmap->drawable, pPictFormat,
 			      0, 0, serverClient, &error);
     (*pScreen->DestroyPixmap) (pPixmap);
@@ -950,6 +935,7 @@ uxa_trapezoids (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
 	    FreePicture (pPicture, 0);
 	    return;
 	}
+	ValidateGC (pPicture->pDrawable, pGC);
 
 	(*pGC->ops->CopyArea) (&pPixmap->drawable, pPicture->pDrawable,
 			       pGC, 0, 0, width, height, 0, 0);
@@ -1023,16 +1009,33 @@ uxa_triangles (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
 	PicturePtr	pPicture;
 	INT16		xDst, yDst;
 	INT16		xRel, yRel;
-	
+	int width = bounds.x2 - bounds.x1;
+	int height = bounds.y2 - bounds.y1;
+	GCPtr pGC;
+	xRectangle rect;
+
 	xDst = tris[0].p1.x >> 16;
 	yDst = tris[0].p1.y >> 16;
 
 	pPicture = uxa_create_alpha_picture (pScreen, pDst, maskFormat,
-					  bounds.x2 - bounds.x1,
-					  bounds.y2 - bounds.y1);
+					     width, height);
 	if (!pPicture)
 	    return;
 
+	/* Clear the alpha picture to 0. */
+	pGC = GetScratchGC (pPicture->pDrawable->depth, pScreen);
+	if (!pGC) {
+	    FreePicture (pPicture, 0);
+	    return;
+	}
+	ValidateGC (pPicture->pDrawable, pGC);
+	rect.x = 0;
+	rect.y = 0;
+	rect.width = width;
+	rect.height = height;
+	uxa_check_poly_fill_rect (pPicture->pDrawable, pGC, 1, &rect);
+	FreeScratchGC (pGC);
+
 	if (uxa_prepare_access(pPicture->pDrawable, UXA_ACCESS_RW)) {
 	    (*ps->AddTriangles) (pPicture, -bounds.x1, -bounds.y1, ntri, tris);
 	    uxa_finish_access(pPicture->pDrawable);


More information about the xorg-commit mailing list