Commit b26530c4 authored by Daniel Vetter's avatar Daniel Vetter

tests: Use igt_device_set/drop_master

Suggested by Chris.

v2: Use "" for local includes (Chris).

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson's avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter's avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 8af74298
Pipeline #21925 passed with stages
in 5 minutes and 45 seconds
......@@ -39,6 +39,8 @@
#include <stdio.h>
#include <string.h>
#include "igt_device.h"
IGT_TEST_DESCRIPTION("Check that drop/setMaster correctly transfer master "
"state");
......@@ -56,8 +58,8 @@ igt_simple_main
/* Open an fd an make it master */
master2 = drm_open_driver(DRIVER_ANY);
do_or_die(drmDropMaster(master1));
do_or_die(drmSetMaster(master2));
igt_device_drop_master(master1);
igt_device_set_master(master2);
/* Auth shouldn't work since we're authenticating with a different
* master than the one we got the magic from. */
......
......@@ -28,6 +28,7 @@
#include <stdio.h>
#include <string.h>
#include "igt_device.h"
typedef struct {
int drm_fd;
......@@ -63,11 +64,9 @@ static void test(data_t *data, enum pipe pipe, igt_output_t *output)
fd = drm_open_driver(DRIVER_ANY);
ret = drmDropMaster(data->drm_fd);
igt_assert_eq(ret, 0);
igt_device_drop_master(data->drm_fd);
ret = drmSetMaster(fd);
igt_assert_eq(ret, 0);
igt_device_set_master(fd);
igt_create_color_fb(fd, mode->hdisplay, mode->vdisplay,
DRM_FORMAT_XRGB8888,
......@@ -81,8 +80,7 @@ static void test(data_t *data, enum pipe pipe, igt_output_t *output)
ret = close(fd);
igt_assert_eq(ret, 0);
ret = drmSetMaster(data->drm_fd);
igt_assert_eq(ret, 0);
igt_device_set_master(data->drm_fd);
igt_plane_set_fb(primary, NULL);
igt_output_set_pipe(output, PIPE_ANY);
......
......@@ -43,6 +43,7 @@
#include <libudev.h>
#include <drm.h>
#include "igt_device.h"
IGT_TEST_DESCRIPTION("Test of CreateLease.");
......@@ -877,7 +878,7 @@ static void master_vs_lease(data_t *data)
igt_assert(is_master(data->master.fd));
igt_assert(is_master(lease_fd));
do_or_die(drmDropMaster(data->master.fd));
igt_device_drop_master(data->master.fd);
igt_assert(!is_master(data->master.fd));
igt_assert(!is_master(lease_fd));
......@@ -885,7 +886,7 @@ static void master_vs_lease(data_t *data)
igt_assert_eq(drmSetMaster(lease_fd), -1);
igt_assert_eq(errno, EINVAL);
do_or_die(drmSetMaster(data->master.fd));
igt_device_set_master(data->master.fd);
igt_assert(is_master(data->master.fd));
igt_assert(is_master(lease_fd));
......@@ -908,8 +909,8 @@ static void multimaster_lease(data_t *data)
_create_simple_lease(master2_fd, data, -EACCES);
do_or_die(drmDropMaster(data->master.fd));
do_or_die(drmSetMaster(master2_fd));
igt_device_drop_master(data->master.fd);
igt_device_set_master(master2_fd);
igt_assert(!is_master(data->master.fd));
igt_assert(!is_master(lease_fd));
......@@ -921,7 +922,7 @@ static void multimaster_lease(data_t *data)
close(master2_fd); /* close is an implicit DropMaster */
igt_assert(!is_master(lease2_fd));
do_or_die(drmSetMaster(data->master.fd));
igt_device_set_master(data->master.fd);
igt_assert(is_master(data->master.fd));
igt_assert(is_master(lease_fd));
......
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