diff options
author | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2015-03-03 14:10:54 +0000 |
---|---|---|
committer | Damien Lespiau <damien.lespiau@intel.com> | 2015-03-12 14:14:27 +0000 |
commit | 0a087733d24fcb2b80584b23e931533d72828770 (patch) | |
tree | 08bb75e191dc80bd602320644eb88f8a3cc77581 /lib/ioctl_wrappers.c | |
parent | f59935c0ce878d20f1a34ae814a778bf476c36f8 (diff) |
tests/kms_addfb: Add support for fb modifiers
Just a few basic tests to make sure fb modifiers can be used and
behave sanely when mixed with the old set_tiling API.
v2:
* Review feedback from Daniel Vetter:
1. Move cap detection into the subtest so skipping works.
2. Added some gtkdoc comments.
3. Two more test cases.
4. Removed unused parts for now.
v3:
* Removed two tests which do not make sense any more after the
fb modifier rewrite.
v4:
* Moved gtkdoc comments into .c file.
* Moved all initialization into fixtures.
* Rebased for fb modifier changes.
v5:
* Added bad modifier subtest.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Diffstat (limited to 'lib/ioctl_wrappers.c')
-rw-r--r-- | lib/ioctl_wrappers.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 66c90de0..5cbb8738 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -1142,3 +1142,26 @@ off_t prime_get_size(int dma_buf_fd) return ret; } + +/** + * igt_require_fb_modifiers: + * @fd: Open DRM file descriptor. + * + * Requires presence of DRM_CAP_ADDFB2_MODIFIERS. + */ +void igt_require_fb_modifiers(int fd) +{ + static bool has_modifiers, cap_modifiers_tested; + + if (!cap_modifiers_tested) { + uint64_t cap_modifiers; + int ret; + + ret = drmGetCap(fd, LOCAL_DRM_CAP_ADDFB2_MODIFIERS, &cap_modifiers); + igt_assert(ret == 0 || errno == EINVAL); + has_modifiers = ret == 0 && cap_modifiers == 1; + cap_modifiers_tested = true; + } + + igt_require(has_modifiers); +} |