rendercheck: 5 commits - 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 Oct 27 02:43:08 EEST 2006
main.c | 35 ++++++++++++++++++--
rendercheck.1 | 5 ++
rendercheck.h | 5 ++
t_blend.c | 13 ++++---
t_composite.c | 9 +++--
t_dstcoords.c | 7 ++--
t_fill.c | 2 -
t_gradient.c | 2 -
t_repeat.c | 2 -
t_triangles.c | 15 +++++---
tests.c | 98 ++++++++++++++++++++++++++++++++++------------------------
11 files changed, 130 insertions(+), 63 deletions(-)
New commits:
diff-tree 72cb2695ae1f78adef263eff779cc88541a41c87 (from ff63516c203c0593ee08b77cc9267afe2ca5b0e3)
Author: Eric Anholt <eric at anholt.net>
Date: Thu Oct 26 16:31:43 2006 -0700
Reduce the size of the rendering done in many tests.
This significantly improves test performance (~60% in blend).
diff --git a/rendercheck.h b/rendercheck.h
index 27a8e5c..f32420e 100644
--- a/rendercheck.h
+++ b/rendercheck.h
@@ -117,7 +117,8 @@ Bool
do_tests(Display *dpy, picture_info *win);
void
-copy_pict_to_win(Display *dpy, picture_info *pict, picture_info *win);
+copy_pict_to_win(Display *dpy, picture_info *pict, picture_info *win,
+ int width, int height);
/* ops.c */
void
diff --git a/t_blend.c b/t_blend.c
index 32c40d8..94cce20 100644
--- a/t_blend.c
+++ b/t_blend.c
@@ -24,6 +24,9 @@
#include "rendercheck.h"
+#define TEST_WIDTH 10
+#define TEST_HEIGHT 10
+
/* Test a composite of a given operation, source, and destination picture.
* Fills the window, and samples from the 0,0 pixel corner.
*/
@@ -36,13 +39,13 @@ blend_test(Display *dpy, picture_info *w
int i;
for (i = 0; i < pixmap_move_iter; i++) {
- XRenderComposite(dpy, PictOpSrc, dst_color->pict, 0, dst->pict, 0, 0,
- 0, 0, 0, 0, win_width, win_height);
- XRenderComposite(dpy, ops[op].op, src_color->pict, 0, dst->pict, 0, 0,
- 0, 0, 0, 0, win_width, win_height);
+ XRenderComposite(dpy, PictOpSrc, dst_color->pict, 0,
+ dst->pict, 0, 0, 0, 0, 0, 0, TEST_WIDTH, TEST_HEIGHT);
+ XRenderComposite(dpy, ops[op].op, src_color->pict, 0,
+ dst->pict, 0, 0, 0, 0, 0, 0, TEST_WIDTH, TEST_HEIGHT);
}
get_pixel(dpy, dst, 0, 0, &tested);
- copy_pict_to_win(dpy, dst, win);
+ copy_pict_to_win(dpy, dst, win, TEST_WIDTH, TEST_HEIGHT);
tdst = dst_color->color;
color_correct(dst, &tdst);
diff --git a/t_composite.c b/t_composite.c
index fd73eec..25b4dd0 100644
--- a/t_composite.c
+++ b/t_composite.c
@@ -24,6 +24,9 @@
#include "rendercheck.h"
+#define TEST_WIDTH 10
+#define TEST_HEIGHT 10
+
/* Test a composite of a given operation, source, mask, and destination picture.
* Fills the window, and samples from the 0,0 pixel corner.
*/
@@ -45,13 +48,13 @@ composite_test(Display *dpy, picture_inf
}
for (i = 0; i < pixmap_move_iter; i++) {
XRenderComposite(dpy, PictOpSrc, dst_color->pict, 0, dst->pict,
- 0, 0, 0, 0, 0, 0, win_width, win_height);
+ 0, 0, 0, 0, 0, 0, TEST_WIDTH, TEST_HEIGHT);
XRenderComposite(dpy, ops[op].op, src_color->pict,
mask_color->pict, dst->pict, 0, 0, 0, 0, 0, 0,
- win_width, win_height);
+ TEST_WIDTH, TEST_HEIGHT);
}
get_pixel(dpy, dst, 0, 0, &tested);
- copy_pict_to_win(dpy, dst, win);
+ copy_pict_to_win(dpy, dst, win, TEST_WIDTH, TEST_HEIGHT);
if (componentAlpha) {
pa.component_alpha = FALSE;
diff --git a/t_dstcoords.c b/t_dstcoords.c
index db71e48..e9f14d9 100644
--- a/t_dstcoords.c
+++ b/t_dstcoords.c
@@ -24,6 +24,9 @@
#include "rendercheck.h"
+#define TEST_WIDTH 10
+#define TEST_HEIGHT 10
+
/* Test destination coordinates by drawing a 3x3 picture offset one pixel.
* XXX: This should be done with another operation, to catch issues with Render
* acceleration in the non-CopyArea-equivalent case.
@@ -38,12 +41,12 @@ dstcoords_test(Display *dpy, picture_inf
for (i = 0; i < pixmap_move_iter; i++) {
XRenderComposite(dpy, PictOpSrc, bg->pict, 0, dst->pict, 0, 0,
- 0, 0, 0, 0, win_width, win_height);
+ 0, 0, 0, 0, TEST_WIDTH, TEST_HEIGHT);
XRenderComposite(dpy, PictOpSrc, fg->pict, 0, dst->pict, 0, 0,
0, 0, 1, 1, 1, 1);
}
- copy_pict_to_win(dpy, dst, win);
+ copy_pict_to_win(dpy, dst, win, TEST_WIDTH, TEST_HEIGHT);
for (x = 0; x < 3; x++) {
for (y = 0; y < 3; y++) {
diff --git a/t_fill.c b/t_fill.c
index 34c3029..f367cb8 100644
--- a/t_fill.c
+++ b/t_fill.c
@@ -36,7 +36,7 @@ fill_test(Display *dpy, picture_info *wi
get_pixel(dpy, src, 0, 0, &tested);
- copy_pict_to_win(dpy, src, win);
+ copy_pict_to_win(dpy, src, win, win_width, win_height);
strcpy(name, "fill ");
describe_format(name, 20 - strlen(name), src->format);
diff --git a/t_gradient.c b/t_gradient.c
index 34aded1..3af209d 100644
--- a/t_gradient.c
+++ b/t_gradient.c
@@ -216,7 +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_pict_to_win(dpy, dst, win);
+ copy_pict_to_win(dpy, dst, win, win_width, win_height);
pix = test_pixels;
while (pix->x >= 0) {
diff --git a/t_repeat.c b/t_repeat.c
index 12ac54f..fc9ceb7 100644
--- a/t_repeat.c
+++ b/t_repeat.c
@@ -97,7 +97,7 @@ repeat_test(Display *dpy, picture_info *
}
}
- copy_pict_to_win(dpy, dst, win);
+ copy_pict_to_win(dpy, dst, win, win_width, win_height);
tdst = dst_color->color;
color_correct(dst, &tdst);
diff --git a/t_triangles.c b/t_triangles.c
index e552560..230c2ff 100644
--- a/t_triangles.c
+++ b/t_triangles.c
@@ -29,6 +29,9 @@
#include "rendercheck.h"
+#define TEST_WIDTH 10
+#define TEST_HEIGHT 10
+
/* Test basic functionality of the triangle operations. We don't care that much
* probably (nobody has used them yet), but we can trivially test by filling
* doing two triangles that will exactly cover the rectangle from 2,2 to 4,4.
@@ -58,12 +61,12 @@ triangles_test(Display *dpy, picture_inf
/* Fill the dst to dst_color */
XRenderComposite(dpy, PictOpSrc, dst_color->pict, None, dst->pict, 0, 0,
- 0, 0, 0, 0, win_width, win_height);
+ 0, 0, 0, 0, TEST_WIDTH, TEST_HEIGHT);
/* Paint the triangles with src_color */
XRenderCompositeTriangles(dpy, ops[op].op, src_color->pict, dst->pict,
XRenderFindStandardFormat(dpy, PictStandardA8), 0, 0, triangles, 2);
- copy_pict_to_win(dpy, dst, win);
+ copy_pict_to_win(dpy, dst, win, TEST_WIDTH, TEST_HEIGHT);
/* Color expected outside of the triangles */
tdst = dst_color->color;
@@ -124,12 +127,12 @@ trifan_test(Display *dpy, picture_info *
/* Fill the dst to dst_color */
XRenderComposite(dpy, PictOpSrc, dst_color->pict, None, dst->pict, 0, 0,
- 0, 0, 0, 0, win_width, win_height);
+ 0, 0, 0, 0, TEST_WIDTH, TEST_HEIGHT);
/* Paint the triangles with src_color */
XRenderCompositeTriFan(dpy, ops[op].op, src_color->pict, dst->pict,
XRenderFindStandardFormat(dpy, PictStandardA8), 0, 0, points, 4);
- copy_pict_to_win(dpy, dst, win);
+ copy_pict_to_win(dpy, dst, win, TEST_WIDTH, TEST_HEIGHT);
/* Color expected outside of the triangles */
tdst = dst_color->color;
@@ -190,12 +193,12 @@ tristrip_test(Display *dpy, picture_info
/* Fill the dst to dst_color */
XRenderComposite(dpy, PictOpSrc, dst_color->pict, None, dst->pict, 0, 0,
- 0, 0, 0, 0, win_width, win_height);
+ 0, 0, 0, 0, TEST_WIDTH, TEST_HEIGHT);
/* Paint the triangles with src_color */
XRenderCompositeTriStrip(dpy, ops[op].op, src_color->pict, dst->pict,
XRenderFindStandardFormat(dpy, PictStandardA8), 0, 0, points, 4);
- copy_pict_to_win(dpy, dst, win);
+ copy_pict_to_win(dpy, dst, win, TEST_WIDTH, TEST_HEIGHT);
/* Color expected outside of the triangles */
tdst = dst_color->color;
diff --git a/tests.c b/tests.c
index ddae088..1111674 100644
--- a/tests.c
+++ b/tests.c
@@ -749,11 +749,12 @@ do { \
* indicates that this behavior should be disabled.
*/
void
-copy_pict_to_win(Display *dpy, picture_info *pict, picture_info *win)
+copy_pict_to_win(Display *dpy, picture_info *pict, picture_info *win,
+ int width, int height)
{
if (pict == win || minimalrendering)
return;
XRenderComposite(dpy, PictOpSrc, pict->pict, 0, win->pict, 0, 0,
- 0, 0, 0, 0, win_width, win_height);
+ 0, 0, 0, 0, width, height);
}
diff-tree ff63516c203c0593ee08b77cc9267afe2ca5b0e3 (from cadf1d2fdfc4a35662a766864d323b4097d07767)
Author: Eric Anholt <eric at anholt.net>
Date: Thu Oct 26 16:15:55 2006 -0700
Slight cleanup of create_formats_list().
diff --git a/tests.c b/tests.c
index fbfcf68..ddae088 100644
--- a/tests.c
+++ b/tests.c
@@ -219,6 +219,9 @@ create_formats_list(Display *dpy)
argb32index = -1;
for (i = 0; ; i++) {
+ char name[20];
+ int alphabits, redbits;
+
if (nformats + 1 == nformats_allocated) {
nformats_allocated *= 2;
format_list = realloc(format_list, sizeof(XRenderPictFormat *) *
@@ -229,50 +232,48 @@ create_formats_list(Display *dpy)
format_list[nformats] = XRenderFindFormat(dpy, PictFormatType, &templ,
i);
- if (format_list[nformats] != NULL) {
- char name[20];
- int alphabits = bit_count(format_list[nformats]->direct.alphaMask);
- int redbits = bit_count(format_list[nformats]->direct.redMask);
-
- /* Our testing code isn't all that hot, so don't bother trying at
- * the low depths yet.
- */
- if ((redbits >= 1 && redbits <= 4) ||
- (alphabits >= 1 && alphabits <= 4))
- {
- continue;
- }
+ if (format_list[nformats] == NULL)
+ break;
- describe_format(name, 20, format_list[nformats]);
+ alphabits = bit_count(format_list[nformats]->direct.alphaMask);
+ redbits = bit_count(format_list[nformats]->direct.redMask);
- if (format_whitelist_len != 0) {
- Bool ok = FALSE;
- int j;
-
- for (j = 0; j < format_whitelist_len; j++) {
- if (strcmp(format_whitelist[j], name) == 0) {
- ok = TRUE;
- break;
- }
- }
- if (!ok) {
- printf("Ignoring server-supported format: %s\n", name);
- continue;
+ /* Our testing code isn't all that hot, so don't bother trying at
+ * the low depths yet.
+ */
+ if ((redbits >= 1 && redbits <= 4) ||
+ (alphabits >= 1 && alphabits <= 4))
+ {
+ continue;
+ }
+
+ describe_format(name, 20, format_list[nformats]);
+
+ if (format_whitelist_len != 0) {
+ Bool ok = FALSE;
+ int j;
+
+ for (j = 0; j < format_whitelist_len; j++) {
+ if (strcmp(format_whitelist[j], name) == 0) {
+ ok = TRUE;
+ break;
}
}
-
- if (format_list[nformats] == XRenderFindStandardFormat(dpy,
- PictStandardARGB32))
- {
- argb32index = nformats;
+ if (!ok) {
+ printf("Ignoring server-supported format: %s\n", name);
+ continue;
}
+ }
- printf("Found server-supported format: %s\n", name);
-
- nformats++;
- } else {
- break;
+ if (format_list[nformats] == XRenderFindStandardFormat(dpy,
+ PictStandardARGB32))
+ {
+ argb32index = nformats;
}
+
+ printf("Found server-supported format: %s\n", name);
+
+ nformats++;
}
if (argb32index == -1) {
errx(1, "required ARGB32 format not found");
diff-tree cadf1d2fdfc4a35662a766864d323b4097d07767 (from 6e809f1ee673a430c58ed486346bf482f451493e)
Author: Eric Anholt <eric at anholt.net>
Date: Thu Oct 26 16:14:29 2006 -0700
Reduce the number of colors to speed up test execution.
The other colors were probably not important.
diff --git a/tests.c b/tests.c
index 4d4eb29..fbfcf68 100644
--- a/tests.c
+++ b/tests.c
@@ -40,10 +40,7 @@ color4d colors[] = {
{1.0, 0, 0, 1.0},
{0, 1.0, 0, 1.0},
{0, 0, 1.0, 1.0},
- {0.5, 0, 0, 0.25},
{0.5, 0, 0, .5},
- {0.0, .5, 1.0, .5},
- {0.0, .5, 1.0, 0}
};
/* Convenience pointers to 1x1 repeating colors */
diff-tree 6e809f1ee673a430c58ed486346bf482f451493e (from 501d5fb5b354951bf8eef893824b637003beea6e)
Author: Eric Anholt <eric at anholt.net>
Date: Thu Oct 26 16:13:45 2006 -0700
Run most tests with all formats, rather than a small subset.
diff --git a/tests.c b/tests.c
index 9481b74..4d4eb29 100644
--- a/tests.c
+++ b/tests.c
@@ -289,6 +289,7 @@ do_tests(Display *dpy, picture_info *win
int num_dests;
picture_info *dests, *pictures_1x1, *pictures_10x10, picture_3x3, *pictures_solid;
int success_mask = 0, tests_passed = 0, tests_total = 0;
+ int num_tests;
create_formats_list(dpy);
@@ -412,17 +413,19 @@ do { \
tests_total++; \
} while (0)
+ num_tests = num_colors * nformats;
+
if (enabled_tests & TEST_FILL) {
Bool ok, group_ok = TRUE;
printf("Beginning testing of filling of 1x1R pictures\n");
- for (i = 0; i < num_colors * nformats; i++) {
+ for (i = 0; i < num_tests; i++) {
ok = fill_test(dpy, win, &pictures_1x1[i]);
RECORD_RESULTS();
}
printf("Beginning testing of filling of 10x10 pictures\n");
- for (i = 0; i < num_colors * nformats; i++) {
+ for (i = 0; i < num_tests; i++) {
ok = fill_test(dpy, win, &pictures_10x10[i]);
RECORD_RESULTS();
}
@@ -498,8 +501,8 @@ do { \
printf("Beginning %s blend test on %s\n", ops[i].name,
pi->name);
- for (src = 0; src < num_colors * nformats; src++) {
- for (dst = 0; dst < num_colors; dst++) {
+ for (src = 0; src < num_tests; src++) {
+ for (dst = 0; dst < num_tests; dst++) {
ok = blend_test(dpy, win, pi, i,
&pictures_1x1[src],
&pictures_1x1[dst]);
@@ -539,9 +542,9 @@ do { \
printf("Beginning %s composite mask test on %s\n",
ops[i].name, pi->name);
- for (src = 0; src < num_colors; src++) {
- for (mask = 0; mask < num_colors; mask++) {
- for (dst = 0; dst < num_colors; dst++) {
+ for (src = 0; src < num_tests; src++) {
+ for (mask = 0; mask < num_tests; mask++) {
+ for (dst = 0; dst < num_tests; dst++) {
ok = composite_test(dpy, win, pi, i,
&pictures_10x10[src],
&pictures_10x10[mask],
@@ -588,9 +591,9 @@ do { \
printf("Beginning %s composite CA mask test on %s\n",
ops[i].name, pi->name);
- for (src = 0; src < num_colors; src++) {
- for (mask = 0; mask < num_colors; mask++) {
- for (dst = 0; dst < num_colors; dst++) {
+ for (src = 0; src < num_tests; src++) {
+ for (mask = 0; mask < num_tests; mask++) {
+ for (dst = 0; dst < num_tests; dst++) {
ok = composite_test(dpy, win, pi, i,
&pictures_10x10[src],
&pictures_10x10[mask],
@@ -637,8 +640,8 @@ do { \
printf("Beginning %s linear gradient test on %s\n",
ops[i].name, pi->name);
- for (src = 0; src < num_colors; src++) {
- for (mask = 0; mask < num_colors; mask++) {
+ for (src = 0; src < num_tests; src++) {
+ for (mask = 0; mask < num_tests; mask++) {
ok = linear_gradient_test(dpy, win, pi, i,
&pictures_1x1[dst]);
RECORD_RESULTS();
diff-tree 501d5fb5b354951bf8eef893824b637003beea6e (from 003f341cf695f66b81d21f255bd816ae825f4ab3)
Author: Eric Anholt <eric at anholt.net>
Date: Thu Oct 26 13:27:25 2006 -0700
Add a -f flag to whitelist formats.
diff --git a/main.c b/main.c
index 01b6d3c..164a0ca 100644
--- a/main.c
+++ b/main.c
@@ -32,6 +32,9 @@ extern int num_colors;
Bool is_verbose = FALSE, minimalrendering = FALSE;
int enabled_tests = ~0; /* Enable all tests by default */
+int format_whitelist_len = 0;
+char **format_whitelist;
+
/* Number of times to repeat operations so that pixmaps will tend to get moved
* into offscreen memory and allow hardware acceleration.
*/
@@ -104,8 +107,8 @@ static void
usage (char *program)
{
fprintf(stderr, "usage: %s [-d|--display display] [-v|--verbose]\n"
- "\t[-t test1,test2,...] [-o op1,op2,...] [--sync]"
- "\t[--minimalrendering]\n"
+ "\t[-t test1,test2,...] [-o op1,op2,...] [-f format1,format2,...]\n"
+ "\t[--sync] [--minimalrendering]\n"
"\tAvailable tests: fill,dcoords,scoords,mcoords,tscoords,\n"
"\t\ttmcoords,blend,composite,cacomposite,gradients,repeat,triangles,\n"
"\t\tbug7366\n",
@@ -123,11 +126,12 @@ int main(int argc, char **argv)
XSetWindowAttributes as;
picture_info window;
char *display = NULL;
- char *test, *opname, *nextname;
+ char *test, *format, *opname, *nextname;
static struct option longopts[] = {
{ "display", required_argument, NULL, 'd' },
{ "iterations", required_argument, NULL, 'i' },
+ { "formats", required_argument, NULL, 'f' },
{ "tests", required_argument, NULL, 't' },
{ "ops", required_argument, NULL, 'o' },
{ "verbose", no_argument, NULL, 'v' },
@@ -137,7 +141,7 @@ int main(int argc, char **argv)
{ NULL, 0, NULL, 0 }
};
- while ((o = getopt_long(argc, argv, "d:i:t:o:v", longopts, NULL)) != -1) {
+ while ((o = getopt_long(argc, argv, "d:i:f:t:o:v", longopts, NULL)) != -1) {
switch (o) {
case 'd':
display = optarg;
@@ -162,6 +166,29 @@ int main(int argc, char **argv)
usage(argv[0]);
}
break;
+ case 'f':
+ nextname = optarg;
+ for (format_whitelist_len = 0;;format_whitelist_len++)
+ {
+ if ((format = strsep(&nextname, ",")) == NULL)
+ break;
+ }
+
+ format_whitelist = malloc(sizeof(char *) *
+ format_whitelist_len);
+ if (format_whitelist == NULL)
+ errx(1, "malloc");
+
+ /* Now the list is separated by \0s, so use strlen to
+ * step between entries.
+ */
+ format = optarg;
+ for (i = 0; i < format_whitelist_len; i++) {
+ format_whitelist[i] = strdup(format);
+ format += strlen(format) + 1;
+ }
+
+ break;
case 't':
nextname = optarg;
diff --git a/rendercheck.1 b/rendercheck.1
index c1f2f5d..4b29091 100644
--- a/rendercheck.1
+++ b/rendercheck.1
@@ -33,6 +33,11 @@ cacomposite, gradients, repeat, triangle
Names must be separated by
commas and have no spaces.
.TP
+.BI \-f|\-\-formats\ format1,format2,format3...
+Enables only a specific subset of the possible formats. Only formats listed
+in the server-supported format list are available. Names must be separated by
+commas and have no spaces.
+.TP
.BI \-o|\-\-ops
Enables only a specific subset of the Render operators.
.TP
diff --git a/rendercheck.h b/rendercheck.h
index 3a4f8c5..27a8e5c 100644
--- a/rendercheck.h
+++ b/rendercheck.h
@@ -87,6 +87,8 @@ extern struct op_info ops[];
extern Bool is_verbose, minimalrendering;
extern color4d colors[];
extern int enabled_tests;
+extern int format_whitelist_len;
+extern char **format_whitelist;
extern picture_info *argb32white, *argb32red, *argb32green, *argb32blue;
/* main.c */
diff --git a/tests.c b/tests.c
index fed1c8c..9481b74 100644
--- a/tests.c
+++ b/tests.c
@@ -246,12 +246,30 @@ create_formats_list(Display *dpy)
continue;
}
+ describe_format(name, 20, format_list[nformats]);
+
+ if (format_whitelist_len != 0) {
+ Bool ok = FALSE;
+ int j;
+
+ for (j = 0; j < format_whitelist_len; j++) {
+ if (strcmp(format_whitelist[j], name) == 0) {
+ ok = TRUE;
+ break;
+ }
+ }
+ if (!ok) {
+ printf("Ignoring server-supported format: %s\n", name);
+ continue;
+ }
+ }
+
if (format_list[nformats] == XRenderFindStandardFormat(dpy,
PictStandardARGB32))
{
argb32index = nformats;
}
- describe_format(name, 20, format_list[nformats]);
+
printf("Found server-supported format: %s\n", name);
nformats++;
More information about the xorg-commit
mailing list