[PATCH] exa: Accept scratch pixmaps with offscreen memory as such.

Michel Dänzer michel at daenzer.net
Thu Mar 19 11:39:11 PDT 2009


On Don, 2009-03-19 at 19:29 +0100, Maarten Maathuis wrote:
> 2009/3/19 Michel Dänzer <michel at daenzer.net>:
> > On Don, 2009-03-19 at 19:10 +0100, Maarten Maathuis wrote:
> >>
> >> -     /* Is this the framebuffer (for classic exa)? */
> >> -     if (pPixData && pPixData == pExaScr->info->memoryBase) {
> >> -         pExaPixmap->fb_ptr = pPixData;
> >> -         pExaPixmap->fb_pitch = devKind;
> >> -         pExaPixmap->offscreen = TRUE;
> >> +     /* Classic EXA:
> >> +      * - Framebuffer.
> >> +      * - Scratch pixmap with offscreen memory.
> >> +      */
> >> +     if (pExaScr->info->memoryBase && pPixData) {
> >
> > Maybe this block should also be guarded by !EXA_HANDLES_PIXMAPS or
> > something like that, to prevent it from executing for drivers that
> > handle pixmap allocation.
> 
> Those drivers don't set memoryBase, but if you want a more explicit
> check, then that can be arranged.

There's nothing that prevents such drivers from changing these fields
even if it doesn't make sense for them.

> >> +         if ((CARD8 *)pPixData >= pExaScr->info->memoryBase &&
> >> +             (CARD8 *)pPixData < (pExaScr->info->memoryBase + pExaScr->info->memorySize)) {
> >
> > (pExaScr->info->memoryBase + pExaScr->info->memorySize) could wrap
> > around to 0, in which case the latter check would always fail.
> 
> I don't see how that failure is bad (considering it won't wrap for the
> cases that are offscreen).

You don't seem to understand: pPixData < 0 is false for any value of
pPixData.

> How would you do it?

E.g. something like

(pPixData - pExaScr->info->memoryBase) < pExaScr->info->memorySize


> > Also, BTW, please try to keep lines below 80 characters or so.
> >
> 
> I looked better this way (imo), but if you insist.

I have two buffers side by side in Emacs, and horizontal scrolling
sucks.


-- 
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the xorg-devel mailing list