On Mon, 2009-06-29 at 11:21 +1000, Dave Airlie wrote:
> From: Dave Airlie <[email protected]>
> 
> Userspace sends us a special relocation type to sync video/exa
> to vlines to avoid tearing, this deals with the relocation
> in the kernel, it picks the correct crtc and avoids issues
> where crtcs are disabled.
> 
> This version also parses the wait until to make sure it isn't
> trying to do anything evil.

I tried the previous version of this patch with the attached DDX patch,
but compiz was still tearing. Any idea what's missing?


-- 
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer
From a893a8836524b4422d918060bb1ecf23c7c21c42 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Michel=20D=C3=A4nzer?= <[email protected]>
Date: Fri, 26 Jun 2009 08:29:16 +0200
Subject: [PATCH] Synchronize DRI2 buffer swaps to the refresh.

---
 src/radeon.h      |    4 ++++
 src/radeon_dri2.c |   32 ++++++++++++++++++++++----------
 2 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/src/radeon.h b/src/radeon.h
index 057ced2..d559d58 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -1126,6 +1126,7 @@ extern void RADEONRestoreMemMapRegisters(ScrnInfoPtr pScrn,
 #ifdef USE_EXA
 /* radeon_exa.c */
 extern Bool RADEONSetupMemEXA(ScreenPtr pScreen);
+extern int RADEONBiggerCrtcArea(PixmapPtr pPix);
 
 /* radeon_exa_funcs.c */
 extern void RADEONCopyCP(PixmapPtr pDst, int srcX, int srcY, int dstX,
@@ -1146,6 +1147,9 @@ extern void RADEONDoPrepareCopyMMIO(ScrnInfoPtr pScrn,
 				    Pixel planemask);
 extern Bool R600DrawInit(ScreenPtr pScreen);
 extern Bool R600LoadShaders(ScrnInfoPtr pScrn);
+
+/* radeon_exa_render.c */
+extern PixmapPtr RADEONGetDrawablePixmap(DrawablePtr pDrawable);
 #endif
 
 #if defined(XF86DRI) && defined(USE_EXA)
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index da5d70b..f41c615 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -231,25 +231,37 @@ radeon_dri2_copy_region(DrawablePtr drawable,
     struct dri2_buffer_priv *dst_private = dest_buffer->driverPrivate;
     ScreenPtr pScreen = drawable->pScreen;
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    DrawablePtr src_drawable;
+    DrawablePtr dst_drawable;
     PixmapPtr src_pixmap;
     PixmapPtr dst_pixmap;
     RegionPtr copy_clip;
     GCPtr gc;
+    BoxPtr box;
+
+    if (src_private->attachment == DRI2BufferFrontLeft)
+	src_drawable = drawable;
+    else
+	src_drawable = &src_private->pixmap->drawable;
+    src_pixmap = RADEONGetDrawablePixmap(src_drawable);
+
+    if (dst_private->attachment == DRI2BufferFrontLeft)
+	dst_drawable = drawable;
+    else
+	dst_drawable = &dst_private->pixmap->drawable;
+    dst_pixmap = RADEONGetDrawablePixmap(dst_drawable);
 
-    src_pixmap = src_private->pixmap;
-    dst_pixmap = dst_private->pixmap;
-    if (src_private->attachment == DRI2BufferFrontLeft) {
-        src_pixmap = (PixmapPtr)drawable;
-    }
-    if (dst_private->attachment == DRI2BufferFrontLeft) {
-        dst_pixmap = (PixmapPtr)drawable;
-    }
     gc = GetScratchGC(drawable->depth, pScreen);
     copy_clip = REGION_CREATE(pScreen, NULL, 0);
     REGION_COPY(pScreen, copy_clip, region);
     (*gc->funcs->ChangeClip) (gc, CT_REGION, copy_clip, 0);
-    ValidateGC(&dst_pixmap->drawable, gc);
-    (*gc->ops->CopyArea)(&src_pixmap->drawable, &dst_pixmap->drawable, gc,
+    ValidateGC(dst_drawable, gc);
+
+    box = REGION_EXTENTS(pScreen, gc->pCompositeClip);
+    RADEONWaitForVLineCP(pScrn, dst_pixmap, RADEONBiggerCrtcArea(dst_pixmap),
+			 box->y1, box->y2);
+
+    (*gc->ops->CopyArea)(src_drawable, dst_drawable, gc,
                          0, 0, drawable->width, drawable->height, 0, 0);
     FreeScratchGC(gc);
     RADEONCPReleaseIndirect(pScrn);
-- 
1.6.3.1

------------------------------------------------------------------------------
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to