summaryrefslogtreecommitdiff
path: root/tests/kms_addfb_basic.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-09-12 12:05:14 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2018-09-14 17:01:10 +0100
commit0b59bb3231ab481959528c5c7b3a98762772e1b0 (patch)
tree5d7c3bebafff4bb5a20ee225c7b9553a44e1ab00 /tests/kms_addfb_basic.c
parent0f3944de6f58544eef83643b31fd772ce8d6ae48 (diff)
igt/kms_addfb_basic: Skip if the KMS interface is not supported
Some drivers and some hardware do not support KMS and so the addfb ioctls are expected to fail. However, since they are expected to fail with a specific errno (ENOTSUP) in the case KMS is not supported on the fd, we can check for that and skip the tests where they are not appropriate. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Diffstat (limited to 'tests/kms_addfb_basic.c')
-rw-r--r--tests/kms_addfb_basic.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
index ce48d24f..400241a9 100644
--- a/tests/kms_addfb_basic.c
+++ b/tests/kms_addfb_basic.c
@@ -667,12 +667,37 @@ static void prop_tests(int fd)
}
+static bool has_addfb2_iface(int fd)
+{
+ struct local_drm_mode_fb_cmd2 f = {};
+ int err;
+
+ err = 0;
+ if (drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f))
+ err = -errno;
+ switch (err) {
+ case -ENOTTY: /* ioctl unrecognised (kernel too old) */
+ case -ENOTSUP: /* driver doesn't support KMS */
+ return false;
+
+ /*
+ * The only other valid response is -EINVAL, but we leave
+ * that for the actual tests themselves to discover for
+ * more accurate reporting.
+ */
+ default:
+ return true;
+ }
+}
+
int fd;
igt_main
{
- igt_fixture
+ igt_fixture {
fd = drm_open_driver_master(DRIVER_ANY);
+ igt_require(has_addfb2_iface(fd));
+ }
invalid_tests(fd);