| .. | .. |
|---|
| 29 | 29 | #define DRM_ATOMIC_H_ |
|---|
| 30 | 30 | |
|---|
| 31 | 31 | #include <drm/drm_crtc.h> |
|---|
| 32 | +#include <drm/drm_util.h> |
|---|
| 32 | 33 | |
|---|
| 33 | 34 | /** |
|---|
| 34 | 35 | * struct drm_crtc_commit - track modeset commits on a CRTC |
|---|
| 35 | 36 | * |
|---|
| 36 | 37 | * This structure is used to track pending modeset changes and atomic commit on |
|---|
| 37 | | - * a per-CRTC basis. Since updating the list should never block this structure |
|---|
| 38 | + * a per-CRTC basis. Since updating the list should never block, this structure |
|---|
| 38 | 39 | * is reference counted to allow waiters to safely wait on an event to complete, |
|---|
| 39 | 40 | * without holding any locks. |
|---|
| 40 | 41 | * |
|---|
| .. | .. |
|---|
| 59 | 60 | * wait for flip_done <---- |
|---|
| 60 | 61 | * clean up atomic state |
|---|
| 61 | 62 | * |
|---|
| 62 | | - * The important bit to know is that cleanup_done is the terminal event, but the |
|---|
| 63 | | - * ordering between flip_done and hw_done is entirely up to the specific driver |
|---|
| 63 | + * The important bit to know is that &cleanup_done is the terminal event, but the |
|---|
| 64 | + * ordering between &flip_done and &hw_done is entirely up to the specific driver |
|---|
| 64 | 65 | * and modeset state change. |
|---|
| 65 | 66 | * |
|---|
| 66 | 67 | * For an implementation of how to use this look at |
|---|
| .. | .. |
|---|
| 91 | 92 | * commit is sent to userspace, or when an out-fence is singalled. Note |
|---|
| 92 | 93 | * that for most hardware, in most cases this happens after @hw_done is |
|---|
| 93 | 94 | * signalled. |
|---|
| 95 | + * |
|---|
| 96 | + * Completion of this stage is signalled implicitly by calling |
|---|
| 97 | + * drm_crtc_send_vblank_event() on &drm_crtc_state.event. |
|---|
| 94 | 98 | */ |
|---|
| 95 | 99 | struct completion flip_done; |
|---|
| 96 | 100 | |
|---|
| .. | .. |
|---|
| 99 | 103 | * |
|---|
| 100 | 104 | * Will be signalled when all hw register changes for this commit have |
|---|
| 101 | 105 | * been written out. Especially when disabling a pipe this can be much |
|---|
| 102 | | - * later than than @flip_done, since that can signal already when the |
|---|
| 106 | + * later than @flip_done, since that can signal already when the |
|---|
| 103 | 107 | * screen goes black, whereas to fully shut down a pipe more register |
|---|
| 104 | 108 | * I/O is required. |
|---|
| 105 | 109 | * |
|---|
| 106 | 110 | * Note that this does not need to include separately reference-counted |
|---|
| 107 | 111 | * resources like backing storage buffer pinning, or runtime pm |
|---|
| 108 | 112 | * management. |
|---|
| 113 | + * |
|---|
| 114 | + * Drivers should call drm_atomic_helper_commit_hw_done() to signal |
|---|
| 115 | + * completion of this stage. |
|---|
| 109 | 116 | */ |
|---|
| 110 | 117 | struct completion hw_done; |
|---|
| 111 | 118 | |
|---|
| .. | .. |
|---|
| 117 | 124 | * a vblank wait completed it might be a bit later. This completion is |
|---|
| 118 | 125 | * useful to throttle updates and avoid hardware updates getting ahead |
|---|
| 119 | 126 | * of the buffer cleanup too much. |
|---|
| 127 | + * |
|---|
| 128 | + * Drivers should call drm_atomic_helper_commit_cleanup_done() to signal |
|---|
| 129 | + * completion of this stage. |
|---|
| 120 | 130 | */ |
|---|
| 121 | 131 | struct completion cleanup_done; |
|---|
| 122 | 132 | |
|---|
| .. | .. |
|---|
| 138 | 148 | /** |
|---|
| 139 | 149 | * @abort_completion: |
|---|
| 140 | 150 | * |
|---|
| 141 | | - * A flag that's set after drm_atomic_helper_setup_commit takes a second |
|---|
| 142 | | - * reference for the completion of $drm_crtc_state.event. It's used by |
|---|
| 143 | | - * the free code to remove the second reference if commit fails. |
|---|
| 151 | + * A flag that's set after drm_atomic_helper_setup_commit() takes a |
|---|
| 152 | + * second reference for the completion of $drm_crtc_state.event. It's |
|---|
| 153 | + * used by the free code to remove the second reference if commit fails. |
|---|
| 144 | 154 | */ |
|---|
| 145 | 155 | bool abort_completion; |
|---|
| 146 | 156 | }; |
|---|
| .. | .. |
|---|
| 191 | 201 | * private objects. The structure itself is used as a vtable to identify the |
|---|
| 192 | 202 | * associated private object type. Each private object type that needs to be |
|---|
| 193 | 203 | * added to the atomic states is expected to have an implementation of these |
|---|
| 194 | | - * hooks and pass a pointer to it's drm_private_state_funcs struct to |
|---|
| 204 | + * hooks and pass a pointer to its drm_private_state_funcs struct to |
|---|
| 195 | 205 | * drm_atomic_get_private_obj_state(). |
|---|
| 196 | 206 | */ |
|---|
| 197 | 207 | struct drm_private_state_funcs { |
|---|
| .. | .. |
|---|
| 227 | 237 | * Currently only tracks the state update functions and the opaque driver |
|---|
| 228 | 238 | * private state itself, but in the future might also track which |
|---|
| 229 | 239 | * &drm_modeset_lock is required to duplicate and update this object's state. |
|---|
| 240 | + * |
|---|
| 241 | + * All private objects must be initialized before the DRM device they are |
|---|
| 242 | + * attached to is registered to the DRM subsystem (call to drm_dev_register()) |
|---|
| 243 | + * and should stay around until this DRM device is unregistered (call to |
|---|
| 244 | + * drm_dev_unregister()). In other words, private objects lifetime is tied |
|---|
| 245 | + * to the DRM device lifetime. This implies that: |
|---|
| 246 | + * |
|---|
| 247 | + * 1/ all calls to drm_atomic_private_obj_init() must be done before calling |
|---|
| 248 | + * drm_dev_register() |
|---|
| 249 | + * 2/ all calls to drm_atomic_private_obj_fini() must be done after calling |
|---|
| 250 | + * drm_dev_unregister() |
|---|
| 230 | 251 | */ |
|---|
| 231 | 252 | struct drm_private_obj { |
|---|
| 253 | + /** |
|---|
| 254 | + * @head: List entry used to attach a private object to a &drm_device |
|---|
| 255 | + * (queued to &drm_mode_config.privobj_list). |
|---|
| 256 | + */ |
|---|
| 257 | + struct list_head head; |
|---|
| 258 | + |
|---|
| 259 | + /** |
|---|
| 260 | + * @lock: Modeset lock to protect the state object. |
|---|
| 261 | + */ |
|---|
| 262 | + struct drm_modeset_lock lock; |
|---|
| 263 | + |
|---|
| 232 | 264 | /** |
|---|
| 233 | 265 | * @state: Current atomic state for this driver private object. |
|---|
| 234 | 266 | */ |
|---|
| .. | .. |
|---|
| 242 | 274 | */ |
|---|
| 243 | 275 | const struct drm_private_state_funcs *funcs; |
|---|
| 244 | 276 | }; |
|---|
| 277 | + |
|---|
| 278 | +/** |
|---|
| 279 | + * drm_for_each_privobj() - private object iterator |
|---|
| 280 | + * |
|---|
| 281 | + * @privobj: pointer to the current private object. Updated after each |
|---|
| 282 | + * iteration |
|---|
| 283 | + * @dev: the DRM device we want get private objects from |
|---|
| 284 | + * |
|---|
| 285 | + * Allows one to iterate over all private objects attached to @dev |
|---|
| 286 | + */ |
|---|
| 287 | +#define drm_for_each_privobj(privobj, dev) \ |
|---|
| 288 | + list_for_each_entry(privobj, &(dev)->mode_config.privobj_list, head) |
|---|
| 245 | 289 | |
|---|
| 246 | 290 | /** |
|---|
| 247 | 291 | * struct drm_private_state - base struct for driver private object state |
|---|
| .. | .. |
|---|
| 264 | 308 | * struct drm_atomic_state - the global state object for atomic updates |
|---|
| 265 | 309 | * @ref: count of all references to this state (will not be freed until zero) |
|---|
| 266 | 310 | * @dev: parent DRM device |
|---|
| 267 | | - * @allow_modeset: allow full modeset |
|---|
| 268 | 311 | * @legacy_cursor_update: hint to enforce legacy cursor IOCTL semantics |
|---|
| 269 | 312 | * @async_update: hint for asynchronous plane update |
|---|
| 270 | 313 | * @planes: pointer to array of structures with per-plane data |
|---|
| .. | .. |
|---|
| 283 | 326 | struct kref ref; |
|---|
| 284 | 327 | |
|---|
| 285 | 328 | struct drm_device *dev; |
|---|
| 329 | + |
|---|
| 330 | + /** |
|---|
| 331 | + * @allow_modeset: |
|---|
| 332 | + * |
|---|
| 333 | + * Allow full modeset. This is used by the ATOMIC IOCTL handler to |
|---|
| 334 | + * implement the DRM_MODE_ATOMIC_ALLOW_MODESET flag. Drivers should |
|---|
| 335 | + * never consult this flag, instead looking at the output of |
|---|
| 336 | + * drm_atomic_crtc_needs_modeset(). |
|---|
| 337 | + */ |
|---|
| 286 | 338 | bool allow_modeset : 1; |
|---|
| 287 | 339 | bool legacy_cursor_update : 1; |
|---|
| 288 | 340 | bool async_update : 1; |
|---|
| 341 | + /** |
|---|
| 342 | + * @duplicated: |
|---|
| 343 | + * |
|---|
| 344 | + * Indicates whether or not this atomic state was duplicated using |
|---|
| 345 | + * drm_atomic_helper_duplicate_state(). Drivers and atomic helpers |
|---|
| 346 | + * should use this to fixup normal inconsistencies in duplicated |
|---|
| 347 | + * states. |
|---|
| 348 | + */ |
|---|
| 349 | + bool duplicated : 1; |
|---|
| 289 | 350 | struct __drm_planes_state *planes; |
|---|
| 290 | 351 | struct __drm_crtcs_state *crtcs; |
|---|
| 291 | 352 | int num_connector; |
|---|
| .. | .. |
|---|
| 302 | 363 | * When a connector or plane is not bound to any CRTC, it's still important |
|---|
| 303 | 364 | * to preserve linearity to prevent the atomic states from being freed to early. |
|---|
| 304 | 365 | * |
|---|
| 305 | | - * This commit (if set) is not bound to any crtc, but will be completed when |
|---|
| 366 | + * This commit (if set) is not bound to any CRTC, but will be completed when |
|---|
| 306 | 367 | * drm_atomic_helper_commit_hw_done() is called. |
|---|
| 307 | 368 | */ |
|---|
| 308 | 369 | struct drm_crtc_commit *fake_commit; |
|---|
| .. | .. |
|---|
| 384 | 445 | struct drm_crtc_state * __must_check |
|---|
| 385 | 446 | drm_atomic_get_crtc_state(struct drm_atomic_state *state, |
|---|
| 386 | 447 | struct drm_crtc *crtc); |
|---|
| 387 | | -int drm_atomic_crtc_set_property(struct drm_crtc *crtc, |
|---|
| 388 | | - struct drm_crtc_state *state, struct drm_property *property, |
|---|
| 389 | | - uint64_t val); |
|---|
| 390 | 448 | struct drm_plane_state * __must_check |
|---|
| 391 | 449 | drm_atomic_get_plane_state(struct drm_atomic_state *state, |
|---|
| 392 | 450 | struct drm_plane *plane); |
|---|
| .. | .. |
|---|
| 394 | 452 | drm_atomic_get_connector_state(struct drm_atomic_state *state, |
|---|
| 395 | 453 | struct drm_connector *connector); |
|---|
| 396 | 454 | |
|---|
| 397 | | -void drm_atomic_private_obj_init(struct drm_private_obj *obj, |
|---|
| 455 | +void drm_atomic_private_obj_init(struct drm_device *dev, |
|---|
| 456 | + struct drm_private_obj *obj, |
|---|
| 398 | 457 | struct drm_private_state *state, |
|---|
| 399 | 458 | const struct drm_private_state_funcs *funcs); |
|---|
| 400 | 459 | void drm_atomic_private_obj_fini(struct drm_private_obj *obj); |
|---|
| .. | .. |
|---|
| 402 | 461 | struct drm_private_state * __must_check |
|---|
| 403 | 462 | drm_atomic_get_private_obj_state(struct drm_atomic_state *state, |
|---|
| 404 | 463 | struct drm_private_obj *obj); |
|---|
| 464 | +struct drm_private_state * |
|---|
| 465 | +drm_atomic_get_old_private_obj_state(struct drm_atomic_state *state, |
|---|
| 466 | + struct drm_private_obj *obj); |
|---|
| 467 | +struct drm_private_state * |
|---|
| 468 | +drm_atomic_get_new_private_obj_state(struct drm_atomic_state *state, |
|---|
| 469 | + struct drm_private_obj *obj); |
|---|
| 470 | + |
|---|
| 471 | +struct drm_connector * |
|---|
| 472 | +drm_atomic_get_old_connector_for_encoder(struct drm_atomic_state *state, |
|---|
| 473 | + struct drm_encoder *encoder); |
|---|
| 474 | +struct drm_connector * |
|---|
| 475 | +drm_atomic_get_new_connector_for_encoder(struct drm_atomic_state *state, |
|---|
| 476 | + struct drm_encoder *encoder); |
|---|
| 405 | 477 | |
|---|
| 406 | 478 | /** |
|---|
| 407 | | - * drm_atomic_get_existing_crtc_state - get crtc state, if it exists |
|---|
| 479 | + * drm_atomic_get_existing_crtc_state - get CRTC state, if it exists |
|---|
| 408 | 480 | * @state: global atomic state object |
|---|
| 409 | | - * @crtc: crtc to grab |
|---|
| 481 | + * @crtc: CRTC to grab |
|---|
| 410 | 482 | * |
|---|
| 411 | | - * This function returns the crtc state for the given crtc, or NULL |
|---|
| 412 | | - * if the crtc is not part of the global atomic state. |
|---|
| 483 | + * This function returns the CRTC state for the given CRTC, or NULL |
|---|
| 484 | + * if the CRTC is not part of the global atomic state. |
|---|
| 413 | 485 | * |
|---|
| 414 | 486 | * This function is deprecated, @drm_atomic_get_old_crtc_state or |
|---|
| 415 | 487 | * @drm_atomic_get_new_crtc_state should be used instead. |
|---|
| .. | .. |
|---|
| 422 | 494 | } |
|---|
| 423 | 495 | |
|---|
| 424 | 496 | /** |
|---|
| 425 | | - * drm_atomic_get_old_crtc_state - get old crtc state, if it exists |
|---|
| 497 | + * drm_atomic_get_old_crtc_state - get old CRTC state, if it exists |
|---|
| 426 | 498 | * @state: global atomic state object |
|---|
| 427 | | - * @crtc: crtc to grab |
|---|
| 499 | + * @crtc: CRTC to grab |
|---|
| 428 | 500 | * |
|---|
| 429 | | - * This function returns the old crtc state for the given crtc, or |
|---|
| 430 | | - * NULL if the crtc is not part of the global atomic state. |
|---|
| 501 | + * This function returns the old CRTC state for the given CRTC, or |
|---|
| 502 | + * NULL if the CRTC is not part of the global atomic state. |
|---|
| 431 | 503 | */ |
|---|
| 432 | 504 | static inline struct drm_crtc_state * |
|---|
| 433 | 505 | drm_atomic_get_old_crtc_state(struct drm_atomic_state *state, |
|---|
| .. | .. |
|---|
| 436 | 508 | return state->crtcs[drm_crtc_index(crtc)].old_state; |
|---|
| 437 | 509 | } |
|---|
| 438 | 510 | /** |
|---|
| 439 | | - * drm_atomic_get_new_crtc_state - get new crtc state, if it exists |
|---|
| 511 | + * drm_atomic_get_new_crtc_state - get new CRTC state, if it exists |
|---|
| 440 | 512 | * @state: global atomic state object |
|---|
| 441 | | - * @crtc: crtc to grab |
|---|
| 513 | + * @crtc: CRTC to grab |
|---|
| 442 | 514 | * |
|---|
| 443 | | - * This function returns the new crtc state for the given crtc, or |
|---|
| 444 | | - * NULL if the crtc is not part of the global atomic state. |
|---|
| 515 | + * This function returns the new CRTC state for the given CRTC, or |
|---|
| 516 | + * NULL if the CRTC is not part of the global atomic state. |
|---|
| 445 | 517 | */ |
|---|
| 446 | 518 | static inline struct drm_crtc_state * |
|---|
| 447 | 519 | drm_atomic_get_new_crtc_state(struct drm_atomic_state *state, |
|---|
| .. | .. |
|---|
| 598 | 670 | } |
|---|
| 599 | 671 | |
|---|
| 600 | 672 | int __must_check |
|---|
| 601 | | -drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state, |
|---|
| 602 | | - const struct drm_display_mode *mode); |
|---|
| 603 | | -int __must_check |
|---|
| 604 | | -drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state, |
|---|
| 605 | | - struct drm_property_blob *blob); |
|---|
| 606 | | -int __must_check |
|---|
| 607 | | -drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state, |
|---|
| 608 | | - struct drm_crtc *crtc); |
|---|
| 609 | | -void drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state, |
|---|
| 610 | | - struct drm_framebuffer *fb); |
|---|
| 611 | | -void drm_atomic_set_fence_for_plane(struct drm_plane_state *plane_state, |
|---|
| 612 | | - struct dma_fence *fence); |
|---|
| 613 | | -int __must_check |
|---|
| 614 | | -drm_atomic_set_crtc_for_connector(struct drm_connector_state *conn_state, |
|---|
| 615 | | - struct drm_crtc *crtc); |
|---|
| 616 | | -int drm_atomic_set_writeback_fb_for_connector( |
|---|
| 617 | | - struct drm_connector_state *conn_state, |
|---|
| 618 | | - struct drm_framebuffer *fb); |
|---|
| 673 | +drm_atomic_add_encoder_bridges(struct drm_atomic_state *state, |
|---|
| 674 | + struct drm_encoder *encoder); |
|---|
| 619 | 675 | int __must_check |
|---|
| 620 | 676 | drm_atomic_add_affected_connectors(struct drm_atomic_state *state, |
|---|
| 621 | 677 | struct drm_crtc *crtc); |
|---|
| .. | .. |
|---|
| 649 | 705 | (__i)++) \ |
|---|
| 650 | 706 | for_each_if ((__state)->connectors[__i].ptr && \ |
|---|
| 651 | 707 | ((connector) = (__state)->connectors[__i].ptr, \ |
|---|
| 708 | + (void)(connector) /* Only to avoid unused-but-set-variable warning */, \ |
|---|
| 652 | 709 | (old_connector_state) = (__state)->connectors[__i].old_state, \ |
|---|
| 653 | 710 | (new_connector_state) = (__state)->connectors[__i].new_state, 1)) |
|---|
| 654 | 711 | |
|---|
| .. | .. |
|---|
| 670 | 727 | (__i)++) \ |
|---|
| 671 | 728 | for_each_if ((__state)->connectors[__i].ptr && \ |
|---|
| 672 | 729 | ((connector) = (__state)->connectors[__i].ptr, \ |
|---|
| 730 | + (void)(connector) /* Only to avoid unused-but-set-variable warning */, \ |
|---|
| 673 | 731 | (old_connector_state) = (__state)->connectors[__i].old_state, 1)) |
|---|
| 674 | 732 | |
|---|
| 675 | 733 | /** |
|---|
| .. | .. |
|---|
| 690 | 748 | (__i)++) \ |
|---|
| 691 | 749 | for_each_if ((__state)->connectors[__i].ptr && \ |
|---|
| 692 | 750 | ((connector) = (__state)->connectors[__i].ptr, \ |
|---|
| 693 | | - (new_connector_state) = (__state)->connectors[__i].new_state, 1)) |
|---|
| 751 | + (void)(connector) /* Only to avoid unused-but-set-variable warning */, \ |
|---|
| 752 | + (new_connector_state) = (__state)->connectors[__i].new_state, \ |
|---|
| 753 | + (void)(new_connector_state) /* Only to avoid unused-but-set-variable warning */, 1)) |
|---|
| 694 | 754 | |
|---|
| 695 | 755 | /** |
|---|
| 696 | 756 | * for_each_oldnew_crtc_in_state - iterate over all CRTCs in an atomic update |
|---|
| .. | .. |
|---|
| 710 | 770 | (__i)++) \ |
|---|
| 711 | 771 | for_each_if ((__state)->crtcs[__i].ptr && \ |
|---|
| 712 | 772 | ((crtc) = (__state)->crtcs[__i].ptr, \ |
|---|
| 773 | + (void)(crtc) /* Only to avoid unused-but-set-variable warning */, \ |
|---|
| 713 | 774 | (old_crtc_state) = (__state)->crtcs[__i].old_state, \ |
|---|
| 775 | + (void)(old_crtc_state) /* Only to avoid unused-but-set-variable warning */, \ |
|---|
| 714 | 776 | (new_crtc_state) = (__state)->crtcs[__i].new_state, 1)) |
|---|
| 715 | 777 | |
|---|
| 716 | 778 | /** |
|---|
| .. | .. |
|---|
| 749 | 811 | (__i)++) \ |
|---|
| 750 | 812 | for_each_if ((__state)->crtcs[__i].ptr && \ |
|---|
| 751 | 813 | ((crtc) = (__state)->crtcs[__i].ptr, \ |
|---|
| 752 | | - (new_crtc_state) = (__state)->crtcs[__i].new_state, 1)) |
|---|
| 814 | + (void)(crtc) /* Only to avoid unused-but-set-variable warning */, \ |
|---|
| 815 | + (new_crtc_state) = (__state)->crtcs[__i].new_state, \ |
|---|
| 816 | + (void)(new_crtc_state) /* Only to avoid unused-but-set-variable warning */, 1)) |
|---|
| 753 | 817 | |
|---|
| 754 | 818 | /** |
|---|
| 755 | 819 | * for_each_oldnew_plane_in_state - iterate over all planes in an atomic update |
|---|
| .. | .. |
|---|
| 769 | 833 | (__i)++) \ |
|---|
| 770 | 834 | for_each_if ((__state)->planes[__i].ptr && \ |
|---|
| 771 | 835 | ((plane) = (__state)->planes[__i].ptr, \ |
|---|
| 836 | + (void)(plane) /* Only to avoid unused-but-set-variable warning */, \ |
|---|
| 772 | 837 | (old_plane_state) = (__state)->planes[__i].old_state,\ |
|---|
| 773 | 838 | (new_plane_state) = (__state)->planes[__i].new_state, 1)) |
|---|
| 774 | 839 | |
|---|
| .. | .. |
|---|
| 829 | 894 | (__i)++) \ |
|---|
| 830 | 895 | for_each_if ((__state)->planes[__i].ptr && \ |
|---|
| 831 | 896 | ((plane) = (__state)->planes[__i].ptr, \ |
|---|
| 832 | | - (new_plane_state) = (__state)->planes[__i].new_state, 1)) |
|---|
| 897 | + (void)(plane) /* Only to avoid unused-but-set-variable warning */, \ |
|---|
| 898 | + (new_plane_state) = (__state)->planes[__i].new_state, \ |
|---|
| 899 | + (void)(new_plane_state) /* Only to avoid unused-but-set-variable warning */, 1)) |
|---|
| 833 | 900 | |
|---|
| 834 | 901 | /** |
|---|
| 835 | 902 | * for_each_oldnew_private_obj_in_state - iterate over all private objects in an atomic update |
|---|
| .. | .. |
|---|
| 913 | 980 | state->connectors_changed; |
|---|
| 914 | 981 | } |
|---|
| 915 | 982 | |
|---|
| 916 | | -int drm_atomic_set_property(struct drm_atomic_state *state, |
|---|
| 917 | | - struct drm_mode_object *obj, |
|---|
| 918 | | - struct drm_property *prop, |
|---|
| 919 | | - uint64_t prop_value); |
|---|
| 983 | +/** |
|---|
| 984 | + * drm_atomic_crtc_effectively_active - compute whether CRTC is actually active |
|---|
| 985 | + * @state: &drm_crtc_state for the CRTC |
|---|
| 986 | + * |
|---|
| 987 | + * When in self refresh mode, the crtc_state->active value will be false, since |
|---|
| 988 | + * the CRTC is off. However in some cases we're interested in whether the CRTC |
|---|
| 989 | + * is active, or effectively active (ie: it's connected to an active display). |
|---|
| 990 | + * In these cases, use this function instead of just checking active. |
|---|
| 991 | + */ |
|---|
| 992 | +static inline bool |
|---|
| 993 | +drm_atomic_crtc_effectively_active(const struct drm_crtc_state *state) |
|---|
| 994 | +{ |
|---|
| 995 | + return state->active || state->self_refresh_active; |
|---|
| 996 | +} |
|---|
| 997 | + |
|---|
| 998 | +/** |
|---|
| 999 | + * struct drm_bus_cfg - bus configuration |
|---|
| 1000 | + * |
|---|
| 1001 | + * This structure stores the configuration of a physical bus between two |
|---|
| 1002 | + * components in an output pipeline, usually between two bridges, an encoder |
|---|
| 1003 | + * and a bridge, or a bridge and a connector. |
|---|
| 1004 | + * |
|---|
| 1005 | + * The bus configuration is stored in &drm_bridge_state separately for the |
|---|
| 1006 | + * input and output buses, as seen from the point of view of each bridge. The |
|---|
| 1007 | + * bus configuration of a bridge output is usually identical to the |
|---|
| 1008 | + * configuration of the next bridge's input, but may differ if the signals are |
|---|
| 1009 | + * modified between the two bridges, for instance by an inverter on the board. |
|---|
| 1010 | + * The input and output configurations of a bridge may differ if the bridge |
|---|
| 1011 | + * modifies the signals internally, for instance by performing format |
|---|
| 1012 | + * conversion, or modifying signals polarities. |
|---|
| 1013 | + */ |
|---|
| 1014 | +struct drm_bus_cfg { |
|---|
| 1015 | + /** |
|---|
| 1016 | + * @format: format used on this bus (one of the MEDIA_BUS_FMT_* format) |
|---|
| 1017 | + * |
|---|
| 1018 | + * This field should not be directly modified by drivers |
|---|
| 1019 | + * (drm_atomic_bridge_chain_select_bus_fmts() takes care of the bus |
|---|
| 1020 | + * format negotiation). |
|---|
| 1021 | + */ |
|---|
| 1022 | + u32 format; |
|---|
| 1023 | + |
|---|
| 1024 | + /** |
|---|
| 1025 | + * @flags: DRM_BUS_* flags used on this bus |
|---|
| 1026 | + */ |
|---|
| 1027 | + u32 flags; |
|---|
| 1028 | +}; |
|---|
| 1029 | + |
|---|
| 1030 | +/** |
|---|
| 1031 | + * struct drm_bridge_state - Atomic bridge state object |
|---|
| 1032 | + */ |
|---|
| 1033 | +struct drm_bridge_state { |
|---|
| 1034 | + /** |
|---|
| 1035 | + * @base: inherit from &drm_private_state |
|---|
| 1036 | + */ |
|---|
| 1037 | + struct drm_private_state base; |
|---|
| 1038 | + |
|---|
| 1039 | + /** |
|---|
| 1040 | + * @bridge: the bridge this state refers to |
|---|
| 1041 | + */ |
|---|
| 1042 | + struct drm_bridge *bridge; |
|---|
| 1043 | + |
|---|
| 1044 | + /** |
|---|
| 1045 | + * @input_bus_cfg: input bus configuration |
|---|
| 1046 | + */ |
|---|
| 1047 | + struct drm_bus_cfg input_bus_cfg; |
|---|
| 1048 | + |
|---|
| 1049 | + /** |
|---|
| 1050 | + * @output_bus_cfg: input bus configuration |
|---|
| 1051 | + */ |
|---|
| 1052 | + struct drm_bus_cfg output_bus_cfg; |
|---|
| 1053 | +}; |
|---|
| 1054 | + |
|---|
| 1055 | +static inline struct drm_bridge_state * |
|---|
| 1056 | +drm_priv_to_bridge_state(struct drm_private_state *priv) |
|---|
| 1057 | +{ |
|---|
| 1058 | + return container_of(priv, struct drm_bridge_state, base); |
|---|
| 1059 | +} |
|---|
| 1060 | + |
|---|
| 1061 | +struct drm_bridge_state * |
|---|
| 1062 | +drm_atomic_get_bridge_state(struct drm_atomic_state *state, |
|---|
| 1063 | + struct drm_bridge *bridge); |
|---|
| 1064 | +struct drm_bridge_state * |
|---|
| 1065 | +drm_atomic_get_old_bridge_state(struct drm_atomic_state *state, |
|---|
| 1066 | + struct drm_bridge *bridge); |
|---|
| 1067 | +struct drm_bridge_state * |
|---|
| 1068 | +drm_atomic_get_new_bridge_state(struct drm_atomic_state *state, |
|---|
| 1069 | + struct drm_bridge *bridge); |
|---|
| 920 | 1070 | |
|---|
| 921 | 1071 | #endif /* DRM_ATOMIC_H_ */ |
|---|