xf86-video-intel: 2 commits - src/intel.h src/sna/kgem.h src/sna/sna_accel.c src/sna/sna.h

Chris Wilson ickle at kemper.freedesktop.org
Mon Jul 16 08:29:47 PDT 2012


 src/intel.h         |    8 ++++++++
 src/sna/kgem.h      |    3 +++
 src/sna/sna.h       |    9 +++++++++
 src/sna/sna_accel.c |   16 +++++++++++++++-
 4 files changed, 35 insertions(+), 1 deletion(-)

New commits:
commit 818c21165c746b7b410a6e6e23b1675d88db685d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jul 16 16:28:00 2012 +0100

    sna: Fixup pixmap validation for sna_copy_area()
    
    Remember to offset the box by the drawable deltas in order to
    compensate for compositing.
    
    Reported-by: Jiri Slaby <jirislaby at gmail.com>
    References: https://bugs.freedesktop.org/show_bug.cgi?id=52142
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 6d7f51c..d7ecb00 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -229,6 +229,14 @@ static void _assert_pixmap_contains_box(PixmapPtr pixmap, const BoxRec *box, con
 	}
 }
 
+static void _assert_pixmap_contains_box_with_offset(PixmapPtr pixmap, const BoxRec *box, int dx, int dy, const char *function)
+{
+	BoxRec b = *box;
+	b.x1 += dx; b.x2 += dx;
+	b.y1 += dy; b.y2 += dy;
+	_assert_pixmap_contains_box(pixmap, &b, function);
+}
+
 static void _assert_pixmap_contains_boxes(PixmapPtr pixmap, const BoxRec *box, int n, int dx, int dy, const char *function)
 {
 	BoxRec extents;
@@ -333,12 +341,14 @@ static void assert_pixmap_damage(PixmapPtr p)
 }
 
 #define assert_pixmap_contains_box(p, b) _assert_pixmap_contains_box(p, b, __FUNCTION__)
+#define assert_pixmap_contains_box_with_offset(p, b, dx, dy) _assert_pixmap_contains_box_with_offset(p, b, dx, dy, __FUNCTION__)
 #define assert_drawable_contains_box(d, b) _assert_drawable_contains_box(d, b, __FUNCTION__)
 #define assert_pixmap_contains_boxes(p, b, n, x, y) _assert_pixmap_contains_boxes(p, b, n, x, y, __FUNCTION__)
 #define assert_pixmap_contains_points(p, pt, n, x, y) _assert_pixmap_contains_points(p, pt, n, x, y, __FUNCTION__)
 
 #else
 #define assert_pixmap_contains_box(p, b)
+#define assert_pixmap_contains_box_with_offset(p, b, dx, dy)
 #define assert_pixmap_contains_boxes(p, b, n, x, y)
 #define assert_pixmap_contains_points(p, pt, n, x, y)
 #define assert_drawable_contains_box(d, b)
@@ -3937,7 +3947,6 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 	bool replaces;
 
 	assert(RegionNumRects(region));
-	assert_pixmap_contains_box(dst_pixmap, RegionExtents(region));
 
 	if (src_pixmap == dst_pixmap)
 		return sna_self_copy_boxes(src, dst, gc,
@@ -3962,6 +3971,11 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
 	src_dx += dx - dst_dx;
 	src_dy += dy - dst_dy;
 
+	assert_pixmap_contains_box(dst_pixmap, RegionExtents(region));
+	assert_pixmap_contains_box_with_offset(src_pixmap,
+					       RegionExtents(region),
+					       src_dx, src_dy);
+
 	replaces = n == 1 &&
 		box->x1 <= 0 &&
 		box->y1 <= 0 &&
commit 623d84bed7c47ac39348775ce35eec54196f6dac
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Jul 16 16:07:37 2012 +0100

    Wrap defines to avoid redefinition warnings
    
    Currently this only catches out ARRAY_SIZE, but wrap the other common
    defines for consistency.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/intel.h b/src/intel.h
index 2076b2f..fe27011 100644
--- a/src/intel.h
+++ b/src/intel.h
@@ -408,9 +408,17 @@ intel_get_screen_private(ScrnInfoPtr scrn)
 	return (intel_screen_private *)(scrn->driverPrivate);
 }
 
+#ifndef ARRAY_SIZE
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
+#endif
+
+#ifndef ALIGN
 #define ALIGN(i,m)	(((i) + (m) - 1) & ~((m) - 1))
+#endif
+
+#ifndef MIN
 #define MIN(a,b)	((a) < (b) ? (a) : (b))
+#endif
 
 static inline unsigned long intel_pixmap_pitch(PixmapPtr pixmap)
 {
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index c354547..8e9b006 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -191,7 +191,10 @@ struct kgem {
 #define KGEM_RELOC_RESERVED 4
 #define KGEM_EXEC_RESERVED 1
 
+#ifndef ARRAY_SIZE
 #define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
+#endif
+
 #define KGEM_BATCH_SIZE(K) ((K)->batch_size-KGEM_BATCH_RESERVED)
 #define KGEM_EXEC_SIZE(K) (int)(ARRAY_SIZE((K)->exec)-KGEM_EXEC_RESERVED)
 #define KGEM_RELOC_SIZE(K) (int)(ARRAY_SIZE((K)->reloc)-KGEM_RELOC_RESERVED)
diff --git a/src/sna/sna.h b/src/sna/sna.h
index 03115c2..194c712 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -327,9 +327,18 @@ to_sna_from_kgem(struct kgem *kgem)
 #ifndef ARRAY_SIZE
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
 #endif
+
+#ifndef ALIGN
 #define ALIGN(i,m)	(((i) + (m) - 1) & ~((m) - 1))
+#endif
+
+#ifndef MIN
 #define MIN(a,b)	((a) <= (b) ? (a) : (b))
+#endif
+
+#ifndef MAX
 #define MAX(a,b)	((a) >= (b) ? (a) : (b))
+#endif
 
 extern xf86CrtcPtr sna_covering_crtc(ScrnInfoPtr scrn,
 				     const BoxRec *box,


More information about the xorg-commit mailing list