[patch] exa: fix pitch handling in ModifyPixmapHeader
Tilman Sauerbeck
tilman at code-monkey.de
Fri Apr 18 05:03:50 PDT 2008
Zhenyu Wang [2008-04-18 11:00]:
> On 2008.04.17 18:36:19 +0200, Michel Dänzer wrote:
> > > > ---
> > > > diff --git a/exa/exa.c b/exa/exa.c
> > > > index 81dc3e2..3369c3a 100644
> > > > --- a/exa/exa.c
> > > > +++ b/exa/exa.c
> > > > @@ -386,6 +386,9 @@ exaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
> > > > if (pExaPixmap) {
> > > > pExaPixmap->sys_ptr = pPixData;
> > > >
> > > > + if (pExaPixmap->fb_pitch == 0)
> > > > + pExaPixmap->fb_pitch = devKind;
> > > > +
> > > > exaSetAccelBlock(pExaScr, pExaPixmap,
> > > > width, height, bitsPerPixel);
> > > > }
> > >
> > > Shouldn't we set fb_pitch even if the current value isn't zero?
>
> So if driver provides CreatePixmap, we might override fb_pitch with
> paddedWidth, but it should be ok.
>
> > > Shouldn't we also set sys_pitch = devKind?
> >
> > I think so, too, and pExaScr->info->pixmapPitchAlign should probably
> > also be enforced for fb_pitch.
>
> yeah, ok for me. But even if I test with those setup, driver only sets
> maxPitch (2.3-branch), I still got gnome crashed chip. Large virtual size
> then large front buffer pitch caught this when rendering onto root window
> pixmap. We still missed somewhere?
Unfortunately I cannot reproduce #15509 on my i945 sofar. I tried the
master branches of xserver.git and intel.git with a framebuffer of
2560x2560 pixels, and rotation still worked fine after I connected the
VGA output and extended my desktop to it.
Anyway, here's a patch that adds the missing pitch stuff to
exaModifyPixmapHeader(). Please have a look and let me know whether it
looks okayish or not.
Regards,
Tilman
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
-------------- next part --------------
diff --git a/exa/exa.c b/exa/exa.c
index 81dc3e2..5014c0f 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -248,6 +248,19 @@ exaSetAccelBlock(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
pExaPixmap->accel_blocked |= EXA_RANGE_HEIGHT;
}
+static void
+exaSetFbPitch(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
+ int w, int h, int bpp)
+{
+ if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
+ pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8;
+ else
+ pExaPixmap->fb_pitch = w * bpp / 8;
+
+ pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
+ pExaScr->info->pixmapPitchAlign);
+}
+
/**
* exaCreatePixmap() creates a new pixmap.
*
@@ -292,12 +305,8 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
if (paddedWidth / 4 > 32767 || h > 32767)
return NullPixmap;
- if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
- pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8;
- else
- pExaPixmap->fb_pitch = w * bpp / 8;
- pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
- pExaScr->info->pixmapPitchAlign);
+ exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
+
if (paddedWidth < pExaPixmap->fb_pitch)
paddedWidth = pExaPixmap->fb_pitch;
@@ -331,12 +340,7 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
pExaPixmap->offscreen = FALSE;
pExaPixmap->fb_ptr = NULL;
- if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
- pExaPixmap->fb_pitch = (1 << (exaLog2(w - 1) + 1)) * bpp / 8;
- else
- pExaPixmap->fb_pitch = w * bpp / 8;
- pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
- pExaScr->info->pixmapPitchAlign);
+ exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
pExaPixmap->fb_size = pExaPixmap->fb_pitch * h;
if (pExaPixmap->fb_pitch > 131071) {
@@ -385,6 +389,9 @@ exaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
if (pExaPixmap) {
pExaPixmap->sys_ptr = pPixData;
+ pExaPixmap->sys_pitch = devKind;
+
+ exaSetFbPitch(pExaScr, pExaPixmap, width, height, bitsPerPixel);
exaSetAccelBlock(pExaScr, pExaPixmap,
width, height, bitsPerPixel);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20080418/5c591550/attachment.pgp>
More information about the xorg
mailing list