summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2015-10-20 22:36:13 +0100
committerDaniel Stone <daniels@collabora.com>2015-11-03 19:46:12 +0000
commitb7a555e997ec43ed005f6b22707dd698e0147f64 (patch)
treebdcc7a0d8907c3a6983f0f85743018478c6a5f5e /tests
parentde7ccdd083579c82a1be0c028acf38617fb8c2ca (diff)
tests/core_prop_blob: Add multiple blobs per connection
This should hit the bug fixed in: commit 8731b269f01e16193390c7276e70530366b8d626 Author: Maneet Singh <mmaneetsingh@nvidia.com> Date: Thu Oct 8 10:10:24 2015 -0400 drm: Correct arguments to list_tail_add in create blob ioctl Arguments passed to list_add_tail were reversed resulting in deletion of old blob property everytime the new one is added. Fixes commit e2f5d2ea479b9b2619965d43db70939589afe43a Author: Daniel Stone <daniels@collabora.com> Date: Fri May 22 13:34:51 2015 +0100 drm/mode: Add user blob-creation ioctl Signed-off-by: Maneet Singh <mmaneetsingh@nvidia.com> [seanpaul tweaked commit subject a little] Signed-off-by: Sean Paul <seanpaul@chromium.org> Cc: stable@kernel.org # v4.2 Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Dave Airlie <airlied@gmail.com> which was introduced with the initial blob support in: commit e2f5d2ea479b9b2619965d43db70939589afe43a Author: Daniel Stone <daniels@collabora.com> Date: Fri May 22 13:34:51 2015 +0100 drm/mode: Add user blob-creation ioctl Add an ioctl which allows users to create blob properties from supplied data. Currently this only supports modes, creating a drm_display_mode from the userspace drm_mode_modeinfo. v2: Removed size/type checks. Rebased on new patches to allow error propagation from create_blob, as well as avoiding double-allocation. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@intel.com> Tested-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Daniel Stone <daniels@collabora.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/core_prop_blob.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/core_prop_blob.c b/tests/core_prop_blob.c
index df4f3ad4..365d728a 100644
--- a/tests/core_prop_blob.c
+++ b/tests/core_prop_blob.c
@@ -208,6 +208,43 @@ test_lifetime(int fd)
}
static void
+test_multiple(int fd)
+{
+ uint32_t prop_ids[5];
+ int fd2;
+ int i;
+
+ fd2 = drm_open_driver(DRIVER_ANY);
+ igt_assert_fd(fd2);
+
+ /* Ensure destroying multiple properties explicitly works as needed. */
+ for (i = 0; i < ARRAY_SIZE(prop_ids); i++) {
+ prop_ids[i] = create_prop(fd2);
+ igt_assert_eq(validate_prop(fd, prop_ids[i]), 0);
+ igt_assert_eq(validate_prop(fd2, prop_ids[i]), 0);
+ }
+ for (i = 0; i < ARRAY_SIZE(prop_ids); i++) {
+ igt_assert_eq(destroy_prop(fd2, prop_ids[i]), 0);
+ igt_assert_eq(validate_prop(fd2, prop_ids[i]), ENOENT);
+ }
+ igt_assert_eq(close(fd2), 0);
+
+ fd2 = drm_open_driver(DRIVER_ANY);
+ igt_assert_fd(fd2);
+
+ /* Ensure that multiple properties get cleaned up on fd close. */
+ for (i = 0; i < ARRAY_SIZE(prop_ids); i++) {
+ prop_ids[i] = create_prop(fd2);
+ igt_assert_eq(validate_prop(fd, prop_ids[i]), 0);
+ igt_assert_eq(validate_prop(fd2, prop_ids[i]), 0);
+ }
+ igt_assert_eq(close(fd2), 0);
+
+ for (i = 0; i < ARRAY_SIZE(prop_ids); i++)
+ igt_assert_eq(validate_prop(fd, prop_ids[i]), ENOENT);
+}
+
+static void
test_core(int fd)
{
uint32_t prop_id;
@@ -256,6 +293,9 @@ igt_main
igt_subtest("blob-prop-lifetime")
test_lifetime(fd);
+ igt_subtest("blob-multiple")
+ test_multiple(fd);
+
igt_fixture
close(fd);
}