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