From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH igt] tests: Use igt_device_set_master
Date: Fri, 8 Dec 2017 18:11:59 +0000 [thread overview]
Message-ID: <20171208181159.13374-1-chris@chris-wilson.co.uk> (raw)
A few tests only require DRM_MASTER privileges for a subset of gen or
tests, and so open the device as normal and conditionally call
drmSetMaster. Translate these over to using igt_device_set_master(),
which includes a bit more debugging for when it fails.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
tests/gem_exec_nop.c | 3 ++-
tests/gem_exec_params.c | 6 ++++--
tests/gem_exec_store.c | 3 ++-
tests/gem_ringfill.c | 3 ++-
4 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/tests/gem_exec_nop.c b/tests/gem_exec_nop.c
index b5f158078..668dcb949 100644
--- a/tests/gem_exec_nop.c
+++ b/tests/gem_exec_nop.c
@@ -26,6 +26,7 @@
*/
#include "igt.h"
+#include "igt_device.h"
#include "igt_rand.h"
#include "igt_sysfs.h"
@@ -710,7 +711,7 @@ igt_main
igt_subtest("headless") {
/* Requires master for changing display modes */
- igt_require(drmSetMaster(device) == 0);
+ igt_device_set_master(device);
headless(device, handle);
}
diff --git a/tests/gem_exec_params.c b/tests/gem_exec_params.c
index 5b72072b2..e1c48b408 100644
--- a/tests/gem_exec_params.c
+++ b/tests/gem_exec_params.c
@@ -26,6 +26,8 @@
*/
#include "igt.h"
+#include "igt_device.h"
+
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
@@ -341,10 +343,10 @@ igt_main
}
igt_subtest("secure-non-master") {
- do_or_die(drmDropMaster(fd));
+ igt_device_drop_master(fd);
execbuf.flags = I915_EXEC_RENDER | I915_EXEC_SECURE;
RUN_FAIL(EPERM);
- do_or_die(drmSetMaster(fd));
+ igt_device_set_master(fd);
igt_assert(drmIoctl(fd,
DRM_IOCTL_I915_GEM_EXECBUFFER2,
&execbuf) == 0);
diff --git a/tests/gem_exec_store.c b/tests/gem_exec_store.c
index 545a4b561..31a2c0967 100644
--- a/tests/gem_exec_store.c
+++ b/tests/gem_exec_store.c
@@ -28,6 +28,7 @@
*/
#include "igt.h"
+#include "igt_device.h"
#include "igt_gt.h"
#include <strings.h>
@@ -320,7 +321,7 @@ igt_main
gen = print_welcome(fd);
if (gen > 3 && gen < 6) /* ctg and ilk need secure batches */
- igt_require(drmSetMaster(fd) == 0);
+ igt_device_set_master(fd);
igt_require_gem(fd);
igt_require(gem_can_store_dword(fd, 0));
diff --git a/tests/gem_ringfill.c b/tests/gem_ringfill.c
index 84cd49c19..c3376a675 100644
--- a/tests/gem_ringfill.c
+++ b/tests/gem_ringfill.c
@@ -32,6 +32,7 @@
*/
#include "igt.h"
+#include "igt_device.h"
#include "igt_gt.h"
#include "igt_vgem.h"
@@ -360,7 +361,7 @@ igt_main
igt_require(gem_can_store_dword(fd, 0));
gen = intel_gen(intel_get_drm_devid(fd));
if (gen > 3 && gen < 6) { /* ctg and ilk need secure batches */
- igt_require(drmSetMaster(fd) == 0);
+ igt_device_set_master(fd);
master = true;
}
--
2.15.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next reply other threads:[~2017-12-08 18:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-08 18:11 Chris Wilson [this message]
2017-12-08 20:14 ` ✗ Fi.CI.BAT: warning for tests: Use igt_device_set_master Patchwork
2017-12-11 9:36 ` [PATCH igt] " Joonas Lahtinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171208181159.13374-1-chris@chris-wilson.co.uk \
--to=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.