summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/display/intel_vblank.h
blob: ec6c3da3eeac0ec737cfd4ee130a5f19dc207080 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* SPDX-License-Identifier: MIT */
/*
 * Copyright © 2022-2023 Intel Corporation
 */

#ifndef __INTEL_VBLANK_H__
#define __INTEL_VBLANK_H__

#include <linux/ktime.h>
#include <linux/types.h>

struct drm_crtc;
struct intel_crtc;
struct intel_crtc_state;

struct intel_vblank_evade_ctx {
	struct intel_crtc *crtc;
	int min, max, vblank_start;
	bool need_vlv_dsi_wa;
};

void intel_vblank_evade_init(const struct intel_crtc_state *old_crtc_state,
			     const struct intel_crtc_state *new_crtc_state,
			     struct intel_vblank_evade_ctx *evade);
/* must be called with vblank interrupt already enabled! */
int intel_vblank_evade(struct intel_vblank_evade_ctx *evade);

u32 i915_get_vblank_counter(struct drm_crtc *crtc);
u32 g4x_get_vblank_counter(struct drm_crtc *crtc);
bool intel_crtc_get_vblank_timestamp(struct drm_crtc *crtc, int *max_error,
				     ktime_t *vblank_time, bool in_vblank_irq);
int intel_get_crtc_scanline(struct intel_crtc *crtc);
void intel_wait_for_pipe_scanline_stopped(struct intel_crtc *crtc);
void intel_wait_for_pipe_scanline_moving(struct intel_crtc *crtc);
void intel_crtc_update_active_timings(const struct intel_crtc_state *crtc_state,
				      bool vrr_enable);
int intel_crtc_scanline_to_hw(struct intel_crtc *crtc, int scanline);

#endif /* __INTEL_VBLANK_H__ */