<div>Hello,<br></div><br><div class="gmail_quote">On Thu, Sep 24, 2009 at 5:25 PM, Aaron Plattner <span dir="ltr"><<a href="mailto:aplattner@nvidia.com">aplattner@nvidia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Thu, Sep 24, 2009 at 02:10:55PM -0700, Michael wrote:<br>
> Hello,<br>
><br>
> I finally found out why drawing ops to window borders always fall back<br>
> to software. It starts with miPaintWindow() - if it has to draw<br>
> outside the window's drawable in order to draw the border it requests<br>
> the screen pixmap which, thanks to the insane way in which it is<br>
> created by miCreateScreenResources(), is a DRAWABLE_PIXMAP without<br>
> further flags set so when miPaintWindow() calls ValidateGC() the resp.<br>
> DDX, be it XAA or EXA or whatever, thinks it's drawing into system<br>
> memory and falls back to software. The following patch fixes this for<br>
> XAA by checking the target drawable against pScreen->devPrivate and<br>
<br>
</div>Use pScreen->GetScreenPixmap(pScreen) instead of pScreen->devPrivate. This<br>
may not be completely sufficient if the driver creates other "special"<br>
pixmaps (e.g. for an overlay), but I think the number of drivers that do<br>
that that also use XAA is zero.<br></blockquote><div><br></div><div>Makes sense, in case someone or something hooks GetScreenPixmap().</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">> use accelerated ops if they match.<br>
<br>
</div>I'm a little worried that this will break some drivers that expect<br>
accelerated pixmaps to have driver-provided devPrivates attached. I don't<br>
know offhand of any drivers that do that, but it is a change in behavior.<br></blockquote><div><br></div><div>These drivers would hook CreatePixmap(), wouldn't they? That's still being called.</div><div><br></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div class="h5">> Index: xaaGC.c<br>
> ===================================================================<br>
> RCS file: /cvsroot/xsrc/external/mit/xorg-server/dist/hw/xfree86/xaa/<br>
> xaaGC.c,v<br>
> retrieving revision 1.1.1.2<br>
> diff -u -w -r1.1.1.2 xaaGC.c<br>
> - --- xaaGC.c 11 Jun 2009 01:52:58 -0000 1.1.1.2<br>
> +++ xaaGC.c 24 Sep 2009 21:06:10 -0000<br>
> @@ -88,7 +88,8 @@<br>
> pGC->fgPixel = 0x7fffffff;<br>
> }<br>
><br>
> - - if((pDraw->type == DRAWABLE_PIXMAP) && !<br>
> IS_OFFSCREEN_PIXMAP(pDraw)){<br>
> + if((pDraw->type == DRAWABLE_PIXMAP) &&<br>
> + !IS_OFFSCREEN_PIXMAP(pDraw) && !PIXMAP_IS_SCREEN(pDraw, pGC)) {<br>
> pGCPriv->flags = OPS_ARE_PIXMAP;<br>
> pGCPriv->changes |= changes;<br>
><br>
> Index: xaalocal.h<br>
> ===================================================================<br>
> RCS file: /cvsroot/xsrc/external/mit/xorg-server/dist/hw/xfree86/xaa/<br>
> xaalocal.h,v<br>
> retrieving revision 1.3<br>
> diff -u -w -r1.3 xaalocal.h<br>
> - --- xaalocal.h 11 Jun 2009 02:13:52 -0000 1.3<br>
> +++ xaalocal.h 24 Sep 2009 21:06:11 -0000<br>
> @@ -1710,6 +1710,9 @@<br>
> #define IS_OFFSCREEN_PIXMAP(pPix)\<br>
> ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->offscreenArea)<br>
><br>
> +#define PIXMAP_IS_SCREEN(pPix, pGC)\<br>
> + (pPix == pGC->pScreen->devPrivate)<br>
> +<br>
> #define PIXMAP_IS_SHARED(pPix)\<br>
> ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->flags &<br>
> SHARED_PIXMAP)<br>
><br>
><br>
> this isn't really a performance issue but there are graphics chips<br>
> which don't let us map their framebuffers in a useful way ( think SGI<br>
> newport and crime for example ) where we really don't want anything to<br>
> fall back to software if there is any other way.<br>
><br>
> A proper way to fix this would be to change the way the screen pixmap<br>
> is created so the accel lib, be it XAA, EXA or whatever, knows what<br>
> it's doing and can mark the pixmap as in video memory. As it is now<br>
> miCreateScreenResources() just calls CreatePixmap() with the right<br>
> depth but no width or height, then fills in geometry, data pointer and<br>
> so on.<br>
<br>
</div></div>Drivers can plug whatever else they need into the screen pixmap by wrapping<br>
CreateScreenResources.<br>
</blockquote></div><div><br></div><div>Maybe XAA should do that. Otherwise, what business has mi knowing about the address of mapped video memory?<br></div><div><br></div><div>have fun</div><div>Michael</div><div><br></div>