public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/4] tests/kms_addfb_basic: Check that only the owner can rmfb
@ 2019-02-28 17:17 Daniel Vetter
  2019-02-28 17:17 ` [igt-dev] [PATCH i-g-t 2/4] tests:core_prop_blob: Drop local_ prefixes Daniel Vetter
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Daniel Vetter @ 2019-02-28 17:17 UTC (permalink / raw)
  To: IGT development; +Cc: Daniel Vetter

Just realized we don't seem to have any testcase for this. Fill this
gap asap!

v2: Use igt_device_set/drop_master (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>
---
 tests/kms_addfb_basic.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c
index 400241a92e81..6519c2315c2a 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);
 }
-- 
2.14.4

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-03-01  7:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-28 17:17 [igt-dev] [PATCH i-g-t 1/4] tests/kms_addfb_basic: Check that only the owner can rmfb Daniel Vetter
2019-02-28 17:17 ` [igt-dev] [PATCH i-g-t 2/4] tests:core_prop_blob: Drop local_ prefixes Daniel Vetter
2019-02-28 17:17 ` [igt-dev] [PATCH i-g-t 3/4] tests: s/core_prop_blob/kms_prop_blob Daniel Vetter
2019-02-28 17:17 ` [igt-dev] [PATCH i-g-t 4/4] tests: Use igt_device_set/drop_master Daniel Vetter
2019-02-28 17:53   ` Chris Wilson
2019-03-01  7:55     ` Daniel Vetter
2019-02-28 17:47 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/4] tests/kms_addfb_basic: Check that only the owner can rmfb Patchwork
2019-02-28 20:42 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox