rendercheck: main.c rendercheck.1 rendercheck.h t_blend.c t_composite.c t_dstcoords.c tests.c t_fill.c t_gradient.c t_repeat.c t_triangles.c
Eric Anholt
anholt at kemper.freedesktop.org
Fri Jun 16 20:31:19 EEST 2006
main.c | 6 ++++--
rendercheck.1 | 6 +++++-
rendercheck.h | 5 ++++-
t_blend.c | 5 +----
t_composite.c | 6 ++----
t_dstcoords.c | 5 ++---
t_fill.c | 5 ++---
t_gradient.c | 5 +----
t_repeat.c | 11 ++---------
t_triangles.c | 12 +++---------
tests.c | 17 +++++++++++++++++
11 files changed, 43 insertions(+), 40 deletions(-)
New commits:
diff-tree 334d2203d35c27e0c0d73226ad8a58360c8b36bb (from b99c20783f3d77077eef2af18960db1a68d0dffd)
Author: Eric Anholt <anholt at FreeBSD.org>
Date: Fri Jun 16 09:49:06 2006 -0700
Add an option "--minimalrendering" which suppresses the copying of offscreen
rendering results to the window, which reduces the runtime of the blend tests by
10.2% +/- 6.2% on my system. The copy remains on by default because I think it
can be useful.
diff --git a/main.c b/main.c
index a6b3961..05653c5 100644
--- a/main.c
+++ b/main.c
@@ -29,7 +29,7 @@
extern int num_ops;
extern int num_colors;
-int is_verbose = FALSE;
+Bool is_verbose = FALSE, minimalrendering = FALSE;
int enabled_tests = ~0; /* Enable all tests by default */
/* Number of times to repeat operations so that pixmaps will tend to get moved
@@ -104,7 +104,7 @@ static void
usage (char *program)
{
fprintf(stderr, "usage: %s [-d|--display display] [-v|--verbose]\n"
- "\t[-t test1,test2,...] [--sync]\n"
+ "\t[-t test1,test2,...] [--sync] [--minimalrendering]\n"
"\tAvailable tests: dcoors,scoords,mcoords,tscoords,\n"
"\t\ttmcoords,blend,composite,cacomposite,gradients,repeat,triangles\n",
program);
@@ -129,6 +129,8 @@ int main(int argc, char **argv)
{ "tests", required_argument, NULL, 't' },
{ "verbose", no_argument, NULL, 'v' },
{ "sync", no_argument, &is_sync, 1},
+ { "minimalrendering", no_argument, &minimalrendering,
+ TRUE},
{ NULL, 0, NULL, 0 }
};
diff --git a/rendercheck.1 b/rendercheck.1
index e24de37..ed8fce5 100644
--- a/rendercheck.1
+++ b/rendercheck.1
@@ -5,7 +5,7 @@ rendercheck \- simple tests of the X Ren
.SH SYNOPSIS
.nf
.B rendercheck [\-d|\-\-display display] [\-i|\-\-iter] [\-\-sync] \
-[\-t|\-\-tests test1,test2,test3,...] [\-v|\-\-verbose]
+[\-t|\-\-tests test1,test2,test3,...] [\-v|\-\-verbose] [\-\-minimalrendering]
.fi
.SH DESCRIPTION
.B rendercheck
@@ -34,6 +34,10 @@ commas and have no spaces.
.BI \-v|\-\-verbose
Enables verbose printing of information on tests run, and successes and
failures.
+.TP
+.BI \-\-minimalrendering
+Disables copying of offscreen destinations to the window, which is on by default
+to provide the user with visual feedback.
.SH BUGS
Several limitations are documented in the TODO file accompanying the source.
Please report any further bugs you find to http://bugs.freedesktop.org/.
diff --git a/rendercheck.h b/rendercheck.h
index f6d2629..38d8040 100644
--- a/rendercheck.h
+++ b/rendercheck.h
@@ -82,7 +82,7 @@ struct op_info {
extern int pixmap_move_iter;
extern int win_width, win_height;
extern struct op_info ops[];
-extern Bool is_verbose;
+extern Bool is_verbose, minimalrendering;
extern color4d colors[];
extern int enabled_tests;
extern picture_info *argb32white, *argb32red, *argb32green, *argb32blue;
@@ -109,6 +109,9 @@ argb_fill(Display *dpy, picture_info *p,
Bool
do_tests(Display *dpy, picture_info *win);
+void
+copy_pict_to_win(Display *dpy, picture_info *pict, picture_info *win);
+
/* ops.c */
void
do_composite(int op, color4d *src, color4d *mask, color4d *dst, color4d *result,
diff --git a/t_blend.c b/t_blend.c
index 3411e9b..a8208b8 100644
--- a/t_blend.c
+++ b/t_blend.c
@@ -42,10 +42,7 @@ blend_test(Display *dpy, picture_info *w
0, 0, 0, 0, win_width, win_height);
}
get_pixel(dpy, dst, 0, 0, &tested);
- /* Copy the output to the window, so the user sees something visual. */
- if (win != dst)
- XRenderComposite(dpy, PictOpSrc, dst->pict, 0, win->pict, 0, 0,
- 0, 0, 0, 0, win_width, win_height);
+ copy_pict_to_win(dpy, dst, win);
tdst = dst_color->color;
color_correct(dst, &tdst);
diff --git a/t_composite.c b/t_composite.c
index ea03f8d..fd73eec 100644
--- a/t_composite.c
+++ b/t_composite.c
@@ -51,10 +51,8 @@ composite_test(Display *dpy, picture_inf
win_width, win_height);
}
get_pixel(dpy, dst, 0, 0, &tested);
- /* Copy the output to the window, so the user sees something visual. */
- if (win != dst)
- XRenderComposite(dpy, PictOpSrc, dst->pict, 0, win->pict, 0, 0,
- 0, 0, 0, 0, win_width, win_height);
+ copy_pict_to_win(dpy, dst, win);
+
if (componentAlpha) {
pa.component_alpha = FALSE;
XRenderChangePicture(dpy, mask_color->pict, CPComponentAlpha,
diff --git a/t_dstcoords.c b/t_dstcoords.c
index f05fb0c..db71e48 100644
--- a/t_dstcoords.c
+++ b/t_dstcoords.c
@@ -42,9 +42,8 @@ dstcoords_test(Display *dpy, picture_inf
XRenderComposite(dpy, PictOpSrc, fg->pict, 0, dst->pict, 0, 0,
0, 0, 1, 1, 1, 1);
}
- /* Copy the output to the window, so the user sees something visual. */
- XRenderComposite(dpy, PictOpSrc, dst->pict, 0, win->pict, 0, 0, 0, 0,
- 0, 0, win_width, win_height);
+
+ copy_pict_to_win(dpy, dst, win);
for (x = 0; x < 3; x++) {
for (y = 0; y < 3; y++) {
diff --git a/t_fill.c b/t_fill.c
index ff61ef3..34c3029 100644
--- a/t_fill.c
+++ b/t_fill.c
@@ -35,9 +35,8 @@ fill_test(Display *dpy, picture_info *wi
char name[20];
get_pixel(dpy, src, 0, 0, &tested);
- /* Copy the output to the window, so the user sees something visual. */
- XRenderComposite(dpy, PictOpSrc, src->pict, 0, win->pict, 0, 0, 0, 0,
- 0, 0, win_width, win_height);
+
+ copy_pict_to_win(dpy, src, win);
strcpy(name, "fill ");
describe_format(name, 20 - strlen(name), src->format);
diff --git a/t_gradient.c b/t_gradient.c
index 6f39dee..34aded1 100644
--- a/t_gradient.c
+++ b/t_gradient.c
@@ -216,10 +216,7 @@ Bool linear_gradient_test(Display *dpy,
XRenderComposite(dpy, ops[op].op, gradient, 0,
dst->pict, 0, 0, 0, 0, 0, 0, win_width, win_height);
- /* Copy the output to the window, so the user sees something visual. */
- if (win != dst)
- XRenderComposite(dpy, PictOpSrc, dst->pict, 0, win->pict, 0, 0,
- 0, 0, 0, 0, win_width, win_height);
+ copy_pict_to_win(dpy, dst, win);
pix = test_pixels;
while (pix->x >= 0) {
diff --git a/t_repeat.c b/t_repeat.c
index 5b65968..12ac54f 100644
--- a/t_repeat.c
+++ b/t_repeat.c
@@ -96,15 +96,8 @@ repeat_test(Display *dpy, picture_info *
0, 0, 0, 0, 0, 0, win_width, win_height);
}
}
- /* Copy the output to the window, so the user sees something
- * visual.
- */
- if (win != dst) {
- XRenderComposite(dpy, PictOpSrc,
- dst->pict, None, win->pict,
- 0, 0, 0, 0, 0, 0,
- win_width, win_height);
- }
+
+ copy_pict_to_win(dpy, dst, win);
tdst = dst_color->color;
color_correct(dst, &tdst);
diff --git a/t_triangles.c b/t_triangles.c
index c911399..e552560 100644
--- a/t_triangles.c
+++ b/t_triangles.c
@@ -63,9 +63,7 @@ triangles_test(Display *dpy, picture_inf
XRenderCompositeTriangles(dpy, ops[op].op, src_color->pict, dst->pict,
XRenderFindStandardFormat(dpy, PictStandardA8), 0, 0, triangles, 2);
- /* Copy the output to the window, so the user sees something visual. */
- XRenderComposite(dpy, PictOpSrc, dst->pict, 0, win->pict, 0, 0, 0, 0,
- 0, 0, win_width, win_height);
+ copy_pict_to_win(dpy, dst, win);
/* Color expected outside of the triangles */
tdst = dst_color->color;
@@ -131,9 +129,7 @@ trifan_test(Display *dpy, picture_info *
XRenderCompositeTriFan(dpy, ops[op].op, src_color->pict, dst->pict,
XRenderFindStandardFormat(dpy, PictStandardA8), 0, 0, points, 4);
- /* Copy the output to the window, so the user sees something visual. */
- XRenderComposite(dpy, PictOpSrc, dst->pict, 0, win->pict, 0, 0, 0, 0,
- 0, 0, win_width, win_height);
+ copy_pict_to_win(dpy, dst, win);
/* Color expected outside of the triangles */
tdst = dst_color->color;
@@ -199,9 +195,7 @@ tristrip_test(Display *dpy, picture_info
XRenderCompositeTriStrip(dpy, ops[op].op, src_color->pict, dst->pict,
XRenderFindStandardFormat(dpy, PictStandardA8), 0, 0, points, 4);
- /* Copy the output to the window, so the user sees something visual. */
- XRenderComposite(dpy, PictOpSrc, dst->pict, 0, win->pict, 0, 0, 0, 0,
- 0, 0, win_width, win_height);
+ copy_pict_to_win(dpy, dst, win);
/* Color expected outside of the triangles */
tdst = dst_color->color;
diff --git a/tests.c b/tests.c
index 4d189f9..53d04e8 100644
--- a/tests.c
+++ b/tests.c
@@ -631,3 +631,20 @@ do { \
return tests_passed == tests_total;
}
+
+/**
+ * \brief copies the contents of a picture to the window.
+ *
+ * This is used in tests so that the user sees flashing colors indicating that
+ * rendercheck is really doing things. The minimalrendering commandline option
+ * indicates that this behavior should be disabled.
+ */
+void
+copy_pict_to_win(Display *dpy, picture_info *pict, picture_info *win)
+{
+ if (pict == win || minimalrendering)
+ return;
+
+ XRenderComposite(dpy, PictOpSrc, pict->pict, 0, win->pict, 0, 0,
+ 0, 0, 0, 0, win_width, win_height);
+}
More information about the xorg-commit
mailing list