xf86-video-intel: 2 commits - src/i830_uxa.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Apr 26 01:17:19 PDT 2010


 src/i830_uxa.c |   73 ++++++++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 57 insertions(+), 16 deletions(-)

New commits:
commit 9a5cd65b593ea82e56e0c403f7ddcc2420a64dc3
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Apr 26 09:07:07 2010 +0100

    i830: if pixman_blt() fails fallback to fbCopyArea()
    
    On older versions of pixman, pixman_blt() can return false if the images
    are <= 8bpp. If we are being called from CopyArea, then we cannot return
    FALSE here as that will trigger an infinite recursion. Instead we must
    manually perform the fallback using fbCopyArea().
    
    Reported-by: Peter Clifton <pcjc2 at cam.ac.uk>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/i830_uxa.c b/src/i830_uxa.c
index 79dfeae..07fca49 100644
--- a/src/i830_uxa.c
+++ b/src/i830_uxa.c
@@ -825,6 +825,8 @@ static Bool i830_uxa_put_image(PixmapPtr pixmap,
 
 		(*screen->DestroyPixmap)(scratch);
 	} else {
+		int dst_pitch;
+
 		/* bo is not busy so can be mapped without a stall, upload in-place. */
 		if (drm_intel_gem_bo_map_gtt(priv->bo)) {
 			xf86DrvMsg(scrn->scrnIndex, X_WARNING,
@@ -832,17 +834,44 @@ static Bool i830_uxa_put_image(PixmapPtr pixmap,
 			return FALSE;
 		}
 
-		pixman_blt((uint32_t *)src, priv->bo->virtual,
-			   src_pitch / sizeof(uint32_t),
-			   pixmap->devKind / sizeof(uint32_t),
-			   pixmap->drawable.bitsPerPixel,
-			   pixmap->drawable.bitsPerPixel,
-			   0, 0,
-			   x, y,
-			   w, h);
+		ret = TRUE;
+
+		/* Older version of pixman did not allow blt for <= 8bpp
+		 * images, so if the blt fails fallback to using the fb.
+		 */
+		dst_pitch = i830_pixmap_pitch (pixmap);
+		if (! pixman_blt((uint32_t *)src,
+				 priv->bo->virtual,
+				 src_pitch / sizeof(uint32_t),
+				 dst_pitch / sizeof(uint32_t),
+				 pixmap->drawable.bitsPerPixel,
+				 pixmap->drawable.bitsPerPixel,
+				 0, 0,
+				 x, y,
+				 w, h))
+		{
+			ret = FALSE;
+
+			scratch = GetScratchPixmapHeader(screen,
+							 w, h,
+							 pixmap->drawable.depth,
+							 pixmap->drawable.bitsPerPixel,
+							 src_pitch,
+							 (pointer) src);
+			if (scratch) {
+				gc = GetScratchGC(pixmap->drawable.depth, screen);
+				if (gc) {
+					ret = !! fbCopyArea(&scratch->drawable, &pixmap->drawable, gc,
+							    0, 0,
+							    w, h,
+							    x, y);
+					FreeScratchGC(gc);
+				}
+				FreeScratchPixmapHeader(scratch);
+			}
+		}
 
 		drm_intel_gem_bo_unmap_gtt(priv->bo);
-		ret = TRUE;
 	}
 
 	return ret;
commit 86d349aa7b0a596fbb9530e896c19349405bf3ba
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Apr 26 09:12:54 2010 +0100

    i830: tidy in flight bo reuse.
    
    A left-over cleanup patch for c374c94. *sigh*
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/i830_uxa.c b/src/i830_uxa.c
index 984069e..79dfeae 100644
--- a/src/i830_uxa.c
+++ b/src/i830_uxa.c
@@ -937,14 +937,26 @@ i830_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
 			list_foreach_entry(priv, struct intel_pixmap,
 					   &intel->in_flight,
 					   in_flight) {
-				if (priv->tiling == tiling &&
-				    priv->stride >= stride &&
-				    priv->bo->size >= priv->stride * aligned_h) {
-					list_del(&priv->in_flight);
-					screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, priv->stride, NULL);
-					i830_uxa_set_pixmap_intel(pixmap, priv);
-					return pixmap;
+				if (priv->tiling != tiling)
+					continue;
+
+				if (tiling == I915_TILING_NONE) {
+				    if (priv->bo->size < size)
+					    continue;
+
+					priv->stride = stride;
+				} else {
+					if (priv->stride < stride ||
+					    priv->bo->size < priv->stride * aligned_h)
+						continue;
+
+					stride = priv->stride;
 				}
+
+				list_del(&priv->in_flight);
+				screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, stride, NULL);
+				i830_uxa_set_pixmap_intel(pixmap, priv);
+				return pixmap;
 			}
 		}
 


More information about the xorg-commit mailing list