test: Make SHM tests in lowlevel-blt-bench optional

A slightly more complex patch to disable the SHM based tests of
lowlevel-blt-bench when MIT-SHM support is not available at compile
time.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2014-08-18 07:43:21 +01:00
parent 9058dac302
commit 02f184e0ef
3 changed files with 10 additions and 5 deletions

View File

@ -246,6 +246,7 @@ if test "x$shm" = "xyes"; then
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no),
AC_MSG_RESULT(assuming no))
AC_DEFINE([HAVE_MIT_SHM], 1, [Define to 1 if MIT-SHM is available])
fi
PKG_CHECK_MODULES(X11_DRI3, [xcb-dri3 xcb-sync xcb-present x11-xcb xshmfence x11 xrender xext libdrm], [x11_dri3="yes"], [x11_dri3="no"])

View File

@ -40,10 +40,7 @@ stress_TESTS += \
endif
check_PROGRAMS = $(stress_TESTS)
noinst_PROGRAMS =
if X11_SHM
noinst_PROGRAMS += lowlevel-blt-bench
endif
noinst_PROGRAMS = lowlevel-blt-bench
AM_CFLAGS = @CWARNFLAGS@ $(X11_CFLAGS) $(DRM_CFLAGS)
LDADD = libtest.la $(X11_LIBS) $(DRM_LIBS) $(CLOCK_GETTIME_LIBS)

View File

@ -37,6 +37,7 @@
#include <X11/Xutil.h> /* for XDestroyImage */
#include <X11/Xlibint.h>
#include <X11/extensions/Xrender.h>
#if HAVE_MIT_SHM
#include <X11/extensions/XShm.h>
#if HAVE_X11_EXTENSIONS_SHMPROTO_H
#include <X11/extensions/shmproto.h>
@ -45,9 +46,10 @@
#else
#error Failed to find the right header for X11 MIT-SHM protocol definitions
#endif
#include <pixman.h> /* for pixman blt functions */
#include <sys/ipc.h>
#include <sys/shm.h>
#endif
#include <pixman.h> /* for pixman blt functions */
#include "test.h"
@ -228,6 +230,7 @@ static Picture source_radial_generic(struct test_display *t, struct test_target
return XRenderCreateRadialGradient(t->dpy, &gradient, stops, colors, 2);
}
#if HAVE_MIT_SHM
static XShmSegmentInfo shmref, shmout;
static void setup_shm(struct test *t)
@ -290,6 +293,10 @@ static Picture source_shm(struct test_display *t, struct test_target *target)
return picture;
}
#else
static void setup_shm(struct test *t) { }
static Picture source_shm(struct test_display *t, struct test_target *target) { return 0; }
#endif
static const struct {
Picture (*create)(struct test_display *, struct test_target *);