rendercheck: 4 commits - main.c man/rendercheck.man rendercheck.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat May 3 23:59:57 UTC 2025


 main.c              |   30 +++++++-------------
 man/rendercheck.man |   75 +++++++++++++++++++++++++++++++---------------------
 rendercheck.h       |   27 ++++++++++++++++--
 3 files changed, 81 insertions(+), 51 deletions(-)

New commits:
commit cbdc2644ed407c2e6a142275bd15d5d1d2ce4575
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sat Apr 26 16:46:11 2025 -0700

    rendercheck.man: add missing tests to --tests description
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/test/rendercheck/-/merge_requests/4>

diff --git a/man/rendercheck.man b/man/rendercheck.man
index 936e88c..32a01a4 100644
--- a/man/rendercheck.man
+++ b/man/rendercheck.man
@@ -37,8 +37,9 @@ Test names include
 .BR \%mcoords ", " \%tscoords ", " \%tmcoords ", "
 .BR \%blend ", " \%composite ", " \%cacomposite ", "
 .BR \%gradients ", "\%repeat ", " \%triangles ", "
+.BR \%bug7366 ", "\%gtk_argb_xbgr ", " \%libreoffice_xrgb ", "
 and
-.BR \%bug7366 .
+.BR \%shmblend .
 Names must be separated by commas and have no spaces.
 .TP
 .BI \-f\fR|\fP\-\-formats " format1,format2,format3..."
commit 64fcb1273938b99c3e6db5450a82e32bb1421b64
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sat Apr 26 16:38:04 2025 -0700

    Add --help option
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/test/rendercheck/-/merge_requests/4>

diff --git a/main.c b/main.c
index c18c2d1..b63d22e 100644
--- a/main.c
+++ b/main.c
@@ -148,14 +148,14 @@ void print_tests(FILE *file, int tests) {
 
 _X_NORETURN
 static void
-usage (char *program)
+usage (const char *program, int exitcode)
 {
     fprintf(stderr, "usage: %s [-d|--display display] [-v|--verbose]\n"
 	"\t[-t test1,test2,...] [-o op1,op2,...] [-f format1,format2,...]\n"
-	"\t[--sync] [--minimalrendering] [--version]\n"
+	"\t[--sync] [--minimalrendering] [--help] [--version]\n"
 	"Available tests:\n", program);
     print_tests(stderr, ~0);
-    exit(1);
+    exit(exitcode);
 }
 
 int main(int argc, char **argv)
@@ -178,6 +178,7 @@ int main(int argc, char **argv)
 		{ "tests",	required_argument,	NULL,	't' },
 		{ "ops",	required_argument,	NULL,	'o' },
 		{ "verbose",	no_argument,		NULL,	'v' },
+		{ "help",	no_argument,		NULL,	'?' },
 		{ "sync",	no_argument,		&is_sync, true},
 		{ "minimalrendering", no_argument,
 		  &longopt_minimalrendering, true},
@@ -185,7 +186,7 @@ int main(int argc, char **argv)
 		{ NULL,		0,			NULL,	0 }
 	};
 
-	while ((o = getopt_long(argc, argv, "d:i:f: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;
@@ -207,7 +208,7 @@ int main(int argc, char **argv)
 					break;
 				}
 				if (i == num_ops)
-					usage(argv[0]);
+					usage(argv[0], EXIT_FAILURE);
 			}
 			break;
 		case 'f':
@@ -258,17 +259,20 @@ int main(int argc, char **argv)
 					}
 				}
 				if (!found)
-					usage(argv[0]);
+					usage(argv[0], EXIT_FAILURE);
 			}
 
 			break;
 		case 'v':
 			is_verbose = true;
 			break;
+                case '?':
+			usage(argv[0], EXIT_SUCCESS);
+			break;
 		case 0:
 			break;
 		default:
-			usage(argv[0]);
+			usage(argv[0], EXIT_FAILURE);
 			break;
 		}
 	}
diff --git a/man/rendercheck.man b/man/rendercheck.man
index a4d4684..936e88c 100644
--- a/man/rendercheck.man
+++ b/man/rendercheck.man
@@ -1,5 +1,5 @@
 .ds q \N'34'
-.TH RENDERCHECK 1 2006-10-26 "rendercheck @version@" "X Version 11"
+.TH RENDERCHECK 1 2025-04-26 "rendercheck @version@" "X Version 11"
 .SH NAME
 rendercheck \- simple tests of the X Render extension.
 .SH SYNOPSIS
@@ -9,6 +9,8 @@ rendercheck \- simple tests of the X Render extension.
     [\fB\-t\fP|\fB\-\-tests\fP \fItest1\fP,\fItest2\fP,\fItest3\fP,...] \
 [\fB\-o\fP|\fB\-\-ops\fP \fIop1\fP,\fIop2\fP,\fIop3\fP,...]
     [\fB\-v|\fB\-\-verbose\fP] [\fB\-\-minimalrendering\fP]
+
+\fBrendercheck\fP [\fB\-\-help\fP|\fB\-\-version\fP]
 .fi
 .SH DESCRIPTION
 .B rendercheck
@@ -54,6 +56,12 @@ and successes and failures.
 .B \-\-minimalrendering
 Disables copying of offscreen destinations to the window,
 which is on by default to provide the user with visual feedback.
+.TP
+.B \-\-help
+Prints usage message and exits.
+.TP
+.B \-\-version
+Prints version information and exits.
 .SH BUGS
 Several limitations are documented in the TODO file accompanying the source.
 Please report any further bugs you find to
commit 68ba622791713cf82017c3c49162b94abaa3d139
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sat Apr 26 16:23:59 2025 -0700

    Use __builtin_popcount if available to replace bit_count()
    
    If the compiler knows of a better method for counting the number of
    bits set in a word for the target CPU, let it use that, instead of the
    classic algorithm optimized for PDP-6.
    
    Based on xorg/lib/libxext at 490a25e6f8a4d2482af4364c700b68ad11a4d10b
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/test/rendercheck/-/merge_requests/4>

diff --git a/main.c b/main.c
index 5ec8090..c18c2d1 100644
--- a/main.c
+++ b/main.c
@@ -42,18 +42,6 @@ int pixmap_move_iter = 1;
 int win_width = 40;
 int win_height = 200;
 
-int
-bit_count(int i)
-{
-	int count;
-
-	count = (i >> 1) & 033333333333;
-	count = i - count - ((count >> 1) & 033333333333);
-	count = (((count + (count >> 3)) & 030707070707) % 077);
-	/* HAKMEM 169 */
-	return count;
-}
-
 /* This is not complete, but decent enough for now.*/
 void
 describe_format(char **desc, const char *prefix, XRenderPictFormat *format)
diff --git a/rendercheck.h b/rendercheck.h
index 30ced40..d8c5e41 100644
--- a/rendercheck.h
+++ b/rendercheck.h
@@ -49,6 +49,30 @@ static inline void errx(int eval, const char *fmt, ...)
 #define max(a, b) (a > b ? a : b)
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
+#ifndef __has_builtin
+# define __has_builtin(x) 0     /* Compatibility with older compilers */
+#endif
+
+#if __has_builtin(__builtin_popcount)
+# define bit_count __builtin_popcount
+#else
+/*
+ * Count the number of bits set to 1 in a 32-bit word.
+ * Algorithm from MIT AI Lab Memo 239: "HAKMEM", ITEM 169.
+ * https://dspace.mit.edu/handle/1721.1/6086
+ */
+static inline int
+bit_count(int i)
+{
+	int count;
+
+	count = (i >> 1) & 033333333333;
+	count = i - count - ((count >> 1) & 033333333333);
+	count = (((count + (count >> 3)) & 030707070707) % 077);
+	return count;
+}
+#endif
+
 typedef struct _color4d
 {
 	double r, g, b, a;
@@ -165,9 +189,6 @@ extern int num_colors;
 void
 describe_format(char **desc, const char *prefix, XRenderPictFormat *format);
 
-int
-bit_count(int i);
-
 void
 print_tests(FILE *file, int tests);
 
commit e9394ac675e4395f81ac1f19d0736dbe3478d6a1
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Sat Apr 26 16:14:15 2025 -0700

    Improve man page formatting
    
    More closely follow common style as described on
    https://man7.org/linux/man-pages/man7/man-pages.7.html
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/test/rendercheck/-/merge_requests/4>

diff --git a/man/rendercheck.man b/man/rendercheck.man
index 905c5dc..a4d4684 100644
--- a/man/rendercheck.man
+++ b/man/rendercheck.man
@@ -1,56 +1,64 @@
 .ds q \N'34'
-.TH rendercheck 1 "rendercheck @version@" "X Version 11"
+.TH RENDERCHECK 1 2006-10-26 "rendercheck @version@" "X Version 11"
 .SH NAME
 rendercheck \- simple tests of the X Render extension.
 .SH SYNOPSIS
 .nf
-.B rendercheck [\-d|\-\-display display] [\-i|\-\-iter] [\-\-sync] \
-[\-t|\-\-tests test1,test2,test3,...] [\-o|\-\-ops op1,op2,op3,...]
-[\-v|\-\-verbose] [\-\-minimalrendering]
+\fBrendercheck\fP [\fB\-d\fP|\fB\-\-display\fP \fIdisplay\fP] \
+[\fB\-i\fP|\fB\-\-iter\fP] [\fB\-\-sync\fP]
+    [\fB\-t\fP|\fB\-\-tests\fP \fItest1\fP,\fItest2\fP,\fItest3\fP,...] \
+[\fB\-o\fP|\fB\-\-ops\fP \fIop1\fP,\fIop2\fP,\fIop3\fP,...]
+    [\fB\-v|\fB\-\-verbose\fP] [\fB\-\-minimalrendering\fP]
 .fi
 .SH DESCRIPTION
 .B rendercheck
-is a set of simple tests of the X Render extension.  It is designed for authors
-of Render implementations in X Servers.
+is a set of simple tests of the X Render extension.
+It is designed for authors of Render implementations in X Servers.
 .SH OPTIONS
 .TP
-.BI \-d|\-\-display\ display
+.BI \-d\fR|\fP\-\-display " display"
 Specifies the display to test against.
 .TP
-.BI \-i|\-\-iter\ iterations
+.BI \-i\fR|\fP\-\-iter " iterations"
 Specifies the number of times to repeat each operation before sampling results.
 Some X Servers may behave differently (hardware vs software rendering paths)
-depending on the previous operations done, so this may be used to influence the
-server's choices.
+depending on the previous operations done,
+so this may be used to influence the server's choices.
 .TP
-.BI \-\-sync
+.B \-\-sync
 Enables synchronous xlib operation, for debugging.
 .TP
-.BI \-t|\-\-tests\ test1,test2,test3...
-Enables only a specific subset of the possible tests.  Test names include 
-fill, dcoords, scoords, mcoords, tscoords, tmcoords, blend, composite,
-cacomposite, gradients, repeat, triangles, and bug7366.
-Names must be separated by
-commas and have no spaces.
+.BI \-t\fR|\fP\-\-tests " test1,test2,test3..."
+Enables only a specific subset of the possible tests.
+Test names include
+.BR \%fill ", " \%dcoords ", " \%scoords ", "
+.BR \%mcoords ", " \%tscoords ", " \%tmcoords ", "
+.BR \%blend ", " \%composite ", " \%cacomposite ", "
+.BR \%gradients ", "\%repeat ", " \%triangles ", "
+and
+.BR \%bug7366 .
+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.
+.BI \-f\fR|\fP\-\-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
+.BR \-o | \-\-ops
 Enables only a specific subset of the Render operators.
 .TP
-.BI \-v|\-\-verbose
-Enables verbose printing of information on tests run, and successes and
-failures.
+.BR \-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.
+.B \-\-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
-https://gitlab.freedesktop.org/xorg/test/rendercheck/-/issues/.
+.UR https://gitlab.freedesktop.org/xorg/test/rendercheck/-/issues/
+the rendercheck issue tracker
+.UE .
 .SH AUTHORS
 Eric Anholt, with help from Keith Packard.


More information about the xorg-commit mailing list