0001
0002
0003
0004
0005
0006 #ifndef __INTEL_FB_H__
0007 #define __INTEL_FB_H__
0008
0009 #include <linux/bits.h>
0010 #include <linux/types.h>
0011
0012 struct drm_device;
0013 struct drm_file;
0014 struct drm_framebuffer;
0015 struct drm_i915_gem_object;
0016 struct drm_i915_private;
0017 struct drm_mode_fb_cmd2;
0018 struct intel_fb_view;
0019 struct intel_framebuffer;
0020 struct intel_plane;
0021 struct intel_plane_state;
0022
0023 #define INTEL_PLANE_CAP_NONE 0
0024 #define INTEL_PLANE_CAP_CCS_RC BIT(0)
0025 #define INTEL_PLANE_CAP_CCS_RC_CC BIT(1)
0026 #define INTEL_PLANE_CAP_CCS_MC BIT(2)
0027 #define INTEL_PLANE_CAP_TILING_X BIT(3)
0028 #define INTEL_PLANE_CAP_TILING_Y BIT(4)
0029 #define INTEL_PLANE_CAP_TILING_Yf BIT(5)
0030 #define INTEL_PLANE_CAP_TILING_4 BIT(6)
0031
0032 bool intel_fb_is_ccs_modifier(u64 modifier);
0033 bool intel_fb_is_rc_ccs_cc_modifier(u64 modifier);
0034 bool intel_fb_is_mc_ccs_modifier(u64 modifier);
0035
0036 bool intel_fb_is_ccs_aux_plane(const struct drm_framebuffer *fb, int color_plane);
0037 int intel_fb_rc_ccs_cc_plane(const struct drm_framebuffer *fb);
0038
0039 u64 *intel_fb_plane_get_modifiers(struct drm_i915_private *i915,
0040 u8 plane_caps);
0041 bool intel_fb_plane_supports_modifier(struct intel_plane *plane, u64 modifier);
0042
0043 const struct drm_format_info *
0044 intel_fb_get_format_info(const struct drm_mode_fb_cmd2 *cmd);
0045
0046 bool
0047 intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info,
0048 u64 modifier);
0049
0050 bool is_surface_linear(const struct drm_framebuffer *fb, int color_plane);
0051
0052 int main_to_ccs_plane(const struct drm_framebuffer *fb, int main_plane);
0053 int skl_ccs_to_main_plane(const struct drm_framebuffer *fb, int ccs_plane);
0054 int skl_main_to_aux_plane(const struct drm_framebuffer *fb, int main_plane);
0055
0056 unsigned int intel_tile_size(const struct drm_i915_private *i915);
0057 unsigned int intel_tile_width_bytes(const struct drm_framebuffer *fb, int color_plane);
0058 unsigned int intel_tile_height(const struct drm_framebuffer *fb, int color_plane);
0059 unsigned int intel_tile_row_size(const struct drm_framebuffer *fb, int color_plane);
0060 unsigned int intel_fb_align_height(const struct drm_framebuffer *fb,
0061 int color_plane, unsigned int height);
0062 unsigned int intel_cursor_alignment(const struct drm_i915_private *i915);
0063 unsigned int intel_surf_alignment(const struct drm_framebuffer *fb,
0064 int color_plane);
0065
0066 void intel_fb_plane_get_subsampling(int *hsub, int *vsub,
0067 const struct drm_framebuffer *fb,
0068 int color_plane);
0069
0070 u32 intel_plane_adjust_aligned_offset(int *x, int *y,
0071 const struct intel_plane_state *state,
0072 int color_plane,
0073 u32 old_offset, u32 new_offset);
0074 u32 intel_plane_compute_aligned_offset(int *x, int *y,
0075 const struct intel_plane_state *state,
0076 int color_plane);
0077
0078 bool intel_fb_needs_pot_stride_remap(const struct intel_framebuffer *fb);
0079 bool intel_fb_supports_90_270_rotation(const struct intel_framebuffer *fb);
0080
0081 int intel_fill_fb_info(struct drm_i915_private *i915, struct intel_framebuffer *fb);
0082 void intel_fb_fill_view(const struct intel_framebuffer *fb, unsigned int rotation,
0083 struct intel_fb_view *view);
0084 int intel_plane_compute_gtt(struct intel_plane_state *plane_state);
0085
0086 int intel_framebuffer_init(struct intel_framebuffer *ifb,
0087 struct drm_i915_gem_object *obj,
0088 struct drm_mode_fb_cmd2 *mode_cmd);
0089 struct drm_framebuffer *
0090 intel_user_framebuffer_create(struct drm_device *dev,
0091 struct drm_file *filp,
0092 const struct drm_mode_fb_cmd2 *user_mode_cmd);
0093
0094 bool intel_fb_uses_dpt(const struct drm_framebuffer *fb);
0095
0096 #endif