From 59d97e7d6807d9cd076d4e8374aca1d9e8027a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 9 Dec 2009 10:36:53 -0500 Subject: [PATCH] modetest: Error out if pageflipping is requested but not available --- tests/modetest/modetest.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 48178b99..34d40ca9 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -51,6 +51,7 @@ #include "xf86drm.h" #include "xf86drmMode.h" #include "intel_bufmgr.h" +#include "i915_drm.h" #ifdef HAVE_CAIRO #include @@ -661,6 +662,23 @@ void usage(char *name) #define dump_resource(res) if (res) dump_##res() +static int page_flipping_supported(int fd) +{ + int ret, value; + struct drm_i915_getparam gp; + + gp.param = I915_PARAM_HAS_PAGEFLIPPING; + gp.value = &value; + + ret = drmCommandWriteRead(fd, DRM_I915_GETPARAM, &gp, sizeof(gp)); + if (ret) { + fprintf(stderr, "drm_i915_getparam: %m\n"); + return 0; + } + + return gp.value; +} + int main(int argc, char **argv) { int c; @@ -725,6 +743,11 @@ int main(int argc, char **argv) } } + if (test_vsync && !page_flipping_supported(fd)) { + fprintf(stderr, "page flipping not supported by drm.\n"); + return -1; + } + if (i == ARRAY_SIZE(modules)) { fprintf(stderr, "failed to load any modules, aborting.\n"); return -1;