[patch] exa: fix pitch handling in ModifyPixmapHeader

Tilman Sauerbeck tilman at code-monkey.de
Sat Apr 19 10:21:23 PDT 2008


Tilman Sauerbeck [2008-04-18 20:48]:
> Tilman Sauerbeck [2008-04-18 19:35]:
> > Zhenyu Wang [2008-04-19 09:16]:
> > > On 2008.04.18 14:03:50 +0200, Tilman Sauerbeck wrote:
> > > > 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.
> > > 
> > > Try to set virtual height <= 2048. Current intel driver will disable
> > > accel if virtualY's larger than 2048, which I think a little overkill.
> > > As hw at least supports 2D blit larger than that, and disable smaller
> > > size pixmap acceleration totally. I don't know much of why it is, Eric?
> > 
> > Thanks, I can reproduce the crash with a framebuffer of 2432x1024
> > pixels. I'll look into it.
> 
> The crash I'm seeing happens in exaFillRegionTiled. Exa is trying to
> copy to the screen pixmap (1024x768 in my case, with the pitch being
> 16384).
> 
> The problem is that exaSetAccelBlock() was never called for the screen
> pixmap, so accel_block is zero and Exa tries to pass it to PrepareCopy.
> 
> Looking for the proper fix now...

The attached patch sets the accel_block thing for the screen pixmap as
well. For xf86-video-intel, another patch is needed, because it
currently lies to the lower layers about the dimensions of the screen
pixmap. Comments?

btw, there's still some cases left where pExaPixmap->accel_block is
messed up, I'm looking for the cause atm.

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..3fc4291 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -686,6 +686,34 @@ exaBitmapToRegion(PixmapPtr pPix)
   return ret;
 }
 
+static Bool
+exaCreateScreenResources(ScreenPtr pScreen)
+{
+    ExaScreenPriv(pScreen);
+    PixmapPtr pScreenPixmap;
+    Bool b;
+
+    pScreen->CreateScreenResources = pExaScr->SavedCreateScreenResources;
+    b = pScreen->CreateScreenResources(pScreen);
+    pScreen->CreateScreenResources = exaCreateScreenResources;
+
+    if (!b)
+        return FALSE;
+
+    pScreenPixmap = pScreen->GetScreenPixmap(pScreen);
+
+    if (pScreenPixmap) {
+        ExaPixmapPriv(pScreenPixmap);
+
+        exaSetAccelBlock(pExaScr, pExaPixmap,
+                         pScreenPixmap->drawable.width,
+                         pScreenPixmap->drawable.height,
+                         pScreenPixmap->drawable.bitsPerPixel);
+    }
+
+    return TRUE;
+}
+
 /**
  * exaCloseScreen() unwraps its wrapped screen functions and tears down EXA's
  * screen private, before calling down to the next CloseSccreen.
@@ -707,6 +735,7 @@ exaCloseScreen(int i, ScreenPtr pScreen)
     pScreen->CopyWindow = pExaScr->SavedCopyWindow;
     pScreen->ChangeWindowAttributes = pExaScr->SavedChangeWindowAttributes;
     pScreen->BitmapToRegion = pExaScr->SavedBitmapToRegion;
+    pScreen->CreateScreenResources = pExaScr->SavedCreateScreenResources;
 #ifdef RENDER
     if (ps) {
 	ps->Composite = pExaScr->SavedComposite;
@@ -864,6 +893,9 @@ exaDriverInit (ScreenPtr		pScreen,
     pExaScr->SavedBitmapToRegion = pScreen->BitmapToRegion;
     pScreen->BitmapToRegion = exaBitmapToRegion;
 
+    pExaScr->SavedCreateScreenResources = pScreen->CreateScreenResources;
+    pScreen->CreateScreenResources = exaCreateScreenResources;
+
 #ifdef RENDER
     if (ps) {
         pExaScr->SavedComposite = ps->Composite;
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index e41f46a..0138e4a 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -107,6 +107,7 @@ typedef struct {
     CopyWindowProcPtr 		 SavedCopyWindow;
     ChangeWindowAttributesProcPtr SavedChangeWindowAttributes;
     BitmapToRegionProcPtr        SavedBitmapToRegion;
+    CreateScreenResourcesProcPtr SavedCreateScreenResources;
     ModifyPixmapHeaderProcPtr    SavedModifyPixmapHeader;
 #ifdef RENDER
     CompositeProcPtr             SavedComposite;
-------------- next part --------------
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 41c0578..0a2f80e 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -823,11 +823,19 @@ i830_update_front_offset(ScrnInfoPtr pScrn)
     * yet.  We'll fix it up at CreateScreenResources.
     */
    if (!pI830->starting) {
-      if (!pScreen->ModifyPixmapHeader(pScreen->GetScreenPixmap(pScreen),
-				       -1, -1, -1, -1, -1,
-				       (pointer)(pI830->FbBase +
-						 pScrn->fbOffset)))
-       FatalError("Couldn't adjust screen pixmap\n");
+       PixmapPtr pPixmap;
+
+       pPixmap = pScreen->GetScreenPixmap(pScreen);
+
+       if (!pScreen->ModifyPixmapHeader(pPixmap,
+                                        pPixmap->drawable.width,
+                                        pPixmap->drawable.height,
+                                        pPixmap->drawable.depth,
+                                        pPixmap->drawable.bitsPerPixel,
+                                        pPixmap->devKind,
+                                        (pointer)(pI830->FbBase +
+                                        pScrn->fbOffset)))
+           FatalError("Couldn't adjust screen pixmap\n");
    }
 }
 
-------------- 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/20080419/dce03007/attachment.pgp>


More information about the xorg mailing list