2 * Copyright © 2006 Keith Packard
3 * Copyright © 2007-2008 Dave Airlie
4 * Copyright © 2007-2008 Intel Corporation
5 * Jesse Barnes <jesse.barnes@intel.com>
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
25 #ifndef __DRM_CRTC_H__
26 #define __DRM_CRTC_H__
28 #include <linux/i2c.h>
29 #include <linux/spinlock.h>
30 #include <linux/types.h>
31 #include <linux/idr.h>
33 #include <linux/hdmi.h>
34 #include <linux/media-bus-format.h>
35 #include <uapi/drm/drm_mode.h>
36 #include <uapi/drm/drm_fourcc.h>
37 #include <drm/drm_modeset_lock.h>
38 #include <drm/drm_rect.h>
39 #include <drm/drm_mode_object.h>
40 #include <drm/drm_framebuffer.h>
41 #include <drm/drm_modes.h>
42 #include <drm/drm_connector.h>
43 #include <drm/drm_encoder.h>
53 static inline int64_t U642I64(uint64_t val)
55 return (int64_t)*((int64_t *)&val);
57 static inline uint64_t I642U64(int64_t val)
59 return (uint64_t)*((uint64_t *)&val);
63 * Rotation property bits. DRM_ROTATE_<degrees> rotates the image by the
64 * specified amount in degrees in counter clockwise direction. DRM_REFLECT_X and
65 * DRM_REFLECT_Y reflects the image along the specified axis prior to rotation
67 #define DRM_ROTATE_0 BIT(0)
68 #define DRM_ROTATE_90 BIT(1)
69 #define DRM_ROTATE_180 BIT(2)
70 #define DRM_ROTATE_270 BIT(3)
71 #define DRM_ROTATE_MASK (DRM_ROTATE_0 | DRM_ROTATE_90 | \
72 DRM_ROTATE_180 | DRM_ROTATE_270)
73 #define DRM_REFLECT_X BIT(4)
74 #define DRM_REFLECT_Y BIT(5)
75 #define DRM_REFLECT_MASK (DRM_REFLECT_X | DRM_REFLECT_Y)
77 /* data corresponds to displayid vend/prod/serial */
78 struct drm_tile_group {
80 struct drm_device *dev;
85 struct drm_property_blob {
86 struct drm_mode_object base;
87 struct drm_device *dev;
88 struct list_head head_global;
89 struct list_head head_file;
94 struct drm_property_enum {
96 struct list_head head;
97 char name[DRM_PROP_NAME_LEN];
100 struct drm_property {
101 struct list_head head;
102 struct drm_mode_object base;
104 char name[DRM_PROP_NAME_LEN];
107 struct drm_device *dev;
109 struct list_head enum_list;
114 struct drm_pending_vblank_event;
117 struct drm_atomic_state;
119 struct drm_crtc_helper_funcs;
120 struct drm_encoder_helper_funcs;
121 struct drm_plane_helper_funcs;
124 * struct drm_crtc_state - mutable CRTC state
125 * @crtc: backpointer to the CRTC
126 * @enable: whether the CRTC should be enabled, gates all other state
127 * @active: whether the CRTC is actively displaying (used for DPMS)
128 * @planes_changed: planes on this crtc are updated
129 * @mode_changed: crtc_state->mode or crtc_state->enable has been changed
130 * @active_changed: crtc_state->active has been toggled.
131 * @connectors_changed: connectors to this crtc have been updated
132 * @zpos_changed: zpos values of planes on this crtc have been updated
133 * @color_mgmt_changed: color management properties have changed (degamma or
134 * gamma LUT or CSC matrix)
135 * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes
136 * @connector_mask: bitmask of (1 << drm_connector_index(connector)) of attached connectors
137 * @encoder_mask: bitmask of (1 << drm_encoder_index(encoder)) of attached encoders
138 * @last_vblank_count: for helpers and drivers to capture the vblank of the
139 * update to ensure framebuffer cleanup isn't done too early
140 * @adjusted_mode: for use by helpers and drivers to compute adjusted mode timings
141 * @mode: current mode timings
142 * @mode_blob: &drm_property_blob for @mode
143 * @degamma_lut: Lookup table for converting framebuffer pixel data
144 * before apply the conversion matrix
145 * @ctm: Transformation matrix
146 * @gamma_lut: Lookup table for converting pixel data after the
148 * @event: optional pointer to a DRM event to signal upon completion of the
150 * @state: backpointer to global drm_atomic_state
152 * Note that the distinction between @enable and @active is rather subtile:
153 * Flipping @active while @enable is set without changing anything else may
154 * never return in a failure from the ->atomic_check callback. Userspace assumes
155 * that a DPMS On will always succeed. In other words: @enable controls resource
156 * assignment, @active controls the actual hardware state.
158 struct drm_crtc_state {
159 struct drm_crtc *crtc;
164 /* computed state bits used by helpers and drivers */
165 bool planes_changed : 1;
166 bool mode_changed : 1;
167 bool active_changed : 1;
168 bool connectors_changed : 1;
169 bool zpos_changed : 1;
170 bool color_mgmt_changed : 1;
172 /* attached planes bitmask:
173 * WARNING: transitional helpers do not maintain plane_mask so
174 * drivers not converted over to atomic helpers should not rely
175 * on plane_mask being accurate!
182 /* last_vblank_count: for vblank waits before cleanup */
183 u32 last_vblank_count;
185 /* adjusted_mode: for use by helpers and drivers */
186 struct drm_display_mode adjusted_mode;
188 struct drm_display_mode mode;
190 /* blob property to expose current mode to atomic userspace */
191 struct drm_property_blob *mode_blob;
193 /* blob property to expose color management to userspace */
194 struct drm_property_blob *degamma_lut;
195 struct drm_property_blob *ctm;
196 struct drm_property_blob *gamma_lut;
198 struct drm_pending_vblank_event *event;
200 struct drm_atomic_state *state;
204 * struct drm_crtc_funcs - control CRTCs for a given device
206 * The drm_crtc_funcs structure is the central CRTC management structure
207 * in the DRM. Each CRTC controls one or more connectors (note that the name
208 * CRTC is simply historical, a CRTC may control LVDS, VGA, DVI, TV out, etc.
209 * connectors, not just CRTs).
211 * Each driver is responsible for filling out this structure at startup time,
212 * in addition to providing other modesetting features, like i2c and DDC
215 struct drm_crtc_funcs {
219 * Reset CRTC hardware and software state to off. This function isn't
220 * called by the core directly, only through drm_mode_config_reset().
221 * It's not a helper hook only for historical reasons.
223 * Atomic drivers can use drm_atomic_helper_crtc_reset() to reset
224 * atomic state using this hook.
226 void (*reset)(struct drm_crtc *crtc);
231 * Update the cursor image. The cursor position is relative to the CRTC
232 * and can be partially or fully outside of the visible area.
234 * Note that contrary to all other KMS functions the legacy cursor entry
235 * points don't take a framebuffer object, but instead take directly a
236 * raw buffer object id from the driver's buffer manager (which is
237 * either GEM or TTM for current drivers).
239 * This entry point is deprecated, drivers should instead implement
240 * universal plane support and register a proper cursor plane using
241 * drm_crtc_init_with_planes().
243 * This callback is optional
247 * 0 on success or a negative error code on failure.
249 int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv,
250 uint32_t handle, uint32_t width, uint32_t height);
255 * Update the cursor image, including hotspot information. The hotspot
256 * must not affect the cursor position in CRTC coordinates, but is only
257 * meant as a hint for virtualized display hardware to coordinate the
258 * guests and hosts cursor position. The cursor hotspot is relative to
259 * the cursor image. Otherwise this works exactly like @cursor_set.
261 * This entry point is deprecated, drivers should instead implement
262 * universal plane support and register a proper cursor plane using
263 * drm_crtc_init_with_planes().
265 * This callback is optional.
269 * 0 on success or a negative error code on failure.
271 int (*cursor_set2)(struct drm_crtc *crtc, struct drm_file *file_priv,
272 uint32_t handle, uint32_t width, uint32_t height,
273 int32_t hot_x, int32_t hot_y);
278 * Update the cursor position. The cursor does not need to be visible
279 * when this hook is called.
281 * This entry point is deprecated, drivers should instead implement
282 * universal plane support and register a proper cursor plane using
283 * drm_crtc_init_with_planes().
285 * This callback is optional.
289 * 0 on success or a negative error code on failure.
291 int (*cursor_move)(struct drm_crtc *crtc, int x, int y);
296 * Set gamma on the CRTC.
298 * This callback is optional.
302 * Drivers that support gamma tables and also fbdev emulation through
303 * the provided helper library need to take care to fill out the gamma
304 * hooks for both. Currently there's a bit an unfortunate duplication
305 * going on, which should eventually be unified to just one set of
308 int (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
314 * Clean up plane resources. This is only called at driver unload time
315 * through drm_mode_config_cleanup() since a CRTC cannot be hotplugged
318 void (*destroy)(struct drm_crtc *crtc);
323 * This is the main legacy entry point to change the modeset state on a
324 * CRTC. All the details of the desired configuration are passed in a
325 * struct &drm_mode_set - see there for details.
327 * Drivers implementing atomic modeset should use
328 * drm_atomic_helper_set_config() to implement this hook.
332 * 0 on success or a negative error code on failure.
334 int (*set_config)(struct drm_mode_set *set);
339 * Legacy entry point to schedule a flip to the given framebuffer.
341 * Page flipping is a synchronization mechanism that replaces the frame
342 * buffer being scanned out by the CRTC with a new frame buffer during
343 * vertical blanking, avoiding tearing (except when requested otherwise
344 * through the DRM_MODE_PAGE_FLIP_ASYNC flag). When an application
345 * requests a page flip the DRM core verifies that the new frame buffer
346 * is large enough to be scanned out by the CRTC in the currently
347 * configured mode and then calls the CRTC ->page_flip() operation with a
348 * pointer to the new frame buffer.
350 * The driver must wait for any pending rendering to the new framebuffer
351 * to complete before executing the flip. It should also wait for any
352 * pending rendering from other drivers if the underlying buffer is a
355 * An application can request to be notified when the page flip has
356 * completed. The drm core will supply a struct &drm_event in the event
357 * parameter in this case. This can be handled by the
358 * drm_crtc_send_vblank_event() function, which the driver should call on
359 * the provided event upon completion of the flip. Note that if
360 * the driver supports vblank signalling and timestamping the vblank
361 * counters and timestamps must agree with the ones returned from page
362 * flip events. With the current vblank helper infrastructure this can
363 * be achieved by holding a vblank reference while the page flip is
364 * pending, acquired through drm_crtc_vblank_get() and released with
365 * drm_crtc_vblank_put(). Drivers are free to implement their own vblank
366 * counter and timestamp tracking though, e.g. if they have accurate
367 * timestamp registers in hardware.
369 * This callback is optional.
373 * Very early versions of the KMS ABI mandated that the driver must
374 * block (but not reject) any rendering to the old framebuffer until the
375 * flip operation has completed and the old framebuffer is no longer
376 * visible. This requirement has been lifted, and userspace is instead
377 * expected to request delivery of an event and wait with recycling old
378 * buffers until such has been received.
382 * 0 on success or a negative error code on failure. Note that if a
383 * ->page_flip() operation is already pending the callback should return
384 * -EBUSY. Pageflips on a disabled CRTC (either by setting a NULL mode
385 * or just runtime disabled through DPMS respectively the new atomic
386 * "ACTIVE" state) should result in an -EINVAL error code. Note that
387 * drm_atomic_helper_page_flip() checks this already for atomic drivers.
389 int (*page_flip)(struct drm_crtc *crtc,
390 struct drm_framebuffer *fb,
391 struct drm_pending_vblank_event *event,
397 * This is the legacy entry point to update a property attached to the
400 * Drivers implementing atomic modeset should use
401 * drm_atomic_helper_crtc_set_property() to implement this hook.
403 * This callback is optional if the driver does not support any legacy
404 * driver-private properties.
408 * 0 on success or a negative error code on failure.
410 int (*set_property)(struct drm_crtc *crtc,
411 struct drm_property *property, uint64_t val);
414 * @atomic_duplicate_state:
416 * Duplicate the current atomic state for this CRTC and return it.
417 * The core and helpers gurantee that any atomic state duplicated with
418 * this hook and still owned by the caller (i.e. not transferred to the
419 * driver by calling ->atomic_commit() from struct
420 * &drm_mode_config_funcs) will be cleaned up by calling the
421 * @atomic_destroy_state hook in this structure.
423 * Atomic drivers which don't subclass struct &drm_crtc should use
424 * drm_atomic_helper_crtc_duplicate_state(). Drivers that subclass the
425 * state structure to extend it with driver-private state should use
426 * __drm_atomic_helper_crtc_duplicate_state() to make sure shared state is
427 * duplicated in a consistent fashion across drivers.
429 * It is an error to call this hook before crtc->state has been
430 * initialized correctly.
434 * If the duplicate state references refcounted resources this hook must
435 * acquire a reference for each of them. The driver must release these
436 * references again in @atomic_destroy_state.
440 * Duplicated atomic state or NULL when the allocation failed.
442 struct drm_crtc_state *(*atomic_duplicate_state)(struct drm_crtc *crtc);
445 * @atomic_destroy_state:
447 * Destroy a state duplicated with @atomic_duplicate_state and release
448 * or unreference all resources it references
450 void (*atomic_destroy_state)(struct drm_crtc *crtc,
451 struct drm_crtc_state *state);
454 * @atomic_set_property:
456 * Decode a driver-private property value and store the decoded value
457 * into the passed-in state structure. Since the atomic core decodes all
458 * standardized properties (even for extensions beyond the core set of
459 * properties which might not be implemented by all drivers) this
460 * requires drivers to subclass the state structure.
462 * Such driver-private properties should really only be implemented for
463 * truly hardware/vendor specific state. Instead it is preferred to
464 * standardize atomic extension and decode the properties used to expose
465 * such an extension in the core.
467 * Do not call this function directly, use
468 * drm_atomic_crtc_set_property() instead.
470 * This callback is optional if the driver does not support any
471 * driver-private atomic properties.
475 * This function is called in the state assembly phase of atomic
476 * modesets, which can be aborted for any reason (including on
477 * userspace's request to just check whether a configuration would be
478 * possible). Drivers MUST NOT touch any persistent state (hardware or
479 * software) or data structures except the passed in @state parameter.
481 * Also since userspace controls in which order properties are set this
482 * function must not do any input validation (since the state update is
483 * incomplete and hence likely inconsistent). Instead any such input
484 * validation must be done in the various atomic_check callbacks.
488 * 0 if the property has been found, -EINVAL if the property isn't
489 * implemented by the driver (which should never happen, the core only
490 * asks for properties attached to this CRTC). No other validation is
491 * allowed by the driver. The core already checks that the property
492 * value is within the range (integer, valid enum value, ...) the driver
493 * set when registering the property.
495 int (*atomic_set_property)(struct drm_crtc *crtc,
496 struct drm_crtc_state *state,
497 struct drm_property *property,
500 * @atomic_get_property:
502 * Reads out the decoded driver-private property. This is used to
503 * implement the GETCRTC IOCTL.
505 * Do not call this function directly, use
506 * drm_atomic_crtc_get_property() instead.
508 * This callback is optional if the driver does not support any
509 * driver-private atomic properties.
513 * 0 on success, -EINVAL if the property isn't implemented by the
514 * driver (which should never happen, the core only asks for
515 * properties attached to this CRTC).
517 int (*atomic_get_property)(struct drm_crtc *crtc,
518 const struct drm_crtc_state *state,
519 struct drm_property *property,
525 * This optional hook can be used to register additional userspace
526 * interfaces attached to the crtc like debugfs interfaces.
527 * It is called late in the driver load sequence from drm_dev_register().
528 * Everything added from this callback should be unregistered in
529 * the early_unregister callback.
533 * 0 on success, or a negative error code on failure.
535 int (*late_register)(struct drm_crtc *crtc);
540 * This optional hook should be used to unregister the additional
541 * userspace interfaces attached to the crtc from
542 * late_unregister(). It is called from drm_dev_unregister(),
543 * early in the driver unload sequence to disable userspace access
544 * before data structures are torndown.
546 void (*early_unregister)(struct drm_crtc *crtc);
550 * struct drm_crtc - central CRTC control structure
551 * @dev: parent DRM device
552 * @port: OF node used by drm_of_find_possible_crtcs()
553 * @head: list management
554 * @name: human readable name, can be overwritten by the driver
555 * @mutex: per-CRTC locking
556 * @base: base KMS object for ID tracking etc.
557 * @primary: primary plane for this CRTC
558 * @cursor: cursor plane for this CRTC
559 * @cursor_x: current x position of the cursor, used for universal cursor planes
560 * @cursor_y: current y position of the cursor, used for universal cursor planes
561 * @enabled: is this CRTC enabled?
562 * @mode: current mode timings
563 * @hwmode: mode timings as programmed to hw regs
564 * @x: x position on screen
565 * @y: y position on screen
566 * @funcs: CRTC control functions
567 * @gamma_size: size of gamma ramp
568 * @gamma_store: gamma ramp values
569 * @helper_private: mid-layer private data
570 * @properties: property tracking for this CRTC
572 * Each CRTC may have one or more connectors associated with it. This structure
573 * allows the CRTC to be controlled.
576 struct drm_device *dev;
577 struct device_node *port;
578 struct list_head head;
585 * This provides a read lock for the overall crtc state (mode, dpms
586 * state, ...) and a write lock for everything which can be update
587 * without a full modeset (fb, cursor data, crtc properties ...). Full
588 * modeset also need to grab dev->mode_config.connection_mutex.
590 struct drm_modeset_lock mutex;
592 struct drm_mode_object base;
594 /* primary and cursor planes for CRTC */
595 struct drm_plane *primary;
596 struct drm_plane *cursor;
599 * @index: Position inside the mode_config.list, can be used as an array
600 * index. It is invariant over the lifetime of the CRTC.
604 /* position of cursor plane on crtc */
610 /* Requested mode from modesetting. */
611 struct drm_display_mode mode;
613 /* Programmed mode in hw, after adjustments for encoders,
614 * crtc, panel scaling etc. Needed for timestamping etc.
616 struct drm_display_mode hwmode;
619 const struct drm_crtc_funcs *funcs;
621 /* Legacy FB CRTC gamma size for reporting to userspace */
623 uint16_t *gamma_store;
625 /* if you are using the helper */
626 const struct drm_crtc_helper_funcs *helper_private;
628 struct drm_object_properties properties;
633 * Current atomic state for this CRTC.
635 struct drm_crtc_state *state;
640 * List of &drm_crtc_commit structures tracking pending commits.
641 * Protected by @commit_lock. This list doesn't hold its own full
642 * reference, but burrows it from the ongoing commit. Commit entries
643 * must be removed from this list once the commit is fully completed,
644 * but before it's correspoding &drm_atomic_state gets destroyed.
646 struct list_head commit_list;
651 * Spinlock to protect @commit_list.
653 spinlock_t commit_lock;
658 * Per-CRTC implicit acquire context used by atomic drivers for legacy
659 * IOCTLs, so that atomic drivers can get at the locking acquire
662 struct drm_modeset_acquire_ctx *acquire_ctx;
666 * struct drm_plane_state - mutable plane state
667 * @plane: backpointer to the plane
668 * @crtc: currently bound CRTC, NULL if disabled
669 * @fb: currently bound framebuffer
670 * @fence: optional fence to wait for before scanning out @fb
671 * @crtc_x: left position of visible portion of plane on crtc
672 * @crtc_y: upper position of visible portion of plane on crtc
673 * @crtc_w: width of visible portion of plane on crtc
674 * @crtc_h: height of visible portion of plane on crtc
675 * @src_x: left position of visible portion of plane within
677 * @src_y: upper position of visible portion of plane within
679 * @src_w: width of visible portion of plane (in 16.16)
680 * @src_h: height of visible portion of plane (in 16.16)
681 * @rotation: rotation of the plane
682 * @zpos: priority of the given plane on crtc (optional)
683 * @normalized_zpos: normalized value of zpos: unique, range from 0 to N-1
684 * where N is the number of active planes for given crtc
685 * @src: clipped source coordinates of the plane (in 16.16)
686 * @dst: clipped destination coordinates of the plane
687 * @visible: visibility of the plane
688 * @state: backpointer to global drm_atomic_state
690 struct drm_plane_state {
691 struct drm_plane *plane;
693 struct drm_crtc *crtc; /* do not write directly, use drm_atomic_set_crtc_for_plane() */
694 struct drm_framebuffer *fb; /* do not write directly, use drm_atomic_set_fb_for_plane() */
697 /* Signed dest location allows it to be partially off screen */
698 int32_t crtc_x, crtc_y;
699 uint32_t crtc_w, crtc_h;
701 /* Source values are 16.16 fixed point */
702 uint32_t src_x, src_y;
703 uint32_t src_h, src_w;
706 unsigned int rotation;
710 unsigned int normalized_zpos;
712 /* Clipped coordinates */
713 struct drm_rect src, dst;
716 * Is the plane actually visible? Can be false even
717 * if fb!=NULL and crtc!=NULL, due to clipping.
721 struct drm_atomic_state *state;
726 * struct drm_plane_funcs - driver plane control functions
728 struct drm_plane_funcs {
732 * This is the legacy entry point to enable and configure the plane for
733 * the given CRTC and framebuffer. It is never called to disable the
734 * plane, i.e. the passed-in crtc and fb paramters are never NULL.
736 * The source rectangle in frame buffer memory coordinates is given by
737 * the src_x, src_y, src_w and src_h parameters (as 16.16 fixed point
738 * values). Devices that don't support subpixel plane coordinates can
739 * ignore the fractional part.
741 * The destination rectangle in CRTC coordinates is given by the
742 * crtc_x, crtc_y, crtc_w and crtc_h parameters (as integer values).
743 * Devices scale the source rectangle to the destination rectangle. If
744 * scaling is not supported, and the source rectangle size doesn't match
745 * the destination rectangle size, the driver must return a
746 * -<errorname>EINVAL</errorname> error.
748 * Drivers implementing atomic modeset should use
749 * drm_atomic_helper_update_plane() to implement this hook.
753 * 0 on success or a negative error code on failure.
755 int (*update_plane)(struct drm_plane *plane,
756 struct drm_crtc *crtc, struct drm_framebuffer *fb,
757 int crtc_x, int crtc_y,
758 unsigned int crtc_w, unsigned int crtc_h,
759 uint32_t src_x, uint32_t src_y,
760 uint32_t src_w, uint32_t src_h);
765 * This is the legacy entry point to disable the plane. The DRM core
766 * calls this method in response to a DRM_IOCTL_MODE_SETPLANE IOCTL call
767 * with the frame buffer ID set to 0. Disabled planes must not be
768 * processed by the CRTC.
770 * Drivers implementing atomic modeset should use
771 * drm_atomic_helper_disable_plane() to implement this hook.
775 * 0 on success or a negative error code on failure.
777 int (*disable_plane)(struct drm_plane *plane);
782 * Clean up plane resources. This is only called at driver unload time
783 * through drm_mode_config_cleanup() since a plane cannot be hotplugged
786 void (*destroy)(struct drm_plane *plane);
791 * Reset plane hardware and software state to off. This function isn't
792 * called by the core directly, only through drm_mode_config_reset().
793 * It's not a helper hook only for historical reasons.
795 * Atomic drivers can use drm_atomic_helper_plane_reset() to reset
796 * atomic state using this hook.
798 void (*reset)(struct drm_plane *plane);
803 * This is the legacy entry point to update a property attached to the
806 * Drivers implementing atomic modeset should use
807 * drm_atomic_helper_plane_set_property() to implement this hook.
809 * This callback is optional if the driver does not support any legacy
810 * driver-private properties.
814 * 0 on success or a negative error code on failure.
816 int (*set_property)(struct drm_plane *plane,
817 struct drm_property *property, uint64_t val);
820 * @atomic_duplicate_state:
822 * Duplicate the current atomic state for this plane and return it.
823 * The core and helpers gurantee that any atomic state duplicated with
824 * this hook and still owned by the caller (i.e. not transferred to the
825 * driver by calling ->atomic_commit() from struct
826 * &drm_mode_config_funcs) will be cleaned up by calling the
827 * @atomic_destroy_state hook in this structure.
829 * Atomic drivers which don't subclass struct &drm_plane_state should use
830 * drm_atomic_helper_plane_duplicate_state(). Drivers that subclass the
831 * state structure to extend it with driver-private state should use
832 * __drm_atomic_helper_plane_duplicate_state() to make sure shared state is
833 * duplicated in a consistent fashion across drivers.
835 * It is an error to call this hook before plane->state has been
836 * initialized correctly.
840 * If the duplicate state references refcounted resources this hook must
841 * acquire a reference for each of them. The driver must release these
842 * references again in @atomic_destroy_state.
846 * Duplicated atomic state or NULL when the allocation failed.
848 struct drm_plane_state *(*atomic_duplicate_state)(struct drm_plane *plane);
851 * @atomic_destroy_state:
853 * Destroy a state duplicated with @atomic_duplicate_state and release
854 * or unreference all resources it references
856 void (*atomic_destroy_state)(struct drm_plane *plane,
857 struct drm_plane_state *state);
860 * @atomic_set_property:
862 * Decode a driver-private property value and store the decoded value
863 * into the passed-in state structure. Since the atomic core decodes all
864 * standardized properties (even for extensions beyond the core set of
865 * properties which might not be implemented by all drivers) this
866 * requires drivers to subclass the state structure.
868 * Such driver-private properties should really only be implemented for
869 * truly hardware/vendor specific state. Instead it is preferred to
870 * standardize atomic extension and decode the properties used to expose
871 * such an extension in the core.
873 * Do not call this function directly, use
874 * drm_atomic_plane_set_property() instead.
876 * This callback is optional if the driver does not support any
877 * driver-private atomic properties.
881 * This function is called in the state assembly phase of atomic
882 * modesets, which can be aborted for any reason (including on
883 * userspace's request to just check whether a configuration would be
884 * possible). Drivers MUST NOT touch any persistent state (hardware or
885 * software) or data structures except the passed in @state parameter.
887 * Also since userspace controls in which order properties are set this
888 * function must not do any input validation (since the state update is
889 * incomplete and hence likely inconsistent). Instead any such input
890 * validation must be done in the various atomic_check callbacks.
894 * 0 if the property has been found, -EINVAL if the property isn't
895 * implemented by the driver (which shouldn't ever happen, the core only
896 * asks for properties attached to this plane). No other validation is
897 * allowed by the driver. The core already checks that the property
898 * value is within the range (integer, valid enum value, ...) the driver
899 * set when registering the property.
901 int (*atomic_set_property)(struct drm_plane *plane,
902 struct drm_plane_state *state,
903 struct drm_property *property,
907 * @atomic_get_property:
909 * Reads out the decoded driver-private property. This is used to
910 * implement the GETPLANE IOCTL.
912 * Do not call this function directly, use
913 * drm_atomic_plane_get_property() instead.
915 * This callback is optional if the driver does not support any
916 * driver-private atomic properties.
920 * 0 on success, -EINVAL if the property isn't implemented by the
921 * driver (which should never happen, the core only asks for
922 * properties attached to this plane).
924 int (*atomic_get_property)(struct drm_plane *plane,
925 const struct drm_plane_state *state,
926 struct drm_property *property,
931 * This optional hook can be used to register additional userspace
932 * interfaces attached to the plane like debugfs interfaces.
933 * It is called late in the driver load sequence from drm_dev_register().
934 * Everything added from this callback should be unregistered in
935 * the early_unregister callback.
939 * 0 on success, or a negative error code on failure.
941 int (*late_register)(struct drm_plane *plane);
946 * This optional hook should be used to unregister the additional
947 * userspace interfaces attached to the plane from
948 * late_unregister(). It is called from drm_dev_unregister(),
949 * early in the driver unload sequence to disable userspace access
950 * before data structures are torndown.
952 void (*early_unregister)(struct drm_plane *plane);
955 enum drm_plane_type {
956 DRM_PLANE_TYPE_OVERLAY,
957 DRM_PLANE_TYPE_PRIMARY,
958 DRM_PLANE_TYPE_CURSOR,
963 * struct drm_plane - central DRM plane control structure
964 * @dev: DRM device this plane belongs to
965 * @head: for list management
966 * @name: human readable name, can be overwritten by the driver
967 * @base: base mode object
968 * @possible_crtcs: pipes this plane can be bound to
969 * @format_types: array of formats supported by this plane
970 * @format_count: number of formats supported
971 * @format_default: driver hasn't supplied supported formats for the plane
972 * @crtc: currently bound CRTC
973 * @fb: currently bound fb
974 * @old_fb: Temporary tracking of the old fb while a modeset is ongoing. Used by
975 * drm_mode_set_config_internal() to implement correct refcounting.
976 * @funcs: helper functions
977 * @properties: property tracking for this plane
978 * @type: type of plane (overlay, primary, cursor)
979 * @state: current atomic state for this plane
980 * @zpos_property: zpos property for this plane
981 * @helper_private: mid-layer private data
984 struct drm_device *dev;
985 struct list_head head;
992 * Protects modeset plane state, together with the mutex of &drm_crtc
993 * this plane is linked to (when active, getting actived or getting
996 struct drm_modeset_lock mutex;
998 struct drm_mode_object base;
1000 uint32_t possible_crtcs;
1001 uint32_t *format_types;
1002 unsigned int format_count;
1003 bool format_default;
1005 struct drm_crtc *crtc;
1006 struct drm_framebuffer *fb;
1008 struct drm_framebuffer *old_fb;
1010 const struct drm_plane_funcs *funcs;
1012 struct drm_object_properties properties;
1014 enum drm_plane_type type;
1017 * @index: Position inside the mode_config.list, can be used as an array
1018 * index. It is invariant over the lifetime of the plane.
1022 const struct drm_plane_helper_funcs *helper_private;
1024 struct drm_plane_state *state;
1026 struct drm_property *zpos_property;
1030 * struct drm_bridge_funcs - drm_bridge control functions
1032 struct drm_bridge_funcs {
1036 * This callback is invoked whenever our bridge is being attached to a
1039 * The attach callback is optional.
1043 * Zero on success, error code on failure.
1045 int (*attach)(struct drm_bridge *bridge);
1050 * This callback is invoked whenever our bridge is being detached from a
1053 * The detach callback is optional.
1055 void (*detach)(struct drm_bridge *bridge);
1060 * This callback is used to validate and adjust a mode. The paramater
1061 * mode is the display mode that should be fed to the next element in
1062 * the display chain, either the final &drm_connector or the next
1063 * &drm_bridge. The parameter adjusted_mode is the input mode the bridge
1064 * requires. It can be modified by this callback and does not need to
1067 * This is the only hook that allows a bridge to reject a modeset. If
1068 * this function passes all other callbacks must succeed for this
1071 * The mode_fixup callback is optional.
1075 * This function is called in the check phase of atomic modesets, which
1076 * can be aborted for any reason (including on userspace's request to
1077 * just check whether a configuration would be possible). Drivers MUST
1078 * NOT touch any persistent state (hardware or software) or data
1079 * structures except the passed in @state parameter.
1083 * True if an acceptable configuration is possible, false if the modeset
1084 * operation should be rejected.
1086 bool (*mode_fixup)(struct drm_bridge *bridge,
1087 const struct drm_display_mode *mode,
1088 struct drm_display_mode *adjusted_mode);
1092 * This callback should disable the bridge. It is called right before
1093 * the preceding element in the display pipe is disabled. If the
1094 * preceding element is a bridge this means it's called before that
1095 * bridge's ->disable() function. If the preceding element is a
1096 * &drm_encoder it's called right before the encoder's ->disable(),
1097 * ->prepare() or ->dpms() hook from struct &drm_encoder_helper_funcs.
1099 * The bridge can assume that the display pipe (i.e. clocks and timing
1100 * signals) feeding it is still running when this callback is called.
1102 * The disable callback is optional.
1104 void (*disable)(struct drm_bridge *bridge);
1109 * This callback should disable the bridge. It is called right after
1110 * the preceding element in the display pipe is disabled. If the
1111 * preceding element is a bridge this means it's called after that
1112 * bridge's ->post_disable() function. If the preceding element is a
1113 * &drm_encoder it's called right after the encoder's ->disable(),
1114 * ->prepare() or ->dpms() hook from struct &drm_encoder_helper_funcs.
1116 * The bridge must assume that the display pipe (i.e. clocks and timing
1117 * singals) feeding it is no longer running when this callback is
1120 * The post_disable callback is optional.
1122 void (*post_disable)(struct drm_bridge *bridge);
1127 * This callback should set the given mode on the bridge. It is called
1128 * after the ->mode_set() callback for the preceding element in the
1129 * display pipeline has been called already. The display pipe (i.e.
1130 * clocks and timing signals) is off when this function is called.
1132 void (*mode_set)(struct drm_bridge *bridge,
1133 struct drm_display_mode *mode,
1134 struct drm_display_mode *adjusted_mode);
1138 * This callback should enable the bridge. It is called right before
1139 * the preceding element in the display pipe is enabled. If the
1140 * preceding element is a bridge this means it's called before that
1141 * bridge's ->pre_enable() function. If the preceding element is a
1142 * &drm_encoder it's called right before the encoder's ->enable(),
1143 * ->commit() or ->dpms() hook from struct &drm_encoder_helper_funcs.
1145 * The display pipe (i.e. clocks and timing signals) feeding this bridge
1146 * will not yet be running when this callback is called. The bridge must
1147 * not enable the display link feeding the next bridge in the chain (if
1148 * there is one) when this callback is called.
1150 * The pre_enable callback is optional.
1152 void (*pre_enable)(struct drm_bridge *bridge);
1157 * This callback should enable the bridge. It is called right after
1158 * the preceding element in the display pipe is enabled. If the
1159 * preceding element is a bridge this means it's called after that
1160 * bridge's ->enable() function. If the preceding element is a
1161 * &drm_encoder it's called right after the encoder's ->enable(),
1162 * ->commit() or ->dpms() hook from struct &drm_encoder_helper_funcs.
1164 * The bridge can assume that the display pipe (i.e. clocks and timing
1165 * signals) feeding it is running when this callback is called. This
1166 * callback must enable the display link feeding the next bridge in the
1167 * chain if there is one.
1169 * The enable callback is optional.
1171 void (*enable)(struct drm_bridge *bridge);
1175 * struct drm_bridge - central DRM bridge control structure
1176 * @dev: DRM device this bridge belongs to
1177 * @encoder: encoder to which this bridge is connected
1178 * @next: the next bridge in the encoder chain
1179 * @of_node: device node pointer to the bridge
1180 * @list: to keep track of all added bridges
1181 * @funcs: control functions
1182 * @driver_private: pointer to the bridge driver's internal context
1185 struct drm_device *dev;
1186 struct drm_encoder *encoder;
1187 struct drm_bridge *next;
1189 struct device_node *of_node;
1191 struct list_head list;
1193 const struct drm_bridge_funcs *funcs;
1194 void *driver_private;
1198 * struct drm_crtc_commit - track modeset commits on a CRTC
1200 * This structure is used to track pending modeset changes and atomic commit on
1201 * a per-CRTC basis. Since updating the list should never block this structure
1202 * is reference counted to allow waiters to safely wait on an event to complete,
1203 * without holding any locks.
1205 * It has 3 different events in total to allow a fine-grained synchronization
1206 * between outstanding updates::
1208 * atomic commit thread hardware
1210 * write new state into hardware ----> ...
1212 * switch to new state on next
1215 * wait for buffers to show up ...
1217 * ... send completion irq
1218 * irq handler signals flip_done
1219 * cleanup old buffers
1221 * signal cleanup_done
1223 * wait for flip_done <----
1224 * clean up atomic state
1226 * The important bit to know is that cleanup_done is the terminal event, but the
1227 * ordering between flip_done and hw_done is entirely up to the specific driver
1228 * and modeset state change.
1230 * For an implementation of how to use this look at
1231 * drm_atomic_helper_setup_commit() from the atomic helper library.
1233 struct drm_crtc_commit {
1237 * DRM CRTC for this commit.
1239 struct drm_crtc *crtc;
1244 * Reference count for this structure. Needed to allow blocking on
1245 * completions without the risk of the completion disappearing
1253 * Will be signaled when the hardware has flipped to the new set of
1254 * buffers. Signals at the same time as when the drm event for this
1255 * commit is sent to userspace, or when an out-fence is singalled. Note
1256 * that for most hardware, in most cases this happens after @hw_done is
1259 struct completion flip_done;
1264 * Will be signalled when all hw register changes for this commit have
1265 * been written out. Especially when disabling a pipe this can be much
1266 * later than than @flip_done, since that can signal already when the
1267 * screen goes black, whereas to fully shut down a pipe more register
1270 * Note that this does not need to include separately reference-counted
1271 * resources like backing storage buffer pinning, or runtime pm
1274 struct completion hw_done;
1279 * Will be signalled after old buffers have been cleaned up by calling
1280 * drm_atomic_helper_cleanup_planes(). Since this can only happen after
1281 * a vblank wait completed it might be a bit later. This completion is
1282 * useful to throttle updates and avoid hardware updates getting ahead
1283 * of the buffer cleanup too much.
1285 struct completion cleanup_done;
1290 * Entry on the per-CRTC commit_list. Protected by crtc->commit_lock.
1292 struct list_head commit_entry;
1297 * &drm_pending_vblank_event pointer to clean up private events.
1299 struct drm_pending_vblank_event *event;
1302 struct __drm_planes_state {
1303 struct drm_plane *ptr;
1304 struct drm_plane_state *state;
1307 struct __drm_crtcs_state {
1308 struct drm_crtc *ptr;
1309 struct drm_crtc_state *state;
1310 struct drm_crtc_commit *commit;
1313 struct __drm_connnectors_state {
1314 struct drm_connector *ptr;
1315 struct drm_connector_state *state;
1319 * struct drm_atomic_state - the global state object for atomic updates
1320 * @dev: parent DRM device
1321 * @allow_modeset: allow full modeset
1322 * @legacy_cursor_update: hint to enforce legacy cursor IOCTL semantics
1323 * @legacy_set_config: Disable conflicting encoders instead of failing with -EINVAL.
1324 * @planes: pointer to array of structures with per-plane data
1325 * @crtcs: pointer to array of CRTC pointers
1326 * @num_connector: size of the @connectors and @connector_states arrays
1327 * @connectors: pointer to array of structures with per-connector data
1328 * @acquire_ctx: acquire context for this atomic modeset state update
1330 struct drm_atomic_state {
1331 struct drm_device *dev;
1332 bool allow_modeset : 1;
1333 bool legacy_cursor_update : 1;
1334 bool legacy_set_config : 1;
1335 struct __drm_planes_state *planes;
1336 struct __drm_crtcs_state *crtcs;
1338 struct __drm_connnectors_state *connectors;
1340 struct drm_modeset_acquire_ctx *acquire_ctx;
1345 * Work item which can be used by the driver or helpers to execute the
1346 * commit without blocking.
1348 struct work_struct commit_work;
1353 * struct drm_mode_set - new values for a CRTC config change
1354 * @fb: framebuffer to use for new config
1355 * @crtc: CRTC whose configuration we're about to change
1356 * @mode: mode timings to use
1357 * @x: position of this CRTC relative to @fb
1358 * @y: position of this CRTC relative to @fb
1359 * @connectors: array of connectors to drive with this CRTC if possible
1360 * @num_connectors: size of @connectors array
1362 * Represents a single crtc the connectors that it drives with what mode
1363 * and from which framebuffer it scans out from.
1365 * This is used to set modes.
1367 struct drm_mode_set {
1368 struct drm_framebuffer *fb;
1369 struct drm_crtc *crtc;
1370 struct drm_display_mode *mode;
1375 struct drm_connector **connectors;
1376 size_t num_connectors;
1380 * struct drm_mode_config_funcs - basic driver provided mode setting functions
1382 * Some global (i.e. not per-CRTC, connector, etc) mode setting functions that
1385 struct drm_mode_config_funcs {
1389 * Create a new framebuffer object. The core does basic checks on the
1390 * requested metadata, but most of that is left to the driver. See
1391 * struct &drm_mode_fb_cmd2 for details.
1393 * If the parameters are deemed valid and the backing storage objects in
1394 * the underlying memory manager all exist, then the driver allocates
1395 * a new &drm_framebuffer structure, subclassed to contain
1396 * driver-specific information (like the internal native buffer object
1397 * references). It also needs to fill out all relevant metadata, which
1398 * should be done by calling drm_helper_mode_fill_fb_struct().
1400 * The initialization is finalized by calling drm_framebuffer_init(),
1401 * which registers the framebuffer and makes it accessible to other
1406 * A new framebuffer with an initial reference count of 1 or a negative
1407 * error code encoded with ERR_PTR().
1409 struct drm_framebuffer *(*fb_create)(struct drm_device *dev,
1410 struct drm_file *file_priv,
1411 const struct drm_mode_fb_cmd2 *mode_cmd);
1414 * @output_poll_changed:
1416 * Callback used by helpers to inform the driver of output configuration
1419 * Drivers implementing fbdev emulation with the helpers can call
1420 * drm_fb_helper_hotplug_changed from this hook to inform the fbdev
1421 * helper of output changes.
1425 * Except that there's no vtable for device-level helper callbacks
1426 * there's no reason this is a core function.
1428 void (*output_poll_changed)(struct drm_device *dev);
1433 * This is the only hook to validate an atomic modeset update. This
1434 * function must reject any modeset and state changes which the hardware
1435 * or driver doesn't support. This includes but is of course not limited
1438 * - Checking that the modes, framebuffers, scaling and placement
1439 * requirements and so on are within the limits of the hardware.
1441 * - Checking that any hidden shared resources are not oversubscribed.
1442 * This can be shared PLLs, shared lanes, overall memory bandwidth,
1443 * display fifo space (where shared between planes or maybe even
1446 * - Checking that virtualized resources exported to userspace are not
1447 * oversubscribed. For various reasons it can make sense to expose
1448 * more planes, crtcs or encoders than which are physically there. One
1449 * example is dual-pipe operations (which generally should be hidden
1450 * from userspace if when lockstepped in hardware, exposed otherwise),
1451 * where a plane might need 1 hardware plane (if it's just on one
1452 * pipe), 2 hardware planes (when it spans both pipes) or maybe even
1453 * shared a hardware plane with a 2nd plane (if there's a compatible
1454 * plane requested on the area handled by the other pipe).
1456 * - Check that any transitional state is possible and that if
1457 * requested, the update can indeed be done in the vblank period
1458 * without temporarily disabling some functions.
1460 * - Check any other constraints the driver or hardware might have.
1462 * - This callback also needs to correctly fill out the &drm_crtc_state
1463 * in this update to make sure that drm_atomic_crtc_needs_modeset()
1464 * reflects the nature of the possible update and returns true if and
1465 * only if the update cannot be applied without tearing within one
1466 * vblank on that CRTC. The core uses that information to reject
1467 * updates which require a full modeset (i.e. blanking the screen, or
1468 * at least pausing updates for a substantial amount of time) if
1469 * userspace has disallowed that in its request.
1471 * - The driver also does not need to repeat basic input validation
1472 * like done for the corresponding legacy entry points. The core does
1473 * that before calling this hook.
1475 * See the documentation of @atomic_commit for an exhaustive list of
1476 * error conditions which don't have to be checked at the
1477 * ->atomic_check() stage?
1479 * See the documentation for struct &drm_atomic_state for how exactly
1480 * an atomic modeset update is described.
1482 * Drivers using the atomic helpers can implement this hook using
1483 * drm_atomic_helper_check(), or one of the exported sub-functions of
1488 * 0 on success or one of the below negative error codes:
1490 * - -EINVAL, if any of the above constraints are violated.
1492 * - -EDEADLK, when returned from an attempt to acquire an additional
1493 * &drm_modeset_lock through drm_modeset_lock().
1495 * - -ENOMEM, if allocating additional state sub-structures failed due
1496 * to lack of memory.
1498 * - -EINTR, -EAGAIN or -ERESTARTSYS, if the IOCTL should be restarted.
1499 * This can either be due to a pending signal, or because the driver
1500 * needs to completely bail out to recover from an exceptional
1501 * situation like a GPU hang. From a userspace point all errors are
1504 int (*atomic_check)(struct drm_device *dev,
1505 struct drm_atomic_state *state);
1510 * This is the only hook to commit an atomic modeset update. The core
1511 * guarantees that @atomic_check has been called successfully before
1512 * calling this function, and that nothing has been changed in the
1515 * See the documentation for struct &drm_atomic_state for how exactly
1516 * an atomic modeset update is described.
1518 * Drivers using the atomic helpers can implement this hook using
1519 * drm_atomic_helper_commit(), or one of the exported sub-functions of
1522 * Nonblocking commits (as indicated with the nonblock parameter) must
1523 * do any preparatory work which might result in an unsuccessful commit
1524 * in the context of this callback. The only exceptions are hardware
1525 * errors resulting in -EIO. But even in that case the driver must
1526 * ensure that the display pipe is at least running, to avoid
1527 * compositors crashing when pageflips don't work. Anything else,
1528 * specifically committing the update to the hardware, should be done
1529 * without blocking the caller. For updates which do not require a
1530 * modeset this must be guaranteed.
1532 * The driver must wait for any pending rendering to the new
1533 * framebuffers to complete before executing the flip. It should also
1534 * wait for any pending rendering from other drivers if the underlying
1535 * buffer is a shared dma-buf. Nonblocking commits must not wait for
1536 * rendering in the context of this callback.
1538 * An application can request to be notified when the atomic commit has
1539 * completed. These events are per-CRTC and can be distinguished by the
1540 * CRTC index supplied in &drm_event to userspace.
1542 * The drm core will supply a struct &drm_event in the event
1543 * member of each CRTC's &drm_crtc_state structure. This can be handled by the
1544 * drm_crtc_send_vblank_event() function, which the driver should call on
1545 * the provided event upon completion of the atomic commit. Note that if
1546 * the driver supports vblank signalling and timestamping the vblank
1547 * counters and timestamps must agree with the ones returned from page
1548 * flip events. With the current vblank helper infrastructure this can
1549 * be achieved by holding a vblank reference while the page flip is
1550 * pending, acquired through drm_crtc_vblank_get() and released with
1551 * drm_crtc_vblank_put(). Drivers are free to implement their own vblank
1552 * counter and timestamp tracking though, e.g. if they have accurate
1553 * timestamp registers in hardware.
1557 * Drivers are not allowed to shut down any display pipe successfully
1558 * enabled through an atomic commit on their own. Doing so can result in
1559 * compositors crashing if a page flip is suddenly rejected because the
1564 * 0 on success or one of the below negative error codes:
1566 * - -EBUSY, if a nonblocking updated is requested and there is
1567 * an earlier updated pending. Drivers are allowed to support a queue
1568 * of outstanding updates, but currently no driver supports that.
1569 * Note that drivers must wait for preceding updates to complete if a
1570 * synchronous update is requested, they are not allowed to fail the
1571 * commit in that case.
1573 * - -ENOMEM, if the driver failed to allocate memory. Specifically
1574 * this can happen when trying to pin framebuffers, which must only
1575 * be done when committing the state.
1577 * - -ENOSPC, as a refinement of the more generic -ENOMEM to indicate
1578 * that the driver has run out of vram, iommu space or similar GPU
1579 * address space needed for framebuffer.
1581 * - -EIO, if the hardware completely died.
1583 * - -EINTR, -EAGAIN or -ERESTARTSYS, if the IOCTL should be restarted.
1584 * This can either be due to a pending signal, or because the driver
1585 * needs to completely bail out to recover from an exceptional
1586 * situation like a GPU hang. From a userspace point of view all errors are
1589 * This list is exhaustive. Specifically this hook is not allowed to
1590 * return -EINVAL (any invalid requests should be caught in
1591 * @atomic_check) or -EDEADLK (this function must not acquire
1592 * additional modeset locks).
1594 int (*atomic_commit)(struct drm_device *dev,
1595 struct drm_atomic_state *state,
1599 * @atomic_state_alloc:
1601 * This optional hook can be used by drivers that want to subclass struct
1602 * &drm_atomic_state to be able to track their own driver-private global
1603 * state easily. If this hook is implemented, drivers must also
1604 * implement @atomic_state_clear and @atomic_state_free.
1608 * A new &drm_atomic_state on success or NULL on failure.
1610 struct drm_atomic_state *(*atomic_state_alloc)(struct drm_device *dev);
1613 * @atomic_state_clear:
1615 * This hook must clear any driver private state duplicated into the
1616 * passed-in &drm_atomic_state. This hook is called when the caller
1617 * encountered a &drm_modeset_lock deadlock and needs to drop all
1618 * already acquired locks as part of the deadlock avoidance dance
1619 * implemented in drm_modeset_lock_backoff().
1621 * Any duplicated state must be invalidated since a concurrent atomic
1622 * update might change it, and the drm atomic interfaces always apply
1623 * updates as relative changes to the current state.
1625 * Drivers that implement this must call drm_atomic_state_default_clear()
1626 * to clear common state.
1628 void (*atomic_state_clear)(struct drm_atomic_state *state);
1631 * @atomic_state_free:
1633 * This hook needs driver private resources and the &drm_atomic_state
1634 * itself. Note that the core first calls drm_atomic_state_clear() to
1635 * avoid code duplicate between the clear and free hooks.
1637 * Drivers that implement this must call drm_atomic_state_default_free()
1638 * to release common resources.
1640 void (*atomic_state_free)(struct drm_atomic_state *state);
1644 * struct drm_mode_config - Mode configuration control structure
1645 * @mutex: mutex protecting KMS related lists and structures
1646 * @connection_mutex: ww mutex protecting connector state and routing
1647 * @acquire_ctx: global implicit acquire context used by atomic drivers for
1649 * @fb_lock: mutex to protect fb state and lists
1650 * @num_fb: number of fbs available
1651 * @fb_list: list of framebuffers available
1652 * @num_encoder: number of encoders on this device
1653 * @encoder_list: list of encoder objects
1654 * @num_overlay_plane: number of overlay planes on this device
1655 * @num_total_plane: number of universal (i.e. with primary/curso) planes on this device
1656 * @plane_list: list of plane objects
1657 * @num_crtc: number of CRTCs on this device
1658 * @crtc_list: list of CRTC objects
1659 * @property_list: list of property objects
1660 * @min_width: minimum pixel width on this device
1661 * @min_height: minimum pixel height on this device
1662 * @max_width: maximum pixel width on this device
1663 * @max_height: maximum pixel height on this device
1664 * @funcs: core driver provided mode setting functions
1665 * @fb_base: base address of the framebuffer
1666 * @poll_enabled: track polling support for this device
1667 * @poll_running: track polling status for this device
1668 * @delayed_event: track delayed poll uevent deliver for this device
1669 * @output_poll_work: delayed work for polling in process context
1670 * @property_blob_list: list of all the blob property objects
1671 * @blob_lock: mutex for blob property allocation and management
1672 * @*_property: core property tracking
1673 * @preferred_depth: preferred RBG pixel depth, used by fb helpers
1674 * @prefer_shadow: hint to userspace to prefer shadow-fb rendering
1675 * @cursor_width: hint to userspace for max cursor width
1676 * @cursor_height: hint to userspace for max cursor height
1677 * @helper_private: mid-layer private data
1679 * Core mode resource tracking structure. All CRTC, encoders, and connectors
1680 * enumerated by the driver are added here, as are global properties. Some
1681 * global restrictions are also here, e.g. dimension restrictions.
1683 struct drm_mode_config {
1684 struct mutex mutex; /* protects configuration (mode lists etc.) */
1685 struct drm_modeset_lock connection_mutex; /* protects connector->encoder and encoder->crtc links */
1686 struct drm_modeset_acquire_ctx *acquire_ctx; /* for legacy _lock_all() / _unlock_all() */
1691 * Mutex for KMS ID allocation and management. Protects both @crtc_idr
1694 struct mutex idr_mutex;
1699 * Main KMS ID tracking object. Use this idr for all IDs, fb, crtc,
1700 * connector, modes - just makes life easier to have only one.
1702 struct idr crtc_idr;
1707 * Use this idr for allocating new IDs for tiled sinks like use in some
1708 * high-res DP MST screens.
1710 struct idr tile_idr;
1712 struct mutex fb_lock; /* proctects global and per-file fb lists */
1714 struct list_head fb_list;
1717 * @num_connector: Number of connectors on this device.
1721 * @connector_ida: ID allocator for connector indices.
1723 struct ida connector_ida;
1725 * @connector_list: List of connector objects.
1727 struct list_head connector_list;
1729 struct list_head encoder_list;
1732 * Track # of overlay planes separately from # of total planes. By
1733 * default we only advertise overlay planes to userspace; if userspace
1734 * sets the "universal plane" capability bit, we'll go ahead and
1735 * expose all planes.
1737 int num_overlay_plane;
1738 int num_total_plane;
1739 struct list_head plane_list;
1742 struct list_head crtc_list;
1744 struct list_head property_list;
1746 int min_width, min_height;
1747 int max_width, max_height;
1748 const struct drm_mode_config_funcs *funcs;
1749 resource_size_t fb_base;
1751 /* output poll support */
1755 struct delayed_work output_poll_work;
1757 struct mutex blob_lock;
1759 /* pointers to standard properties */
1760 struct list_head property_blob_list;
1762 * @edid_property: Default connector property to hold the EDID of the
1763 * currently connected sink, if any.
1765 struct drm_property *edid_property;
1767 * @dpms_property: Default connector property to control the
1768 * connector's DPMS state.
1770 struct drm_property *dpms_property;
1772 * @path_property: Default connector property to hold the DP MST path
1775 struct drm_property *path_property;
1777 * @tile_property: Default connector property to store the tile
1778 * position of a tiled screen, for sinks which need to be driven with
1781 struct drm_property *tile_property;
1783 * @plane_type_property: Default plane property to differentiate
1784 * CURSOR, PRIMARY and OVERLAY legacy uses of planes.
1786 struct drm_property *plane_type_property;
1788 * @rotation_property: Optional property for planes or CRTCs to specifiy
1791 struct drm_property *rotation_property;
1793 * @prop_src_x: Default atomic plane property for the plane source
1794 * position in the connected &drm_framebuffer.
1796 struct drm_property *prop_src_x;
1798 * @prop_src_y: Default atomic plane property for the plane source
1799 * position in the connected &drm_framebuffer.
1801 struct drm_property *prop_src_y;
1803 * @prop_src_w: Default atomic plane property for the plane source
1804 * position in the connected &drm_framebuffer.
1806 struct drm_property *prop_src_w;
1808 * @prop_src_h: Default atomic plane property for the plane source
1809 * position in the connected &drm_framebuffer.
1811 struct drm_property *prop_src_h;
1813 * @prop_crtc_x: Default atomic plane property for the plane destination
1814 * position in the &drm_crtc is is being shown on.
1816 struct drm_property *prop_crtc_x;
1818 * @prop_crtc_y: Default atomic plane property for the plane destination
1819 * position in the &drm_crtc is is being shown on.
1821 struct drm_property *prop_crtc_y;
1823 * @prop_crtc_w: Default atomic plane property for the plane destination
1824 * position in the &drm_crtc is is being shown on.
1826 struct drm_property *prop_crtc_w;
1828 * @prop_crtc_h: Default atomic plane property for the plane destination
1829 * position in the &drm_crtc is is being shown on.
1831 struct drm_property *prop_crtc_h;
1833 * @prop_fb_id: Default atomic plane property to specify the
1836 struct drm_property *prop_fb_id;
1838 * @prop_crtc_id: Default atomic plane property to specify the
1841 struct drm_property *prop_crtc_id;
1843 * @prop_active: Default atomic CRTC property to control the active
1844 * state, which is the simplified implementation for DPMS in atomic
1847 struct drm_property *prop_active;
1849 * @prop_mode_id: Default atomic CRTC property to set the mode for a
1850 * CRTC. A 0 mode implies that the CRTC is entirely disabled - all
1851 * connectors must be of and active must be set to disabled, too.
1853 struct drm_property *prop_mode_id;
1856 * @dvi_i_subconnector_property: Optional DVI-I property to
1857 * differentiate between analog or digital mode.
1859 struct drm_property *dvi_i_subconnector_property;
1861 * @dvi_i_select_subconnector_property: Optional DVI-I property to
1862 * select between analog or digital mode.
1864 struct drm_property *dvi_i_select_subconnector_property;
1867 * @tv_subconnector_property: Optional TV property to differentiate
1868 * between different TV connector types.
1870 struct drm_property *tv_subconnector_property;
1872 * @tv_select_subconnector_property: Optional TV property to select
1873 * between different TV connector types.
1875 struct drm_property *tv_select_subconnector_property;
1877 * @tv_mode_property: Optional TV property to select
1878 * the output TV mode.
1880 struct drm_property *tv_mode_property;
1882 * @tv_left_margin_property: Optional TV property to set the left
1885 struct drm_property *tv_left_margin_property;
1887 * @tv_right_margin_property: Optional TV property to set the right
1890 struct drm_property *tv_right_margin_property;
1892 * @tv_top_margin_property: Optional TV property to set the right
1895 struct drm_property *tv_top_margin_property;
1897 * @tv_bottom_margin_property: Optional TV property to set the right
1900 struct drm_property *tv_bottom_margin_property;
1902 * @tv_brightness_property: Optional TV property to set the
1905 struct drm_property *tv_brightness_property;
1907 * @tv_contrast_property: Optional TV property to set the
1910 struct drm_property *tv_contrast_property;
1912 * @tv_flicker_reduction_property: Optional TV property to control the
1913 * flicker reduction mode.
1915 struct drm_property *tv_flicker_reduction_property;
1917 * @tv_overscan_property: Optional TV property to control the overscan
1920 struct drm_property *tv_overscan_property;
1922 * @tv_saturation_property: Optional TV property to set the
1925 struct drm_property *tv_saturation_property;
1927 * @tv_hue_property: Optional TV property to set the hue.
1929 struct drm_property *tv_hue_property;
1932 * @scaling_mode_property: Optional connector property to control the
1933 * upscaling, mostly used for built-in panels.
1935 struct drm_property *scaling_mode_property;
1937 * @aspect_ratio_property: Optional connector property to control the
1938 * HDMI infoframe aspect ratio setting.
1940 struct drm_property *aspect_ratio_property;
1942 * @degamma_lut_property: Optional CRTC property to set the LUT used to
1943 * convert the framebuffer's colors to linear gamma.
1945 struct drm_property *degamma_lut_property;
1947 * @degamma_lut_size_property: Optional CRTC property for the size of
1948 * the degamma LUT as supported by the driver (read-only).
1950 struct drm_property *degamma_lut_size_property;
1952 * @ctm_property: Optional CRTC property to set the
1953 * matrix used to convert colors after the lookup in the
1956 struct drm_property *ctm_property;
1958 * @gamma_lut_property: Optional CRTC property to set the LUT used to
1959 * convert the colors, after the CTM matrix, to the gamma space of the
1962 struct drm_property *gamma_lut_property;
1964 * @gamma_lut_size_property: Optional CRTC property for the size of the
1965 * gamma LUT as supported by the driver (read-only).
1967 struct drm_property *gamma_lut_size_property;
1970 * @suggested_x_property: Optional connector property with a hint for
1971 * the position of the output on the host's screen.
1973 struct drm_property *suggested_x_property;
1975 * @suggested_y_property: Optional connector property with a hint for
1976 * the position of the output on the host's screen.
1978 struct drm_property *suggested_y_property;
1980 /* dumb ioctl parameters */
1981 uint32_t preferred_depth, prefer_shadow;
1984 * @async_page_flip: Does this device support async flips on the primary
1987 bool async_page_flip;
1990 * @allow_fb_modifiers:
1992 * Whether the driver supports fb modifiers in the ADDFB2.1 ioctl call.
1994 bool allow_fb_modifiers;
1997 uint32_t cursor_width, cursor_height;
1999 struct drm_mode_config_helper_funcs *helper_private;
2003 * drm_for_each_plane_mask - iterate over planes specified by bitmask
2004 * @plane: the loop cursor
2005 * @dev: the DRM device
2006 * @plane_mask: bitmask of plane indices
2008 * Iterate over all planes specified by bitmask.
2010 #define drm_for_each_plane_mask(plane, dev, plane_mask) \
2011 list_for_each_entry((plane), &(dev)->mode_config.plane_list, head) \
2012 for_each_if ((plane_mask) & (1 << drm_plane_index(plane)))
2015 * drm_for_each_encoder_mask - iterate over encoders specified by bitmask
2016 * @encoder: the loop cursor
2017 * @dev: the DRM device
2018 * @encoder_mask: bitmask of encoder indices
2020 * Iterate over all encoders specified by bitmask.
2022 #define drm_for_each_encoder_mask(encoder, dev, encoder_mask) \
2023 list_for_each_entry((encoder), &(dev)->mode_config.encoder_list, head) \
2024 for_each_if ((encoder_mask) & (1 << drm_encoder_index(encoder)))
2026 #define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
2027 #define obj_to_mode(x) container_of(x, struct drm_display_mode, base)
2028 #define obj_to_fb(x) container_of(x, struct drm_framebuffer, base)
2029 #define obj_to_property(x) container_of(x, struct drm_property, base)
2030 #define obj_to_blob(x) container_of(x, struct drm_property_blob, base)
2031 #define obj_to_plane(x) container_of(x, struct drm_plane, base)
2033 struct drm_prop_enum_list {
2038 extern __printf(6, 7)
2039 int drm_crtc_init_with_planes(struct drm_device *dev,
2040 struct drm_crtc *crtc,
2041 struct drm_plane *primary,
2042 struct drm_plane *cursor,
2043 const struct drm_crtc_funcs *funcs,
2044 const char *name, ...);
2045 extern void drm_crtc_cleanup(struct drm_crtc *crtc);
2048 * drm_crtc_index - find the index of a registered CRTC
2049 * @crtc: CRTC to find index for
2051 * Given a registered CRTC, return the index of that CRTC within a DRM
2052 * device's list of CRTCs.
2054 static inline unsigned int drm_crtc_index(struct drm_crtc *crtc)
2060 * drm_crtc_mask - find the mask of a registered CRTC
2061 * @crtc: CRTC to find mask for
2063 * Given a registered CRTC, return the mask bit of that CRTC for an
2064 * encoder's possible_crtcs field.
2066 static inline uint32_t drm_crtc_mask(struct drm_crtc *crtc)
2068 return 1 << drm_crtc_index(crtc);
2071 extern __printf(8, 9)
2072 int drm_universal_plane_init(struct drm_device *dev,
2073 struct drm_plane *plane,
2074 unsigned long possible_crtcs,
2075 const struct drm_plane_funcs *funcs,
2076 const uint32_t *formats,
2077 unsigned int format_count,
2078 enum drm_plane_type type,
2079 const char *name, ...);
2080 extern int drm_plane_init(struct drm_device *dev,
2081 struct drm_plane *plane,
2082 unsigned long possible_crtcs,
2083 const struct drm_plane_funcs *funcs,
2084 const uint32_t *formats, unsigned int format_count,
2086 extern void drm_plane_cleanup(struct drm_plane *plane);
2089 * drm_plane_index - find the index of a registered plane
2090 * @plane: plane to find index for
2092 * Given a registered plane, return the index of that plane within a DRM
2093 * device's list of planes.
2095 static inline unsigned int drm_plane_index(struct drm_plane *plane)
2097 return plane->index;
2099 extern struct drm_plane * drm_plane_from_index(struct drm_device *dev, int idx);
2100 extern void drm_plane_force_disable(struct drm_plane *plane);
2101 extern void drm_crtc_get_hv_timing(const struct drm_display_mode *mode,
2102 int *hdisplay, int *vdisplay);
2103 extern int drm_crtc_force_disable(struct drm_crtc *crtc);
2104 extern int drm_crtc_force_disable_all(struct drm_device *dev);
2106 extern void drm_mode_config_init(struct drm_device *dev);
2107 extern void drm_mode_config_reset(struct drm_device *dev);
2108 extern void drm_mode_config_cleanup(struct drm_device *dev);
2110 static inline bool drm_property_type_is(struct drm_property *property,
2113 /* instanceof for props.. handles extended type vs original types: */
2114 if (property->flags & DRM_MODE_PROP_EXTENDED_TYPE)
2115 return (property->flags & DRM_MODE_PROP_EXTENDED_TYPE) == type;
2116 return property->flags & type;
2119 extern struct drm_property *drm_property_create(struct drm_device *dev, int flags,
2120 const char *name, int num_values);
2121 extern struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags,
2123 const struct drm_prop_enum_list *props,
2125 struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
2126 int flags, const char *name,
2127 const struct drm_prop_enum_list *props,
2129 uint64_t supported_bits);
2130 struct drm_property *drm_property_create_range(struct drm_device *dev, int flags,
2132 uint64_t min, uint64_t max);
2133 struct drm_property *drm_property_create_signed_range(struct drm_device *dev,
2134 int flags, const char *name,
2135 int64_t min, int64_t max);
2136 struct drm_property *drm_property_create_object(struct drm_device *dev,
2137 int flags, const char *name, uint32_t type);
2138 struct drm_property *drm_property_create_bool(struct drm_device *dev, int flags,
2140 struct drm_property_blob *drm_property_create_blob(struct drm_device *dev,
2143 struct drm_property_blob *drm_property_lookup_blob(struct drm_device *dev,
2145 int drm_property_replace_global_blob(struct drm_device *dev,
2146 struct drm_property_blob **replace,
2149 struct drm_mode_object *obj_holds_id,
2150 struct drm_property *prop_holds_id);
2151 struct drm_property_blob *drm_property_reference_blob(struct drm_property_blob *blob);
2152 void drm_property_unreference_blob(struct drm_property_blob *blob);
2153 extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property);
2154 extern int drm_property_add_enum(struct drm_property *property, int index,
2155 uint64_t value, const char *name);
2156 extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
2159 extern int drm_mode_set_config_internal(struct drm_mode_set *set);
2161 extern struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,
2163 extern struct drm_tile_group *drm_mode_get_tile_group(struct drm_device *dev,
2165 extern void drm_mode_put_tile_group(struct drm_device *dev,
2166 struct drm_tile_group *tg);
2168 extern int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
2169 struct drm_property *property,
2172 extern struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
2173 unsigned int supported_rotations);
2174 extern unsigned int drm_rotation_simplify(unsigned int rotation,
2175 unsigned int supported_rotations);
2176 extern void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,
2177 uint degamma_lut_size,
2179 uint gamma_lut_size);
2181 int drm_plane_create_zpos_property(struct drm_plane *plane,
2183 unsigned int min, unsigned int max);
2185 int drm_plane_create_zpos_immutable_property(struct drm_plane *plane,
2189 static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
2192 struct drm_mode_object *mo;
2193 mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PLANE);
2194 return mo ? obj_to_plane(mo) : NULL;
2197 static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
2200 struct drm_mode_object *mo;
2201 mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CRTC);
2202 return mo ? obj_to_crtc(mo) : NULL;
2205 static inline struct drm_property *drm_property_find(struct drm_device *dev,
2208 struct drm_mode_object *mo;
2209 mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PROPERTY);
2210 return mo ? obj_to_property(mo) : NULL;
2214 * Extract a degamma/gamma LUT value provided by user and round it to the
2215 * precision supported by the hardware.
2217 static inline uint32_t drm_color_lut_extract(uint32_t user_input,
2218 uint32_t bit_precision)
2220 uint32_t val = user_input;
2221 uint32_t max = 0xffff >> (16 - bit_precision);
2223 /* Round only if we're not using full precision. */
2224 if (bit_precision < 16) {
2225 val += 1UL << (16 - bit_precision - 1);
2226 val >>= 16 - bit_precision;
2229 return clamp_val(val, 0, max);
2232 /* Plane list iterator for legacy (overlay only) planes. */
2233 #define drm_for_each_legacy_plane(plane, dev) \
2234 list_for_each_entry(plane, &(dev)->mode_config.plane_list, head) \
2235 for_each_if (plane->type == DRM_PLANE_TYPE_OVERLAY)
2237 #define drm_for_each_plane(plane, dev) \
2238 list_for_each_entry(plane, &(dev)->mode_config.plane_list, head)
2240 #define drm_for_each_crtc(crtc, dev) \
2241 list_for_each_entry(crtc, &(dev)->mode_config.crtc_list, head)
2244 assert_drm_connector_list_read_locked(struct drm_mode_config *mode_config)
2247 * The connector hotadd/remove code currently grabs both locks when
2248 * updating lists. Hence readers need only hold either of them to be
2249 * safe and the check amounts to
2251 * WARN_ON(not_holding(A) && not_holding(B)).
2253 WARN_ON(!mutex_is_locked(&mode_config->mutex) &&
2254 !drm_modeset_is_locked(&mode_config->connection_mutex));
2257 #define drm_for_each_connector(connector, dev) \
2258 for (assert_drm_connector_list_read_locked(&(dev)->mode_config), \
2259 connector = list_first_entry(&(dev)->mode_config.connector_list, \
2260 struct drm_connector, head); \
2261 &connector->head != (&(dev)->mode_config.connector_list); \
2262 connector = list_next_entry(connector, head))
2264 #define drm_for_each_encoder(encoder, dev) \
2265 list_for_each_entry(encoder, &(dev)->mode_config.encoder_list, head)
2267 #define drm_for_each_fb(fb, dev) \
2268 for (WARN_ON(!mutex_is_locked(&(dev)->mode_config.fb_lock)), \
2269 fb = list_first_entry(&(dev)->mode_config.fb_list, \
2270 struct drm_framebuffer, head); \
2271 &fb->head != (&(dev)->mode_config.fb_list); \
2272 fb = list_next_entry(fb, head))
2275 bool drm_probe_ddc(struct i2c_adapter *adapter);
2276 struct edid *drm_get_edid(struct drm_connector *connector,
2277 struct i2c_adapter *adapter);
2278 struct edid *drm_get_edid_switcheroo(struct drm_connector *connector,
2279 struct i2c_adapter *adapter);
2280 struct edid *drm_edid_duplicate(const struct edid *edid);
2281 int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
2283 u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
2284 enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code);
2285 bool drm_detect_hdmi_monitor(struct edid *edid);
2286 bool drm_detect_monitor_audio(struct edid *edid);
2287 bool drm_rgb_quant_range_selectable(struct edid *edid);
2288 int drm_add_modes_noedid(struct drm_connector *connector,
2289 int hdisplay, int vdisplay);
2290 void drm_set_preferred_mode(struct drm_connector *connector,
2291 int hpref, int vpref);
2293 int drm_edid_header_is_valid(const u8 *raw_edid);
2294 bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid,
2295 bool *edid_corrupt);
2296 bool drm_edid_is_valid(struct edid *edid);
2297 void drm_edid_get_monitor_name(struct edid *edid, char *name,
2299 struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
2300 int hsize, int vsize, int fresh,
2304 extern int drm_bridge_add(struct drm_bridge *bridge);
2305 extern void drm_bridge_remove(struct drm_bridge *bridge);
2306 extern struct drm_bridge *of_drm_find_bridge(struct device_node *np);
2307 extern int drm_bridge_attach(struct drm_device *dev, struct drm_bridge *bridge);
2308 extern void drm_bridge_detach(struct drm_bridge *bridge);
2310 bool drm_bridge_mode_fixup(struct drm_bridge *bridge,
2311 const struct drm_display_mode *mode,
2312 struct drm_display_mode *adjusted_mode);
2313 void drm_bridge_disable(struct drm_bridge *bridge);
2314 void drm_bridge_post_disable(struct drm_bridge *bridge);
2315 void drm_bridge_mode_set(struct drm_bridge *bridge,
2316 struct drm_display_mode *mode,
2317 struct drm_display_mode *adjusted_mode);
2318 void drm_bridge_pre_enable(struct drm_bridge *bridge);
2319 void drm_bridge_enable(struct drm_bridge *bridge);
2321 #endif /* __DRM_CRTC_H__ */