| 1 | /* SPDX-License-Identifier: MIT */ |
|---|---|
| 2 | /* |
| 3 | * Copyright © 2022-2023 Intel Corporation |
| 4 | */ |
| 5 | |
| 6 | #ifndef __INTEL_VBLANK_H__ |
| 7 | #define __INTEL_VBLANK_H__ |
| 8 | |
| 9 | #include <linux/ktime.h> |
| 10 | #include <linux/types.h> |
| 11 | |
| 12 | struct drm_crtc; |
| 13 | struct drm_display_mode; |
| 14 | struct intel_atomic_state; |
| 15 | struct intel_crtc; |
| 16 | struct intel_crtc_state; |
| 17 | |
| 18 | struct intel_vblank_evade_ctx { |
| 19 | struct intel_crtc *crtc; |
| 20 | int min, max, vblank_start; |
| 21 | bool need_vlv_dsi_wa; |
| 22 | }; |
| 23 | |
| 24 | int intel_mode_vdisplay(const struct drm_display_mode *mode); |
| 25 | int intel_mode_vblank_start(const struct drm_display_mode *mode); |
| 26 | int intel_mode_vblank_end(const struct drm_display_mode *mode); |
| 27 | int intel_mode_vtotal(const struct drm_display_mode *mode); |
| 28 | int intel_mode_vblank_delay(const struct drm_display_mode *mode); |
| 29 | |
| 30 | void intel_vblank_evade_init(const struct intel_crtc_state *old_crtc_state, |
| 31 | const struct intel_crtc_state *new_crtc_state, |
| 32 | struct intel_vblank_evade_ctx *evade); |
| 33 | /* must be called with vblank interrupt already enabled! */ |
| 34 | int intel_vblank_evade(struct intel_vblank_evade_ctx *evade); |
| 35 | |
| 36 | u32 i915_get_vblank_counter(struct drm_crtc *crtc); |
| 37 | u32 g4x_get_vblank_counter(struct drm_crtc *crtc); |
| 38 | bool intel_crtc_get_vblank_timestamp(struct drm_crtc *crtc, int *max_error, |
| 39 | ktime_t *vblank_time, bool in_vblank_irq); |
| 40 | int intel_get_crtc_scanline(struct intel_crtc *crtc); |
| 41 | void intel_wait_for_pipe_scanline_stopped(struct intel_crtc *crtc); |
| 42 | void intel_wait_for_pipe_scanline_moving(struct intel_crtc *crtc); |
| 43 | void intel_crtc_update_active_timings(const struct intel_crtc_state *crtc_state, |
| 44 | bool vrr_enable); |
| 45 | int intel_crtc_scanline_offset(const struct intel_crtc_state *crtc_state); |
| 46 | |
| 47 | const struct intel_crtc_state * |
| 48 | intel_pre_commit_crtc_state(struct intel_atomic_state *state, |
| 49 | struct intel_crtc *crtc); |
| 50 | |
| 51 | int intel_crtc_vblank_length(const struct intel_crtc_state *crtc_state); |
| 52 | |
| 53 | #endif /* __INTEL_VBLANK_H__ */ |
| 54 |
