xserver: Branch 'master' - 3 commits

Maarten Maathuis madman2003 at kemper.freedesktop.org
Fri Feb 27 08:27:47 PST 2009


 exa/exa.c           |   13 ++++++++++---
 exa/exa_glyphs.c    |   32 +++++++++++++++-----------------
 exa/exa_migration.c |   20 ++++++++++++++++----
 exa/exa_priv.h      |    2 +-
 4 files changed, 42 insertions(+), 25 deletions(-)

New commits:
commit f028b14876dc536b575d4b6e1df7f37ee525acec
Author: Maarten Maathuis <madman2003 at gmail.com>
Date:   Fri Feb 27 13:06:28 2009 +0100

    exa: whitespace

diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c
index 1480bc2..596b60c 100644
--- a/exa/exa_glyphs.c
+++ b/exa/exa_glyphs.c
@@ -187,7 +187,6 @@ exaRealizeGlyphCaches(ScreenPtr    pScreen,
     }
 
     /* Now allocate the pixmap and picture */
-       
     pPixmap = (*pScreen->CreatePixmap) (pScreen,
 					CACHE_PICTURE_WIDTH,
 					height, depth, 0);
@@ -205,7 +204,6 @@ exaRealizeGlyphCaches(ScreenPtr    pScreen,
 	return FALSE;
 
     /* And store the picture in all the caches for the format */
-    
     for (i = 0; i < EXA_NUM_GLYPH_CACHES; i++) {
 	ExaGlyphCachePtr cache = &pExaScr->glyphCaches[i];
 	int j;
@@ -458,13 +456,12 @@ exaGlyphCacheBufferGlyph(ScreenPtr         pScreen,
 	     * already in the output buffer were at this position in
 	     * the cache
 	     */
-	    
 	    pos = cache->evictionPosition;
 	    DBG_GLYPH_CACHE(("  evicting glyph at %d\n", pos));
 	    if (buffer->count) {
 		int x, y;
 		int i;
-		
+
 		x = CACHE_X(pos);
 		y = CACHE_Y(pos);
 
commit ed00515ec54b294f304b8ae2857e3073f97860d2
Author: Maarten Maathuis <madman2003 at gmail.com>
Date:   Thu Feb 26 22:18:03 2009 +0100

    exa: fixup exaAssertNotDirty.
    
    - Do the right thing based on prepare access.

diff --git a/exa/exa.c b/exa/exa.c
index 5425f90..76860a4 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -517,7 +517,10 @@ exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
 	return NULL;
 }
 
-void
+/**
+ * Returns TRUE if pixmap can be accessed offscreen.
+ */
+Bool
 ExaDoPrepareAccess(DrawablePtr pDrawable, int index)
 {
     ScreenPtr	    pScreen = pDrawable->pScreen;
@@ -531,12 +534,12 @@ ExaDoPrepareAccess(DrawablePtr pDrawable, int index)
     }
 
     if (!offscreen)
-	return;
+	return FALSE;
 
     exaWaitSync (pDrawable->pScreen);
 
     if (pExaScr->info->PrepareAccess == NULL)
-	return;
+	return TRUE;
 
     if (index >= EXA_PREPARE_AUX0 &&
 	!(pExaScr->info->flags & EXA_SUPPORTS_PREPARE_AUX)) {
@@ -549,7 +552,11 @@ ExaDoPrepareAccess(DrawablePtr pDrawable, int index)
 	if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED)
 	    FatalError("Driver failed PrepareAccess on a pinned pixmap\n");
 	exaMoveOutPixmap (pPixmap);
+
+	return FALSE;
     }
+
+    return TRUE;
 }
 
 void
diff --git a/exa/exa_migration.c b/exa/exa_migration.c
index 9d0eda0..8b91150 100644
--- a/exa/exa_migration.c
+++ b/exa/exa_migration.c
@@ -545,9 +545,9 @@ exaAssertNotDirty (PixmapPtr pPixmap)
     ExaPixmapPriv (pPixmap);
     CARD8 *dst, *src;
     RegionRec ValidReg;
-    int dst_pitch, src_pitch, cpp, y, nbox;
+    int dst_pitch, src_pitch, cpp, y, nbox, save_pitch;
     BoxPtr pBox;
-    Bool ret = TRUE;
+    Bool ret = TRUE, save_offscreen;
 
     if (exaPixmapIsPinned(pPixmap) || pExaPixmap->area == NULL)
 	return ret;
@@ -566,7 +566,14 @@ exaAssertNotDirty (PixmapPtr pPixmap)
     src_pitch = pExaPixmap->fb_pitch;
     cpp = pPixmap->drawable.bitsPerPixel / 8;
 
-    ExaDoPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
+    save_offscreen = pExaPixmap->offscreen;
+    save_pitch = pPixmap->devKind;
+    pExaPixmap->offscreen = TRUE;
+    pPixmap->devKind = pExaPixmap->fb_pitch;
+
+    if (!ExaDoPrepareAccess(&pPixmap->drawable, EXA_PREPARE_SRC))
+	goto skip;
+
     while (nbox--) {
 	    int rowbytes;
 
@@ -579,7 +586,7 @@ exaAssertNotDirty (PixmapPtr pPixmap)
 		continue;
 
 	    rowbytes = (pBox->x2 - pBox->x1) * cpp;
-	    src = pExaPixmap->fb_ptr + pBox->y1 * src_pitch + pBox->x1 * cpp;
+	    src = (CARD8 *) pPixmap->devPrivate.ptr + pBox->y1 * src_pitch + pBox->x1 * cpp;
 	    dst = pExaPixmap->sys_ptr + pBox->y1 * dst_pitch + pBox->x1 * cpp;
 
 	    for (y = pBox->y1; y < pBox->y2;
@@ -592,8 +599,13 @@ exaAssertNotDirty (PixmapPtr pPixmap)
 		}
 	    }
     }
+
+skip:
     exaFinishAccess(&pPixmap->drawable, EXA_PREPARE_SRC);
 
+    pExaPixmap->offscreen = save_offscreen;
+    pPixmap->devKind = save_pitch;
+
 out:
     REGION_UNINIT(pScreen, &ValidReg);
     return ret;
diff --git a/exa/exa_priv.h b/exa/exa_priv.h
index a618fb4..a037eb0 100644
--- a/exa/exa_priv.h
+++ b/exa/exa_priv.h
@@ -449,7 +449,7 @@ void
 ExaOffscreenFini (ScreenPtr pScreen);
 
 /* exa.c */
-void
+Bool
 ExaDoPrepareAccess(DrawablePtr pDrawable, int index);
 
 void
commit 2e88b6004f09dbcb888abf05d4d5554231b2bd1a
Author: Maarten Maathuis <madman2003 at gmail.com>
Date:   Thu Feb 26 21:14:23 2009 +0100

    exa: minor glyphs cleanup.
    
    - This should fix subtle coordinate bugs and make the code a bit cleaner to read.

diff --git a/exa/exa_glyphs.c b/exa/exa_glyphs.c
index d55839c..1480bc2 100644
--- a/exa/exa_glyphs.c
+++ b/exa/exa_glyphs.c
@@ -525,8 +525,8 @@ exaGlyphCacheBufferGlyph(ScreenPtr         pScreen,
     }
 
     rect->pDst = pDst;
-    rect->xDst = xDst - pGlyph->info.x;
-    rect->yDst = yDst - pGlyph->info.y;
+    rect->xDst = xDst;
+    rect->yDst = yDst;
     rect->width = pGlyph->info.width;
     rect->height = pGlyph->info.height;
 
@@ -603,8 +603,8 @@ exaBufferGlyph(ScreenPtr         pScreen,
     rect->ySrc = ySrc;
     rect->xMask = xMask;
     rect->yMask = yMask;
-    rect->xDst = xDst - pGlyph->info.x;
-    rect->yDst = yDst - pGlyph->info.y;
+    rect->xDst = xDst;
+    rect->yDst = yDst;
     rect->width = width;
     rect->height = height;
 
@@ -706,7 +706,7 @@ exaGlyphs (CARD8 	 op,
     ScreenPtr   pScreen = pDst->pDrawable->pScreen;
     int		width = 0, height = 0;
     int		x, y;
-    int		xDst = list->xOff, yDst = list->yOff;
+    int		first_xOff = list->xOff, first_yOff = list->yOff;
     int		n;
     GlyphPtr	glyph;
     int		error;
@@ -777,27 +777,28 @@ exaGlyphs (CARD8 	 op,
 
 	    if (glyph->info.width > 0 && glyph->info.height > 0)
 	    {
+		/* pGlyph->info.{x,y} compensate for empty space in the glyph. */
 		if (maskFormat)
 		{
 		    if (exaBufferGlyph(pScreen, &buffer, glyph, NULL, pMask,
-				       0, 0, 0, 0, x, y) == ExaGlyphNeedFlush)
+				       0, 0, 0, 0, x - glyph->info.x, y - glyph->info.y) == ExaGlyphNeedFlush)
 		    {
 			exaGlyphsToMask(pMask, &buffer);
 			exaBufferGlyph(pScreen, &buffer, glyph, NULL, pMask,
-				       0, 0, 0, 0, x, y);
+				       0, 0, 0, 0, x - glyph->info.x, y - glyph->info.y);
 		    }
 		}
 		else
 		{
 		    if (exaBufferGlyph(pScreen, &buffer, glyph, pSrc, pDst,
-				       xSrc + x - xDst, ySrc + y - yDst,
-				       x, y, x + extents.x1, y + extents.y1)
+				       xSrc + (x - glyph->info.x) - first_xOff, ySrc + (y - glyph->info.y) - first_yOff,
+				       0, 0, x - glyph->info.x, y - glyph->info.y)
 			== ExaGlyphNeedFlush)
 		    {
 			exaGlyphsToDst(pSrc, pDst, &buffer);
 			exaBufferGlyph(pScreen, &buffer, glyph, pSrc, pDst,
-				       xSrc + x - xDst, ySrc + y - yDst,
-				       x, y, x + extents.x1, y + extents.y1);
+				       xSrc + (x - glyph->info.x) - first_xOff, ySrc + (y - glyph->info.y) - first_yOff,
+				       0, 0, x - glyph->info.x, y - glyph->info.y);
 		    }
 		}
 	    }
@@ -823,8 +824,8 @@ exaGlyphs (CARD8 	 op,
 			  pSrc,
 			  pMask,
 			  pDst,
-			  xSrc + x - xDst,
-			  ySrc + y - yDst,
+			  xSrc + x - first_xOff,
+			  ySrc + y - first_yOff,
 			  0, 0,
 			  x, y,
 			  width, height);


More information about the xorg-commit mailing list