1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2019 Intel Corporation
4  */
5 
6 #ifndef __INTEL_ATOMIC_PLANE_H__
7 #define __INTEL_ATOMIC_PLANE_H__
8 
9 #include <linux/types.h>
10 
11 struct drm_plane;
12 struct drm_property;
13 struct drm_rect;
14 struct intel_atomic_state;
15 struct intel_crtc;
16 struct intel_crtc_state;
17 struct intel_plane;
18 struct intel_plane_state;
19 
20 extern const struct drm_plane_helper_funcs intel_plane_helper_funcs;
21 
22 unsigned int intel_adjusted_rate(const struct drm_rect *src,
23 				 const struct drm_rect *dst,
24 				 unsigned int rate);
25 unsigned int intel_plane_pixel_rate(const struct intel_crtc_state *crtc_state,
26 				    const struct intel_plane_state *plane_state);
27 
28 unsigned int intel_plane_data_rate(const struct intel_crtc_state *crtc_state,
29 				   const struct intel_plane_state *plane_state);
30 void intel_plane_copy_uapi_to_hw_state(struct intel_plane_state *plane_state,
31 				       const struct intel_plane_state *from_plane_state,
32 				       struct intel_crtc *crtc);
33 void intel_plane_copy_hw_state(struct intel_plane_state *plane_state,
34 			       const struct intel_plane_state *from_plane_state);
35 void intel_update_plane(struct intel_plane *plane,
36 			const struct intel_crtc_state *crtc_state,
37 			const struct intel_plane_state *plane_state);
38 void intel_disable_plane(struct intel_plane *plane,
39 			 const struct intel_crtc_state *crtc_state);
40 struct intel_plane *intel_plane_alloc(void);
41 void intel_plane_free(struct intel_plane *plane);
42 struct drm_plane_state *intel_plane_duplicate_state(struct drm_plane *plane);
43 void intel_plane_destroy_state(struct drm_plane *plane,
44 			       struct drm_plane_state *state);
45 void skl_update_planes_on_crtc(struct intel_atomic_state *state,
46 			       struct intel_crtc *crtc);
47 void i9xx_update_planes_on_crtc(struct intel_atomic_state *state,
48 				struct intel_crtc *crtc);
49 int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_state,
50 					struct intel_crtc_state *crtc_state,
51 					const struct intel_plane_state *old_plane_state,
52 					struct intel_plane_state *intel_state);
53 int intel_plane_atomic_check(struct intel_atomic_state *state,
54 			     struct intel_plane *plane);
55 int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_state,
56 				    struct intel_crtc_state *crtc_state,
57 				    const struct intel_plane_state *old_plane_state,
58 				    struct intel_plane_state *plane_state);
59 int intel_plane_calc_min_cdclk(struct intel_atomic_state *state,
60 			       struct intel_plane *plane,
61 			       bool *need_cdclk_calc);
62 int intel_atomic_plane_check_clipping(struct intel_plane_state *plane_state,
63 				      struct intel_crtc_state *crtc_state,
64 				      int min_scale, int max_scale,
65 				      bool can_position);
66 void intel_plane_set_invisible(struct intel_crtc_state *crtc_state,
67 			       struct intel_plane_state *plane_state);
68 
69 #endif /* __INTEL_ATOMIC_PLANE_H__ */
70