[patch] drawing window borders always falls back to software

Michael macallan at NetBSD.org
Thu Sep 24 14:10:55 PDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I finally found out why drawing ops to window borders always fall back  
to software. It starts with miPaintWindow() - if it has to draw  
outside the window's drawable in order to draw the border it requests  
the screen pixmap which, thanks to the insane way in which it is  
created by miCreateScreenResources(), is a DRAWABLE_PIXMAP without  
further flags set so when miPaintWindow() calls ValidateGC() the resp.  
DDX, be it XAA or EXA or whatever, thinks it's drawing into system  
memory and falls back to software. The following patch fixes this for  
XAA by  checking the target drawable against pScreen->devPrivate and  
use accelerated ops if they match.

Index: xaaGC.c
===================================================================
RCS file: /cvsroot/xsrc/external/mit/xorg-server/dist/hw/xfree86/xaa/ 
xaaGC.c,v
retrieving revision 1.1.1.2
diff -u -w -r1.1.1.2 xaaGC.c
- --- xaaGC.c     11 Jun 2009 01:52:58 -0000      1.1.1.2
+++ xaaGC.c     24 Sep 2009 21:06:10 -0000
@@ -88,7 +88,8 @@
             pGC->fgPixel = 0x7fffffff;
      }

- -    if((pDraw->type == DRAWABLE_PIXMAP) && ! 
IS_OFFSCREEN_PIXMAP(pDraw)){
+    if((pDraw->type == DRAWABLE_PIXMAP) &&
+       !IS_OFFSCREEN_PIXMAP(pDraw) && !PIXMAP_IS_SCREEN(pDraw, pGC)) {
         pGCPriv->flags = OPS_ARE_PIXMAP;
          pGCPriv->changes |= changes;

Index: xaalocal.h
===================================================================
RCS file: /cvsroot/xsrc/external/mit/xorg-server/dist/hw/xfree86/xaa/ 
xaalocal.h,v
retrieving revision 1.3
diff -u -w -r1.3 xaalocal.h
- --- xaalocal.h  11 Jun 2009 02:13:52 -0000      1.3
+++ xaalocal.h  24 Sep 2009 21:06:11 -0000
@@ -1710,6 +1710,9 @@
  #define IS_OFFSCREEN_PIXMAP(pPix)\
          ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->offscreenArea)

+#define PIXMAP_IS_SCREEN(pPix, pGC)\
+        (pPix == pGC->pScreen->devPrivate)
+
  #define PIXMAP_IS_SHARED(pPix)\
          ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->flags &  
SHARED_PIXMAP)


this isn't really a performance issue but there are graphics chips  
which don't let us map their framebuffers in a useful way ( think SGI  
newport and crime for example ) where we really don't want anything to  
fall back to software if there is any other way.

A proper way to fix this would be to change the way the screen pixmap  
is created so the accel lib, be it XAA, EXA or whatever, knows what  
it's doing and can mark the pixmap as in video memory. As it is now  
miCreateScreenResources() just calls CreatePixmap() with the right  
depth but no width or height, then fills in geometry, data pointer and  
so on.

have fun
Michael

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iQEVAwUBSrvgX8pnzkX8Yg2nAQKq6Qf9Gb7RE6Kz3ngvMa7mJeEmXKdNeALTJg3a
xG6UfzkVLd1PZmduZcEQNFS/djvetuAIS7Qi/gWGLZbBM8s0pzzrSCjMDwaEvUP5
dgrdFnpgWGMJqh9RTrEC2TqAig5lTslh3RhrP6wK4Lykmovh/UTEPyFT+BjRNb56
mm+R3EuNpmLqPDACkHm0GNX1OSanY/BtjOPT4TCBy0ZHIqVNzKS40KoCJDKMeF/q
2gmU/hgT/ofA+0ofr8tJhtCWzjJTgoWyj1lDWJdkn6Fo2FNPcxpRmrX7E3t7qZbO
sd2pr1m6ofK8ncpmD6teZrwy74TYuftrvR6qBk3dMeVWUTB2KHXSww==
=ryc3
-----END PGP SIGNATURE-----


More information about the xorg-devel mailing list