[PATCH] Ensure blitter quiescience before reading pixels from the framebuffer
Bernardo Innocenti
bernie at codewiz.org
Tue Jul 17 04:02:36 PDT 2007
On my laptop, I sometimes see trapezoids and glyphs painted in
the wrong color. It happens mostly in Gtk widgets, but I could
reproduce the problem also with a small cairo testcase.
I can't test this fix right now because I'm travelling and I
can't afford to download and build all the xserver prerequisites,
but the race I'm fixing here would perfectly justify the symptoms
I see.
Unfortunately, calling XSync() at this point will stall the GPU
and has therefore a huge impact on performance. But I can't
think of another way to protect access. If we're always going
to accesse these 1x1 repeated pixmaps with the CPU, a better
fix would be not uploading them in the first place.
diff --git a/hw/xfree86/xaa/xaaPict.c b/hw/xfree86/xaa/xaaPict.c
index 55f0f6e..52852df 100644
--- a/hw/xfree86/xaa/xaaPict.c
+++ b/hw/xfree86/xaa/xaaPict.c
@@ -237,6 +237,7 @@ XAADoComposite (
if((pSrc->pDrawable->width == 1) && (pSrc->pDrawable->height == 1)) {
CARD16 red, green, blue, alpha;
+ XAASync();
CARD32 pixel =
*((CARD32*)(((PixmapPtr)(pSrc->pDrawable))->devPrivate.ptr));
@@ -594,8 +595,9 @@ XAADoGlyphs (CARD8 op,
!(infoRec->WriteBitmapFlags & NO_TRANSPARENCY))
{
CARD16 red, green, blue, alpha;
- CARD32 pixel =
- *((CARD32*)(((PixmapPtr)(pSrc->pDrawable))->devPrivate.ptr));
+ CARD32 pixel;
+ XaaSync();
+ pixel = *((CARD32*)(((PixmapPtr)(pSrc->pDrawable))->devPrivate.ptr));
CARD32 *bits, *pntr, *pnt;
int x, y, i, n, left, top, right, bottom, width, height, pitch;
int L, T, R, B, X, Y, h, w, dwords, row, column, nbox;
--
1.5.2.3
--
// Bernardo Innocenti
\X/ http://www.codewiz.org/
More information about the xorg
mailing list