diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2009-12-09 10:36:53 -0500 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2009-12-15 08:44:40 -0500 |
commit | 59d97e7d6807d9cd076d4e8374aca1d9e8027a6b (patch) | |
tree | dcbf5d0fd50faf5c87e65a2e62fc170abe500aaf /tests/modetest | |
parent | edc77dd291594e017ca0ee96a785412107ebff74 (diff) |
modetest: Error out if pageflipping is requested but not available
Diffstat (limited to 'tests/modetest')
-rw-r--r-- | tests/modetest/modetest.c | 23 |
1 files changed, 23 insertions, 0 deletions
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 <math.h> @@ -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; |