I'm trying to break the vicious cycle where cairo can't forward
composite operations with extend mode EXTEND_PAD to XRender because some
drivers don't implement it correctly and the drivers don't get fixed
because the bugs are not exposed by cairo.

The (trivial) fixes consist of just announcing that the driver doesn't
support the affected repeat modes, so that the server's software
fallback will be used.  This is good enough in practice and certainly
much better than the current client-side fallback that cairo is using:
If an application currently wants to upscale an image using a bilinear
filter this is what happens: It needs to enable EXTEND_PAD so that the
image borders are rendered correctly, so cairo will (1) fetch the
destination region from the server (nevermind that it's going to be
overwritten completely), (2) fetch the whole source image (even if only
a tiny part of it will be redrawn, as is the case when scrolling), (3)
scale the image in software and then (4) send it back to the server.
All of this will go over the wire, no shared memory is used.
It should come as no surprise that this is unacceptably slow, which for
example forces firefox to ditch bilinear filtering completely.

The following three drivers are still affected (bug reports: [1,2,3]):
-radeonhd, -mga and -i128.  Since -radeonhd shares most its exa code
with -ati, it can just use the same fix that is already in -ati [4], and
probably also take advantage of hardware acceleration that is present in
-ati now [5].  I'm attaching the patches for the other two drivers to
this email.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=19728
[2] https://bugs.freedesktop.org/show_bug.cgi?id=19839
[3] https://bugs.freedesktop.org/show_bug.cgi?id=20076
[4]
http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/commit/?id=7e54c4b8acafead8de5d0dd6fdc1b619f832dd6f
[5]
http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/commit/?id=fa8e5a4fc236f8f15f462cb0d6164b194a65a118
>From e2536dac06d82f2d2a2b77d8d00fc85925889d81 Mon Sep 17 00:00:00 2001
From: Thomas Jaeger <thjae...@gmail.com>
Date: Fri, 30 Jan 2009 16:25:07 -0500
Subject: [PATCH] CheckComposite:  Add a few checks

It looks like the driver doesn't support any form of repeating and only
nearest-neighbor interpolation.
---
 src/i128exa.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/i128exa.c b/src/i128exa.c
index 84452a8..5bf0c5d 100644
--- a/src/i128exa.c
+++ b/src/i128exa.c
@@ -476,11 +476,15 @@ i128CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
     if (pMaskPicture) return FALSE;
 
     /* when transforms added, be sure to check for linear/nearest */
-    /* if (pSrcPicture->transform) return FALSE; */
+    if (pSrcPicture->transform && pSrcPicture->filter != PictFilterNearest)
+        return FALSE;
 
     /* no support for external alpha */
     if (pSrcPicture->alphaMap || pDstPicture->alphaMap) return FALSE;
 
+    /* driver currently doesn't support repeating */
+    if (pSrcPicture->repeat) return FALSE;
+
     pI128->source = i128MapSourceFormat(pSrcPicture->format);
     if (!pI128->source)
         return FALSE;
-- 
1.6.0.6

>From 4303b45018994a8d41864d720fa2e3e6e3e79afa Mon Sep 17 00:00:00 2001
From: Thomas Jaeger <thjae...@gmail.com>
Date: Fri, 30 Jan 2009 16:18:34 -0500
Subject: [PATCH] Fall back to software for unsupported repeat modes

---
 src/mga_exa.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/mga_exa.c b/src/mga_exa.c
index 9321452..524e1b3 100644
--- a/src/mga_exa.c
+++ b/src/mga_exa.c
@@ -332,6 +332,11 @@ mgaCheckSourceTexture(int tmu, PicturePtr pPict)
         return FALSE;
     }
 
+    if (pPict->repeat && pPict->repeatType != RepeatNormal) {
+        DEBUG_MSG(("Unsupported repeat type %d\n", pPict->repeatType));
+        return FALSE;
+    }
+
     if (pPict->repeat && ((w & (w - 1)) != 0 || (h & (h - 1)) != 0)) {
         DEBUG_MSG(("NPOT repeat unsupported (%dx%d)\n", w, h));
         return FALSE;
-- 
1.6.0.6

_______________________________________________
xorg-devel mailing list
xorg-devel@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to