xf86-video-intel: src/sna/sna_trapezoids.c

Chris Wilson ickle at kemper.freedesktop.org
Mon May 14 03:45:03 PDT 2012


 src/sna/sna_trapezoids.c |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

New commits:
commit b654b8794db7b00666ce5c59535a9302932c483b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon May 14 11:36:15 2012 +0100

    sna/trapezoids: Fix picture creation for fallback trapezoids
    
    Being a little lax in not updating the format after upconversion to
    PICT_a8, meant we were trying to composite with a depth 1, 8 bpp a8
    image and thoroughly confusing everybody when creating the upload
    trapezoid mask.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index 3bc3284..8d5594d 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -2473,7 +2473,13 @@ trapezoids_fallback(CARD8 op, PicturePtr src, PicturePtr dst,
 		bounds.x1 -= dst->pDrawable->x;
 		bounds.y1 -= dst->pDrawable->y;
 		depth = maskFormat->depth;
-		format = maskFormat->format | (BitsPerPixel(depth) << 24);
+		if (depth == 1) {
+			format = PIXMAN_a1;
+		} else if (depth < 8) {
+			format = PIXMAN_a4;
+			depth = 4;
+		} else
+			format = PIXMAN_a8;
 
 		DBG(("%s: mask (%dx%d) depth=%d, format=%08x\n",
 		     __FUNCTION__, width, height, depth, format));
@@ -2511,15 +2517,22 @@ trapezoids_fallback(CARD8 op, PicturePtr src, PicturePtr dst,
 								       0, 0,
 								       0, 0,
 								       width, height);
+						format = PIXMAN_a8;
+						depth = 8;
 						pixman_image_unref (a8);
 					}
 				}
 
 				pixman_image_unref(image);
 			}
+			if (format != PIXMAN_a8) {
+				screen->DestroyPixmap(scratch);
+				return;
+			}
 		} else {
 			scratch = sna_pixmap_create_unattached(screen,
-							       width, height, depth);
+							       width, height,
+							       depth);
 			if (!scratch)
 				return;
 
@@ -2532,6 +2545,7 @@ trapezoids_fallback(CARD8 op, PicturePtr src, PicturePtr dst,
 					pixman_rasterize_trapezoid(image,
 								   (pixman_trapezoid_t *)traps,
 								   -bounds.x1, -bounds.y1);
+				pixman_image_unref(image);
 			}
 		}
 


More information about the xorg-commit mailing list