rendercheck: 2 commits - t_blend.c t_composite.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Dec 1 13:45:36 PST 2010


 t_blend.c     |  170 ++++++++++++++++++++++++++++-----------------------
 t_composite.c |  190 +++++++++++++++++++++++++++++++---------------------------
 2 files changed, 194 insertions(+), 166 deletions(-)

New commits:
commit 81d988f407ab997e0e43432b3e2a85820bbe2756
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Dec 1 21:36:31 2010 +0000

    composite: Handle more sources than available rows in the window
    
    Group the sources into pages if we cannot fit them all onto a single
    window.
    
    Reported-by: Aaron Plattner <aplattner at nvidia.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/t_composite.c b/t_composite.c
index d305d1e..73133db 100644
--- a/t_composite.c
+++ b/t_composite.c
@@ -38,6 +38,14 @@ composite_test(Display *dpy, picture_info *win, picture_info *dst,
 	color4d expected, tested, tdst, tmsk;
 	char testname[40];
 	int i, s, m, d, iter;
+	int page, num_pages;
+
+	/* If the window is smaller than the number of sources to test,
+	 * we need to break the sources up into pages.
+	 *
+	 * We however assume that the window will always be wider than num_ops.
+	 */
+	num_pages = num_src / win_height + 1;
 
 	for (d = 0; d < num_dst; d++) {
 	    tdst = dst_color[d]->color;
@@ -45,6 +53,7 @@ composite_test(Display *dpy, picture_info *win, picture_info *dst,
 
 	    for (m = 0; m < num_mask; m++) {
 		XRenderDirectFormat mask_acc;
+		int this_src, rem_src;
 		XImage *image;
 
 		if (componentAlpha) {
@@ -55,101 +64,106 @@ composite_test(Display *dpy, picture_info *win, picture_info *dst,
 					 CPComponentAlpha, &pa);
 		}
 
-		for (iter = 0; iter < pixmap_move_iter; iter++) {
-		    XRenderComposite(dpy, PictOpSrc,
-				     dst_color[d]->pict, 0, dst->pict,
-				     0, 0,
-				     0, 0,
-				     0, 0,
-				     num_op, num_src);
-		    for (s = 0; s < num_src; s++) {
-			for (i = 0; i < num_op; i++)
-			    XRenderComposite(dpy, ops[op[i]].op,
-					     src_color[s]->pict,
-					     mask_color[m]->pict,
-					     dst->pict,
-					     0, 0,
-					     0, 0,
-					     i, s,
-					     1, 1);
+		rem_src = num_src;
+		for (page = 0; page < num_pages; page++) {
+		    this_src = rem_src / (num_pages - page);
+		    for (iter = 0; iter < pixmap_move_iter; iter++) {
+			XRenderComposite(dpy, PictOpSrc,
+					 dst_color[d]->pict, 0, dst->pict,
+					 0, 0,
+					 0, 0,
+					 0, 0,
+					 num_op, this_src);
+			for (s = 0; s < this_src; s++) {
+			    for (i = 0; i < num_op; i++)
+				XRenderComposite(dpy, ops[op[i]].op,
+						 src_color[s]->pict,
+						 mask_color[m]->pict,
+						 dst->pict,
+						 0, 0,
+						 0, 0,
+						 i, s,
+						 1, 1);
+			}
 		    }
-		}
 
-		if (componentAlpha) {
-		    XRenderPictureAttributes pa;
+		    if (componentAlpha) {
+			XRenderPictureAttributes pa;
 
-		    pa.component_alpha = FALSE;
-		    XRenderChangePicture(dpy, mask_color[m]->pict,
-					 CPComponentAlpha, &pa);
-		}
+			pa.component_alpha = FALSE;
+			XRenderChangePicture(dpy, mask_color[m]->pict,
+					     CPComponentAlpha, &pa);
+		    }
 
-		image = XGetImage(dpy, dst->d,
-				  0, 0, num_op, num_src,
-				  0xffffffff, ZPixmap);
-		copy_pict_to_win(dpy, dst, win, win_width, win_height);
-
-		if (componentAlpha &&
-		    mask_color[m]->format->direct.redMask == 0) {
-		    /* Ax component-alpha masks expand alpha into
-		     * all color channels.
-		     * XXX: This should be located somewhere generic.
-		     */
-		    tmsk.a = mask_color[m]->color.a;
-		    tmsk.r = mask_color[m]->color.a;
-		    tmsk.g = mask_color[m]->color.a;
-		    tmsk.b = mask_color[m]->color.a;
-		} else
-		    tmsk = mask_color[m]->color;
-
-		accuracy(&mask_acc,
-			 &mask_color[m]->format->direct,
-			 &dst_color[d]->format->direct);
-		accuracy(&mask_acc, &mask_acc, &dst->format->direct);
-
-		for (s = 0; s < num_src; s++) {
-		    XRenderDirectFormat acc;
-
-		    accuracy(&acc, &mask_acc, &src_color[s]->format->direct);
-
-		    for (i = 0; i < num_op; i++) {
-			get_pixel_from_image(image, dst, i, s, &tested);
-
-			do_composite(ops[op[i]].op,
-				     &src_color[s]->color, &tmsk, &tdst,
-				     &expected, componentAlpha);
-			color_correct(dst, &expected);
-
-			if (eval_diff(&acc, &expected, &tested) > 3.) {
-			    snprintf(testname, 40,
-				     "%s %scomposite", ops[op[i]].name,
-				     componentAlpha ? "CA " : "");
-			    print_fail(testname, &expected, &tested, 0, 0,
-				       eval_diff(&acc, &expected, &tested));
-			    printf("src color: %.2f %.2f %.2f %.2f\n"
-				   "msk color: %.2f %.2f %.2f %.2f\n"
-				   "dst color: %.2f %.2f %.2f %.2f\n",
-				   src_color[s]->color.r,
-				   src_color[s]->color.g,
-				   src_color[s]->color.b,
-				   src_color[s]->color.a,
-				   mask_color[m]->color.r,
-				   mask_color[m]->color.g,
-				   mask_color[m]->color.b,
-				   mask_color[m]->color.a,
-				   dst_color[d]->color.r,
-				   dst_color[d]->color.g,
-				   dst_color[d]->color.b,
-				   dst_color[d]->color.a);
-			    printf("src: %s, mask: %s, dst: %s\n",
-				   src_color[s]->name,
-				   mask_color[m]->name,
-				   dst->name);
-			    XDestroyImage(image);
-			    return FALSE;
+		    image = XGetImage(dpy, dst->d,
+				      0, 0, num_op, this_src,
+				      0xffffffff, ZPixmap);
+		    copy_pict_to_win(dpy, dst, win, win_width, win_height);
+
+		    if (componentAlpha &&
+			mask_color[m]->format->direct.redMask == 0) {
+			/* Ax component-alpha masks expand alpha into
+			 * all color channels.
+			 * XXX: This should be located somewhere generic.
+			 */
+			tmsk.a = mask_color[m]->color.a;
+			tmsk.r = mask_color[m]->color.a;
+			tmsk.g = mask_color[m]->color.a;
+			tmsk.b = mask_color[m]->color.a;
+		    } else
+			tmsk = mask_color[m]->color;
+
+		    accuracy(&mask_acc,
+			     &mask_color[m]->format->direct,
+			     &dst_color[d]->format->direct);
+		    accuracy(&mask_acc, &mask_acc, &dst->format->direct);
+
+		    for (s = 0; s < this_src; s++) {
+			XRenderDirectFormat acc;
+
+			accuracy(&acc, &mask_acc, &src_color[s]->format->direct);
+
+			for (i = 0; i < num_op; i++) {
+			    get_pixel_from_image(image, dst, i, s, &tested);
+
+			    do_composite(ops[op[i]].op,
+					 &src_color[s]->color, &tmsk, &tdst,
+					 &expected, componentAlpha);
+			    color_correct(dst, &expected);
+
+			    if (eval_diff(&acc, &expected, &tested) > 3.) {
+				snprintf(testname, 40,
+					 "%s %scomposite", ops[op[i]].name,
+					 componentAlpha ? "CA " : "");
+				print_fail(testname, &expected, &tested, 0, 0,
+					   eval_diff(&acc, &expected, &tested));
+				printf("src color: %.2f %.2f %.2f %.2f\n"
+				       "msk color: %.2f %.2f %.2f %.2f\n"
+				       "dst color: %.2f %.2f %.2f %.2f\n",
+				       src_color[s]->color.r,
+				       src_color[s]->color.g,
+				       src_color[s]->color.b,
+				       src_color[s]->color.a,
+				       mask_color[m]->color.r,
+				       mask_color[m]->color.g,
+				       mask_color[m]->color.b,
+				       mask_color[m]->color.a,
+				       dst_color[d]->color.r,
+				       dst_color[d]->color.g,
+				       dst_color[d]->color.b,
+				       dst_color[d]->color.a);
+				printf("src: %s, mask: %s, dst: %s\n",
+				       src_color[s]->name,
+				       mask_color[m]->name,
+				       dst->name);
+				XDestroyImage(image);
+				return FALSE;
+			    }
 			}
 		    }
+		    XDestroyImage(image);
+		    rem_src -= this_src;
 		}
-		XDestroyImage(image);
 	    }
 	}
 
commit c285306dfaadb388706529623d171cc9fdde1b78
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Dec 1 21:36:31 2010 +0000

    blend: Handle more sources than available rows in the window
    
    Group the sources into pages if we cannot fit them all onto a single
    window.
    
    Reported-by: Aaron Plattner <aplattner at nvidia.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/t_blend.c b/t_blend.c
index 525ea09..3a91400 100644
--- a/t_blend.c
+++ b/t_blend.c
@@ -34,93 +34,107 @@ blend_test(Display *dpy, picture_info *win, picture_info *dst,
 	color4d expected, tested, tdst;
 	char testname[20];
 	int i, j, k, y, iter;
+	int page, num_pages;
+
+	/* If the window is smaller than the number of sources to test,
+	 * we need to break the sources up into pages.
+	 *
+	 * We however assume that the window will always be wider than num_ops.
+	 */
+	num_pages = num_src / win_height + 1;
 
 	k = y = 0;
 	while (k < num_dst) {
 	    XImage *image;
 	    int k0 = k;
-
-	    for (iter = 0; iter < pixmap_move_iter; iter++) {
-		k = k0;
-		y = 0;
-		while (k < num_dst && y + num_src < win_height) {
-		    XRenderComposite(dpy, PictOpSrc,
-				     dst_color[k]->pict, 0, dst->pict,
-				     0, 0,
-				     0, 0,
-				     0, y,
-				     num_op, num_src);
-		    for (j = 0; j < num_src; j++) {
-			for (i = 0; i < num_op; i++) {
-			    XRenderComposite(dpy, ops[op[i]].op,
-					     src_color[j]->pict, 0, dst->pict,
-					     0, 0,
-					     0, 0,
-					     i, y,
-					     1, 1);
-			}
-			y++;
+	    int this_src, rem_src;
+
+	    rem_src = num_src;
+	    for (page = 0; page < num_pages; page++) {
+		    this_src = rem_src / (num_pages - page);
+		    for (iter = 0; iter < pixmap_move_iter; iter++) {
+			    k = k0;
+			    y = 0;
+			    while (k < num_dst && y + this_src < win_height) {
+				    XRenderComposite(dpy, PictOpSrc,
+						     dst_color[k]->pict, 0, dst->pict,
+						     0, 0,
+						     0, 0,
+						     0, y,
+						     num_op, this_src);
+				    for (j = 0; j < this_src; j++) {
+					    for (i = 0; i < num_op; i++) {
+						    XRenderComposite(dpy, ops[op[i]].op,
+								     src_color[j]->pict, 0, dst->pict,
+								     0, 0,
+								     0, 0,
+								     i, y,
+								     1, 1);
+					    }
+					    y++;
+				    }
+				    k++;
+			    }
 		    }
-		    k++;
-		}
-	    }
 
-	    image = XGetImage(dpy, dst->d,
-			      0, 0, num_ops, y,
-			      0xffffffff, ZPixmap);
-	    copy_pict_to_win(dpy, dst, win, win_width, win_height);
-
-	    y = 0;
-	    while (k0 < k) {
-		XRenderDirectFormat dst_acc;
-
-		accuracy(&dst_acc,
-			 &dst->format->direct,
-			 &dst_color[k0]->format->direct);
-
-		tdst = dst_color[k0]->color;
-		color_correct(dst, &tdst);
-
-		for (j = 0; j < num_src; j++) {
-		    XRenderDirectFormat acc;
-
-		    accuracy(&acc, &src_color[j]->format->direct, &dst_acc);
-
-		    for (i = 0; i < num_op; i++) {
-			get_pixel_from_image(image, dst, i, y, &tested);
-
-			do_composite(ops[op[i]].op,
-				     &src_color[j]->color,
-				     NULL,
-				     &tdst,
-				     &expected,
-				     FALSE);
-			color_correct(dst, &expected);
-
-			if (eval_diff(&acc, &expected, &tested) > 3.) {
-			    char srcformat[20];
-
-			    snprintf(testname, 20, "%s blend", ops[op[i]].name);
-			    describe_format(srcformat, 20, src_color[j]->format);
-			    print_fail(testname, &expected, &tested, 0, 0,
-				       eval_diff(&acc, &expected, &tested));
-			    printf("src color: %.2f %.2f %.2f %.2f (%s)\n"
-				   "dst color: %.2f %.2f %.2f %.2f\n",
-				   src_color[j]->color.r, src_color[j]->color.g,
-				   src_color[j]->color.b, src_color[j]->color.a,
-				   srcformat,
-				   dst_color[k0]->color.r, dst_color[k0]->color.g,
-				   dst_color[k0]->color.b, dst_color[k0]->color.a);
-			    printf("src: %s, dst: %s\n", src_color[j]->name, dst->name);
-			    return FALSE;
-			}
+		    image = XGetImage(dpy, dst->d,
+				      0, 0, num_ops, y,
+				      0xffffffff, ZPixmap);
+		    copy_pict_to_win(dpy, dst, win, win_width, win_height);
+
+		    y = 0;
+		    while (k0 < k) {
+			    XRenderDirectFormat dst_acc;
+
+			    accuracy(&dst_acc,
+				     &dst->format->direct,
+				     &dst_color[k0]->format->direct);
+
+			    tdst = dst_color[k0]->color;
+			    color_correct(dst, &tdst);
+
+			    for (j = 0; j < this_src; j++) {
+				    XRenderDirectFormat acc;
+
+				    accuracy(&acc, &src_color[j]->format->direct, &dst_acc);
+
+				    for (i = 0; i < num_op; i++) {
+					    get_pixel_from_image(image, dst, i, y, &tested);
+
+					    do_composite(ops[op[i]].op,
+							 &src_color[j]->color,
+							 NULL,
+							 &tdst,
+							 &expected,
+							 FALSE);
+					    color_correct(dst, &expected);
+
+					    if (eval_diff(&acc, &expected, &tested) > 3.) {
+						    char srcformat[20];
+
+						    snprintf(testname, 20, "%s blend", ops[op[i]].name);
+						    describe_format(srcformat, 20, src_color[j]->format);
+						    print_fail(testname, &expected, &tested, 0, 0,
+							       eval_diff(&acc, &expected, &tested));
+						    printf("src color: %.2f %.2f %.2f %.2f (%s)\n"
+							   "dst color: %.2f %.2f %.2f %.2f\n",
+							   src_color[j]->color.r, src_color[j]->color.g,
+							   src_color[j]->color.b, src_color[j]->color.a,
+							   srcformat,
+							   dst_color[k0]->color.r, dst_color[k0]->color.g,
+							   dst_color[k0]->color.b, dst_color[k0]->color.a);
+						    printf("src: %s, dst: %s\n", src_color[j]->name, dst->name);
+						    return FALSE;
+					    }
+				    }
+				    y++;
+			    }
+			    k0++;
 		    }
-		    y++;
-		}
-		k0++;
-	    }
 
-	    XDestroyImage(image);
+		    XDestroyImage(image);
+		    rem_src -= this_src;
+	    }
 	}
 
 	return TRUE;


More information about the xorg-commit mailing list