summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2019-02-28 18:17:20 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2019-03-01 08:52:00 +0100
commit226f4285b46454b7cf715417c513ead6e0b2411a (patch)
tree5974da7230555c00cfff35f1083d2a868912ba4b /tests
parent6be2dc8ddfa332d129149aa3b13db14fa2cd6c0a (diff)
tests/kms_addfb_basic: Check that only the owner can rmfb
Just realized we don't seem to have any testcase for this. Fill this gap asap! v2: Use igt_device_set/drop_master (Chris) v3: Use "" for local includes (Chris) Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> (v1) Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/kms_addfb_basic.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
index 400241a9..d5dc3eff 100644
--- a/tests/kms_addfb_basic.c
+++ b/tests/kms_addfb_basic.c
@@ -39,6 +39,7 @@
#include "drm_fourcc.h"
#include "igt_rand.h"
+#include "igt_device.h"
uint32_t gem_bo;
uint32_t gem_bo_small;
@@ -667,6 +668,45 @@ static void prop_tests(int fd)
}
+static void master_tests(int fd)
+{
+ struct drm_mode_fb_cmd2 f = {};
+
+ 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);
+ }
+
+ igt_subtest("master-rmfb") {
+ int master2_fd;
+
+ igt_device_drop_master(fd);
+
+ master2_fd = drm_open_driver_master(DRIVER_ANY);
+
+ igt_assert_eq(rmfb(master2_fd, f.fb_id), -ENOENT);
+
+ igt_device_drop_master(master2_fd);
+ close(master2_fd);
+
+ igt_device_set_master(fd);
+ }
+
+ igt_fixture
+ igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f.fb_id) == 0);
+
+}
+
static bool has_addfb2_iface(int fd)
{
struct local_drm_mode_fb_cmd2 f = {};
@@ -713,6 +753,8 @@ igt_main
prop_tests(fd);
+ master_tests(fd);
+
igt_fixture
close(fd);
}