aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2014-12-18 16:01:56 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-01-05 07:55:29 -0500
commitd34f20d6e2f21bd3531b969dc40913181a8ae31a (patch)
tree05c0a22fb00068b2bc06bfedd078d97908da20b9 /include
parentae16c597b61ae4613b13a0c3fac302e8d8827ac7 (diff)
drm: Atomic modeset ioctl
The atomic modeset ioctl can be used to push any number of new values for object properties. The driver can then check the full device configuration as single unit, and try to apply the changes atomically. The ioctl simply takes a list of object IDs and property IDs and their values. Originally based on a patch from Ville Syrjälä, although it has mutated (mutilated?) enough since then that you probably shouldn't blame it on him ;-) The atomic support is hidden behind the DRM_CLIENT_CAP_ATOMIC cap (to protect legacy userspace) and drm.atomic module param (for now). v2: Check for file_priv->atomic to make sure we only allow userspace in-the-know to use atomic. Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Sean Paul <seanpaul@chromium.org> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'include')
-rw-r--r--include/drm/drm_crtc.h10
-rw-r--r--include/uapi/drm/drm.h1
-rw-r--r--include/uapi/drm/drm_mode.h23
3 files changed, 32 insertions, 2 deletions
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index fc4767fa723b..1dcfb685d15f 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -902,7 +902,7 @@ struct drm_bridge {
902/** 902/**
903 * struct struct drm_atomic_state - the global state object for atomic updates 903 * struct struct drm_atomic_state - the global state object for atomic updates
904 * @dev: parent DRM device 904 * @dev: parent DRM device
905 * @flags: state flags like async update 905 * @allow_modeset: allow full modeset
906 * @planes: pointer to array of plane pointers 906 * @planes: pointer to array of plane pointers
907 * @plane_states: pointer to array of plane states pointers 907 * @plane_states: pointer to array of plane states pointers
908 * @crtcs: pointer to array of CRTC pointers 908 * @crtcs: pointer to array of CRTC pointers
@@ -914,7 +914,7 @@ struct drm_bridge {
914 */ 914 */
915struct drm_atomic_state { 915struct drm_atomic_state {
916 struct drm_device *dev; 916 struct drm_device *dev;
917 uint32_t flags; 917 bool allow_modeset : 1;
918 struct drm_plane **planes; 918 struct drm_plane **planes;
919 struct drm_plane_state **plane_states; 919 struct drm_plane_state **plane_states;
920 struct drm_crtc **crtcs; 920 struct drm_crtc **crtcs;
@@ -1346,6 +1346,10 @@ extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
1346extern int drm_mode_create_aspect_ratio_property(struct drm_device *dev); 1346extern int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
1347extern int drm_mode_create_dirty_info_property(struct drm_device *dev); 1347extern int drm_mode_create_dirty_info_property(struct drm_device *dev);
1348extern int drm_mode_create_suggested_offset_properties(struct drm_device *dev); 1348extern int drm_mode_create_suggested_offset_properties(struct drm_device *dev);
1349extern bool drm_property_change_valid_get(struct drm_property *property,
1350 uint64_t value, struct drm_mode_object **ref);
1351extern void drm_property_change_valid_put(struct drm_property *property,
1352 struct drm_mode_object *ref);
1349 1353
1350extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, 1354extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
1351 struct drm_encoder *encoder); 1355 struct drm_encoder *encoder);
@@ -1437,6 +1441,8 @@ extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
1437extern int drm_mode_plane_set_obj_prop(struct drm_plane *plane, 1441extern int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
1438 struct drm_property *property, 1442 struct drm_property *property,
1439 uint64_t value); 1443 uint64_t value);
1444extern int drm_mode_atomic_ioctl(struct drm_device *dev,
1445 void *data, struct drm_file *file_priv);
1440 1446
1441extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, 1447extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
1442 int *bpp); 1448 int *bpp);
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index f7b2baf7ecb2..01b2d6d0e355 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -784,6 +784,7 @@ struct drm_prime_handle {
784#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties) 784#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties)
785#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property) 785#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property)
786#define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2) 786#define DRM_IOCTL_MODE_CURSOR2 DRM_IOWR(0xBB, struct drm_mode_cursor2)
787#define DRM_IOCTL_MODE_ATOMIC DRM_IOWR(0xBC, struct drm_mode_atomic)
787 788
788/** 789/**
789 * Device specific ioctls should only be in their respective headers 790 * Device specific ioctls should only be in their respective headers
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index b8f9c0f2e7fe..ca788e01dab2 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -526,4 +526,27 @@ struct drm_mode_destroy_dumb {
526 uint32_t handle; 526 uint32_t handle;
527}; 527};
528 528
529/* page-flip flags are valid, plus: */
530#define DRM_MODE_ATOMIC_TEST_ONLY 0x0100
531#define DRM_MODE_ATOMIC_NONBLOCK 0x0200
532#define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400
533
534#define DRM_MODE_ATOMIC_FLAGS (\
535 DRM_MODE_PAGE_FLIP_EVENT |\
536 DRM_MODE_PAGE_FLIP_ASYNC |\
537 DRM_MODE_ATOMIC_TEST_ONLY |\
538 DRM_MODE_ATOMIC_NONBLOCK |\
539 DRM_MODE_ATOMIC_ALLOW_MODESET)
540
541struct drm_mode_atomic {
542 __u32 flags;
543 __u32 count_objs;
544 __u64 objs_ptr;
545 __u64 count_props_ptr;
546 __u64 props_ptr;
547 __u64 prop_values_ptr;
548 __u64 reserved;
549 __u64 user_data;
550};
551
529#endif 552#endif