Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    2)  * Copyright © 2006 Keith Packard
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    3)  * Copyright © 2007-2008 Dave Airlie
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    4)  * Copyright © 2007-2008 Intel Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    5)  *   Jesse Barnes <jesse.barnes@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    7)  * Permission is hereby granted, free of charge, to any person obtaining a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    8)  * copy of this software and associated documentation files (the "Software"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    9)  * to deal in the Software without restriction, including without limitation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   10)  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   11)  * and/or sell copies of the Software, and to permit persons to whom the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   12)  * Software is furnished to do so, subject to the following conditions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   13)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   14)  * The above copyright notice and this permission notice shall be included in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   15)  * all copies or substantial portions of the Software.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   16)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   17)  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   18)  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   19)  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   20)  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   21)  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   22)  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   23)  * OTHER DEALINGS IN THE SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   24)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   25) #ifndef __DRM_CRTC_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   26) #define __DRM_CRTC_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   28) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   29) #include <linux/spinlock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   30) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   31) #include <linux/fb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   32) #include <linux/hdmi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   33) #include <linux/media-bus-format.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   34) #include <uapi/drm/drm_mode.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   35) #include <uapi/drm/drm_fourcc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   36) #include <drm/drm_modeset_lock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   37) #include <drm/drm_rect.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   38) #include <drm/drm_mode_object.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   39) #include <drm/drm_framebuffer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   40) #include <drm/drm_modes.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   41) #include <drm/drm_connector.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   42) #include <drm/drm_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   43) #include <drm/drm_property.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   44) #include <drm/drm_edid.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   45) #include <drm/drm_plane.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   46) #include <drm/drm_blend.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   47) #include <drm/drm_color_mgmt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   48) #include <drm/drm_debugfs_crc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   49) #include <drm/drm_mode_config.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   51) struct drm_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   52) struct drm_mode_set;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   53) struct drm_file;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   54) struct drm_clip_rect;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   55) struct drm_printer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   56) struct drm_self_refresh_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   57) struct device_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   58) struct dma_fence;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   59) struct edid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   61) static inline int64_t U642I64(uint64_t val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   62) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   63) 	return (int64_t)*((int64_t *)&val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   64) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   65) static inline uint64_t I642U64(int64_t val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   66) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   67) 	return (uint64_t)*((uint64_t *)&val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   68) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   70) struct drm_crtc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   71) struct drm_pending_vblank_event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   72) struct drm_plane;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   73) struct drm_bridge;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   74) struct drm_atomic_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   76) struct drm_crtc_helper_funcs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   77) struct drm_plane_helper_funcs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   79) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   80)  * struct drm_crtc_state - mutable CRTC state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   81)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   82)  * Note that the distinction between @enable and @active is rather subtle:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   83)  * Flipping @active while @enable is set without changing anything else may
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   84)  * never return in a failure from the &drm_mode_config_funcs.atomic_check
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   85)  * callback. Userspace assumes that a DPMS On will always succeed. In other
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   86)  * words: @enable controls resource assignment, @active controls the actual
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   87)  * hardware state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   88)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   89)  * The three booleans active_changed, connectors_changed and mode_changed are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   90)  * intended to indicate whether a full modeset is needed, rather than strictly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   91)  * describing what has changed in a commit. See also:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   92)  * drm_atomic_crtc_needs_modeset()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   93)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   94)  * WARNING: Transitional helpers (like drm_helper_crtc_mode_set() or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   95)  * drm_helper_crtc_mode_set_base()) do not maintain many of the derived control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   96)  * state like @plane_mask so drivers not converted over to atomic helpers should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   97)  * not rely on these being accurate!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   98)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   99) struct drm_crtc_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  100) 	/** @crtc: backpointer to the CRTC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  101) 	struct drm_crtc *crtc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  103) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  104) 	 * @enable: Whether the CRTC should be enabled, gates all other state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  105) 	 * This controls reservations of shared resources. Actual hardware state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  106) 	 * is controlled by @active.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  107) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  108) 	bool enable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  110) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  111) 	 * @active: Whether the CRTC is actively displaying (used for DPMS).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  112) 	 * Implies that @enable is set. The driver must not release any shared
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  113) 	 * resources if @active is set to false but @enable still true, because
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  114) 	 * userspace expects that a DPMS ON always succeeds.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  115) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  116) 	 * Hence drivers must not consult @active in their various
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  117) 	 * &drm_mode_config_funcs.atomic_check callback to reject an atomic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  118) 	 * commit. They can consult it to aid in the computation of derived
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  119) 	 * hardware state, since even in the DPMS OFF state the display hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  120) 	 * should be as much powered down as when the CRTC is completely
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  121) 	 * disabled through setting @enable to false.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  122) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  123) 	bool active;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  124) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  125) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  126) 	 * @planes_changed: Planes on this crtc are updated. Used by the atomic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  127) 	 * helpers and drivers to steer the atomic commit control flow.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  128) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  129) 	bool planes_changed : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  131) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  132) 	 * @mode_changed: @mode or @enable has been changed. Used by the atomic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  133) 	 * helpers and drivers to steer the atomic commit control flow. See also
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  134) 	 * drm_atomic_crtc_needs_modeset().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  135) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  136) 	 * Drivers are supposed to set this for any CRTC state changes that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  137) 	 * require a full modeset. They can also reset it to false if e.g. a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  138) 	 * @mode change can be done without a full modeset by only changing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  139) 	 * scaler settings.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  140) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  141) 	bool mode_changed : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  143) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  144) 	 * @active_changed: @active has been toggled. Used by the atomic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  145) 	 * helpers and drivers to steer the atomic commit control flow. See also
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  146) 	 * drm_atomic_crtc_needs_modeset().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  147) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  148) 	bool active_changed : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  150) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  151) 	 * @connectors_changed: Connectors to this crtc have been updated,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  152) 	 * either in their state or routing. Used by the atomic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  153) 	 * helpers and drivers to steer the atomic commit control flow. See also
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  154) 	 * drm_atomic_crtc_needs_modeset().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  155) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  156) 	 * Drivers are supposed to set this as-needed from their own atomic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  157) 	 * check code, e.g. from &drm_encoder_helper_funcs.atomic_check
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  158) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  159) 	bool connectors_changed : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  160) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  161) 	 * @zpos_changed: zpos values of planes on this crtc have been updated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  162) 	 * Used by the atomic helpers and drivers to steer the atomic commit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  163) 	 * control flow.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  164) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  165) 	bool zpos_changed : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  166) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  167) 	 * @color_mgmt_changed: Color management properties have changed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  168) 	 * (@gamma_lut, @degamma_lut or @ctm). Used by the atomic helpers and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  169) 	 * drivers to steer the atomic commit control flow.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  170) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  171) 	bool color_mgmt_changed : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  173) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  174) 	 * @no_vblank:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  175) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  176) 	 * Reflects the ability of a CRTC to send VBLANK events. This state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  177) 	 * usually depends on the pipeline configuration. If set to true, DRM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  178) 	 * atomic helpers will send out a fake VBLANK event during display
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  179) 	 * updates after all hardware changes have been committed. This is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  180) 	 * implemented in drm_atomic_helper_fake_vblank().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  181) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  182) 	 * One usage is for drivers and/or hardware without support for VBLANK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  183) 	 * interrupts. Such drivers typically do not initialize vblanking
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  184) 	 * (i.e., call drm_vblank_init() with the number of CRTCs). For CRTCs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  185) 	 * without initialized vblanking, this field is set to true in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  186) 	 * drm_atomic_helper_check_modeset(), and a fake VBLANK event will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  187) 	 * send out on each update of the display pipeline by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  188) 	 * drm_atomic_helper_fake_vblank().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  189) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  190) 	 * Another usage is CRTCs feeding a writeback connector operating in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  191) 	 * oneshot mode. In this case the fake VBLANK event is only generated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  192) 	 * when a job is queued to the writeback connector, and we want the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  193) 	 * core to fake VBLANK events when this part of the pipeline hasn't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  194) 	 * changed but others had or when the CRTC and connectors are being
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  195) 	 * disabled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  196) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  197) 	 * __drm_atomic_helper_crtc_duplicate_state() will not reset the value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  198) 	 * from the current state, the CRTC driver is then responsible for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  199) 	 * updating this field when needed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  200) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  201) 	 * Note that the combination of &drm_crtc_state.event == NULL and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  202) 	 * &drm_crtc_state.no_blank == true is valid and usually used when the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  203) 	 * writeback connector attached to the CRTC has a new job queued. In
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  204) 	 * this case the driver will send the VBLANK event on its own when the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  205) 	 * writeback job is complete.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  206) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  207) 	bool no_vblank : 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  209) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  210) 	 * @plane_mask: Bitmask of drm_plane_mask(plane) of planes attached to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  211) 	 * this CRTC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  212) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  213) 	u32 plane_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  215) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  216) 	 * @connector_mask: Bitmask of drm_connector_mask(connector) of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  217) 	 * connectors attached to this CRTC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  218) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  219) 	u32 connector_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  221) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  222) 	 * @encoder_mask: Bitmask of drm_encoder_mask(encoder) of encoders
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  223) 	 * attached to this CRTC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  224) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  225) 	u32 encoder_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  227) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  228) 	 * @adjusted_mode:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  229) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  230) 	 * Internal display timings which can be used by the driver to handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  231) 	 * differences between the mode requested by userspace in @mode and what
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  232) 	 * is actually programmed into the hardware.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  233) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  234) 	 * For drivers using &drm_bridge, this stores hardware display timings
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  235) 	 * used between the CRTC and the first bridge. For other drivers, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  236) 	 * meaning of the adjusted_mode field is purely driver implementation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  237) 	 * defined information, and will usually be used to store the hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  238) 	 * display timings used between the CRTC and encoder blocks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  239) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  240) 	struct drm_display_mode adjusted_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  241) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  242) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  243) 	 * @mode:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  244) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  245) 	 * Display timings requested by userspace. The driver should try to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  246) 	 * match the refresh rate as close as possible (but note that it's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  247) 	 * undefined what exactly is close enough, e.g. some of the HDMI modes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  248) 	 * only differ in less than 1% of the refresh rate). The active width
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  249) 	 * and height as observed by userspace for positioning planes must match
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  250) 	 * exactly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  251) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  252) 	 * For external connectors where the sink isn't fixed (like with a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  253) 	 * built-in panel), this mode here should match the physical mode on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  254) 	 * wire to the last details (i.e. including sync polarities and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  255) 	 * everything).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  256) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  257) 	struct drm_display_mode mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  259) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  260) 	 * @mode_blob: &drm_property_blob for @mode, for exposing the mode to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  261) 	 * atomic userspace.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  262) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  263) 	struct drm_property_blob *mode_blob;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  264) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  265) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  266) 	 * @degamma_lut:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  267) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  268) 	 * Lookup table for converting framebuffer pixel data before apply the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  269) 	 * color conversion matrix @ctm. See drm_crtc_enable_color_mgmt(). The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  270) 	 * blob (if not NULL) is an array of &struct drm_color_lut.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  271) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  272) 	struct drm_property_blob *degamma_lut;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  274) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  275) 	 * @ctm:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  276) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  277) 	 * Color transformation matrix. See drm_crtc_enable_color_mgmt(). The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  278) 	 * blob (if not NULL) is a &struct drm_color_ctm.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  279) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  280) 	struct drm_property_blob *ctm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  281) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  282) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  283) 	 * @gamma_lut:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  284) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  285) 	 * Lookup table for converting pixel data after the color conversion
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  286) 	 * matrix @ctm.  See drm_crtc_enable_color_mgmt(). The blob (if not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  287) 	 * NULL) is an array of &struct drm_color_lut.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  288) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  289) 	struct drm_property_blob *gamma_lut;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  290) #if defined(CONFIG_ROCKCHIP_DRM_CUBIC_LUT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  291) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  292) 	 * @cubic_lut:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  293) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  294) 	 * Cubic Lookup table for converting pixel data. See
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  295) 	 * drm_crtc_enable_color_mgmt(). The blob (if not NULL) is a 3D array
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  296) 	 * of &struct drm_color_lut.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  297) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  298) 	struct drm_property_blob *cubic_lut;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  299) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  300) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  301) 	 * @target_vblank:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  302) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  303) 	 * Target vertical blank period when a page flip
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  304) 	 * should take effect.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  305) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  306) 	u32 target_vblank;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  307) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  308) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  309) 	 * @async_flip:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  310) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  311) 	 * This is set when DRM_MODE_PAGE_FLIP_ASYNC is set in the legacy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  312) 	 * PAGE_FLIP IOCTL. It's not wired up for the atomic IOCTL itself yet.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  313) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  314) 	bool async_flip;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  315) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  316) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  317) 	 * @vrr_enabled:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  318) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  319) 	 * Indicates if variable refresh rate should be enabled for the CRTC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  320) 	 * Support for the requested vrr state will depend on driver and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  321) 	 * hardware capabiltiy - lacking support is not treated as failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  322) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  323) 	bool vrr_enabled;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  324) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  325) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  326) 	 * @self_refresh_active:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  327) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  328) 	 * Used by the self refresh helpers to denote when a self refresh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  329) 	 * transition is occurring. This will be set on enable/disable callbacks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  330) 	 * when self refresh is being enabled or disabled. In some cases, it may
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  331) 	 * not be desirable to fully shut off the crtc during self refresh.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  332) 	 * CRTC's can inspect this flag and determine the best course of action.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  333) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  334) 	bool self_refresh_active;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  335) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  336) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  337) 	 * @event:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  338) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  339) 	 * Optional pointer to a DRM event to signal upon completion of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  340) 	 * state update. The driver must send out the event when the atomic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  341) 	 * commit operation completes. There are two cases:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  342) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  343) 	 *  - The event is for a CRTC which is being disabled through this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  344) 	 *    atomic commit. In that case the event can be send out any time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  345) 	 *    after the hardware has stopped scanning out the current
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  346) 	 *    framebuffers. It should contain the timestamp and counter for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  347) 	 *    last vblank before the display pipeline was shut off. The simplest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  348) 	 *    way to achieve that is calling drm_crtc_send_vblank_event()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  349) 	 *    somewhen after drm_crtc_vblank_off() has been called.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  350) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  351) 	 *  - For a CRTC which is enabled at the end of the commit (even when it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  352) 	 *    undergoes an full modeset) the vblank timestamp and counter must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  353) 	 *    be for the vblank right before the first frame that scans out the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  354) 	 *    new set of buffers. Again the event can only be sent out after the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  355) 	 *    hardware has stopped scanning out the old buffers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  356) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  357) 	 *  - Events for disabled CRTCs are not allowed, and drivers can ignore
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  358) 	 *    that case.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  359) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  360) 	 * For very simple hardware without VBLANK interrupt, enabling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  361) 	 * &struct drm_crtc_state.no_vblank makes DRM's atomic commit helpers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  362) 	 * send a fake VBLANK event at the end of the display update after all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  363) 	 * hardware changes have been applied. See
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  364) 	 * drm_atomic_helper_fake_vblank().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  365) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  366) 	 * For more complex hardware this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  367) 	 * can be handled by the drm_crtc_send_vblank_event() function,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  368) 	 * which the driver should call on the provided event upon completion of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  369) 	 * the atomic commit. Note that if the driver supports vblank signalling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  370) 	 * and timestamping the vblank counters and timestamps must agree with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  371) 	 * the ones returned from page flip events. With the current vblank
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  372) 	 * helper infrastructure this can be achieved by holding a vblank
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  373) 	 * reference while the page flip is pending, acquired through
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  374) 	 * drm_crtc_vblank_get() and released with drm_crtc_vblank_put().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  375) 	 * Drivers are free to implement their own vblank counter and timestamp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  376) 	 * tracking though, e.g. if they have accurate timestamp registers in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  377) 	 * hardware.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  378) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  379) 	 * For hardware which supports some means to synchronize vblank
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  380) 	 * interrupt delivery with committing display state there's also
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  381) 	 * drm_crtc_arm_vblank_event(). See the documentation of that function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  382) 	 * for a detailed discussion of the constraints it needs to be used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  383) 	 * safely.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  384) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  385) 	 * If the device can't notify of flip completion in a race-free way
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  386) 	 * at all, then the event should be armed just after the page flip is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  387) 	 * committed. In the worst case the driver will send the event to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  388) 	 * userspace one frame too late. This doesn't allow for a real atomic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  389) 	 * update, but it should avoid tearing.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  390) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  391) 	struct drm_pending_vblank_event *event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  392) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  393) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  394) 	 * @commit:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  395) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  396) 	 * This tracks how the commit for this update proceeds through the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  397) 	 * various phases. This is never cleared, except when we destroy the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  398) 	 * state, so that subsequent commits can synchronize with previous ones.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  399) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  400) 	struct drm_crtc_commit *commit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  401) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  402) 	/** @state: backpointer to global drm_atomic_state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  403) 	struct drm_atomic_state *state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  404) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  405) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  406) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  407)  * struct drm_crtc_funcs - control CRTCs for a given device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  408)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  409)  * The drm_crtc_funcs structure is the central CRTC management structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  410)  * in the DRM.  Each CRTC controls one or more connectors (note that the name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  411)  * CRTC is simply historical, a CRTC may control LVDS, VGA, DVI, TV out, etc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  412)  * connectors, not just CRTs).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  413)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  414)  * Each driver is responsible for filling out this structure at startup time,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  415)  * in addition to providing other modesetting features, like i2c and DDC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  416)  * bus accessors.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  417)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  418) struct drm_crtc_funcs {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  419) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  420) 	 * @reset:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  421) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  422) 	 * Reset CRTC hardware and software state to off. This function isn't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  423) 	 * called by the core directly, only through drm_mode_config_reset().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  424) 	 * It's not a helper hook only for historical reasons.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  425) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  426) 	 * Atomic drivers can use drm_atomic_helper_crtc_reset() to reset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  427) 	 * atomic state using this hook.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  428) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  429) 	void (*reset)(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  430) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  431) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  432) 	 * @cursor_set:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  433) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  434) 	 * Update the cursor image. The cursor position is relative to the CRTC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  435) 	 * and can be partially or fully outside of the visible area.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  436) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  437) 	 * Note that contrary to all other KMS functions the legacy cursor entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  438) 	 * points don't take a framebuffer object, but instead take directly a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  439) 	 * raw buffer object id from the driver's buffer manager (which is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  440) 	 * either GEM or TTM for current drivers).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  441) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  442) 	 * This entry point is deprecated, drivers should instead implement
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  443) 	 * universal plane support and register a proper cursor plane using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  444) 	 * drm_crtc_init_with_planes().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  445) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  446) 	 * This callback is optional
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  447) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  448) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  449) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  450) 	 * 0 on success or a negative error code on failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  451) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  452) 	int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  453) 			  uint32_t handle, uint32_t width, uint32_t height);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  454) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  455) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  456) 	 * @cursor_set2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  457) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  458) 	 * Update the cursor image, including hotspot information. The hotspot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  459) 	 * must not affect the cursor position in CRTC coordinates, but is only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  460) 	 * meant as a hint for virtualized display hardware to coordinate the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  461) 	 * guests and hosts cursor position. The cursor hotspot is relative to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  462) 	 * the cursor image. Otherwise this works exactly like @cursor_set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  463) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  464) 	 * This entry point is deprecated, drivers should instead implement
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  465) 	 * universal plane support and register a proper cursor plane using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  466) 	 * drm_crtc_init_with_planes().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  467) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  468) 	 * This callback is optional.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  469) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  470) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  471) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  472) 	 * 0 on success or a negative error code on failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  473) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  474) 	int (*cursor_set2)(struct drm_crtc *crtc, struct drm_file *file_priv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  475) 			   uint32_t handle, uint32_t width, uint32_t height,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  476) 			   int32_t hot_x, int32_t hot_y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  477) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  478) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  479) 	 * @cursor_move:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  480) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  481) 	 * Update the cursor position. The cursor does not need to be visible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  482) 	 * when this hook is called.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  483) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  484) 	 * This entry point is deprecated, drivers should instead implement
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  485) 	 * universal plane support and register a proper cursor plane using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  486) 	 * drm_crtc_init_with_planes().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  487) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  488) 	 * This callback is optional.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  489) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  490) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  491) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  492) 	 * 0 on success or a negative error code on failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  493) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  494) 	int (*cursor_move)(struct drm_crtc *crtc, int x, int y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  495) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  496) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  497) 	 * @gamma_set:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  498) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  499) 	 * Set gamma on the CRTC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  500) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  501) 	 * This callback is optional.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  502) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  503) 	 * Atomic drivers who want to support gamma tables should implement the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  504) 	 * atomic color management support, enabled by calling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  505) 	 * drm_crtc_enable_color_mgmt(), which then supports the legacy gamma
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  506) 	 * interface through the drm_atomic_helper_legacy_gamma_set()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  507) 	 * compatibility implementation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  508) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  509) 	int (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  510) 			 uint32_t size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  511) 			 struct drm_modeset_acquire_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  512) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  513) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  514) 	 * @destroy:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  515) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  516) 	 * Clean up CRTC resources. This is only called at driver unload time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  517) 	 * through drm_mode_config_cleanup() since a CRTC cannot be hotplugged
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  518) 	 * in DRM.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  519) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  520) 	void (*destroy)(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  521) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  522) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  523) 	 * @set_config:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  524) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  525) 	 * This is the main legacy entry point to change the modeset state on a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  526) 	 * CRTC. All the details of the desired configuration are passed in a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  527) 	 * &struct drm_mode_set - see there for details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  528) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  529) 	 * Drivers implementing atomic modeset should use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  530) 	 * drm_atomic_helper_set_config() to implement this hook.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  531) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  532) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  533) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  534) 	 * 0 on success or a negative error code on failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  535) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  536) 	int (*set_config)(struct drm_mode_set *set,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  537) 			  struct drm_modeset_acquire_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  538) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  539) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  540) 	 * @page_flip:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  541) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  542) 	 * Legacy entry point to schedule a flip to the given framebuffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  543) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  544) 	 * Page flipping is a synchronization mechanism that replaces the frame
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  545) 	 * buffer being scanned out by the CRTC with a new frame buffer during
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  546) 	 * vertical blanking, avoiding tearing (except when requested otherwise
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  547) 	 * through the DRM_MODE_PAGE_FLIP_ASYNC flag). When an application
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  548) 	 * requests a page flip the DRM core verifies that the new frame buffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  549) 	 * is large enough to be scanned out by the CRTC in the currently
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  550) 	 * configured mode and then calls this hook with a pointer to the new
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  551) 	 * frame buffer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  552) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  553) 	 * The driver must wait for any pending rendering to the new framebuffer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  554) 	 * to complete before executing the flip. It should also wait for any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  555) 	 * pending rendering from other drivers if the underlying buffer is a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  556) 	 * shared dma-buf.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  557) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  558) 	 * An application can request to be notified when the page flip has
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  559) 	 * completed. The drm core will supply a &struct drm_event in the event
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  560) 	 * parameter in this case. This can be handled by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  561) 	 * drm_crtc_send_vblank_event() function, which the driver should call on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  562) 	 * the provided event upon completion of the flip. Note that if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  563) 	 * the driver supports vblank signalling and timestamping the vblank
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  564) 	 * counters and timestamps must agree with the ones returned from page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  565) 	 * flip events. With the current vblank helper infrastructure this can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  566) 	 * be achieved by holding a vblank reference while the page flip is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  567) 	 * pending, acquired through drm_crtc_vblank_get() and released with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  568) 	 * drm_crtc_vblank_put(). Drivers are free to implement their own vblank
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  569) 	 * counter and timestamp tracking though, e.g. if they have accurate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  570) 	 * timestamp registers in hardware.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  571) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  572) 	 * This callback is optional.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  573) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  574) 	 * NOTE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  575) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  576) 	 * Very early versions of the KMS ABI mandated that the driver must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  577) 	 * block (but not reject) any rendering to the old framebuffer until the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  578) 	 * flip operation has completed and the old framebuffer is no longer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  579) 	 * visible. This requirement has been lifted, and userspace is instead
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  580) 	 * expected to request delivery of an event and wait with recycling old
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  581) 	 * buffers until such has been received.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  582) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  583) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  584) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  585) 	 * 0 on success or a negative error code on failure. Note that if a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  586) 	 * page flip operation is already pending the callback should return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  587) 	 * -EBUSY. Pageflips on a disabled CRTC (either by setting a NULL mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  588) 	 * or just runtime disabled through DPMS respectively the new atomic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  589) 	 * "ACTIVE" state) should result in an -EINVAL error code. Note that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  590) 	 * drm_atomic_helper_page_flip() checks this already for atomic drivers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  591) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  592) 	int (*page_flip)(struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  593) 			 struct drm_framebuffer *fb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  594) 			 struct drm_pending_vblank_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  595) 			 uint32_t flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  596) 			 struct drm_modeset_acquire_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  597) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  598) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  599) 	 * @page_flip_target:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  600) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  601) 	 * Same as @page_flip but with an additional parameter specifying the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  602) 	 * absolute target vertical blank period (as reported by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  603) 	 * drm_crtc_vblank_count()) when the flip should take effect.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  604) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  605) 	 * Note that the core code calls drm_crtc_vblank_get before this entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  606) 	 * point, and will call drm_crtc_vblank_put if this entry point returns
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  607) 	 * any non-0 error code. It's the driver's responsibility to call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  608) 	 * drm_crtc_vblank_put after this entry point returns 0, typically when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  609) 	 * the flip completes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  610) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  611) 	int (*page_flip_target)(struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  612) 				struct drm_framebuffer *fb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  613) 				struct drm_pending_vblank_event *event,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  614) 				uint32_t flags, uint32_t target,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  615) 				struct drm_modeset_acquire_ctx *ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  616) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  617) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  618) 	 * @set_property:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  619) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  620) 	 * This is the legacy entry point to update a property attached to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  621) 	 * CRTC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  622) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  623) 	 * This callback is optional if the driver does not support any legacy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  624) 	 * driver-private properties. For atomic drivers it is not used because
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  625) 	 * property handling is done entirely in the DRM core.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  626) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  627) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  628) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  629) 	 * 0 on success or a negative error code on failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  630) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  631) 	int (*set_property)(struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  632) 			    struct drm_property *property, uint64_t val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  633) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  634) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  635) 	 * @atomic_duplicate_state:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  636) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  637) 	 * Duplicate the current atomic state for this CRTC and return it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  638) 	 * The core and helpers guarantee that any atomic state duplicated with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  639) 	 * this hook and still owned by the caller (i.e. not transferred to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  640) 	 * driver by calling &drm_mode_config_funcs.atomic_commit) will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  641) 	 * cleaned up by calling the @atomic_destroy_state hook in this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  642) 	 * structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  643) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  644) 	 * This callback is mandatory for atomic drivers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  645) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  646) 	 * Atomic drivers which don't subclass &struct drm_crtc_state should use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  647) 	 * drm_atomic_helper_crtc_duplicate_state(). Drivers that subclass the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  648) 	 * state structure to extend it with driver-private state should use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  649) 	 * __drm_atomic_helper_crtc_duplicate_state() to make sure shared state is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  650) 	 * duplicated in a consistent fashion across drivers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  651) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  652) 	 * It is an error to call this hook before &drm_crtc.state has been
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  653) 	 * initialized correctly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  654) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  655) 	 * NOTE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  656) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  657) 	 * If the duplicate state references refcounted resources this hook must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  658) 	 * acquire a reference for each of them. The driver must release these
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  659) 	 * references again in @atomic_destroy_state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  660) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  661) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  662) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  663) 	 * Duplicated atomic state or NULL when the allocation failed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  664) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  665) 	struct drm_crtc_state *(*atomic_duplicate_state)(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  666) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  667) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  668) 	 * @atomic_destroy_state:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  669) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  670) 	 * Destroy a state duplicated with @atomic_duplicate_state and release
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  671) 	 * or unreference all resources it references
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  672) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  673) 	 * This callback is mandatory for atomic drivers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  674) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  675) 	void (*atomic_destroy_state)(struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  676) 				     struct drm_crtc_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  677) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  678) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  679) 	 * @atomic_set_property:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  680) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  681) 	 * Decode a driver-private property value and store the decoded value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  682) 	 * into the passed-in state structure. Since the atomic core decodes all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  683) 	 * standardized properties (even for extensions beyond the core set of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  684) 	 * properties which might not be implemented by all drivers) this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  685) 	 * requires drivers to subclass the state structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  686) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  687) 	 * Such driver-private properties should really only be implemented for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  688) 	 * truly hardware/vendor specific state. Instead it is preferred to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  689) 	 * standardize atomic extension and decode the properties used to expose
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  690) 	 * such an extension in the core.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  691) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  692) 	 * Do not call this function directly, use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  693) 	 * drm_atomic_crtc_set_property() instead.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  694) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  695) 	 * This callback is optional if the driver does not support any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  696) 	 * driver-private atomic properties.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  697) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  698) 	 * NOTE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  699) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  700) 	 * This function is called in the state assembly phase of atomic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  701) 	 * modesets, which can be aborted for any reason (including on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  702) 	 * userspace's request to just check whether a configuration would be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  703) 	 * possible). Drivers MUST NOT touch any persistent state (hardware or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  704) 	 * software) or data structures except the passed in @state parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  705) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  706) 	 * Also since userspace controls in which order properties are set this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  707) 	 * function must not do any input validation (since the state update is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  708) 	 * incomplete and hence likely inconsistent). Instead any such input
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  709) 	 * validation must be done in the various atomic_check callbacks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  710) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  711) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  712) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  713) 	 * 0 if the property has been found, -EINVAL if the property isn't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  714) 	 * implemented by the driver (which should never happen, the core only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  715) 	 * asks for properties attached to this CRTC). No other validation is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  716) 	 * allowed by the driver. The core already checks that the property
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  717) 	 * value is within the range (integer, valid enum value, ...) the driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  718) 	 * set when registering the property.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  719) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  720) 	int (*atomic_set_property)(struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  721) 				   struct drm_crtc_state *state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  722) 				   struct drm_property *property,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  723) 				   uint64_t val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  724) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  725) 	 * @atomic_get_property:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  726) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  727) 	 * Reads out the decoded driver-private property. This is used to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  728) 	 * implement the GETCRTC IOCTL.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  729) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  730) 	 * Do not call this function directly, use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  731) 	 * drm_atomic_crtc_get_property() instead.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  732) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  733) 	 * This callback is optional if the driver does not support any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  734) 	 * driver-private atomic properties.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  735) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  736) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  737) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  738) 	 * 0 on success, -EINVAL if the property isn't implemented by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  739) 	 * driver (which should never happen, the core only asks for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  740) 	 * properties attached to this CRTC).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  741) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  742) 	int (*atomic_get_property)(struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  743) 				   const struct drm_crtc_state *state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  744) 				   struct drm_property *property,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  745) 				   uint64_t *val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  746) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  747) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  748) 	 * @late_register:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  749) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  750) 	 * This optional hook can be used to register additional userspace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  751) 	 * interfaces attached to the crtc like debugfs interfaces.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  752) 	 * It is called late in the driver load sequence from drm_dev_register().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  753) 	 * Everything added from this callback should be unregistered in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  754) 	 * the early_unregister callback.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  755) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  756) 	 * Returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  757) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  758) 	 * 0 on success, or a negative error code on failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  759) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  760) 	int (*late_register)(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  761) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  762) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  763) 	 * @early_unregister:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  764) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  765) 	 * This optional hook should be used to unregister the additional
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  766) 	 * userspace interfaces attached to the crtc from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  767) 	 * @late_register. It is called from drm_dev_unregister(),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  768) 	 * early in the driver unload sequence to disable userspace access
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  769) 	 * before data structures are torndown.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  770) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  771) 	void (*early_unregister)(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  772) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  773) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  774) 	 * @set_crc_source:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  775) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  776) 	 * Changes the source of CRC checksums of frames at the request of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  777) 	 * userspace, typically for testing purposes. The sources available are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  778) 	 * specific of each driver and a %NULL value indicates that CRC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  779) 	 * generation is to be switched off.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  780) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  781) 	 * When CRC generation is enabled, the driver should call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  782) 	 * drm_crtc_add_crc_entry() at each frame, providing any information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  783) 	 * that characterizes the frame contents in the crcN arguments, as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  784) 	 * provided from the configured source. Drivers must accept an "auto"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  785) 	 * source name that will select a default source for this CRTC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  786) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  787) 	 * This may trigger an atomic modeset commit if necessary, to enable CRC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  788) 	 * generation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  789) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  790) 	 * Note that "auto" can depend upon the current modeset configuration,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  791) 	 * e.g. it could pick an encoder or output specific CRC sampling point.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  792) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  793) 	 * This callback is optional if the driver does not support any CRC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  794) 	 * generation functionality.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  795) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  796) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  797) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  798) 	 * 0 on success or a negative error code on failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  799) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  800) 	int (*set_crc_source)(struct drm_crtc *crtc, const char *source);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  801) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  802) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  803) 	 * @verify_crc_source:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  804) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  805) 	 * verifies the source of CRC checksums of frames before setting the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  806) 	 * source for CRC and during crc open. Source parameter can be NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  807) 	 * while disabling crc source.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  808) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  809) 	 * This callback is optional if the driver does not support any CRC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  810) 	 * generation functionality.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  811) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  812) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  813) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  814) 	 * 0 on success or a negative error code on failure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  815) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  816) 	int (*verify_crc_source)(struct drm_crtc *crtc, const char *source,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  817) 				 size_t *values_cnt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  818) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  819) 	 * @get_crc_sources:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  820) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  821) 	 * Driver callback for getting a list of all the available sources for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  822) 	 * CRC generation. This callback depends upon verify_crc_source, So
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  823) 	 * verify_crc_source callback should be implemented before implementing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  824) 	 * this. Driver can pass full list of available crc sources, this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  825) 	 * callback does the verification on each crc-source before passing it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  826) 	 * to userspace.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  827) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  828) 	 * This callback is optional if the driver does not support exporting of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  829) 	 * possible CRC sources list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  830) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  831) 	 * RETURNS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  832) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  833) 	 * a constant character pointer to the list of all the available CRC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  834) 	 * sources. On failure driver should return NULL. count should be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  835) 	 * updated with number of sources in list. if zero we don't process any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  836) 	 * source from the list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  837) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  838) 	const char *const *(*get_crc_sources)(struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  839) 					      size_t *count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  840) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  841) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  842) 	 * @atomic_print_state:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  843) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  844) 	 * If driver subclasses &struct drm_crtc_state, it should implement
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  845) 	 * this optional hook for printing additional driver specific state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  846) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  847) 	 * Do not call this directly, use drm_atomic_crtc_print_state()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  848) 	 * instead.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  849) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  850) 	void (*atomic_print_state)(struct drm_printer *p,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  851) 				   const struct drm_crtc_state *state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  852) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  853) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  854) 	 * @get_vblank_counter:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  855) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  856) 	 * Driver callback for fetching a raw hardware vblank counter for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  857) 	 * CRTC. It's meant to be used by new drivers as the replacement of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  858) 	 * &drm_driver.get_vblank_counter hook.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  859) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  860) 	 * This callback is optional. If a device doesn't have a hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  861) 	 * counter, the driver can simply leave the hook as NULL. The DRM core
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  862) 	 * will account for missed vblank events while interrupts where disabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  863) 	 * based on system timestamps.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  864) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  865) 	 * Wraparound handling and loss of events due to modesetting is dealt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  866) 	 * with in the DRM core code, as long as drivers call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  867) 	 * drm_crtc_vblank_off() and drm_crtc_vblank_on() when disabling or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  868) 	 * enabling a CRTC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  869) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  870) 	 * See also &drm_device.vblank_disable_immediate and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  871) 	 * &drm_device.max_vblank_count.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  872) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  873) 	 * Returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  874) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  875) 	 * Raw vblank counter value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  876) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  877) 	u32 (*get_vblank_counter)(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  878) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  879) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  880) 	 * @enable_vblank:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  881) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  882) 	 * Enable vblank interrupts for the CRTC. It's meant to be used by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  883) 	 * new drivers as the replacement of &drm_driver.enable_vblank hook.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  884) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  885) 	 * Returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  886) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  887) 	 * Zero on success, appropriate errno if the vblank interrupt cannot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  888) 	 * be enabled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  889) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  890) 	int (*enable_vblank)(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  891) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  892) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  893) 	 * @disable_vblank:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  894) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  895) 	 * Disable vblank interrupts for the CRTC. It's meant to be used by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  896) 	 * new drivers as the replacement of &drm_driver.disable_vblank hook.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  897) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  898) 	void (*disable_vblank)(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  899) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  900) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  901) 	 * @get_vblank_timestamp:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  902) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  903) 	 * Called by drm_get_last_vbltimestamp(). Should return a precise
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  904) 	 * timestamp when the most recent vblank interval ended or will end.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  905) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  906) 	 * Specifically, the timestamp in @vblank_time should correspond as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  907) 	 * closely as possible to the time when the first video scanline of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  908) 	 * the video frame after the end of vblank will start scanning out,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  909) 	 * the time immediately after end of the vblank interval. If the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  910) 	 * @crtc is currently inside vblank, this will be a time in the future.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  911) 	 * If the @crtc is currently scanning out a frame, this will be the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  912) 	 * past start time of the current scanout. This is meant to adhere
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  913) 	 * to the OpenML OML_sync_control extension specification.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  914) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  915) 	 * Parameters:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  916) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  917) 	 * crtc:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  918) 	 *     CRTC for which timestamp should be returned.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  919) 	 * max_error:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  920) 	 *     Maximum allowable timestamp error in nanoseconds.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  921) 	 *     Implementation should strive to provide timestamp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  922) 	 *     with an error of at most max_error nanoseconds.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  923) 	 *     Returns true upper bound on error for timestamp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  924) 	 * vblank_time:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  925) 	 *     Target location for returned vblank timestamp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  926) 	 * in_vblank_irq:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  927) 	 *     True when called from drm_crtc_handle_vblank().  Some drivers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  928) 	 *     need to apply some workarounds for gpu-specific vblank irq quirks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  929) 	 *     if flag is set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  930) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  931) 	 * Returns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  932) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  933) 	 * True on success, false on failure, which means the core should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  934) 	 * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  935) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  936) 	bool (*get_vblank_timestamp)(struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  937) 				     int *max_error,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  938) 				     ktime_t *vblank_time,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  939) 				     bool in_vblank_irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  940) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  941) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  942) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  943)  * struct drm_crtc - central CRTC control structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  944)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  945)  * Each CRTC may have one or more connectors associated with it.  This structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  946)  * allows the CRTC to be controlled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  947)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  948) struct drm_crtc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  949) 	/** @dev: parent DRM device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  950) 	struct drm_device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  951) 	/** @port: OF node used by drm_of_find_possible_crtcs(). */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  952) 	struct device_node *port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  953) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  954) 	 * @head:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  955) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  956) 	 * List of all CRTCs on @dev, linked from &drm_mode_config.crtc_list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  957) 	 * Invariant over the lifetime of @dev and therefore does not need
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  958) 	 * locking.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  959) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  960) 	struct list_head head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  961) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  962) 	/** @name: human readable name, can be overwritten by the driver */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  963) 	char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  964) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  965) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  966) 	 * @mutex:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  967) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  968) 	 * This provides a read lock for the overall CRTC state (mode, dpms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  969) 	 * state, ...) and a write lock for everything which can be update
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  970) 	 * without a full modeset (fb, cursor data, CRTC properties ...). A full
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  971) 	 * modeset also need to grab &drm_mode_config.connection_mutex.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  972) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  973) 	 * For atomic drivers specifically this protects @state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  974) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  975) 	struct drm_modeset_lock mutex;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  976) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  977) 	/** @base: base KMS object for ID tracking etc. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  978) 	struct drm_mode_object base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  979) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  980) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  981) 	 * @primary:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  982) 	 * Primary plane for this CRTC. Note that this is only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  983) 	 * relevant for legacy IOCTL, it specifies the plane implicitly used by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  984) 	 * the SETCRTC and PAGE_FLIP IOCTLs. It does not have any significance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  985) 	 * beyond that.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  986) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  987) 	struct drm_plane *primary;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  988) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  989) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  990) 	 * @cursor:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  991) 	 * Cursor plane for this CRTC. Note that this is only relevant for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  992) 	 * legacy IOCTL, it specifies the plane implicitly used by the SETCURSOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  993) 	 * and SETCURSOR2 IOCTLs. It does not have any significance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  994) 	 * beyond that.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  995) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  996) 	struct drm_plane *cursor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  997) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  998) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  999) 	 * @index: Position inside the mode_config.list, can be used as an array
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1000) 	 * index. It is invariant over the lifetime of the CRTC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1001) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1002) 	unsigned index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1003) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1004) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1005) 	 * @cursor_x: Current x position of the cursor, used for universal
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1006) 	 * cursor planes because the SETCURSOR IOCTL only can update the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1007) 	 * framebuffer without supplying the coordinates. Drivers should not use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1008) 	 * this directly, atomic drivers should look at &drm_plane_state.crtc_x
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1009) 	 * of the cursor plane instead.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1010) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1011) 	int cursor_x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1012) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1013) 	 * @cursor_y: Current y position of the cursor, used for universal
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1014) 	 * cursor planes because the SETCURSOR IOCTL only can update the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1015) 	 * framebuffer without supplying the coordinates. Drivers should not use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1016) 	 * this directly, atomic drivers should look at &drm_plane_state.crtc_y
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1017) 	 * of the cursor plane instead.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1018) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1019) 	int cursor_y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1020) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1021) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1022) 	 * @enabled:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1023) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1024) 	 * Is this CRTC enabled? Should only be used by legacy drivers, atomic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1025) 	 * drivers should instead consult &drm_crtc_state.enable and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1026) 	 * &drm_crtc_state.active. Atomic drivers can update this by calling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1027) 	 * drm_atomic_helper_update_legacy_modeset_state().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1028) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1029) 	bool enabled;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1030) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1031) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1032) 	 * @mode:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1033) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1034) 	 * Current mode timings. Should only be used by legacy drivers, atomic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1035) 	 * drivers should instead consult &drm_crtc_state.mode. Atomic drivers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1036) 	 * can update this by calling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1037) 	 * drm_atomic_helper_update_legacy_modeset_state().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1038) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1039) 	struct drm_display_mode mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1040) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1041) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1042) 	 * @hwmode:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1043) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1044) 	 * Programmed mode in hw, after adjustments for encoders, crtc, panel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1045) 	 * scaling etc. Should only be used by legacy drivers, for high
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1046) 	 * precision vblank timestamps in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1047) 	 * drm_crtc_vblank_helper_get_vblank_timestamp().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1048) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1049) 	 * Note that atomic drivers should not use this, but instead use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1050) 	 * &drm_crtc_state.adjusted_mode. And for high-precision timestamps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1051) 	 * drm_crtc_vblank_helper_get_vblank_timestamp() used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1052) 	 * &drm_vblank_crtc.hwmode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1053) 	 * which is filled out by calling drm_calc_timestamping_constants().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1054) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1055) 	struct drm_display_mode hwmode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1056) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1057) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1058) 	 * @x:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1059) 	 * x position on screen. Should only be used by legacy drivers, atomic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1060) 	 * drivers should look at &drm_plane_state.crtc_x of the primary plane
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1061) 	 * instead. Updated by calling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1062) 	 * drm_atomic_helper_update_legacy_modeset_state().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1063) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1064) 	int x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1065) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1066) 	 * @y:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1067) 	 * y position on screen. Should only be used by legacy drivers, atomic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1068) 	 * drivers should look at &drm_plane_state.crtc_y of the primary plane
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1069) 	 * instead. Updated by calling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1070) 	 * drm_atomic_helper_update_legacy_modeset_state().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1071) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1072) 	int y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1073) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1074) 	/** @funcs: CRTC control functions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1075) 	const struct drm_crtc_funcs *funcs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1076) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1077) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1078) 	 * @gamma_size: Size of legacy gamma ramp reported to userspace. Set up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1079) 	 * by calling drm_mode_crtc_set_gamma_size().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1080) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1081) 	uint32_t gamma_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1082) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1083) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1084) 	 * @gamma_store: Gamma ramp values used by the legacy SETGAMMA and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1085) 	 * GETGAMMA IOCTls. Set up by calling drm_mode_crtc_set_gamma_size().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1086) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1087) 	uint16_t *gamma_store;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1088) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1089) 	/** @helper_private: mid-layer private data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1090) 	const struct drm_crtc_helper_funcs *helper_private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1091) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1092) 	/** @properties: property tracking for this CRTC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1093) 	struct drm_object_properties properties;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1094) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1095) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1096) 	 * @state:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1097) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1098) 	 * Current atomic state for this CRTC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1099) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1100) 	 * This is protected by @mutex. Note that nonblocking atomic commits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1101) 	 * access the current CRTC state without taking locks. Either by going
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1102) 	 * through the &struct drm_atomic_state pointers, see
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1103) 	 * for_each_oldnew_crtc_in_state(), for_each_old_crtc_in_state() and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1104) 	 * for_each_new_crtc_in_state(). Or through careful ordering of atomic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1105) 	 * commit operations as implemented in the atomic helpers, see
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1106) 	 * &struct drm_crtc_commit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1107) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1108) 	struct drm_crtc_state *state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1110) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1111) 	 * @commit_list:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1112) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1113) 	 * List of &drm_crtc_commit structures tracking pending commits.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1114) 	 * Protected by @commit_lock. This list holds its own full reference,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1115) 	 * as does the ongoing commit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1116) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1117) 	 * "Note that the commit for a state change is also tracked in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1118) 	 * &drm_crtc_state.commit. For accessing the immediately preceding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1119) 	 * commit in an atomic update it is recommended to just use that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1120) 	 * pointer in the old CRTC state, since accessing that doesn't need
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1121) 	 * any locking or list-walking. @commit_list should only be used to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1122) 	 * stall for framebuffer cleanup that's signalled through
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1123) 	 * &drm_crtc_commit.cleanup_done."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1124) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1125) 	struct list_head commit_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1127) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1128) 	 * @commit_lock:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1129) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1130) 	 * Spinlock to protect @commit_list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1131) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1132) 	spinlock_t commit_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1134) #ifdef CONFIG_DEBUG_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1135) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1136) 	 * @debugfs_entry:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1137) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1138) 	 * Debugfs directory for this CRTC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1139) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1140) 	struct dentry *debugfs_entry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1141) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1143) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1144) 	 * @crc:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1145) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1146) 	 * Configuration settings of CRC capture.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1147) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1148) 	struct drm_crtc_crc crc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1150) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1151) 	 * @fence_context:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1152) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1153) 	 * timeline context used for fence operations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1154) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1155) 	unsigned int fence_context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1157) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1158) 	 * @fence_lock:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1159) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1160) 	 * spinlock to protect the fences in the fence_context.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1161) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1162) 	spinlock_t fence_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1163) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1164) 	 * @fence_seqno:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1165) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1166) 	 * Seqno variable used as monotonic counter for the fences
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1167) 	 * created on the CRTC's timeline.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1168) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1169) 	unsigned long fence_seqno;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1171) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1172) 	 * @timeline_name:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1173) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1174) 	 * The name of the CRTC's fence timeline.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1175) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1176) 	char timeline_name[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1178) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1179) 	 * @self_refresh_data: Holds the state for the self refresh helpers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1180) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1181) 	 * Initialized via drm_self_refresh_helper_init().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1182) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1183) 	struct drm_self_refresh_data *self_refresh_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1184) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1186) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1187)  * struct drm_mode_set - new values for a CRTC config change
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1188)  * @fb: framebuffer to use for new config
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1189)  * @crtc: CRTC whose configuration we're about to change
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1190)  * @mode: mode timings to use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1191)  * @x: position of this CRTC relative to @fb
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1192)  * @y: position of this CRTC relative to @fb
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1193)  * @connectors: array of connectors to drive with this CRTC if possible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1194)  * @num_connectors: size of @connectors array
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1195)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1196)  * This represents a modeset configuration for the legacy SETCRTC ioctl and is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1197)  * also used internally. Atomic drivers instead use &drm_atomic_state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1198)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1199) struct drm_mode_set {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1200) 	struct drm_framebuffer *fb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1201) 	struct drm_crtc *crtc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1202) 	struct drm_display_mode *mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1204) 	uint32_t x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1205) 	uint32_t y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1207) 	struct drm_connector **connectors;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1208) 	size_t num_connectors;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1209) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1211) #define obj_to_crtc(x) container_of(x, struct drm_crtc, base)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1213) __printf(6, 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1214) int drm_crtc_init_with_planes(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1215) 			      struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1216) 			      struct drm_plane *primary,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1217) 			      struct drm_plane *cursor,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1218) 			      const struct drm_crtc_funcs *funcs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1219) 			      const char *name, ...);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1220) void drm_crtc_cleanup(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1222) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1223)  * drm_crtc_index - find the index of a registered CRTC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1224)  * @crtc: CRTC to find index for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1225)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1226)  * Given a registered CRTC, return the index of that CRTC within a DRM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1227)  * device's list of CRTCs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1228)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1229) static inline unsigned int drm_crtc_index(const struct drm_crtc *crtc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1230) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1231) 	return crtc->index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1232) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1234) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1235)  * drm_crtc_mask - find the mask of a registered CRTC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1236)  * @crtc: CRTC to find mask for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1237)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1238)  * Given a registered CRTC, return the mask bit of that CRTC for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1239)  * &drm_encoder.possible_crtcs and &drm_plane.possible_crtcs fields.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1240)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1241) static inline uint32_t drm_crtc_mask(const struct drm_crtc *crtc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1242) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1243) 	return 1 << drm_crtc_index(crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1244) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1245) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1246) int drm_mode_set_config_internal(struct drm_mode_set *set);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1247) struct drm_crtc *drm_crtc_from_index(struct drm_device *dev, int idx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1248) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1249) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1250)  * drm_crtc_find - look up a CRTC object from its ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1251)  * @dev: DRM device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1252)  * @file_priv: drm file to check for lease against.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1253)  * @id: &drm_mode_object ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1254)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1255)  * This can be used to look up a CRTC from its userspace ID. Only used by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1256)  * drivers for legacy IOCTLs and interface, nowadays extensions to the KMS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1257)  * userspace interface should be done using &drm_property.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1258)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1259) static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1260) 		struct drm_file *file_priv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1261) 		uint32_t id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1262) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1263) 	struct drm_mode_object *mo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1264) 	mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_CRTC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1265) 	return mo ? obj_to_crtc(mo) : NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1266) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1268) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1269)  * drm_for_each_crtc - iterate over all CRTCs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1270)  * @crtc: a &struct drm_crtc as the loop cursor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1271)  * @dev: the &struct drm_device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1272)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1273)  * Iterate over all CRTCs of @dev.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1274)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1275) #define drm_for_each_crtc(crtc, dev) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1276) 	list_for_each_entry(crtc, &(dev)->mode_config.crtc_list, head)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1277) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1278) #endif /* __DRM_CRTC_H__ */