[PATCH] Add Xaa CopyAreaFlags SYNC_BEFORE_SCREEN_COPY

Paulo Cesar Pereira de Andrade pcpa at mandriva.com.br
Thu Jan 8 09:31:34 PST 2009


  This flag is intended for use with hardware that supports only either
positive X screen copy, or sign X == sign Y screen copy, and have a
limited fifo.
---
 hw/xfree86/xaa/XAA.HOWTO    |    5 +++++
 hw/xfree86/xaa/xaa.h        |    5 +++--
 hw/xfree86/xaa/xaaCpyArea.c |   29 ++++++++++++++++++++++++-----
 3 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/hw/xfree86/xaa/XAA.HOWTO b/hw/xfree86/xaa/XAA.HOWTO
index cbd71c1..1d0b05c 100644
--- a/hw/xfree86/xaa/XAA.HOWTO
+++ b/hw/xfree86/xaa/XAA.HOWTO
@@ -185,6 +185,11 @@ descriptions of those primitives below.
       This indicates that the hardware can only cope with blitting when
       the direction of x is the same as the direction in y.
 
+    SYNC_AFTER_SUBSEQUENT_SCREEN_COPY
+
+      This indicates that the hardware must be sync'ed before subsequent
+      screen copies.
+
 
 void SetupForScreenToScreenCopy( ScrnInfoPtr pScrn,
 			int xdir, int ydir,
diff --git a/hw/xfree86/xaa/xaa.h b/hw/xfree86/xaa/xaa.h
index 7db6b95..a83f6eb 100644
--- a/hw/xfree86/xaa/xaa.h
+++ b/hw/xfree86/xaa/xaa.h
@@ -3,7 +3,7 @@
 #define _XAA_H
 
 #define XAA_VERSION_MAJOR   1
-#define XAA_VERSION_MINOR   2
+#define XAA_VERSION_MINOR   3
 #define XAA_VERSION_RELEASE 1
 
 /*
@@ -28,7 +28,7 @@
 ---------               --------
 23           ONLY_LEFT_TO_RIGHT_BITBLT
 22           ONLY_TWO_BITBLT_DIRECTIONS
-21                         .
+21           SYNC_BEFORE_SCREEN_COPY
 20                         .
 19                         .
 18                         .
@@ -159,6 +159,7 @@
 /* copyarea flags */
 #define ONLY_TWO_BITBLT_DIRECTIONS	0x00400000
 #define ONLY_LEFT_TO_RIGHT_BITBLT	0x00800000
+#define SYNC_BEFORE_SCREEN_COPY		0x00200000
 
 /* line flags */
 #define LINE_PATTERN_LSBFIRST_MSBJUSTIFIED	0x00800000
diff --git a/hw/xfree86/xaa/xaaCpyArea.c b/hw/xfree86/xaa/xaaCpyArea.c
index 6a898cd..b7cf2f2 100644
--- a/hw/xfree86/xaa/xaaCpyArea.c
+++ b/hw/xfree86/xaa/xaaCpyArea.c
@@ -286,11 +286,14 @@ XAAScreenToScreenBitBlt(
         (*infoRec->SetupForScreenToScreenCopy)(pScrn,
             1, ydir, alu, planemask, -1);
         for (; nbox; pbox++, pptSrc++, nbox--)
-            if (pptSrc->y != pbox->y1 || pptSrc->x >= pbox->x1)
+            if (pptSrc->y != pbox->y1 || pptSrc->x >= pbox->x1) {
                 /* No problem. Do a xdir = 1 blit instead. */
+		if (infoRec->CopyAreaFlags & SYNC_BEFORE_SCREEN_COPY)
+		    (*infoRec->Sync)(infoRec->pScrn);
                 (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
                     pptSrc->x, pptSrc->y, pbox->x1, pbox->y1,
                     pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+	    }
             else 
             {
                 /*
@@ -306,18 +309,24 @@ XAAScreenToScreenBitBlt(
                 extra = w % stripeWidth;
 
                 /* First, take care of the little bit on the far right */
-                if (extra)
+                if (extra) {
+		    if (infoRec->CopyAreaFlags & SYNC_BEFORE_SCREEN_COPY)
+			(*infoRec->Sync)(infoRec->pScrn);
                     (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
                         pptSrc->x + fullStripes * stripeWidth, pptSrc->y,
                         pbox->x1 + fullStripes * stripeWidth, pbox->y1,
                         extra, pbox->y2 - pbox->y1);
+		}
 
                 /* Now, take care of the rest of the blit */
-                for (i = fullStripes - 1; i >= 0; i--)
+                for (i = fullStripes - 1; i >= 0; i--) {
+		    if (infoRec->CopyAreaFlags & SYNC_BEFORE_SCREEN_COPY)
+			(*infoRec->Sync)(infoRec->pScrn);
                     (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
                         pptSrc->x + i * stripeWidth, pptSrc->y,
                         pbox->x1 + i * stripeWidth, pbox->y1,
                         stripeWidth, pbox->y2 - pbox->y1);
+		}
             }
         SET_SYNC_FLAG(infoRec);
         return;
@@ -336,6 +345,8 @@ XAAScreenToScreenBitBlt(
                     -1, -1, alu, planemask, -1);
                 dirsetup = -1;
             }
+	    if (infoRec->CopyAreaFlags & SYNC_BEFORE_SCREEN_COPY)
+		(*infoRec->Sync)(infoRec->pScrn);
             (*infoRec->SubsequentScreenToScreenCopy)(pScrn,pptSrc->x, pptSrc->y,
                 pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
         }
@@ -346,6 +357,8 @@ XAAScreenToScreenBitBlt(
                     1, 1, alu, planemask, -1);
                 dirsetup = 1;
             }
+	    if (infoRec->CopyAreaFlags & SYNC_BEFORE_SCREEN_COPY)
+		(*infoRec->Sync)(infoRec->pScrn);
             (*infoRec->SubsequentScreenToScreenCopy)(pScrn,pptSrc->x, pptSrc->y,
                 pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
         }
@@ -361,10 +374,13 @@ XAAScreenToScreenBitBlt(
                         1, 1, alu, planemask, -1);
                     dirsetup = 1;
                 }
-                for (i = pbox->y2 - pbox->y1 - 1; i >= 0; i--)
+                for (i = pbox->y2 - pbox->y1 - 1; i >= 0; i--) {
+		    if (infoRec->CopyAreaFlags & SYNC_BEFORE_SCREEN_COPY)
+			(*infoRec->Sync)(infoRec->pScrn);
                     (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
                         pptSrc->x, pptSrc->y + i, pbox->x1, pbox->y1 + i,
                         pbox->x2 - pbox->x1, 1);
+		}
             }
             else {
                 /*
@@ -377,10 +393,13 @@ XAAScreenToScreenBitBlt(
                         -1, -1, alu, planemask, -1);
                     dirsetup = -1;
                 }
-                for (i = 0; i < pbox->y2 - pbox->y1; i++)
+                for (i = 0; i < pbox->y2 - pbox->y1; i++) {
+		    if (infoRec->CopyAreaFlags & SYNC_BEFORE_SCREEN_COPY)
+			(*infoRec->Sync)(infoRec->pScrn);
                     (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
                         pptSrc->x, pptSrc->y + i, pbox->x1, pbox->y1 + i,
                         pbox->x2 - pbox->x1, 1);
+		}
             }
     } /* next box */
     SET_SYNC_FLAG(infoRec);
-- 
1.6.0.5

------=_20090108160610_32972--



More information about the xorg mailing list