Commit 0f3be861 authored by Chris Wilson's avatar Chris Wilson

tests: Use igt_device_set_master

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's avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen's avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
parent 3a999957
......@@ -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);
}
......
......@@ -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);
......
......@@ -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));
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment