xserver: Branch 'master' - 8 commits

Adam Jackson ajax at kemper.freedesktop.org
Wed Sep 28 16:50:10 UTC 2016


 hw/kdrive/ephyr/ephyr_glamor_glx.c   |    8 +
 hw/kdrive/ephyr/ephyrinit.c          |    7 -
 test/.gitignore                      |    2 
 test/Makefile.am                     |   23 ++-
 test/scripts/run-piglit.sh           |   80 ++++++++++++
 test/scripts/xephyr-glamor-piglit.sh |   16 ++
 test/scripts/xvfb-piglit.sh          |   67 ----------
 test/simple-xinit.c                  |  229 +++++++++++++++++++++++++++++++++++
 8 files changed, 363 insertions(+), 69 deletions(-)

New commits:
commit c49e820f796c27cbd2907709576a3fb672acd453
Author: Eric Anholt <eric at anholt.net>
Date:   Sun Sep 25 13:30:22 2016 -0700

    test: Run xts against Xephyr -glamor when present
    
    v2: Drop x8r8g8b8 skip, now that it's fixed.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/test/Makefile.am b/test/Makefile.am
index cf19bec..c89915c 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -19,10 +19,16 @@ noinst_PROGRAMS = \
 
 if XVFB
 XVFB_TESTS = scripts/xvfb-piglit.sh
+if XEPHYR
+if GLAMOR
+XEPHYR_GLAMOR_TESTS = scripts/xephyr-glamor-piglit.sh
+endif
+endif
 endif
 
 SCRIPT_TESTS = \
 	$(XVFB_TESTS) \
+	$(XEPHYR_GLAMOR_TESTS) \
 	$(NULL)
 
 TESTS = \
diff --git a/test/scripts/xephyr-glamor-piglit.sh b/test/scripts/xephyr-glamor-piglit.sh
new file mode 100755
index 0000000..51d42c3
--- /dev/null
+++ b/test/scripts/xephyr-glamor-piglit.sh
@@ -0,0 +1,16 @@
+# Start a Xephyr server using glamor.  Since the test environment is
+# headless, we start an Xvfb first to host the Xephyr.
+export PIGLIT_RESULTS_DIR=$XSERVER_BUILDDIR/test/piglit-results/xephyr-glamor
+
+export SERVER_COMMAND="$XSERVER_BUILDDIR/hw/kdrive/ephyr/Xephyr \
+        -glamor \
+        -glamor-skip-present \
+        -noreset \
+        -schedMax 2000 \
+        -screen 1280x1024"
+
+$XSERVER_BUILDDIR/test/simple-xinit \
+        $XSERVER_DIR/test/scripts/run-piglit.sh \
+        -- \
+        $XSERVER_BUILDDIR/hw/vfb/Xvfb \
+        -screen scrn 1280x1024x24
commit 5392ea5525082ceeb3aad50d9168baee2abc860e
Author: Eric Anholt <eric at anholt.net>
Date:   Sun Sep 25 13:30:21 2016 -0700

    test: Switch our testing X server to being spawned with simple-xinit
    
    Once I introduced a second X server being tested, I found that startx
    hit races in choosing a display.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/test/scripts/run-piglit.sh b/test/scripts/run-piglit.sh
index 3623a05..b999c25 100755
--- a/test/scripts/run-piglit.sh
+++ b/test/scripts/run-piglit.sh
@@ -38,7 +38,7 @@ if test "x$SERVER_COMMAND" = "x"; then
     exit 1
 fi
 
-startx \
+$XSERVER_BUILDDIR/test/simple-xinit \
     $XSERVER_DIR/test/scripts/xinit-piglit-session.sh \
     -- \
     $SERVER_COMMAND
commit 283840c295c69aa3729f3f0aa2bf3ef83b1c220f
Author: Eric Anholt <eric at anholt.net>
Date:   Sun Sep 25 13:30:20 2016 -0700

    test: Update piglit HTML even when tests all pass
    
    I was confused by the behavior I'd written before.  keithp and
    mattst88 responded with shock that I would have made it so surprising,
    as well.
    
    v2: Point to index.html instead of problems.html, which won't exist if
        we had no problems.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/test/scripts/run-piglit.sh b/test/scripts/run-piglit.sh
index c412d7e..3623a05 100755
--- a/test/scripts/run-piglit.sh
+++ b/test/scripts/run-piglit.sh
@@ -66,15 +66,15 @@ if ! grep "^ *crash: *0$" $SHORT_SUMMARY > /dev/null; then
     status=1
 fi
 
-if test $status != 0; then
-    $PIGLIT_DIR/piglit-summary-html.py \
+$PIGLIT_DIR/piglit-summary-html.py \
 	--overwrite \
 	$PIGLIT_RESULTS_DIR/html \
 	$PIGLIT_RESULTS_DIR
 
+if test $status != 0; then
     echo "Some piglit tests failed."
     echo "The list of failing tests can be found in $LONG_SUMMARY."
-    echo "An html page of the failing tests can be found at $PIGLIT_RESULTS_DIR/html/problems.html"
 fi
+echo "An html page of the test status can be found at $PIGLIT_RESULTS_DIR/html/index.html"
 
 exit $status
commit 022fea767cd29d256fb99159df89cc25d339e787
Author: Eric Anholt <eric at anholt.net>
Date:   Sun Sep 25 13:30:19 2016 -0700

    test: Fix parsing of piglit results
    
    The "dmesg-fail" line was matching our "fail" regex, so if you didn't
    have those we would ignore fails.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/test/scripts/run-piglit.sh b/test/scripts/run-piglit.sh
index 11e9c1e..c412d7e 100755
--- a/test/scripts/run-piglit.sh
+++ b/test/scripts/run-piglit.sh
@@ -55,14 +55,14 @@ cat $SHORT_SUMMARY
 # Parse the piglit summary to decide on our exit status.
 status=0
 # "pass: 0" would mean no tests actually ran.
-if grep "pass:.*0" $SHORT_SUMMARY > /dev/null; then
+if grep "^ *pass: *0$" $SHORT_SUMMARY > /dev/null; then
     status=1
 fi
 # Fails or crashes should be failures from make check's perspective.
-if ! grep "fail:.*0" $SHORT_SUMMARY > /dev/null; then
+if ! grep "^ *fail: *0$" $SHORT_SUMMARY > /dev/null; then
     status=1
 fi
-if ! grep "crash:.*0" $SHORT_SUMMARY > /dev/null; then
+if ! grep "^ *crash: *0$" $SHORT_SUMMARY > /dev/null; then
     status=1
 fi
 
commit 7fe5b9c02cf90b81532cb6dee3ec75c90c72c27c
Author: Eric Anholt <eric at anholt.net>
Date:   Sun Sep 25 13:30:18 2016 -0700

    test: Make the piglit-running script callable with an arbitrary server
    
    v2: Check that SERVER_COMMAND is set.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/test/.gitignore b/test/.gitignore
index c44fc82..47f766c 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -11,6 +11,7 @@ xfree86
 xkb
 xtest
 signal-logging
+piglit-results
 simple-xinit
 *.log
 *.trs
diff --git a/test/Makefile.am b/test/Makefile.am
index 24bfc35..cf19bec 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -163,6 +163,7 @@ endif
 EXTRA_DIST = \
 	$(SCRIPT_TESTS) \
 	scripts/xinit-piglit-session.sh \
+	scripts/run-piglit.sh \
 	ddxstubs.c \
 	$(NULL)
 
diff --git a/test/scripts/run-piglit.sh b/test/scripts/run-piglit.sh
new file mode 100755
index 0000000..11e9c1e
--- /dev/null
+++ b/test/scripts/run-piglit.sh
@@ -0,0 +1,80 @@
+#!/bin/sh
+
+set -e
+
+if test "x$XTEST_DIR" = "x"; then
+    echo "XTEST_DIR must be set to the directory of the xtest repository."
+    # Exit as a "skip" so make check works even without piglit.
+    exit 77
+fi
+
+if test "x$PIGLIT_DIR" = "x"; then
+    echo "PIGLIT_DIR must be set to the directory of the piglit repository."
+    # Exit as a "skip" so make check works even without piglit.
+    exit 77
+fi
+
+if test "x$PIGLIT_RESULTS_DIR" = "x"; then
+    echo "PIGLIT_RESULTS_DIR must be set to where to output piglit results."
+    # Exit as a real failure because it should always be set.
+    exit 1
+fi
+
+if test "x$XSERVER_DIR" = "x"; then
+    echo "XSERVER_DIR must be set to the directory of the xserver repository."
+    # Exit as a real failure because it should always be set.
+    exit 1
+fi
+
+if test "x$XSERVER_BUILDDIR" = "x"; then
+    echo "XSERVER_BUILDDIR must be set to the build directory of the xserver repository."
+    # Exit as a real failure because it should always be set.
+    exit 1
+fi
+
+if test "x$SERVER_COMMAND" = "x"; then
+    echo "SERVER_COMMAND must be set to the server to be spawned."
+    # Exit as a real failure because it should always be set.
+    exit 1
+fi
+
+startx \
+    $XSERVER_DIR/test/scripts/xinit-piglit-session.sh \
+    -- \
+    $SERVER_COMMAND
+
+# Write out piglit-summaries.
+SHORT_SUMMARY=$PIGLIT_RESULTS_DIR/summary
+LONG_SUMMARY=$PIGLIT_RESULTS_DIR/long-summary
+$PIGLIT_DIR/piglit-summary.py -s $PIGLIT_RESULTS_DIR > $SHORT_SUMMARY
+$PIGLIT_DIR/piglit-summary.py $PIGLIT_RESULTS_DIR > $LONG_SUMMARY
+
+# Write the short summary to make check's log file.
+cat $SHORT_SUMMARY
+
+# Parse the piglit summary to decide on our exit status.
+status=0
+# "pass: 0" would mean no tests actually ran.
+if grep "pass:.*0" $SHORT_SUMMARY > /dev/null; then
+    status=1
+fi
+# Fails or crashes should be failures from make check's perspective.
+if ! grep "fail:.*0" $SHORT_SUMMARY > /dev/null; then
+    status=1
+fi
+if ! grep "crash:.*0" $SHORT_SUMMARY > /dev/null; then
+    status=1
+fi
+
+if test $status != 0; then
+    $PIGLIT_DIR/piglit-summary-html.py \
+	--overwrite \
+	$PIGLIT_RESULTS_DIR/html \
+	$PIGLIT_RESULTS_DIR
+
+    echo "Some piglit tests failed."
+    echo "The list of failing tests can be found in $LONG_SUMMARY."
+    echo "An html page of the failing tests can be found at $PIGLIT_RESULTS_DIR/html/problems.html"
+fi
+
+exit $status
diff --git a/test/scripts/xvfb-piglit.sh b/test/scripts/xvfb-piglit.sh
index b775239..799f285 100755
--- a/test/scripts/xvfb-piglit.sh
+++ b/test/scripts/xvfb-piglit.sh
@@ -1,72 +1,7 @@
-#!/bin/sh
-
-set -e
-
-if test "x$XTEST_DIR" = "x"; then
-    echo "XTEST_DIR must be set to the directory of the xtest repository."
-    # Exit as a "skip" so make check works even without piglit.
-    exit 77
-fi
-
-if test "x$PIGLIT_DIR" = "x"; then
-    echo "PIGLIT_DIR must be set to the directory of the piglit repository."
-    # Exit as a "skip" so make check works even without piglit.
-    exit 77
-fi
-
-if test "x$XSERVER_DIR" = "x"; then
-    echo "XSERVER_DIR must be set to the directory of the xserver repository."
-    # Exit as a real failure because it should always be set.
-    exit 1
-fi
-
-if test "x$XSERVER_BUILDDIR" = "x"; then
-    echo "XSERVER_BUILDDIR must be set to the build directory of the xserver repository."
-    # Exit as a real failure because it should always be set.
-    exit 1
-fi
-
-export PIGLIT_RESULTS_DIR=$PIGLIT_DIR/results/xvfb
-
-startx \
-    $XSERVER_DIR/test/scripts/xinit-piglit-session.sh \
-    -- \
-    $XSERVER_BUILDDIR/hw/vfb/Xvfb \
+export SERVER_COMMAND="$XSERVER_DIR/hw/vfb/Xvfb \
         -noreset \
-        -screen scrn 1280x1024x24
-
-# Write out piglit-summaries.
-SHORT_SUMMARY=$PIGLIT_RESULTS_DIR/summary
-LONG_SUMMARY=$PIGLIT_RESULTS_DIR/long-summary
-$PIGLIT_DIR/piglit-summary.py -s $PIGLIT_RESULTS_DIR > $SHORT_SUMMARY
-$PIGLIT_DIR/piglit-summary.py $PIGLIT_RESULTS_DIR > $LONG_SUMMARY
-
-# Write the short summary to make check's log file.
-cat $SHORT_SUMMARY
-
-# Parse the piglit summary to decide on our exit status.
-status=0
-# "pass: 0" would mean no tests actually ran.
-if grep "pass:.*0" $SHORT_SUMMARY > /dev/null; then
-    status=1
-fi
-# Fails or crashes should be failures from make check's perspective.
-if ! grep "fail:.*0" $SHORT_SUMMARY > /dev/null; then
-    status=1
-fi
-if ! grep "crash:.*0" $SHORT_SUMMARY > /dev/null; then
-    status=1
-fi
-
-if test $status != 0; then
-    $PIGLIT_DIR/piglit-summary-html.py \
-	--overwrite \
-	$PIGLIT_RESULTS_DIR/html \
-	$PIGLIT_RESULTS_DIR
+        -screen scrn 1280x1024x24"
+export PIGLIT_RESULTS_DIR=$XSERVER_BUILDDIR/test/piglit-results/xvfb
 
-    echo "Some piglit tests failed."
-    echo "The list of failing tests can be found in $LONG_SUMMARY."
-    echo "An html page of the failing tests can be found at $PIGLIT_RESULTS_DIR/html/problems.html"
-fi
+exec $XSERVER_DIR/test/scripts/run-piglit.sh
 
-exit $status
commit 7ac130a0664b43b6ba5324548c8f7ab8230f7199
Author: Eric Anholt <eric at anholt.net>
Date:   Sun Sep 25 13:30:17 2016 -0700

    test: Add a little xinit-like program for starting servers for testing
    
    The normal xinit is racy because it doesn't use -displayfd.  This
    implements the bare minimum for testing purposes, using -displayfd to
    sequence starting the client, and avoids adding yet another dependency
    to the server.
    
    v2: Fix asprintf error checks.
    v3: Add error checking for fork(), clarify calloc() arg.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/test/.gitignore b/test/.gitignore
index a62fc3d..c44fc82 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -11,5 +11,6 @@ xfree86
 xkb
 xtest
 signal-logging
+simple-xinit
 *.log
 *.trs
diff --git a/test/Makefile.am b/test/Makefile.am
index 4ccadf5..24bfc35 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,17 +1,22 @@
 if ENABLE_UNIT_TESTS
 SUBDIRS= .
-noinst_PROGRAMS = list string
+TEST_PROGS = list string
 if XORG
 # Tests that require at least some DDX functions in order to fully link
 # For now, requires xf86 ddx, could be adjusted to use another
 SUBDIRS += xi1 xi2
-noinst_PROGRAMS += xkb input xtest misc fixes xfree86 signal-logging touch
+TEST_PROGS += xkb input xtest misc fixes xfree86 signal-logging touch
 if RES
-noinst_PROGRAMS += hashtabletest
+TEST_PROGS += hashtabletest
 endif
 endif
 check_LTLIBRARIES = libxservertest.la
 
+noinst_PROGRAMS = \
+	simple-xinit \
+	$(TEST_PROGS) \
+	$(NULL)
+
 if XVFB
 XVFB_TESTS = scripts/xvfb-piglit.sh
 endif
@@ -21,7 +26,7 @@ SCRIPT_TESTS = \
 	$(NULL)
 
 TESTS = \
-	$(noinst_PROGRAMS) \
+	$(TEST_PROGS) \
 	$(SCRIPT_TESTS) \
 	$(NULL)
 
diff --git a/test/simple-xinit.c b/test/simple-xinit.c
new file mode 100644
index 0000000..89189a6
--- /dev/null
+++ b/test/simple-xinit.c
@@ -0,0 +1,229 @@
+/*
+ * Copyright © 2016 Broadcom
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <errno.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+static void
+kill_server(int server_pid)
+{
+    int ret = kill(server_pid, SIGTERM);
+    int wstatus;
+
+    if (ret) {
+        fprintf(stderr, "Failed to send kill to the server: %s\n",
+                strerror(errno));
+        exit(1);
+    }
+
+    ret = waitpid(server_pid, &wstatus, 0);
+    if (ret < 0) {
+        fprintf(stderr, "Failed to wait for X to die: %s\n", strerror(errno));
+        exit(1);
+    }
+}
+
+static void
+usage(int argc, char **argv)
+{
+    fprintf(stderr, "%s <client command> -- <server command>\n", argv[0]);
+    exit(1);
+}
+
+/* Starts the X server, returning its pid. */
+static int
+start_server(char *const *server_args)
+{
+    int server_pid = fork();
+
+    if (server_pid == -1) {
+        fprintf(stderr, "Fork failed: %s\n", strerror(errno));
+        exit(1);
+    } else if (server_pid != 0) {
+        /* Continue along the main process that will exec the client. */
+        return server_pid;
+    }
+
+    /* Execute the server.  This only returns if an error occurred. */
+    execvp(server_args[0], server_args);
+    fprintf(stderr, "Error starting the server: %s\n", strerror(errno));
+    exit(1);
+}
+
+/* Reads the display number out of the started server's display socket. */
+static int
+get_display(int displayfd)
+{
+    char display_string[10];
+    ssize_t ret;
+
+    ret = read(displayfd, display_string, sizeof(display_string - 1));
+    if (ret <= 0) {
+        fprintf(stderr, "Failed reading displayfd: %s\n", strerror(errno));
+        exit(1);
+    }
+
+    /* We've read in the display number as a string terminated by
+     * '\n', but not '\0'.  Cap it and parse the number.
+     */
+    display_string[ret] = '\0';
+    return atoi(display_string);
+}
+
+static int
+start_client(char *const *client_args, int display)
+{
+    char *display_string;
+    int ret;
+    int client_pid;
+
+    ret = asprintf(&display_string, ":%d", display);
+    if (ret < 0) {
+        fprintf(stderr, "asprintf fail\n");
+        exit(1);
+    }
+
+    ret = setenv("DISPLAY", display_string, true);
+    if (ret) {
+        fprintf(stderr, "Failed to set DISPLAY\n");
+        exit(1);
+    }
+
+    client_pid = fork();
+    if (client_pid == -1) {
+        fprintf(stderr, "Fork failed: %s\n", strerror(errno));
+        exit(1);
+    } else if (client_pid) {
+        int wstatus;
+
+        ret = waitpid(client_pid, &wstatus, 0);
+        if (ret < 0) {
+            fprintf(stderr, "Error waiting for client to start: %s\n",
+                    strerror(errno));
+            return 1;
+        }
+
+        return WEXITSTATUS(wstatus);
+    } else {
+        execvp(client_args[0], client_args);
+        /* exec only returns if an error occurred. */
+        fprintf(stderr, "Error starting the client: %s\n", strerror(errno));
+        exit(1);
+    }
+}
+
+/* Splits the incoming argc/argv into a pair of NULL-terminated arrays
+ * of args.
+ */
+static void
+parse_args(int argc, char **argv,
+           char * const **out_client_args,
+           char * const **out_server_args,
+           int displayfd)
+{
+    /* We're stripping the -- and the program name, inserting two
+     * NULLs, and also the -displayfd and fd number.
+     */
+    char **args_storage = calloc(argc + 2, sizeof(char *));
+    char *const *client_args;
+    char *const *server_args = NULL;
+    char **next_arg = args_storage;
+    bool parsing_client = true;
+    int i, ret;
+    char *displayfd_string;
+
+    if (!args_storage)
+        exit(1);
+
+    client_args = args_storage;
+    for (i = 1; i < argc; i++) {
+        if (strcmp(argv[i], "--") == 0) {
+            if (!parsing_client)
+                usage(argc, argv);
+
+            /* Cap the client list */
+            *next_arg = NULL;
+            next_arg++;
+
+            /* Move to adding into server_args. */
+            server_args = next_arg;
+            parsing_client = false;
+            continue;
+        }
+
+        *next_arg = argv[i];
+        next_arg++;
+    }
+
+    if (client_args[0] == NULL || !server_args || server_args[0] == NULL)
+        usage(argc, argv);
+
+    /* Give the server -displayfd X */
+    *next_arg = (char *)"-displayfd";
+    next_arg++;
+
+    ret = asprintf(&displayfd_string, "%d", displayfd);
+    if (ret < 0) {
+        fprintf(stderr, "asprintf fail\n");
+        exit(1);
+    }
+    *next_arg = displayfd_string;
+    next_arg++;
+
+    *out_client_args = client_args;
+    *out_server_args = server_args;
+}
+
+int
+main(int argc, char **argv)
+{
+    char * const *client_args;
+    char * const *server_args;
+    int displayfd_pipe[2];
+    int display, server_pid;
+    int ret;
+
+    ret = pipe(displayfd_pipe);
+    if (ret) {
+        fprintf(stderr, "Pipe creation failure: %s", strerror(errno));
+        exit(1);
+    }
+
+    parse_args(argc, argv, &client_args, &server_args, displayfd_pipe[1]);
+    server_pid = start_server(server_args);
+    display = get_display(displayfd_pipe[0]);
+    ret = start_client(client_args, display);
+    kill_server(server_pid);
+
+    exit(ret);
+}
commit 8d5e0c07b965d545c925c34be95d41c29135a63a
Author: Eric Anholt <eric at anholt.net>
Date:   Sun Sep 25 13:30:16 2016 -0700

    test: Handle srcdir != builddir in Xvfb testing
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/test/Makefile.am b/test/Makefile.am
index 5a35e2b..4ccadf5 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -26,7 +26,8 @@ TESTS = \
 	$(NULL)
 
 TESTS_ENVIRONMENT = \
-	XSERVER_DIR=$(abs_top_builddir) \
+	XSERVER_DIR=$(abs_top_srcdir) \
+	XSERVER_BUILDDIR=$(abs_top_builddir) \
 	$(XORG_MALLOC_DEBUG_ENV) \
 	$(NULL)
 
diff --git a/test/scripts/xvfb-piglit.sh b/test/scripts/xvfb-piglit.sh
index 2a4e940..b775239 100755
--- a/test/scripts/xvfb-piglit.sh
+++ b/test/scripts/xvfb-piglit.sh
@@ -20,12 +20,18 @@ if test "x$XSERVER_DIR" = "x"; then
     exit 1
 fi
 
+if test "x$XSERVER_BUILDDIR" = "x"; then
+    echo "XSERVER_BUILDDIR must be set to the build directory of the xserver repository."
+    # Exit as a real failure because it should always be set.
+    exit 1
+fi
+
 export PIGLIT_RESULTS_DIR=$PIGLIT_DIR/results/xvfb
 
 startx \
     $XSERVER_DIR/test/scripts/xinit-piglit-session.sh \
     -- \
-    $XSERVER_DIR/hw/vfb/Xvfb \
+    $XSERVER_BUILDDIR/hw/vfb/Xvfb \
         -noreset \
         -screen scrn 1280x1024x24
 
commit add49792608171feef8090f7520cfa02d2daae9c
Author: Eric Anholt <eric at anholt.net>
Date:   Sun Sep 25 13:30:15 2016 -0700

    ephyr: Add a mode for skipping redisplay in glamor
    
    This speeds up headless testing of Xephyr -glamor with softpipe from
    "a test per minute or so" to "a test every few seconds".
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Eric Anholt <eric at anholt.net>

diff --git a/hw/kdrive/ephyr/ephyr_glamor_glx.c b/hw/kdrive/ephyr/ephyr_glamor_glx.c
index 2f21914..007123c 100644
--- a/hw/kdrive/ephyr/ephyr_glamor_glx.c
+++ b/hw/kdrive/ephyr/ephyr_glamor_glx.c
@@ -57,6 +57,7 @@ static Display *dpy;
 static XVisualInfo *visual_info;
 static GLXFBConfig fb_config;
 Bool ephyr_glamor_gles2;
+Bool ephyr_glamor_skip_present;
 /** @} */
 
 /**
@@ -220,6 +221,13 @@ ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor,
 {
     GLint old_vao;
 
+    /* Skip presenting the output in this mode.  Presentation is
+     * expensive, and if we're just running the X Test suite headless,
+     * nobody's watching.
+     */
+    if (ephyr_glamor_skip_present)
+        return;
+
     glXMakeCurrent(dpy, glamor->glx_win, glamor->ctx);
 
     if (glamor->vao) {
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 149ea98..7632c26 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -36,7 +36,7 @@ extern Bool EphyrWantResize;
 extern Bool EphyrWantNoHostGrab;
 extern Bool kdHasPointer;
 extern Bool kdHasKbd;
-extern Bool ephyr_glamor, ephyr_glamor_gles2;
+extern Bool ephyr_glamor, ephyr_glamor_gles2, ephyr_glamor_skip_present;
 
 extern Bool ephyrNoXV;
 
@@ -148,6 +148,7 @@ ddxUseMsg(void)
 #ifdef GLAMOR
     ErrorF("-glamor              Enable 2D acceleration using glamor\n");
     ErrorF("-glamor_gles2        Enable 2D acceleration using glamor (with GLES2 only)\n");
+    ErrorF("-glamor-skip-present Skip presenting the output when using glamor (for internal testing optimization)\n");
 #endif
     ErrorF
         ("-fakexa              Simulate acceleration using software rendering\n");
@@ -288,6 +289,10 @@ ddxProcessArgument(int argc, char **argv, int i)
         ephyrFuncs.finiAccel = ephyr_glamor_fini;
         return 1;
     }
+    else if (!strcmp (argv[i], "-glamor-skip-present")) {
+        ephyr_glamor_skip_present = TRUE;
+        return 1;
+    }
 #endif
     else if (!strcmp(argv[i], "-fakexa")) {
         ephyrFuncs.initAccel = ephyrDrawInit;


More information about the xorg-commit mailing list