diff options
Diffstat (limited to 'include/drm/drm_crtc.h')
-rw-r--r-- | include/drm/drm_crtc.h | 70 |
1 files changed, 66 insertions, 4 deletions
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 291239f2fafc..6588bffb6518 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -63,8 +63,16 @@ struct drm_mode_object { | |||
63 | 63 | ||
64 | #define DRM_OBJECT_MAX_PROPERTY 24 | 64 | #define DRM_OBJECT_MAX_PROPERTY 24 |
65 | struct drm_object_properties { | 65 | struct drm_object_properties { |
66 | int count; | 66 | int count, atomic_count; |
67 | uint32_t ids[DRM_OBJECT_MAX_PROPERTY]; | 67 | /* NOTE: if we ever start dynamically destroying properties (ie. |
68 | * not at drm_mode_config_cleanup() time), then we'd have to do | ||
69 | * a better job of detaching property from mode objects to avoid | ||
70 | * dangling property pointers: | ||
71 | */ | ||
72 | struct drm_property *properties[DRM_OBJECT_MAX_PROPERTY]; | ||
73 | /* do not read/write values directly, but use drm_object_property_get_value() | ||
74 | * and drm_object_property_set_value(): | ||
75 | */ | ||
68 | uint64_t values[DRM_OBJECT_MAX_PROPERTY]; | 76 | uint64_t values[DRM_OBJECT_MAX_PROPERTY]; |
69 | }; | 77 | }; |
70 | 78 | ||
@@ -237,7 +245,9 @@ struct drm_atomic_state; | |||
237 | 245 | ||
238 | /** | 246 | /** |
239 | * struct drm_crtc_state - mutable CRTC state | 247 | * struct drm_crtc_state - mutable CRTC state |
248 | * @crtc: backpointer to the CRTC | ||
240 | * @enable: whether the CRTC should be enabled, gates all other state | 249 | * @enable: whether the CRTC should be enabled, gates all other state |
250 | * @active: whether the CRTC is actively displaying (used for DPMS) | ||
241 | * @mode_changed: for use by helpers and drivers when computing state updates | 251 | * @mode_changed: for use by helpers and drivers when computing state updates |
242 | * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes | 252 | * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes |
243 | * @last_vblank_count: for helpers and drivers to capture the vblank of the | 253 | * @last_vblank_count: for helpers and drivers to capture the vblank of the |
@@ -248,9 +258,18 @@ struct drm_atomic_state; | |||
248 | * @event: optional pointer to a DRM event to signal upon completion of the | 258 | * @event: optional pointer to a DRM event to signal upon completion of the |
249 | * state update | 259 | * state update |
250 | * @state: backpointer to global drm_atomic_state | 260 | * @state: backpointer to global drm_atomic_state |
261 | * | ||
262 | * Note that the distinction between @enable and @active is rather subtile: | ||
263 | * Flipping @active while @enable is set without changing anything else may | ||
264 | * never return in a failure from the ->atomic_check callback. Userspace assumes | ||
265 | * that a DPMS On will always succeed. In other words: @enable controls resource | ||
266 | * assignment, @active controls the actual hardware state. | ||
251 | */ | 267 | */ |
252 | struct drm_crtc_state { | 268 | struct drm_crtc_state { |
269 | struct drm_crtc *crtc; | ||
270 | |||
253 | bool enable; | 271 | bool enable; |
272 | bool active; | ||
254 | 273 | ||
255 | /* computed state bits used by helpers and drivers */ | 274 | /* computed state bits used by helpers and drivers */ |
256 | bool planes_changed : 1; | 275 | bool planes_changed : 1; |
@@ -292,6 +311,9 @@ struct drm_crtc_state { | |||
292 | * @atomic_duplicate_state: duplicate the atomic state for this CRTC | 311 | * @atomic_duplicate_state: duplicate the atomic state for this CRTC |
293 | * @atomic_destroy_state: destroy an atomic state for this CRTC | 312 | * @atomic_destroy_state: destroy an atomic state for this CRTC |
294 | * @atomic_set_property: set a property on an atomic state for this CRTC | 313 | * @atomic_set_property: set a property on an atomic state for this CRTC |
314 | * (do not call directly, use drm_atomic_crtc_set_property()) | ||
315 | * @atomic_get_property: get a property on an atomic state for this CRTC | ||
316 | * (do not call directly, use drm_atomic_crtc_get_property()) | ||
295 | * | 317 | * |
296 | * The drm_crtc_funcs structure is the central CRTC management structure | 318 | * The drm_crtc_funcs structure is the central CRTC management structure |
297 | * in the DRM. Each CRTC controls one or more connectors (note that the name | 319 | * in the DRM. Each CRTC controls one or more connectors (note that the name |
@@ -351,6 +373,10 @@ struct drm_crtc_funcs { | |||
351 | struct drm_crtc_state *state, | 373 | struct drm_crtc_state *state, |
352 | struct drm_property *property, | 374 | struct drm_property *property, |
353 | uint64_t val); | 375 | uint64_t val); |
376 | int (*atomic_get_property)(struct drm_crtc *crtc, | ||
377 | const struct drm_crtc_state *state, | ||
378 | struct drm_property *property, | ||
379 | uint64_t *val); | ||
354 | }; | 380 | }; |
355 | 381 | ||
356 | /** | 382 | /** |
@@ -449,11 +475,14 @@ struct drm_crtc { | |||
449 | 475 | ||
450 | /** | 476 | /** |
451 | * struct drm_connector_state - mutable connector state | 477 | * struct drm_connector_state - mutable connector state |
478 | * @connector: backpointer to the connector | ||
452 | * @crtc: CRTC to connect connector to, NULL if disabled | 479 | * @crtc: CRTC to connect connector to, NULL if disabled |
453 | * @best_encoder: can be used by helpers and drivers to select the encoder | 480 | * @best_encoder: can be used by helpers and drivers to select the encoder |
454 | * @state: backpointer to global drm_atomic_state | 481 | * @state: backpointer to global drm_atomic_state |
455 | */ | 482 | */ |
456 | struct drm_connector_state { | 483 | struct drm_connector_state { |
484 | struct drm_connector *connector; | ||
485 | |||
457 | struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_connector() */ | 486 | struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_connector() */ |
458 | 487 | ||
459 | struct drm_encoder *best_encoder; | 488 | struct drm_encoder *best_encoder; |
@@ -475,6 +504,9 @@ struct drm_connector_state { | |||
475 | * @atomic_duplicate_state: duplicate the atomic state for this connector | 504 | * @atomic_duplicate_state: duplicate the atomic state for this connector |
476 | * @atomic_destroy_state: destroy an atomic state for this connector | 505 | * @atomic_destroy_state: destroy an atomic state for this connector |
477 | * @atomic_set_property: set a property on an atomic state for this connector | 506 | * @atomic_set_property: set a property on an atomic state for this connector |
507 | * (do not call directly, use drm_atomic_connector_set_property()) | ||
508 | * @atomic_get_property: get a property on an atomic state for this connector | ||
509 | * (do not call directly, use drm_atomic_connector_get_property()) | ||
478 | * | 510 | * |
479 | * Each CRTC may have one or more connectors attached to it. The functions | 511 | * Each CRTC may have one or more connectors attached to it. The functions |
480 | * below allow the core DRM code to control connectors, enumerate available modes, | 512 | * below allow the core DRM code to control connectors, enumerate available modes, |
@@ -508,6 +540,10 @@ struct drm_connector_funcs { | |||
508 | struct drm_connector_state *state, | 540 | struct drm_connector_state *state, |
509 | struct drm_property *property, | 541 | struct drm_property *property, |
510 | uint64_t val); | 542 | uint64_t val); |
543 | int (*atomic_get_property)(struct drm_connector *connector, | ||
544 | const struct drm_connector_state *state, | ||
545 | struct drm_property *property, | ||
546 | uint64_t *val); | ||
511 | }; | 547 | }; |
512 | 548 | ||
513 | /** | 549 | /** |
@@ -693,6 +729,7 @@ struct drm_connector { | |||
693 | 729 | ||
694 | /** | 730 | /** |
695 | * struct drm_plane_state - mutable plane state | 731 | * struct drm_plane_state - mutable plane state |
732 | * @plane: backpointer to the plane | ||
696 | * @crtc: currently bound CRTC, NULL if disabled | 733 | * @crtc: currently bound CRTC, NULL if disabled |
697 | * @fb: currently bound framebuffer | 734 | * @fb: currently bound framebuffer |
698 | * @fence: optional fence to wait for before scanning out @fb | 735 | * @fence: optional fence to wait for before scanning out @fb |
@@ -709,6 +746,8 @@ struct drm_connector { | |||
709 | * @state: backpointer to global drm_atomic_state | 746 | * @state: backpointer to global drm_atomic_state |
710 | */ | 747 | */ |
711 | struct drm_plane_state { | 748 | struct drm_plane_state { |
749 | struct drm_plane *plane; | ||
750 | |||
712 | struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_plane() */ | 751 | struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_plane() */ |
713 | struct drm_framebuffer *fb; /* do not write directly, use drm_atomic_set_fb_for_plane() */ | 752 | struct drm_framebuffer *fb; /* do not write directly, use drm_atomic_set_fb_for_plane() */ |
714 | struct fence *fence; | 753 | struct fence *fence; |
@@ -735,6 +774,9 @@ struct drm_plane_state { | |||
735 | * @atomic_duplicate_state: duplicate the atomic state for this plane | 774 | * @atomic_duplicate_state: duplicate the atomic state for this plane |
736 | * @atomic_destroy_state: destroy an atomic state for this plane | 775 | * @atomic_destroy_state: destroy an atomic state for this plane |
737 | * @atomic_set_property: set a property on an atomic state for this plane | 776 | * @atomic_set_property: set a property on an atomic state for this plane |
777 | * (do not call directly, use drm_atomic_plane_set_property()) | ||
778 | * @atomic_get_property: get a property on an atomic state for this plane | ||
779 | * (do not call directly, use drm_atomic_plane_get_property()) | ||
738 | */ | 780 | */ |
739 | struct drm_plane_funcs { | 781 | struct drm_plane_funcs { |
740 | int (*update_plane)(struct drm_plane *plane, | 782 | int (*update_plane)(struct drm_plane *plane, |
@@ -758,6 +800,10 @@ struct drm_plane_funcs { | |||
758 | struct drm_plane_state *state, | 800 | struct drm_plane_state *state, |
759 | struct drm_property *property, | 801 | struct drm_property *property, |
760 | uint64_t val); | 802 | uint64_t val); |
803 | int (*atomic_get_property)(struct drm_plane *plane, | ||
804 | const struct drm_plane_state *state, | ||
805 | struct drm_property *property, | ||
806 | uint64_t *val); | ||
761 | }; | 807 | }; |
762 | 808 | ||
763 | enum drm_plane_type { | 809 | enum drm_plane_type { |
@@ -856,7 +902,7 @@ struct drm_bridge { | |||
856 | /** | 902 | /** |
857 | * 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 |
858 | * @dev: parent DRM device | 904 | * @dev: parent DRM device |
859 | * @flags: state flags like async update | 905 | * @allow_modeset: allow full modeset |
860 | * @planes: pointer to array of plane pointers | 906 | * @planes: pointer to array of plane pointers |
861 | * @plane_states: pointer to array of plane states pointers | 907 | * @plane_states: pointer to array of plane states pointers |
862 | * @crtcs: pointer to array of CRTC pointers | 908 | * @crtcs: pointer to array of CRTC pointers |
@@ -868,7 +914,7 @@ struct drm_bridge { | |||
868 | */ | 914 | */ |
869 | struct drm_atomic_state { | 915 | struct drm_atomic_state { |
870 | struct drm_device *dev; | 916 | struct drm_device *dev; |
871 | uint32_t flags; | 917 | bool allow_modeset : 1; |
872 | struct drm_plane **planes; | 918 | struct drm_plane **planes; |
873 | struct drm_plane_state **plane_states; | 919 | struct drm_plane_state **plane_states; |
874 | struct drm_crtc **crtcs; | 920 | struct drm_crtc **crtcs; |
@@ -1053,6 +1099,16 @@ struct drm_mode_config { | |||
1053 | struct drm_property *tile_property; | 1099 | struct drm_property *tile_property; |
1054 | struct drm_property *plane_type_property; | 1100 | struct drm_property *plane_type_property; |
1055 | struct drm_property *rotation_property; | 1101 | struct drm_property *rotation_property; |
1102 | struct drm_property *prop_src_x; | ||
1103 | struct drm_property *prop_src_y; | ||
1104 | struct drm_property *prop_src_w; | ||
1105 | struct drm_property *prop_src_h; | ||
1106 | struct drm_property *prop_crtc_x; | ||
1107 | struct drm_property *prop_crtc_y; | ||
1108 | struct drm_property *prop_crtc_w; | ||
1109 | struct drm_property *prop_crtc_h; | ||
1110 | struct drm_property *prop_fb_id; | ||
1111 | struct drm_property *prop_crtc_id; | ||
1056 | 1112 | ||
1057 | /* DVI-I properties */ | 1113 | /* DVI-I properties */ |
1058 | struct drm_property *dvi_i_subconnector_property; | 1114 | struct drm_property *dvi_i_subconnector_property; |
@@ -1290,6 +1346,10 @@ extern int drm_mode_create_scaling_mode_property(struct drm_device *dev); | |||
1290 | extern int drm_mode_create_aspect_ratio_property(struct drm_device *dev); | 1346 | extern int drm_mode_create_aspect_ratio_property(struct drm_device *dev); |
1291 | extern int drm_mode_create_dirty_info_property(struct drm_device *dev); | 1347 | extern int drm_mode_create_dirty_info_property(struct drm_device *dev); |
1292 | extern int drm_mode_create_suggested_offset_properties(struct drm_device *dev); | 1348 | extern int drm_mode_create_suggested_offset_properties(struct drm_device *dev); |
1349 | extern bool drm_property_change_valid_get(struct drm_property *property, | ||
1350 | uint64_t value, struct drm_mode_object **ref); | ||
1351 | extern void drm_property_change_valid_put(struct drm_property *property, | ||
1352 | struct drm_mode_object *ref); | ||
1293 | 1353 | ||
1294 | extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, | 1354 | extern int drm_mode_connector_attach_encoder(struct drm_connector *connector, |
1295 | struct drm_encoder *encoder); | 1355 | struct drm_encoder *encoder); |
@@ -1381,6 +1441,8 @@ extern int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data, | |||
1381 | extern int drm_mode_plane_set_obj_prop(struct drm_plane *plane, | 1441 | extern int drm_mode_plane_set_obj_prop(struct drm_plane *plane, |
1382 | struct drm_property *property, | 1442 | struct drm_property *property, |
1383 | uint64_t value); | 1443 | uint64_t value); |
1444 | extern int drm_mode_atomic_ioctl(struct drm_device *dev, | ||
1445 | void *data, struct drm_file *file_priv); | ||
1384 | 1446 | ||
1385 | extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, | 1447 | extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth, |
1386 | int *bpp); | 1448 | int *bpp); |