diff options
author | Dave Airlie <airlied@redhat.com> | 2017-10-11 00:00:25 +0100 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2017-10-11 00:00:25 +0100 |
commit | 5014a730980393d6cd85e1b8d6e94d64cdbe833b (patch) | |
tree | 50a06e819ea64c420452c83f4c12a28af96189bc | |
parent | f155fcf0f5dec300ad1a8b728c759487071c71b0 (diff) |
lease: add loclkms_sequence
-rw-r--r-- | tests/kms_lease.c | 75 |
1 files changed, 69 insertions, 6 deletions
diff --git a/tests/kms_lease.c b/tests/kms_lease.c index eed836de..b61f571c 100644 --- a/tests/kms_lease.c +++ b/tests/kms_lease.c @@ -44,6 +44,69 @@ IGT_TEST_DESCRIPTION("Test of CreateLease."); +struct local_drm_mode_create_lease { + /** Pointer to array of object ids (__u32) */ + __u64 object_ids; + /** Number of object ids */ + __u32 object_count; + /** flags for new FD (O_CLOEXEC, etc) */ + __u32 flags; + + /** Return: unique identifier for lessee. */ + __u32 lessee_id; + /** Return: file descriptor to new drm_master file */ + __u32 fd; +}; + +struct local_drm_mode_list_lessees { + /** Number of lessees. + * On input, provides length of the array. + * On output, provides total number. No + * more than the input number will be written + * back, so two calls can be used to get + * the size and then the data. + */ + __u32 count_lessees; + __u32 pad; + + /** Pointer to lessees. + * pointer to __u64 array of lessee ids + */ + __u64 lessees_ptr; +}; + +struct local_drm_mode_get_lease { + /** Number of leased objects. + * On input, provides length of the array. + * On output, provides total number. No + * more than the input number will be written + * back, so two calls can be used to get + * the size and then the data. + */ + __u32 count_objects; + __u32 pad; + + /** Pointer to objects. + * pointer to __u32 array of object ids + */ + __u64 objects_ptr; +}; + +/** + * Revoke lease + */ +struct local_drm_mode_revoke_lease { + /** Unique ID of lessee + */ + __u32 lessee_id; +}; + + +#define LOCAL_DRM_IOCTL_MODE_CREATE_LEASE DRM_IOWR(0xC6, struct local_drm_mode_create_lease) +#define LOCAL_DRM_IOCTL_MODE_LIST_LESSEES DRM_IOWR(0xC7, struct local_drm_mode_list_lessees) +#define LOCAL_DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct local_drm_mode_get_lease) +#define LOCAL_DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct local_drm_mode_revoke_lease) + typedef struct { int fd; uint32_t lessee_id; @@ -139,20 +202,20 @@ static void cleanup_crtc(lease_t *lease, igt_output_t *output) igt_display_commit(display); } -static int create_lease(int fd, struct drm_mode_create_lease *mcl) +static int create_lease(int fd, struct local_drm_mode_create_lease *mcl) { int err = 0; - if (igt_ioctl(fd, DRM_IOCTL_MODE_CREATE_LEASE, mcl)) + if (igt_ioctl(fd, LOCAL_DRM_IOCTL_MODE_CREATE_LEASE, mcl)) err = -errno; return err; } -static int revoke_lease(int fd, struct drm_mode_revoke_lease *mrl) +static int revoke_lease(int fd, struct local_drm_mode_revoke_lease *mrl) { int err = 0; - if (igt_ioctl(fd, DRM_IOCTL_MODE_REVOKE_LEASE, mrl)) + if (igt_ioctl(fd, LOCAL_DRM_IOCTL_MODE_REVOKE_LEASE, mrl)) err = -errno; return err; } @@ -160,7 +223,7 @@ static int revoke_lease(int fd, struct drm_mode_revoke_lease *mrl) static int make_lease(data_t *data, lease_t *lease) { uint32_t object_ids[3]; - struct drm_mode_create_lease mcl; + struct local_drm_mode_create_lease mcl; int ret; mcl.object_ids = (uint64_t) (uintptr_t) &object_ids[0]; @@ -303,7 +366,7 @@ static void lease_unleased_connector(data_t *data) static void lease_revoke(data_t *data) { lease_t lease; - struct drm_mode_revoke_lease mrl; + struct local_drm_mode_revoke_lease mrl; int ret; /* Create a valid lease */ |