xf86-video-intel: src/intel_dri.c src/sna/sna_dri.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Oct 11 01:24:54 PDT 2012


 src/intel_dri.c   |   25 ++++++++++++-------------
 src/sna/sna_dri.c |   30 ++++++++++++++++--------------
 2 files changed, 28 insertions(+), 27 deletions(-)

New commits:
commit dadffd0061e2b14db397608e3cedfe9c76e546c8
Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Oct 11 14:30:29 2012 +1000

    intel: fix fullscreen damage posting on pageflip
    
    While playing with MPX and sw cursor I noticed page flips won't
    end up misrendering some bits, so the sw cursor was replacing the
    bits on the wrong pixmap.
    
    Fix the damage handling to be correct and append damage before swapping
    the pointers and process damage after.
    
    This fixes misrendering with MPX cursors under a fullscreen compositor,
    that pageflips.
    
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    [ickle: The secret is that damage is sometimes reported before the
    rendering in DamageRegionAppend, and sometimes afterwards in
    DamageRegionProcessPending. For instance, the software cursor operates
    prior to being rendered over.]
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_dri.c b/src/intel_dri.c
index 64cb567..867a465 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -725,6 +725,17 @@ static struct intel_pixmap *
 intel_exchange_pixmap_buffers(struct intel_screen_private *intel, PixmapPtr front, PixmapPtr back)
 {
 	struct intel_pixmap *new_front, *new_back;
+	RegionRec region;
+
+	/* Post damage on the front buffer so that listeners, such
+	 * as DisplayLink know take a copy and shove it over the USB.
+	 * also for sw cursors.
+	 */
+	region.extents.x1 = region.extents.y1 = 0;
+	region.extents.x2 = front->drawable.width;
+	region.extents.y2 = front->drawable.height;
+	region.data = NULL;
+	DamageRegionAppend(&front->drawable, &region);
 
 	new_front = intel_get_pixmap_private(back);
 	new_back = intel_get_pixmap_private(front);
@@ -735,19 +746,7 @@ intel_exchange_pixmap_buffers(struct intel_screen_private *intel, PixmapPtr fron
 
 	intel_glamor_exchange_buffers(intel, front, back);
 
-	/* Post damage on the new front buffer so that listeners, such
-	 * as DisplayLink know take a copy and shove it over the USB.
-	 */
-	{
-		RegionRec region;
-
-		region.extents.x1 = region.extents.y1 = 0;
-		region.extents.x2 = front->drawable.width;
-		region.extents.y2 = front->drawable.height;
-		region.data = NULL;
-		DamageRegionAppend(&front->drawable, &region);
-		DamageRegionProcessPending(&front->drawable);
-	}
+	DamageRegionProcessPending(&front->drawable);
 
 	return new_front;
 }
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index 2fc3af2..15ac46a 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -430,6 +430,16 @@ static void set_bo(PixmapPtr pixmap, struct kgem_bo *bo)
 	struct sna_pixmap *priv = sna_pixmap(pixmap);
 	RegionRec region;
 
+	/* Post damage on the new front buffer so that listeners, such
+	 * as DisplayLink know take a copy and shove it over the USB,
+	 * also for software cursors and the like.
+	 */
+	region.extents.x1 = region.extents.y1 = 0;
+	region.extents.x2 = pixmap->drawable.width;
+	region.extents.y2 = pixmap->drawable.height;
+	region.data = NULL;
+	DamageRegionAppend(&pixmap->drawable, &region);
+
 	sna_damage_all(&priv->gpu_damage,
 		       pixmap->drawable.width,
 		       pixmap->drawable.height);
@@ -446,14 +456,6 @@ static void set_bo(PixmapPtr pixmap, struct kgem_bo *bo)
 	if (bo->domain != DOMAIN_GPU)
 		bo->domain = DOMAIN_NONE;
 
-	/* Post damage on the new front buffer so that listeners, such
-	 * as DisplayLink know take a copy and shove it over the USB.
-	 */
-	region.extents.x1 = region.extents.y1 = 0;
-	region.extents.x2 = pixmap->drawable.width;
-	region.extents.y2 = pixmap->drawable.height;
-	region.data = NULL;
-	DamageRegionAppend(&pixmap->drawable, &region);
 	DamageRegionProcessPending(&pixmap->drawable);
 }
 
@@ -618,15 +620,17 @@ sna_dri_copy_to_front(struct sna *sna, DrawablePtr draw, RegionPtr region,
 		boxes = &clip.extents;
 		n = 1;
 	}
+	pixman_region_translate(region, dx, dy);
+	DamageRegionAppend(&pixmap->drawable, region);
 	if (wedged(sna)) {
 		sna_dri_copy_fallback(sna, draw->bitsPerPixel,
-				      src_bo, -draw->x, -draw->y,
-				      dst_bo, dx, dy,
+				      src_bo, -draw->x-dx, -draw->y-dy,
+				      dst_bo, 0, 0,
 				      boxes, n);
 	} else {
 		sna->render.copy_boxes(sna, GXcopy,
-				       (PixmapPtr)draw, src_bo, -draw->x, -draw->y,
-				       pixmap, dst_bo, dx, dy,
+				       (PixmapPtr)draw, src_bo, -draw->x-dx, -draw->y-dy,
+				       pixmap, dst_bo, 0, 0,
 				       boxes, n, COPY_LAST);
 
 		DBG(("%s: flushing? %d\n", __FUNCTION__, flush));
@@ -637,8 +641,6 @@ sna_dri_copy_to_front(struct sna *sna, DrawablePtr draw, RegionPtr region,
 		}
 	}
 
-	pixman_region_translate(region, dx, dy);
-	DamageRegionAppend(&pixmap->drawable, region);
 	DamageRegionProcessPending(&pixmap->drawable);
 
 	if (clip.data)


More information about the xorg-commit mailing list