Support atomic modesetting ioctl
Subsystems (2)
PATCH v2 1/2 Support atomic modesetting ioctl
From: Ville Syrjälä <[email protected]>
Add support for the atomic modesetting ioctl through a property-set API.
v1: Squashed intermediate patches from Ville, Rob and myself. Updated
for current kernel interface (no blobs).
v2: Rewrite user-facing API to provide transactional/cursor interface.
Use memclear to zero out ioctl.
Signed-off-by Ville Syrjälä <[email protected]>
Signed-off-by Rob Clark <[email protected]>
Signed-off-by Daniel Stone <[email protected]>
--- include/drm/drm.h | 9 ++ include/drm/drm_mode.h | 16 ++++ xf86drmMode.c | 240 +++++++++++++++++++++++++++++++++++++++++++++++++ xf86drmMode.h | 19 ++++ 4 files changed, 284 insertions(+)
include/drm/drm.h +9 -0
@@ -635,6 +635,13 @@ struct drm_get_cap {*/ #define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2 +/** +* DRM_CLIENT_CAP_ATOMIC +* +* If set to 1, the DRM core will allow atomic modesetting requests. +*/ +#define DRM_CLIENT_CAP_ATOMIC 3 +/** DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ struct drm_set_client_cap {__u64 capability;
@@ -758,6 +765,7 @@ struct drm_prime_handle {#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties)#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property)#define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2) +#define DRM_IOCTL_MODE_ATOMIC DRM_IOWR(0xBC, struct drm_mode_atomic)/** * Device specific ioctls should only be in their respective headers
@@ -806,6 +814,7 @@ struct drm_event_vblank {#define DRM_CAP_PRIME 0x5#define DRM_CAP_TIMESTAMP_MONOTONIC 0x6#define DRM_CAP_ASYNC_PAGE_FLIP 0x7 +#define DRM_CAP_ATOMIC 0xa#define DRM_PRIME_CAP_IMPORT 0x1#define DRM_PRIME_CAP_EXPORT 0x2
include/drm/drm_mode.h +16 -0
@@ -507,4 +507,20 @@ struct drm_mode_destroy_dumb { __u32 handle; }; +/* page-flip flags are valid, plus: */ +#define DRM_MODE_ATOMIC_TEST_ONLY 0x0100 +#define DRM_MODE_ATOMIC_NONBLOCK 0x0200 +#define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400 + +struct drm_mode_atomic { +__u32 flags; +__u32 count_objs; +__u64 objs_ptr; +__u64 count_props_ptr; +__u64 props_ptr; +__u64 prop_values_ptr; +__u64 reserved; +__u64 user_data; +}; +#endif
xf86drmMode.c +240 -0
252 lines not on this page · raw message
xf86drmMode.h +19 -0
@@ -484,6 +484,25 @@ extern int drmModeObjectSetProperty(int fd, uint32_t object_id, uint32_t object_type, uint32_t property_id, uint64_t value); + +typedef struct _drmModeAtomicReq drmModeAtomicReq , *drmModeAtomicReqPtr ; + +extern drmModeAtomicReqPtr drmModeAtomicAlloc (void ); +extern drmModeAtomicReqPtr drmModeAtomicDuplicate (drmModeAtomicReqPtr req); +extern int drmModeAtomicMerge (drmModeAtomicReqPtr base, +drmModeAtomicReqPtr augment); +extern void drmModeAtomicFree (drmModeAtomicReqPtr req); +extern int drmModeAtomicGetCursor (drmModeAtomicReqPtr req); +extern void drmModeAtomicSetCursor (drmModeAtomicReqPtr req,int cursor); +extern int drmModeAtomicAddProperty (drmModeAtomicReqPtr req, +uint32_t object_id, +uint32_t property_id, +uint64_t value); +extern int drmModeAtomicCommit (int fd, +drmModeAtomicReqPtr req, +uint32_t flags, +void *user_data); +#if defined(__cplusplus) || defined(c_plusplus) }#endif
Signature · 6 lines
2.4.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 2/2 Add blob property create/destroy ioctl wrappers
v2: Use memclear to zero out structure.
Signed-off-by Daniel Stone <[email protected]>
--- include/drm/drm.h | 2 ++ include/drm/drm_mode.h | 21 +++++++++++++++++++++ xf86drmMode.c | 34 ++++++++++++++++++++++++++++++++++ xf86drmMode.h | 5 +++++ 4 files changed, 62 insertions(+)
include/drm/drm.h +2 -0
@@ -766,6 +766,8 @@ struct drm_prime_handle {#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property)#define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2)#define DRM_IOCTL_MODE_ATOMIC DRM_IOWR(0xBC, struct drm_mode_atomic) +#define DRM_IOCTL_MODE_CREATEPROPBLOB DRM_IOWR(0xBD, struct drm_mode_create_blob) +#define DRM_IOCTL_MODE_DESTROYPROPBLOB DRM_IOWR(0xBE, struct drm_mode_destroy_blob)/** * Device specific ioctls should only be in their respective headers
include/drm/drm_mode.h +21 -0
@@ -523,4 +523,25 @@ struct drm_mode_atomic { __u64 user_data; }; +/** +* Create a new 'blob' data property, copying length bytes from data pointer, +* and returning new blob ID. +*/ +struct drm_mode_create_blob { +/** Pointer to data to copy. */ +__u64 data; +/** Length of data to copy. */ +__u32 length; +/** Return: new property ID. */ +__u32 blob_id; +}; + +/** +* Destroy a user-created blob property. +*/ +struct drm_mode_destroy_blob { +__u32 blob_id; +}; + +#endif
xf86drmMode.c +34 -0
@@ -1387,3 +1387,37 @@ out:return ret; } + +int +drmModeCreatePropertyBlob (int fd,const void *data,size_t length,uint32_t *id) +{ +struct drm_mode_create_blob create; +int ret; + +if (length >=0xffffffff ) +return -ERANGE ; + +memclear (create); + + create.length = length; + create.data = (uintptr_t ) data; + create.blob_id =0 ; + *id =0 ; + + ret =DRM_IOCTL (fd,DRM_IOCTL_MODE_CREATEPROPBLOB , &create); +if (ret !=0 ) +return ret; + + *id = create.blob_id; +return 0 ; +} + +int +drmModeDestroyPropertyBlob (int fd,uint32_t id) +{ +struct drm_mode_destroy_blob destroy; + +memclear (destroy); + destroy.blob_id = id; +return DRM_IOCTL (fd,DRM_IOCTL_MODE_DESTROYPROPBLOB , &destroy); +}
xf86drmMode.h +5 -0
@@ -503,6 +503,11 @@ extern int drmModeAtomicCommit(int fd,uint32_t flags, void *user_data); +extern int drmModeCreatePropertyBlob (int fd,const void *data,size_t size, +uint32_t *id); +extern int drmModeDestroyPropertyBlob (int fd,uint32_t id); + +#if defined(__cplusplus) || defined(c_plusplus) }#endif
Signature · 6 lines
2.4.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel