[PATCH i-g-t 1/2] tests/kms_addfb_basic: Add invalid tests to set fb props

Daniel Vetter daniel.vetter at ffwll.ch
Fri Apr 22 20:04:15 UTC 2016


There's no properties on fb modeset objects, bug bugs in the
kernel when trying to use those ioctls in such an invalid way.

Cc: Dave Airlie <airlied at gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 tests/kms_addfb_basic.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
index 64047303dea7..de77b3cd907d 100644
--- a/tests/kms_addfb_basic.c
+++ b/tests/kms_addfb_basic.c
@@ -477,6 +477,70 @@ static void addfb25_ytile(int fd)
 	}
 }
 
+static void prop_tests(int fd)
+{
+	struct drm_mode_fb_cmd2 f = {};
+	struct drm_mode_obj_get_properties get_props = {};
+	struct drm_mode_obj_set_property set_prop = {};
+	uint64_t prop, prop_val;
+
+	f.width = 1024;
+	f.height = 1024;
+	f.pixel_format = DRM_FORMAT_XRGB8888;
+	f.pitches[0] = 1024*4;
+
+	igt_fixture {
+		gem_bo = igt_create_bo_with_dimensions(fd, 1024, 1024,
+			DRM_FORMAT_XRGB8888, 0, 0, NULL, NULL, NULL);
+		igt_assert(gem_bo);
+
+		f.handles[0] = gem_bo;
+
+		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_ADDFB2, &f) == 0);
+	}
+
+	get_props.props_ptr = (uintptr_t) ∝
+	get_props.prop_values_ptr = (uintptr_t) &prop_val;
+	get_props.count_props = 1;
+	get_props.obj_id = f.fb_id;
+
+	igt_subtest("invalid-get-prop-any") {
+		get_props.obj_type = 0; /* DRM_MODE_OBJECT_ANY */
+
+		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_OBJ_GETPROPERTIES,
+				    &get_props) == -1 && errno == EINVAL);
+	}
+
+	igt_subtest("invalid-get-prop") {
+		get_props.obj_type = DRM_MODE_OBJECT_FB;
+
+		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_OBJ_GETPROPERTIES,
+				    &get_props) == -1 && errno == EINVAL);
+	}
+
+	set_prop.value = 0;
+	set_prop.prop_id = 1;
+	set_prop.obj_id = f.fb_id;
+
+	igt_subtest("invalid-set-prop-any") {
+		set_prop.obj_type = 0; /* DRM_MODE_OBJECT_ANY */
+
+		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_OBJ_SETPROPERTY,
+				    &set_prop) == -1 && errno == EINVAL);
+	}
+
+	igt_subtest("invalid-set-prop") {
+		set_prop.obj_type = DRM_MODE_OBJECT_FB;
+
+		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_OBJ_SETPROPERTY,
+				    &set_prop) == -1 && errno == EINVAL);
+	}
+
+	igt_fixture
+		igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f.fb_id) == 0);
+
+}
+
 int fd;
 
 igt_main
@@ -496,6 +560,8 @@ igt_main
 
 	tiling_tests(fd);
 
+	prop_tests(fd);
+
 	igt_fixture
 		close(fd);
 }
-- 
2.5.0



More information about the dri-devel mailing list