xf86-video-intel: src/intel_uxa.c

Chris Wilson ickle at kemper.freedesktop.org
Sun Sep 12 17:08:35 PDT 2010


 src/intel_uxa.c |   29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

New commits:
commit 08c2caca48323d6d5701dcef3486f850619d7905
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Sep 12 12:34:51 2010 +0100

    uxa: Apply source clipping to blits
    
    Yes, this should be done in the higher layers. Yes, I have written code
    to that. No, it is not ready, hence add the sanity check to the
    SRC_COPY_BLT.
    
    This isn't the first report that I've seen, but will be the last.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=30120
    Reported-by: rezbit.hex at gmail.com
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel_uxa.c b/src/intel_uxa.c
index 0dcd5d3..ef4c553 100644
--- a/src/intel_uxa.c
+++ b/src/intel_uxa.c
@@ -411,12 +411,39 @@ i830_uxa_copy(PixmapPtr dest, int src_x1, int src_y1, int dst_x1,
 	ScrnInfoPtr scrn = xf86Screens[dest->drawable.pScreen->myNum];
 	intel_screen_private *intel = intel_get_screen_private(scrn);
 	uint32_t cmd;
-	int dst_x2, dst_y2;
+	int dst_x2, dst_y2, src_x2, src_y2;
 	unsigned int dst_pitch, src_pitch;
 
 	dst_x2 = dst_x1 + w;
 	dst_y2 = dst_y1 + h;
 
+	/* XXX Fixup extents as a lamentable workaround for missing
+	 * source clipping in the upper layers.
+	 */
+	if (dst_x1 < 0)
+		src_x1 -= dst_x1, dst_x1 = 0;
+	if (dst_y1 < 0)
+		src_y1 -= dst_y1, dst_y1 = 0;
+	if (dst_x2 > dest->drawable.width)
+		dst_x2 = dest->drawable.width;
+	if (dst_y2 > dest->drawable.height)
+		dst_y2 = dest->drawable.height;
+
+	src_x2 = src_x1 + (dst_x2 - dst_x1);
+	src_y2 = src_y1 + (dst_y2 - dst_y1);
+
+	if (src_x1 < 0)
+		dst_x1 -= src_x1, src_x1 = 0;
+	if (src_y1 < 0)
+		dst_y1 -= src_y1, src_y1 = 0;
+	if (src_x2 > intel->render_source->drawable.width)
+		dst_x2 -= src_x2 - intel->render_source->drawable.width;
+	if (src_y2 > intel->render_source->drawable.height)
+		dst_y2 -= src_y2 - intel->render_source->drawable.height;
+
+	if (dst_x2 <= dst_x1 || dst_y2 <= dst_y1)
+		return;
+
 	dst_pitch = intel_pixmap_pitch(dest);
 	src_pitch = intel_pixmap_pitch(intel->render_source);
 


More information about the xorg-commit mailing list