1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2020 Intel Corporation
4  */
5 
6 #ifndef _INTEL_CRTC_H_
7 #define _INTEL_CRTC_H_
8 
9 #include <linux/types.h>
10 #include <linux/kconfig.h>
11 
12 enum i9xx_plane_id;
13 enum pipe;
14 struct drm_display_mode;
15 #define drm_i915_private inteldrm_softc
16 struct drm_i915_private;
17 struct intel_atomic_state;
18 struct intel_crtc;
19 struct intel_crtc_state;
20 
21 /*
22  * FIXME: We should instead only take spinlocks once for the entire update
23  * instead of once per mmio.
24  */
25 #if IS_ENABLED(CONFIG_PROVE_LOCKING)
26 #define VBLANK_EVASION_TIME_US 250
27 #else
28 #define VBLANK_EVASION_TIME_US 100
29 #endif
30 
31 int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
32 			     int usecs);
33 void intel_crtc_arm_vblank_event(struct intel_crtc_state *crtc_state);
34 u32 intel_crtc_max_vblank_count(const struct intel_crtc_state *crtc_state);
35 int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe);
36 struct intel_crtc_state *intel_crtc_state_alloc(struct intel_crtc *crtc);
37 void intel_crtc_state_reset(struct intel_crtc_state *crtc_state,
38 			    struct intel_crtc *crtc);
39 u32 intel_crtc_get_vblank_counter(struct intel_crtc *crtc);
40 void intel_crtc_vblank_on(const struct intel_crtc_state *crtc_state);
41 void intel_crtc_vblank_off(const struct intel_crtc_state *crtc_state);
42 void intel_pipe_update_start(struct intel_atomic_state *state,
43 			     struct intel_crtc *crtc);
44 void intel_pipe_update_end(struct intel_atomic_state *state,
45 			   struct intel_crtc *crtc);
46 void intel_wait_for_vblank_workers(struct intel_atomic_state *state);
47 struct intel_crtc *intel_first_crtc(struct drm_i915_private *i915);
48 struct intel_crtc *intel_crtc_for_pipe(struct drm_i915_private *i915,
49 				       enum pipe pipe);
50 void intel_wait_for_vblank_if_active(struct drm_i915_private *i915,
51 				     enum pipe pipe);
52 void intel_crtc_wait_for_next_vblank(struct intel_crtc *crtc);
53 
54 #endif
55