xf86-video-intel: 3 commits - src/sna/sna_accel.c src/sna/sna_driver.c test/basic-copyarea.c test/basic-copyarea-size.c test/basic-fillrect.c test/basic-lines.c test/basic-putimage.c test/basic-stress.c test/.gitignore test/Makefile.am test/mixed-stress.c test/render-composite-solid.c test/render-copyarea.c test/render-copyarea-size.c test/render-fill.c test/render-fill-copy.c test/render-trapezoid.c test/render-trapezoid-image.c test/test.h test/test_image.c

Chris Wilson ickle at kemper.freedesktop.org
Sun Nov 6 01:58:44 PST 2011


 src/sna/sna_accel.c           |    2 
 src/sna/sna_driver.c          |    1 
 test/.gitignore               |    1 
 test/Makefile.am              |    1 
 test/basic-copyarea-size.c    |    6 +
 test/basic-copyarea.c         |    3 
 test/basic-fillrect.c         |    3 
 test/basic-lines.c            |  147 ++++++++++++++++++++++++++++++++++++++++++
 test/basic-putimage.c         |    3 
 test/basic-stress.c           |    3 
 test/mixed-stress.c           |    3 
 test/render-composite-solid.c |    3 
 test/render-copyarea-size.c   |    6 +
 test/render-copyarea.c        |    3 
 test/render-fill-copy.c       |    3 
 test/render-fill.c            |    3 
 test/render-trapezoid-image.c |    6 +
 test/render-trapezoid.c       |    6 +
 test/test.h                   |    2 
 test/test_image.c             |    7 +-
 20 files changed, 190 insertions(+), 22 deletions(-)

New commits:
commit 0b9408d972050cb02c1024926c406cd45508a158
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Nov 6 09:55:09 2011 +0000

    sna: Self-intersection of wide PolyLine are only drawn once
    
    We need to process the union of the PolyLine command if lineWidth!=0 so
    we cannot generally feed lineWidth==1 into our special case handler.
    Proving the lines do not intersect is as difficult as finding the
    intersections and thereby finding the union of the path - so there is no
    advantage in adding a check whether a wide line could be special cased.
    
    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 3c8322f..e33d45a 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4037,7 +4037,7 @@ sna_poly_line(DrawablePtr drawable, GCPtr gc,
 	     flags & 2));
 	if (gc->fillStyle == FillSolid &&
 	    gc->lineStyle == LineSolid &&
-	    gc->lineWidth <= 1 &&
+	    (gc->lineWidth == 0 || (gc->lineWidth == 1 && n == 1)) &&
 	    PM_IS_SOLID(drawable, gc->planemask)) {
 		struct sna_pixmap *priv = sna_pixmap_from_drawable(drawable);
 		struct sna_damage **damage;
commit c76714c29d29687f941a9112e80223c817185d53
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Nov 6 09:43:47 2011 +0000

    test: Add a basic line tester
    
    Starting with exercising drawing of a single segment.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/.gitignore b/test/.gitignore
index e44eb3f..4bfc70d 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -2,6 +2,7 @@ basic-copyarea
 basic-copyarea-size
 basic-fillrect
 basic-putimage
+basic-lines
 basic-stress
 render-fill
 render-trapezoid
diff --git a/test/Makefile.am b/test/Makefile.am
index 475cb17..dc35f9f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -3,6 +3,7 @@ stress_TESTS = \
 	basic-copyarea \
 	basic-copyarea-size \
 	basic-putimage \
+	basic-lines \
 	basic-stress \
 	render-fill \
 	render-trapezoid \
diff --git a/test/basic-copyarea-size.c b/test/basic-copyarea-size.c
index 3c4249e..732bb81 100644
--- a/test/basic-copyarea-size.c
+++ b/test/basic-copyarea-size.c
@@ -88,11 +88,13 @@ int main(int argc, char **argv)
 		test_compare(&test,
 			     real.a, real.format,
 			     ref.a, ref.format,
-			     0, 0, size, size);
+			     0, 0, size, size,
+			     "");
 		test_compare(&test,
 			     real.b, real.format,
 			     ref.b, ref.format,
-			     0, 0, size, size);
+			     0, 0, size, size,
+			     "");
 
 		target_fini(&test.real, &real);
 		target_fini(&test.ref, &ref);
diff --git a/test/basic-copyarea.c b/test/basic-copyarea.c
index a4302f3..a3a4ae7 100644
--- a/test/basic-copyarea.c
+++ b/test/basic-copyarea.c
@@ -264,7 +264,8 @@ static void rect_tests(struct test *t, int reps, int sets, enum target target, i
 		test_compare(t,
 			     real.draw, real.format,
 			     ref.draw, ref.format,
-			     0, 0, real.width, real.height);
+			     0, 0, real.width, real.height,
+			     ""
 	}
 
 	printf("passed [%d iterations x %d]\n", reps, sets);
diff --git a/test/basic-fillrect.c b/test/basic-fillrect.c
index 55dacb6..67d7067 100644
--- a/test/basic-fillrect.c
+++ b/test/basic-fillrect.c
@@ -228,7 +228,8 @@ static void rect_tests(struct test *t, int reps, int sets, enum target target)
 		test_compare(t,
 			     real.draw, real.format,
 			     ref.draw, ref.format,
-			     0, 0, real.width, real.height);
+			     0, 0, real.width, real.height,
+			     "");
 	}
 
 	printf("passed [%d iterations x %d]\n", reps, sets);
diff --git a/test/basic-lines.c b/test/basic-lines.c
new file mode 100644
index 0000000..b710b24
--- /dev/null
+++ b/test/basic-lines.c
@@ -0,0 +1,147 @@
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <X11/Xutil.h> /* for XDestroyImage */
+#include <pixman.h> /* for pixman blt functions */
+
+#include "test.h"
+
+static const XPoint points[]= {
+	/* top */
+	{ 0, 0},
+	{ 1, 0},
+	{ 2, 0},
+	{ 3, 0},
+	{ 4, 0},
+	{ 5, 0},
+	{ 6, 0},
+	{ 7, 0},
+	{ 8, 0},
+	/* right */
+	{ 8, 1},
+	{ 8, 2},
+	{ 8, 3},
+	{ 8, 4},
+	{ 8, 5},
+	{ 8, 6},
+	{ 8, 7},
+	{ 8, 8},
+	/* bottom */
+	{ 7, 8},
+	{ 6, 8},
+	{ 5, 8},
+	{ 4, 8},
+	{ 3, 8},
+	{ 2, 8},
+	{ 1, 8},
+	{ 0, 8},
+	/* left */
+	{ 0, 7},
+	{ 0, 6},
+	{ 0, 5},
+	{ 0, 4},
+	{ 0, 3},
+	{ 0, 2},
+	{ 0, 1},
+	{ 0, 0} /* and origin again for luck */
+};
+#define NUM_POINTS (sizeof(points)/sizeof(points[0]))
+
+static void clear(struct test_display *dpy, struct test_target *tt)
+{
+	XRenderColor render_color = {0};
+	XRenderFillRectangle(dpy->dpy, PictOpClear, tt->picture, &render_color,
+			     0, 0, tt->width, tt->height);
+}
+
+static void draw_line(struct test_display *dpy, struct test_target *tt,
+		      int alu, int width, int style, int cap,
+		      const XPoint *p1, const XPoint *p2,
+		      int dx, int dy)
+{
+	XGCValues val;
+	GC gc;
+
+	val.function = GXcopy;
+	val.foreground = WhitePixel(dpy->dpy, 0);
+	val.line_width = width;
+	val.line_style = style;
+	val.cap_style = cap;
+
+	gc = XCreateGC(dpy->dpy, tt->draw,
+		       GCForeground |
+		       GCFunction |
+		       GCLineWidth |
+		       GCLineStyle |
+		       GCCapStyle,
+		       &val);
+	XDrawLine(dpy->dpy, tt->draw, gc,
+		  p1->x + dx, p1->y + dy,
+		  p2->x + dx, p2->y + dy);
+	XFreeGC(dpy->dpy, gc);
+}
+
+static void line_tests(struct test *t, enum target target)
+{
+	char buf[1024];
+	struct test_target real, ref;
+	int a, b, alu, lw, style, cap;
+
+	printf("Testing drawing of single line segments (%s): ",
+	       test_target_name(target));
+	fflush(stdout);
+
+	test_target_create_render(&t->real, target, &real);
+	test_target_create_render(&t->ref, target, &ref);
+
+	style = LineSolid;
+
+	for (alu = 0; alu < 16; alu++) {
+		for (cap = CapNotLast; cap <= CapProjecting; cap++) {
+			for (lw = 0; lw <= 4; lw++) {
+				for (a = 0; a < NUM_POINTS; a++) {
+					for (b = 0; b < NUM_POINTS; b++) {
+						sprintf(buf,
+							"p1=(%d, %d), p2=(%d, %d), width=%d, cap=%d, alu=%d",
+							points[a].x, points[a].y,
+							points[b].x, points[b].y,
+							lw, cap, alu);
+
+						clear(&t->real, &real);
+						clear(&t->ref, &ref);
+
+						draw_line(&t->real, &real, alu, lw, style, cap,
+							  &points[a], &points[b], 64, 64);
+						draw_line(&t->ref, &ref, alu, lw, style, cap,
+							  &points[a], &points[b], 64, 64);
+
+						test_compare(t,
+							     real.draw, real.format,
+							     ref.draw, ref.format,
+							     0, 0, real.width, real.height,
+							     buf);
+					}
+				}
+			}
+		}
+	}
+
+	test_target_destroy_render(&t->real, &real);
+	test_target_destroy_render(&t->ref, &ref);
+
+	printf("\n");
+}
+
+int main(int argc, char **argv)
+{
+	struct test test;
+	enum target t;
+
+	test_init(&test, argc, argv);
+
+	for (t = TARGET_FIRST; t <= TARGET_LAST; t++)
+		line_tests(&test, t);
+
+	return 0;
+}
diff --git a/test/basic-putimage.c b/test/basic-putimage.c
index ce31976..5d68908 100644
--- a/test/basic-putimage.c
+++ b/test/basic-putimage.c
@@ -245,7 +245,8 @@ static void rect_tests(struct test *t, int reps, int sets, enum target target, i
 		test_compare(t,
 			     real.draw, real.format,
 			     ref.draw, ref.format,
-			     0, 0, real.width, real.height);
+			     0, 0, real.width, real.height,
+			     "");
 	}
 
 	printf("passed [%d iterations x %d]\n", reps, sets);
diff --git a/test/basic-stress.c b/test/basic-stress.c
index 28fe5c9..5657173 100644
--- a/test/basic-stress.c
+++ b/test/basic-stress.c
@@ -130,7 +130,8 @@ static void rect_tests(struct test *test, int iterations, enum target target)
 	test_compare(test,
 		     real.draw, real.format,
 		     ref.draw, ref.format,
-		     0, 0, real.width, real.height);
+		     0, 0, real.width, real.height,
+		     "");
 
 	printf("passed [%d iterations]\n", n);
 
diff --git a/test/mixed-stress.c b/test/mixed-stress.c
index 8aa7ca9..42e2c08 100644
--- a/test/mixed-stress.c
+++ b/test/mixed-stress.c
@@ -183,7 +183,8 @@ static void rect_tests(struct test *test, int iterations, enum target target)
 	test_compare(test,
 		     real.draw, real.format,
 		     ref.draw, ref.format,
-		     0, 0, real.width, real.height);
+		     0, 0, real.width, real.height,
+		     "");
 
 	printf("passed [%d iterations]\n", n);
 
diff --git a/test/render-composite-solid.c b/test/render-composite-solid.c
index 3918247..6609c4b 100644
--- a/test/render-composite-solid.c
+++ b/test/render-composite-solid.c
@@ -220,7 +220,8 @@ static void rect_tests(struct test *t, int reps, int sets, enum target target)
 		test_compare(t,
 			     real.draw, real.format,
 			     ref.draw, ref.format,
-			     0, 0, real.width, real.height);
+			     0, 0, real.width, real.height,
+			     "");
 	}
 
 	printf("passed [%d iterations x %d]\n", reps, sets);
diff --git a/test/render-copyarea-size.c b/test/render-copyarea-size.c
index 89d1ed3..65fb6ca 100644
--- a/test/render-copyarea-size.c
+++ b/test/render-copyarea-size.c
@@ -101,11 +101,13 @@ int main(int argc, char **argv)
 		test_compare(&test,
 			     real.a, real.format,
 			     ref.a, ref.format,
-			     0, 0, size, size);
+			     0, 0, size, size,
+			     "");
 		test_compare(&test,
 			     real.b, real.format,
 			     ref.b, ref.format,
-			     0, 0, size, size);
+			     0, 0, size, size,
+			     "");
 
 		target_fini(&test.real, &real);
 		target_fini(&test.ref, &ref);
diff --git a/test/render-copyarea.c b/test/render-copyarea.c
index d45a456..bcab553 100644
--- a/test/render-copyarea.c
+++ b/test/render-copyarea.c
@@ -287,7 +287,8 @@ static void rect_tests(struct test *t, int reps, int sets, enum target target, i
 		test_compare(t,
 			     real.draw, real.format,
 			     ref.draw, ref.format,
-			     0, 0, real.width, real.height);
+			     0, 0, real.width, real.height,
+			     "");
 	}
 
 	printf("passed [%d iterations x %d]\n", reps, sets);
diff --git a/test/render-fill-copy.c b/test/render-fill-copy.c
index 2017e08..bc4a734 100644
--- a/test/render-fill-copy.c
+++ b/test/render-fill-copy.c
@@ -244,7 +244,8 @@ static void rect_tests(struct test *t, int reps, int sets, enum target target)
 		test_compare(t,
 			     real.draw, real.format,
 			     ref.draw, ref.format,
-			     0, 0, real.width, real.height);
+			     0, 0, real.width, real.height,
+			     "");
 	}
 
 	printf("passed [%d iterations x %d]\n", reps, sets);
diff --git a/test/render-fill.c b/test/render-fill.c
index 709c217..27d565b 100644
--- a/test/render-fill.c
+++ b/test/render-fill.c
@@ -212,7 +212,8 @@ static void rect_tests(struct test *t, int reps, int sets, enum target target)
 		test_compare(t,
 			     real.draw, real.format,
 			     ref.draw, ref.format,
-			     0, 0, real.width, real.height);
+			     0, 0, real.width, real.height,
+			     "");
 	}
 
 	printf("passed [%d iterations x %d]\n", reps, sets);
diff --git a/test/render-trapezoid-image.c b/test/render-trapezoid-image.c
index 4f6ddd7..c794cbb 100644
--- a/test/render-trapezoid-image.c
+++ b/test/render-trapezoid-image.c
@@ -418,7 +418,8 @@ static void rect_tests(struct test *t,
 		test_compare(t,
 			     real.draw, real.format,
 			     ref.draw, ref.format,
-			     0, 0, real.width, real.height);
+			     0, 0, real.width, real.height,
+			     "");
 	}
 
 	printf("passed [%d iterations x %d]\n", reps, sets);
@@ -562,7 +563,8 @@ static void trap_tests(struct test *t,
 		test_compare(t,
 			     real.draw, real.format,
 			     ref.draw, ref.format,
-			     0, 0, real.width, real.height);
+			     0, 0, real.width, real.height,
+			     "");
 	}
 
 	printf("passed [%d iterations x %d]\n", reps, sets);
diff --git a/test/render-trapezoid.c b/test/render-trapezoid.c
index 13683e1..f7fd5bb 100644
--- a/test/render-trapezoid.c
+++ b/test/render-trapezoid.c
@@ -267,7 +267,8 @@ static void rect_tests(struct test *t,
 		test_compare(t,
 			     real.draw, real.format,
 			     ref.draw, ref.format,
-			     0, 0, real.width, real.height);
+			     0, 0, real.width, real.height,
+			     "");
 	}
 
 	printf("passed [%d iterations x %d]\n", reps, sets);
@@ -391,7 +392,8 @@ static void trap_tests(struct test *t,
 		test_compare(t,
 			     real.draw, real.format,
 			     ref.draw, ref.format,
-			     0, 0, real.width, real.height);
+			     0, 0, real.width, real.height,
+			     "");
 	}
 
 	printf("passed [%d iterations x %d]\n", reps, sets);
diff --git a/test/test.h b/test/test.h
index b46dbb5..1e3995b 100644
--- a/test/test.h
+++ b/test/test.h
@@ -43,7 +43,7 @@ void test_init(struct test *test, int argc, char **argv);
 void test_compare(struct test *real,
 		  Drawable real_draw, XRenderPictFormat *real_format,
 		  Drawable ref_draw, XRenderPictFormat *ref_format,
-		  int x, int y, int w, int h);
+		  int x, int y, int w, int h, const char *info);
 
 #define MAX_DELTA 3
 int pixel_difference(uint32_t a, uint32_t b);
diff --git a/test/test_image.c b/test/test_image.c
index a2fdbf0..f2cf906 100644
--- a/test/test_image.c
+++ b/test/test_image.c
@@ -117,7 +117,8 @@ static void test_compare_fallback(struct test *t,
 void test_compare(struct test *t,
 		  Drawable real_draw, XRenderPictFormat *real_format,
 		  Drawable ref_draw, XRenderPictFormat *ref_format,
-		  int x, int y, int w, int h)
+		  int x, int y, int w, int h,
+		  const char *info)
 {
 	XImage real_image, ref_image;
 	Pixmap tmp;
@@ -172,8 +173,8 @@ void test_compare(struct test *t,
 				show_pixels(buf,
 					    &real_image, &ref_image,
 					    i, j, w, h);
-				die("discrepancy found at (%d+%d, %d+%d): found %08x, expected %08x (delta: %d)\n%s",
-				    x,i, y,j, a, b, pixel_difference(a, b), buf);
+				die("discrepancy found at (%d+%d, %d+%d): found %08x, expected %08x (delta: %d)\n%s%s\n",
+				    x,i, y,j, a, b, pixel_difference(a, b), buf, info);
 			}
 		}
 		real += real_image.bytes_per_line;
commit c1e1e20fe7875262530a4d522e970985642c3f13
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Nov 5 20:59:17 2011 +0000

    sna: Add the pixman version to the debug output
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index 8711934..77c0b4c 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -1034,6 +1034,7 @@ void sna_init_scrn(ScrnInfoPtr scrn, int entity_num)
 #endif
 
 	DBG(("%s\n", __FUNCTION__));
+	DBG(("pixman version: %d\n", pixman_version_string()));
 
 	sna_device_key = xf86AllocateEntityPrivateIndex();
 


More information about the xorg-commit mailing list