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 2016 Intel Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Permission is hereby granted, free of charge, to any person obtaining a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * copy of this software and associated documentation files (the "Software"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * to deal in the Software without restriction, including without limitation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * and/or sell copies of the Software, and to permit persons to whom the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * Software is furnished to do so, subject to the following conditions:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * The above copyright notice and this permission notice (including the next
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * paragraph) shall be included in all copies or substantial portions of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * Software.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * OTHER DEALINGS IN THE SOFTWARE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #ifndef _DRM_VBLANK_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #define _DRM_VBLANK_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <linux/seqlock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include <linux/idr.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include <linux/poll.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include <linux/kthread.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include <drm/drm_file.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include <drm/drm_modes.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) struct drm_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) struct drm_crtc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) struct drm_vblank_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  * struct drm_pending_vblank_event - pending vblank event tracking
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) struct drm_pending_vblank_event {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	 * @base: Base structure for tracking pending DRM events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	struct drm_pending_event base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	 * @pipe: drm_crtc_index() of the &drm_crtc this event is for.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	unsigned int pipe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	 * @sequence: frame event should be triggered at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	u64 sequence;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	 * @event: Actual event which will be sent to userspace.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 		/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 		 * @event.base: DRM event base class.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 		struct drm_event base;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 		/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 		 * @event.vbl:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 		 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 		 * Event payload for vblank events, requested through
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 		 * either the MODE_PAGE_FLIP or MODE_ATOMIC IOCTL. Also
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		 * generated by the legacy WAIT_VBLANK IOCTL, but new userspace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		 * should use MODE_QUEUE_SEQUENCE and &event.seq instead.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 		struct drm_event_vblank vbl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 		 * @event.seq: Event payload for the MODE_QUEUEU_SEQUENCE IOCTL.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		struct drm_event_crtc_sequence seq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	} event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)  * struct drm_vblank_crtc - vblank tracking for a CRTC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)  * This structure tracks the vblank state for one CRTC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  * Note that for historical reasons - the vblank handling code is still shared
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  * with legacy/non-kms drivers - this is a free-standing structure not directly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  * connected to &struct drm_crtc. But all public interface functions are taking
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  * a &struct drm_crtc to hide this implementation detail.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) struct drm_vblank_crtc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	 * @dev: Pointer to the &drm_device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	struct drm_device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	 * @queue: Wait queue for vblank waiters.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	wait_queue_head_t queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	 * @disable_timer: Disable timer for the delayed vblank disabling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	 * hysteresis logic. Vblank disabling is controlled through the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	 * drm_vblank_offdelay module option and the setting of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	 * &drm_device.max_vblank_count value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	struct timer_list disable_timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	 * @seqlock: Protect vblank count and time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	seqlock_t seqlock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	 * @count:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	 * Current software vblank counter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	 * Note that for a given vblank counter value drm_crtc_handle_vblank()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	 * and drm_crtc_vblank_count() or drm_crtc_vblank_count_and_time()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	 * provide a barrier: Any writes done before calling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	 * drm_crtc_handle_vblank() will be visible to callers of the later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	 * functions, iff the vblank count is the same or a later one.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	 * IMPORTANT: This guarantee requires barriers, therefor never access
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	 * this field directly. Use drm_crtc_vblank_count() instead.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	atomic64_t count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	 * @time: Vblank timestamp corresponding to @count.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	ktime_t time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	 * @refcount: Number of users/waiters of the vblank interrupt. Only when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	 * this refcount reaches 0 can the hardware interrupt be disabled using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	 * @disable_timer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	atomic_t refcount;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	 * @last: Protected by &drm_device.vbl_lock, used for wraparound handling.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	u32 last;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	 * @max_vblank_count:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	 * Maximum value of the vblank registers for this crtc. This value +1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	 * will result in a wrap-around of the vblank register. It is used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	 * by the vblank core to handle wrap-arounds.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	 * If set to zero the vblank core will try to guess the elapsed vblanks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	 * between times when the vblank interrupt is disabled through
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	 * high-precision timestamps. That approach is suffering from small
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	 * races and imprecision over longer time periods, hence exposing a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	 * hardware vblank counter is always recommended.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	 * This is the runtime configurable per-crtc maximum set through
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	 * drm_crtc_set_max_vblank_count(). If this is used the driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	 * must leave the device wide &drm_device.max_vblank_count at zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	 * If non-zero, &drm_crtc_funcs.get_vblank_counter must be set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	u32 max_vblank_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	 * @inmodeset: Tracks whether the vblank is disabled due to a modeset.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	 * For legacy driver bit 2 additionally tracks whether an additional
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	 * temporary vblank reference has been acquired to paper over the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	 * hardware counter resetting/jumping. KMS drivers should instead just
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	 * call drm_crtc_vblank_off() and drm_crtc_vblank_on(), which explicitly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	 * save and restore the vblank count.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	unsigned int inmodeset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	 * @pipe: drm_crtc_index() of the &drm_crtc corresponding to this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	 * structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	unsigned int pipe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	 * @framedur_ns: Frame/Field duration in ns, used by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	 * drm_crtc_vblank_helper_get_vblank_timestamp() and computed by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	 * drm_calc_timestamping_constants().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	int framedur_ns;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	 * @linedur_ns: Line duration in ns, used by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	 * drm_crtc_vblank_helper_get_vblank_timestamp() and computed by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	 * drm_calc_timestamping_constants().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	int linedur_ns;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	 * @hwmode:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	 * Cache of the current hardware display mode. Only valid when @enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	 * is set. This is used by helpers like
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	 * drm_crtc_vblank_helper_get_vblank_timestamp(). We can't just access
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	 * the hardware mode by e.g. looking at &drm_crtc_state.adjusted_mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	 * because that one is really hard to get from interrupt context.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	struct drm_display_mode hwmode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	 * @enabled: Tracks the enabling state of the corresponding &drm_crtc to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	 * avoid double-disabling and hence corrupting saved state. Needed by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	 * drivers not using atomic KMS, since those might go through their CRTC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	 * disabling functions multiple times.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	bool enabled;
^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) 	 * @worker: The &kthread_worker used for executing vblank works.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	struct kthread_worker *worker;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	 * @pending_work: A list of scheduled &drm_vblank_work items that are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	 * waiting for a future vblank.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	struct list_head pending_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	/**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	 * @work_wait_queue: The wait queue used for signaling that a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	 * &drm_vblank_work item has either finished executing, or was
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	 * cancelled.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	wait_queue_head_t work_wait_queue;
^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) int drm_vblank_init(struct drm_device *dev, unsigned int num_crtcs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) bool drm_dev_has_vblank(const struct drm_device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) u64 drm_crtc_vblank_count(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) u64 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 				   ktime_t *vblanktime);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 			       struct drm_pending_vblank_event *e);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) void drm_crtc_arm_vblank_event(struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 			      struct drm_pending_vblank_event *e);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) void drm_vblank_set_event(struct drm_pending_vblank_event *e,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 			  u64 *seq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 			  ktime_t *now);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) bool drm_crtc_handle_vblank(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) int drm_crtc_vblank_get(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) void drm_crtc_vblank_put(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) void drm_crtc_wait_one_vblank(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) void drm_crtc_vblank_off(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) void drm_crtc_vblank_reset(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) void drm_crtc_vblank_on(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) void drm_vblank_restore(struct drm_device *dev, unsigned int pipe);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) void drm_crtc_vblank_restore(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) void drm_calc_timestamping_constants(struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 				     const struct drm_display_mode *mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) wait_queue_head_t *drm_crtc_vblank_waitqueue(struct drm_crtc *crtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) void drm_crtc_set_max_vblank_count(struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 				   u32 max_vblank_count);
^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)  * Helpers for struct drm_crtc_funcs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) typedef bool (*drm_vblank_get_scanout_position_func)(struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 						     bool in_vblank_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 						     int *vpos, int *hpos,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 						     ktime_t *stime,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 						     ktime_t *etime,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 						     const struct drm_display_mode *mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) bool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) drm_crtc_vblank_helper_get_vblank_timestamp_internal(struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 						     int *max_error,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 						     ktime_t *vblank_time,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 						     bool in_vblank_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 						     drm_vblank_get_scanout_position_func get_scanout_position);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) bool drm_crtc_vblank_helper_get_vblank_timestamp(struct drm_crtc *crtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 						 int *max_error,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 						 ktime_t *vblank_time,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 						 bool in_vblank_irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) #endif