xref: /linux/drivers/gpu/drm/i915/display/intel_fb.h (revision 9009b455811b0fa1f6b0adfa94db136984db5a38)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2020-2021 Intel Corporation
4  */
5 
6 #ifndef __INTEL_FB_H__
7 #define __INTEL_FB_H__
8 
9 #include <linux/types.h>
10 
11 struct drm_framebuffer;
12 
13 struct drm_i915_private;
14 
15 struct intel_fb_view;
16 struct intel_framebuffer;
17 struct intel_plane_state;
18 
19 bool is_ccs_plane(const struct drm_framebuffer *fb, int plane);
20 bool is_gen12_ccs_plane(const struct drm_framebuffer *fb, int plane);
21 bool is_gen12_ccs_cc_plane(const struct drm_framebuffer *fb, int plane);
22 bool is_aux_plane(const struct drm_framebuffer *fb, int plane);
23 bool is_semiplanar_uv_plane(const struct drm_framebuffer *fb, int color_plane);
24 
25 bool is_surface_linear(const struct drm_framebuffer *fb, int color_plane);
26 
27 int main_to_ccs_plane(const struct drm_framebuffer *fb, int main_plane);
28 int skl_ccs_to_main_plane(const struct drm_framebuffer *fb, int ccs_plane);
29 int skl_main_to_aux_plane(const struct drm_framebuffer *fb, int main_plane);
30 
31 unsigned int intel_tile_size(const struct drm_i915_private *i915);
32 unsigned int intel_tile_height(const struct drm_framebuffer *fb, int color_plane);
33 unsigned int intel_tile_row_size(const struct drm_framebuffer *fb, int color_plane);
34 
35 unsigned int intel_cursor_alignment(const struct drm_i915_private *i915);
36 
37 void intel_fb_plane_get_subsampling(int *hsub, int *vsub,
38 				    const struct drm_framebuffer *fb,
39 				    int color_plane);
40 
41 u32 intel_plane_adjust_aligned_offset(int *x, int *y,
42 				      const struct intel_plane_state *state,
43 				      int color_plane,
44 				      u32 old_offset, u32 new_offset);
45 u32 intel_plane_compute_aligned_offset(int *x, int *y,
46 				       const struct intel_plane_state *state,
47 				       int color_plane);
48 
49 int intel_fill_fb_info(struct drm_i915_private *i915, struct drm_framebuffer *fb);
50 void intel_fb_fill_view(const struct intel_framebuffer *fb, unsigned int rotation,
51 			struct intel_fb_view *view);
52 int intel_plane_compute_gtt(struct intel_plane_state *plane_state);
53 
54 #endif /* __INTEL_FB_H__ */
55