| 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/bits.h> | 
|---|
| 10 | #include <linux/types.h> | 
|---|
| 11 |  | 
|---|
| 12 | struct drm_device; | 
|---|
| 13 | struct drm_file; | 
|---|
| 14 | struct drm_framebuffer; | 
|---|
| 15 | struct drm_gem_object; | 
|---|
| 16 | struct drm_mode_fb_cmd2; | 
|---|
| 17 | struct intel_display; | 
|---|
| 18 | struct intel_fb_view; | 
|---|
| 19 | struct intel_framebuffer; | 
|---|
| 20 | struct intel_plane; | 
|---|
| 21 | struct intel_plane_state; | 
|---|
| 22 | struct intel_remapped_info; | 
|---|
| 23 | struct intel_rotation_info; | 
|---|
| 24 |  | 
|---|
| 25 | #define INTEL_PLANE_CAP_NONE		0 | 
|---|
| 26 | #define INTEL_PLANE_CAP_CCS_RC		BIT(0) | 
|---|
| 27 | #define INTEL_PLANE_CAP_CCS_RC_CC	BIT(1) | 
|---|
| 28 | #define INTEL_PLANE_CAP_CCS_MC		BIT(2) | 
|---|
| 29 | #define INTEL_PLANE_CAP_TILING_X	BIT(3) | 
|---|
| 30 | #define INTEL_PLANE_CAP_TILING_Y	BIT(4) | 
|---|
| 31 | #define INTEL_PLANE_CAP_TILING_Yf	BIT(5) | 
|---|
| 32 | #define INTEL_PLANE_CAP_TILING_4	BIT(6) | 
|---|
| 33 | #define INTEL_PLANE_CAP_NEED64K_PHYS	BIT(7) | 
|---|
| 34 |  | 
|---|
| 35 | bool intel_fb_is_tiled_modifier(u64 modifier); | 
|---|
| 36 | bool intel_fb_is_ccs_modifier(u64 modifier); | 
|---|
| 37 | bool intel_fb_is_rc_ccs_cc_modifier(u64 modifier); | 
|---|
| 38 | bool intel_fb_is_mc_ccs_modifier(u64 modifier); | 
|---|
| 39 | bool intel_fb_needs_64k_phys(u64 modifier); | 
|---|
| 40 | bool intel_fb_is_tile4_modifier(u64 modifier); | 
|---|
| 41 |  | 
|---|
| 42 | bool intel_fb_is_ccs_aux_plane(const struct drm_framebuffer *fb, int color_plane); | 
|---|
| 43 | int intel_fb_rc_ccs_cc_plane(const struct drm_framebuffer *fb); | 
|---|
| 44 |  | 
|---|
| 45 | u64 *intel_fb_plane_get_modifiers(struct intel_display *display, | 
|---|
| 46 | u8 plane_caps); | 
|---|
| 47 | bool intel_fb_plane_supports_modifier(struct intel_plane *plane, u64 modifier); | 
|---|
| 48 |  | 
|---|
| 49 | const struct drm_format_info * | 
|---|
| 50 | intel_fb_get_format_info(u32 pixel_format, u64 modifier); | 
|---|
| 51 |  | 
|---|
| 52 | bool | 
|---|
| 53 | intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info, | 
|---|
| 54 | u64 modifier); | 
|---|
| 55 |  | 
|---|
| 56 | bool is_surface_linear(const struct drm_framebuffer *fb, int color_plane); | 
|---|
| 57 |  | 
|---|
| 58 | int main_to_ccs_plane(const struct drm_framebuffer *fb, int main_plane); | 
|---|
| 59 | int skl_ccs_to_main_plane(const struct drm_framebuffer *fb, int ccs_plane); | 
|---|
| 60 | int skl_main_to_aux_plane(const struct drm_framebuffer *fb, int main_plane); | 
|---|
| 61 |  | 
|---|
| 62 | unsigned int intel_tile_size(struct intel_display *display); | 
|---|
| 63 | unsigned int intel_tile_width_bytes(const struct drm_framebuffer *fb, int color_plane); | 
|---|
| 64 | unsigned int intel_tile_height(const struct drm_framebuffer *fb, int color_plane); | 
|---|
| 65 | unsigned int intel_tile_row_size(const struct drm_framebuffer *fb, int color_plane); | 
|---|
| 66 | unsigned int intel_fb_align_height(const struct drm_framebuffer *fb, | 
|---|
| 67 | int color_plane, unsigned int height); | 
|---|
| 68 |  | 
|---|
| 69 | void intel_fb_plane_get_subsampling(int *hsub, int *vsub, | 
|---|
| 70 | const struct drm_framebuffer *fb, | 
|---|
| 71 | int color_plane); | 
|---|
| 72 |  | 
|---|
| 73 | u32 intel_plane_adjust_aligned_offset(int *x, int *y, | 
|---|
| 74 | const struct intel_plane_state *plane_state, | 
|---|
| 75 | int color_plane, | 
|---|
| 76 | u32 old_offset, u32 new_offset); | 
|---|
| 77 | u32 intel_plane_compute_aligned_offset(int *x, int *y, | 
|---|
| 78 | const struct intel_plane_state *plane_state, | 
|---|
| 79 | int color_plane); | 
|---|
| 80 |  | 
|---|
| 81 | bool intel_fb_needs_pot_stride_remap(const struct intel_framebuffer *fb); | 
|---|
| 82 | bool intel_plane_uses_fence(const struct intel_plane_state *plane_state); | 
|---|
| 83 | bool intel_fb_supports_90_270_rotation(const struct intel_framebuffer *fb); | 
|---|
| 84 |  | 
|---|
| 85 | unsigned int intel_rotation_info_size(const struct intel_rotation_info *rot_info); | 
|---|
| 86 | unsigned int intel_remapped_info_size(const struct intel_remapped_info *rem_info); | 
|---|
| 87 |  | 
|---|
| 88 | int intel_fill_fb_info(struct intel_display *display, struct intel_framebuffer *fb); | 
|---|
| 89 | void intel_fb_fill_view(const struct intel_framebuffer *fb, unsigned int rotation, | 
|---|
| 90 | struct intel_fb_view *view); | 
|---|
| 91 | unsigned int intel_fb_view_vtd_guard(const struct drm_framebuffer *fb, | 
|---|
| 92 | const struct intel_fb_view *view, | 
|---|
| 93 | unsigned int rotation); | 
|---|
| 94 | int intel_plane_compute_gtt(struct intel_plane_state *plane_state); | 
|---|
| 95 |  | 
|---|
| 96 | unsigned int intel_fb_xy_to_linear(int x, int y, | 
|---|
| 97 | const struct intel_plane_state *plane_state, | 
|---|
| 98 | int color_plane); | 
|---|
| 99 | void intel_add_fb_offsets(int *x, int *y, | 
|---|
| 100 | const struct intel_plane_state *plane_state, | 
|---|
| 101 | int color_plane); | 
|---|
| 102 |  | 
|---|
| 103 | int intel_framebuffer_init(struct intel_framebuffer *ifb, | 
|---|
| 104 | struct drm_gem_object *obj, | 
|---|
| 105 | const struct drm_format_info *info, | 
|---|
| 106 | struct drm_mode_fb_cmd2 *mode_cmd); | 
|---|
| 107 |  | 
|---|
| 108 | struct intel_framebuffer *intel_framebuffer_alloc(void); | 
|---|
| 109 |  | 
|---|
| 110 | struct drm_framebuffer * | 
|---|
| 111 | intel_framebuffer_create(struct drm_gem_object *obj, | 
|---|
| 112 | const struct drm_format_info *info, | 
|---|
| 113 | struct drm_mode_fb_cmd2 *mode_cmd); | 
|---|
| 114 | struct drm_framebuffer * | 
|---|
| 115 | intel_user_framebuffer_create(struct drm_device *dev, | 
|---|
| 116 | struct drm_file *filp, | 
|---|
| 117 | const struct drm_format_info *info, | 
|---|
| 118 | const struct drm_mode_fb_cmd2 *user_mode_cmd); | 
|---|
| 119 |  | 
|---|
| 120 | bool intel_fb_modifier_uses_dpt(struct intel_display *display, u64 modifier); | 
|---|
| 121 | bool intel_fb_uses_dpt(const struct drm_framebuffer *fb); | 
|---|
| 122 |  | 
|---|
| 123 | unsigned int intel_fb_modifier_to_tiling(u64 fb_modifier); | 
|---|
| 124 |  | 
|---|
| 125 | struct drm_gem_object *intel_fb_bo(const struct drm_framebuffer *fb); | 
|---|
| 126 |  | 
|---|
| 127 | #endif /* __INTEL_FB_H__ */ | 
|---|
| 128 |  | 
|---|