History

drm: Add four ioctls for managing drm mode object leases [v7]

drm_mode_create_lease Creates a lease for a list of drm mode objects, returning an fd for the new drm_master and a 64-bit identifier for the lessee drm_mode_list_lesees List the identifiers of the lessees for a master file drm_mode_get_lease List the leased objects for a master file drm_mode_revoke_lease Erase the set of objects managed by a lease. This should suffice to at least create and query leases. Changes for v2 as suggested by Daniel Vetter <daniel.vetter@ffwll.ch>: * query ioctls only query the master associated with the provided file. * 'mask_lease' value has been removed * change ioctl has been removed. Changes for v3 suggested in part by Dave Airlie <airlied@gmail.com> * Add revoke ioctl. Changes for v4 suggested by Dave Airlie <airlied@gmail.com> * Expand on the comment about the magic use of &drm_lease_idr_object * Pad lease ioctl structures to align on 64-bit boundaries Changes for v5 suggested by Dave Airlie <airlied@gmail.com> * Check for non-negative object_id in create_lease to avoid debug output from the kernel. Changes for v6 provided by Dave Airlie <airlied@gmail.com> * For non-universal planes add primary/cursor planes to lease If we aren't exposing universal planes to this userspace client, and it requests a lease on a crtc, we should implicitly export the primary and cursor planes for the crtc. If the lessee doesn't request universal planes, it will just see the crtc, but if it does request them it will then see the plane objects as well. This also moves the object look ups earlier as a side effect, so we'd exit the ioctl quicker for non-existant objects. * Restrict leases to crtc/connector/planes. This only allows leasing for objects we wish to allow. Changes for v7 provided by Dave Airlie <airlied@gmail.com> * Check pad args are 0 * Check create flags and object count are valid. * Check return from fd allocation * Refactor lease idr setup and add some simple validation * Use idr_mutex uniformly (Keith)

Keith Packard committed 9 years ago

Commit 62884cd1 parent 7de440d7 files · +504 −2Browse files

Showing the changes to include/uapi (2 of 7 files). Show all

Unified · Split

2 files
  1. include/uapi/drm/drm.h +5 −0
  2. include/uapi/drm/drm_mode.h +66 −0
include/uapi/drm/drm.h+5−0
@@ -888,6 +888,11 @@ extern "C" { · 887 unmodified lines
888888 #define DRM_IOCTL_SYNCOBJ_RESET DRM_IOWR(0xC4, struct drm_syncobj_array)
889889 #define DRM_IOCTL_SYNCOBJ_SIGNAL DRM_IOWR(0xC5, struct drm_syncobj_array)
890890
891+#define DRM_IOCTL_MODE_CREATE_LEASE DRM_IOWR(0xC6, struct drm_mode_create_lease)
892+#define DRM_IOCTL_MODE_LIST_LESSEES DRM_IOWR(0xC7, struct drm_mode_list_lessees)
893+#define DRM_IOCTL_MODE_GET_LEASE DRM_IOWR(0xC8, struct drm_mode_get_lease)
894+#define DRM_IOCTL_MODE_REVOKE_LEASE DRM_IOWR(0xC9, struct drm_mode_revoke_lease)
895+
891896 /**
892897 * Device specific ioctls should only be in their respective headers
893898 * The device specific ioctl range is from 0x40 to 0x9f.
include/uapi/drm/drm_mode.h+66−0
@@ -782,6 +782,72 @@ struct drm_mode_destroy_blob { · 781 unmodified lines
782782 __u32 blob_id;
783783 };
784784
785+/**
786+ * Lease mode resources, creating another drm_master.
787+ */
788+struct drm_mode_create_lease {
789+ /** Pointer to array of object ids (__u32) */
790+ __u64 object_ids;
791+ /** Number of object ids */
792+ __u32 object_count;
793+ /** flags for new FD (O_CLOEXEC, etc) */
794+ __u32 flags;
795+
796+ /** Return: unique identifier for lessee. */
797+ __u32 lessee_id;
798+ /** Return: file descriptor to new drm_master file */
799+ __u32 fd;
800+};
801+
802+/**
803+ * List lesses from a drm_master
804+ */
805+struct drm_mode_list_lessees {
806+ /** Number of lessees.
807+ * On input, provides length of the array.
808+ * On output, provides total number. No
809+ * more than the input number will be written
810+ * back, so two calls can be used to get
811+ * the size and then the data.
812+ */
813+ __u32 count_lessees;
814+ __u32 pad;
815+
816+ /** Pointer to lessees.
817+ * pointer to __u64 array of lessee ids
818+ */
819+ __u64 lessees_ptr;
820+};
821+
822+/**
823+ * Get leased objects
824+ */
825+struct drm_mode_get_lease {
826+ /** Number of leased objects.
827+ * On input, provides length of the array.
828+ * On output, provides total number. No
829+ * more than the input number will be written
830+ * back, so two calls can be used to get
831+ * the size and then the data.
832+ */
833+ __u32 count_objects;
834+ __u32 pad;
835+
836+ /** Pointer to objects.
837+ * pointer to __u32 array of object ids
838+ */
839+ __u64 objects_ptr;
840+};
841+
842+/**
843+ * Revoke lease
844+ */
845+struct drm_mode_revoke_lease {
846+ /** Unique ID of lessee
847+ */
848+ __u32 lessee_id;
849+};
850+
785851 #if defined(__cplusplus)
786852 }
787853 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t