summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-02-16 11:22:23 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-02-16 11:24:21 +0000
commit52b11f63d7922032caef0f0a5979b080dbddcbfc (patch)
treec5bd818e31176273e2aa5e1695fc539cfbfe6e10
parent8050ced6204f5aca12e6c57f86308b6ad1b98209 (diff)
sna: Upconvert fallback trapezoids to a8
Since the hardware only handles a8 without tricky emulation and pixman insists on using a1 for sharp trapezoids we need to ensure that we convert the a1 to a8 for our trapezoidal mask. More worryingly, this path should never be hit... References: https://bugs.freedesktop.org/show_bug.cgi?id=46156 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_trapezoids.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index 28c8a677..b02f8f71 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -2009,20 +2009,41 @@ trapezoids_fallback(CARD8 op, PicturePtr src, PicturePtr dst,
DBG(("%s: mask (%dx%d) depth=%d, format=%08x\n",
__FUNCTION__, width, height, depth, format));
scratch = sna_pixmap_create_upload(screen,
- width, height, depth,
+ width, height, 8,
KGEM_BUFFER_WRITE);
if (!scratch)
return;
- memset(scratch->devPrivate.ptr, 0, scratch->devKind*height);
- image = pixman_image_create_bits(format, width, height,
- scratch->devPrivate.ptr,
- scratch->devKind);
+ if (depth < 8) {
+ image = pixman_image_create_bits(format, width, height,
+ NULL, 0);
+ } else {
+ memset(scratch->devPrivate.ptr, 0, scratch->devKind*height);
+ image = pixman_image_create_bits(format, width, height,
+ scratch->devPrivate.ptr,
+ scratch->devKind);
+ }
if (image) {
for (; ntrap; ntrap--, traps++)
pixman_rasterize_trapezoid(image,
(pixman_trapezoid_t *)traps,
-bounds.x1, -bounds.y1);
+ if (depth < 8) {
+ pixman_image_t *a8;
+
+ a8 = pixman_image_create_bits(PIXMAN_a8, width, height,
+ scratch->devPrivate.ptr,
+ scratch->devKind);
+ if (a8) {
+ pixman_image_composite(PIXMAN_OP_SRC,
+ image, NULL, a8,
+ 0, 0,
+ 0, 0,
+ 0, 0,
+ width, height);
+ pixman_image_unref (a8);
+ }
+ }
pixman_image_unref(image);
}