| 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 | |
| 11 | enum i9xx_plane_id; |
| 12 | enum pipe; |
| 13 | struct drm_device; |
| 14 | struct drm_display_mode; |
| 15 | struct drm_file; |
| 16 | struct drm_pending_vblank_event; |
| 17 | struct intel_atomic_state; |
| 18 | struct intel_crtc; |
| 19 | struct intel_crtc_state; |
| 20 | struct intel_display; |
| 21 | |
| 22 | /* |
| 23 | * FIXME: We should instead only take spinlocks once for the entire update |
| 24 | * instead of once per mmio. |
| 25 | */ |
| 26 | #if IS_ENABLED(CONFIG_PROVE_LOCKING) |
| 27 | #define VBLANK_EVASION_TIME_US 250 |
| 28 | #else |
| 29 | #define VBLANK_EVASION_TIME_US 100 |
| 30 | #endif |
| 31 | |
| 32 | int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode, |
| 33 | int usecs); |
| 34 | int intel_scanlines_to_usecs(const struct drm_display_mode *adjusted_mode, |
| 35 | int scanlines); |
| 36 | void intel_crtc_arm_vblank_event(struct intel_crtc_state *crtc_state); |
| 37 | void intel_crtc_prepare_vblank_event(struct intel_crtc_state *crtc_state, |
| 38 | struct drm_pending_vblank_event **event); |
| 39 | u32 intel_crtc_max_vblank_count(const struct intel_crtc_state *crtc_state); |
| 40 | int intel_crtc_init(struct intel_display *display, enum pipe pipe); |
| 41 | int intel_crtc_get_pipe_from_crtc_id_ioctl(struct drm_device *dev, void *data, |
| 42 | struct drm_file *file_priv); |
| 43 | struct intel_crtc_state *intel_crtc_state_alloc(struct intel_crtc *crtc); |
| 44 | void intel_crtc_state_reset(struct intel_crtc_state *crtc_state, |
| 45 | struct intel_crtc *crtc); |
| 46 | u32 intel_crtc_get_vblank_counter(struct intel_crtc *crtc); |
| 47 | void intel_crtc_vblank_on(const struct intel_crtc_state *crtc_state); |
| 48 | void intel_crtc_vblank_off(const struct intel_crtc_state *crtc_state); |
| 49 | void intel_pipe_update_start(struct intel_atomic_state *state, |
| 50 | struct intel_crtc *crtc); |
| 51 | void intel_pipe_update_end(struct intel_atomic_state *state, |
| 52 | struct intel_crtc *crtc); |
| 53 | void intel_wait_for_vblank_workers(struct intel_atomic_state *state); |
| 54 | struct intel_crtc *intel_first_crtc(struct intel_display *display); |
| 55 | struct intel_crtc *intel_crtc_for_pipe(struct intel_display *display, |
| 56 | enum pipe pipe); |
| 57 | void intel_wait_for_vblank_if_active(struct intel_display *display, |
| 58 | enum pipe pipe); |
| 59 | void intel_crtc_wait_for_next_vblank(struct intel_crtc *crtc); |
| 60 | |
| 61 | bool intel_any_crtc_enable_changed(struct intel_atomic_state *state); |
| 62 | bool intel_crtc_enable_changed(const struct intel_crtc_state *old_crtc_state, |
| 63 | const struct intel_crtc_state *new_crtc_state); |
| 64 | bool intel_any_crtc_active_changed(struct intel_atomic_state *state); |
| 65 | bool intel_crtc_active_changed(const struct intel_crtc_state *old_crtc_state, |
| 66 | const struct intel_crtc_state *new_crtc_state); |
| 67 | |
| 68 | unsigned int intel_crtc_bw_num_active_planes(const struct intel_crtc_state *crtc_state); |
| 69 | unsigned int intel_crtc_bw_data_rate(const struct intel_crtc_state *crtc_state); |
| 70 | int intel_crtc_bw_min_cdclk(const struct intel_crtc_state *crtc_state); |
| 71 | |
| 72 | #endif |
| 73 | |