linux/drivers/gpu/drm/i915/display/intel_fb.h
<<
>>
Prefs
   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
  12struct drm_device;
  13struct drm_file;
  14struct drm_framebuffer;
  15struct drm_i915_gem_object;
  16struct drm_i915_private;
  17struct drm_mode_fb_cmd2;
  18struct intel_fb_view;
  19struct intel_framebuffer;
  20struct intel_plane;
  21struct intel_plane_state;
  22
  23#define INTEL_PLANE_CAP_NONE            0
  24#define INTEL_PLANE_CAP_CCS_RC          BIT(0)
  25#define INTEL_PLANE_CAP_CCS_RC_CC       BIT(1)
  26#define INTEL_PLANE_CAP_CCS_MC          BIT(2)
  27#define INTEL_PLANE_CAP_TILING_X        BIT(3)
  28#define INTEL_PLANE_CAP_TILING_Y        BIT(4)
  29#define INTEL_PLANE_CAP_TILING_Yf       BIT(5)
  30
  31bool intel_fb_is_ccs_modifier(u64 modifier);
  32bool intel_fb_is_rc_ccs_cc_modifier(u64 modifier);
  33bool intel_fb_is_mc_ccs_modifier(u64 modifier);
  34
  35bool intel_fb_is_ccs_aux_plane(const struct drm_framebuffer *fb, int color_plane);
  36int intel_fb_rc_ccs_cc_plane(const struct drm_framebuffer *fb);
  37
  38u64 *intel_fb_plane_get_modifiers(struct drm_i915_private *i915,
  39                                  u8 plane_caps);
  40bool intel_fb_plane_supports_modifier(struct intel_plane *plane, u64 modifier);
  41
  42const struct drm_format_info *
  43intel_fb_get_format_info(const struct drm_mode_fb_cmd2 *cmd);
  44
  45bool
  46intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info,
  47                                    u64 modifier);
  48
  49bool is_surface_linear(const struct drm_framebuffer *fb, int color_plane);
  50
  51int main_to_ccs_plane(const struct drm_framebuffer *fb, int main_plane);
  52int skl_ccs_to_main_plane(const struct drm_framebuffer *fb, int ccs_plane);
  53int skl_main_to_aux_plane(const struct drm_framebuffer *fb, int main_plane);
  54
  55unsigned int intel_tile_size(const struct drm_i915_private *i915);
  56unsigned int intel_tile_width_bytes(const struct drm_framebuffer *fb, int color_plane);
  57unsigned int intel_tile_height(const struct drm_framebuffer *fb, int color_plane);
  58unsigned int intel_tile_row_size(const struct drm_framebuffer *fb, int color_plane);
  59unsigned int intel_fb_align_height(const struct drm_framebuffer *fb,
  60                                   int color_plane, unsigned int height);
  61unsigned int intel_cursor_alignment(const struct drm_i915_private *i915);
  62unsigned int intel_surf_alignment(const struct drm_framebuffer *fb,
  63                                  int color_plane);
  64
  65void intel_fb_plane_get_subsampling(int *hsub, int *vsub,
  66                                    const struct drm_framebuffer *fb,
  67                                    int color_plane);
  68
  69u32 intel_plane_adjust_aligned_offset(int *x, int *y,
  70                                      const struct intel_plane_state *state,
  71                                      int color_plane,
  72                                      u32 old_offset, u32 new_offset);
  73u32 intel_plane_compute_aligned_offset(int *x, int *y,
  74                                       const struct intel_plane_state *state,
  75                                       int color_plane);
  76
  77bool intel_fb_needs_pot_stride_remap(const struct intel_framebuffer *fb);
  78bool intel_fb_supports_90_270_rotation(const struct intel_framebuffer *fb);
  79
  80int intel_fill_fb_info(struct drm_i915_private *i915, struct intel_framebuffer *fb);
  81void intel_fb_fill_view(const struct intel_framebuffer *fb, unsigned int rotation,
  82                        struct intel_fb_view *view);
  83int intel_plane_compute_gtt(struct intel_plane_state *plane_state);
  84
  85int intel_framebuffer_init(struct intel_framebuffer *ifb,
  86                           struct drm_i915_gem_object *obj,
  87                           struct drm_mode_fb_cmd2 *mode_cmd);
  88struct drm_framebuffer *
  89intel_user_framebuffer_create(struct drm_device *dev,
  90                              struct drm_file *filp,
  91                              const struct drm_mode_fb_cmd2 *user_mode_cmd);
  92
  93bool intel_fb_uses_dpt(const struct drm_framebuffer *fb);
  94
  95#endif /* __INTEL_FB_H__ */
  96