xf86-video-intel: src/sna/sna_display.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Jan 6 06:14:06 PST 2015


 src/sna/sna_display.c |   44 ++++++++++++++++++++++++++++----------------
 1 file changed, 28 insertions(+), 16 deletions(-)

New commits:
commit fdb3a008e991131870cf28a7c8eb2b373e023fad
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Jan 6 14:11:40 2015 +0000

    sna: Clip copy to CRTC shadow
    
    If the user sets the CRTC position before resizing the framebuffer, we
    end up with an out-of-bounds CRTC and install a shadow (as the current
    framebuffer does not cover the CRTC). In this case, we copy the visible
    region before displaying on the CRTC. However, this needs to be clipped
    for self-consistency.
    
    Reported-by: Zdenek Kabelac <zkabelac at redhat.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index c2c7406..d1111c7 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -1992,7 +1992,6 @@ force_shadow:
 		}
 
 		if (__sna_pixmap_get_bo(sna->front) && !crtc->transformPresent) {
-			DrawableRec tmp;
 			BoxRec b;
 
 			b.x1 = crtc->x;
@@ -2000,21 +1999,34 @@ force_shadow:
 			b.x2 = crtc->x + crtc->mode.HDisplay;
 			b.y2 = crtc->y + crtc->mode.VDisplay;
 
-			DBG(("%s: copying onto shadow CRTC: (%d, %d)x(%d, %d), handle=%d\n",
-			     __FUNCTION__,
-			     b.x1, b.y1,
-			     b.x2, b.y2,
-			     bo->handle));
-
-			tmp.width = crtc->mode.HDisplay;
-			tmp.height = crtc->mode.VDisplay;
-			tmp.depth = sna->front->drawable.depth;
-			tmp.bitsPerPixel = sna->front->drawable.bitsPerPixel;
-
-			(void)sna->render.copy_boxes(sna, GXcopy,
-						     &sna->front->drawable, __sna_pixmap_get_bo(sna->front), 0, 0,
-						     &tmp, bo, -b.x1, -b.y1,
-						     &b, 1, 0);
+			if (b.x1 < 0)
+				b.x1 = 0;
+			if (b.y1 < 0)
+				b.y1 = 0;
+			if (b.x2 > scrn->virtualX)
+				b.x2 = scrn->virtualX;
+			if (b.y2 > scrn->virtualY)
+				b.y2 = scrn->virtualY;
+			if (b.y2 > b.y1 && b.x2 > b.x1) {
+				DrawableRec tmp;
+
+				DBG(("%s: copying onto shadow CRTC: (%d, %d)x(%d, %d) [fb=%dx%d], handle=%d\n",
+				     __FUNCTION__,
+				     b.x1, b.y1,
+				     b.x2-b.x1, b.y2-b.y1,
+				     scrn->virtualX, scrn->virtualY,
+				     bo->handle));
+
+				tmp.width = crtc->mode.HDisplay;
+				tmp.height = crtc->mode.VDisplay;
+				tmp.depth = sna->front->drawable.depth;
+				tmp.bitsPerPixel = sna->front->drawable.bitsPerPixel;
+
+				(void)sna->render.copy_boxes(sna, GXcopy,
+							     &sna->front->drawable, __sna_pixmap_get_bo(sna->front), 0, 0,
+							     &tmp, bo, -crtc->x, -crtc->y,
+							     &b, 1, 0);
+			}
 		}
 
 		sna_crtc->shadow_bo_width = crtc->mode.HDisplay;


More information about the xorg-commit mailing list