1
2
3
4
5
6#ifndef TEGRA_PLANE_H
7#define TEGRA_PLANE_H 1
8
9#include <drm/drm_plane.h>
10
11struct tegra_bo;
12struct tegra_dc;
13
14struct tegra_plane {
15 struct drm_plane base;
16 struct tegra_dc *dc;
17 unsigned int offset;
18 unsigned int index;
19};
20
21struct tegra_cursor {
22 struct tegra_plane base;
23
24 struct tegra_bo *bo;
25 unsigned int width;
26 unsigned int height;
27};
28
29static inline struct tegra_plane *to_tegra_plane(struct drm_plane *plane)
30{
31 return container_of(plane, struct tegra_plane, base);
32}
33
34struct tegra_plane_legacy_blending_state {
35 bool alpha;
36 bool top;
37};
38
39struct tegra_plane_state {
40 struct drm_plane_state base;
41
42 struct sg_table *sgt[3];
43 dma_addr_t iova[3];
44
45 struct tegra_bo_tiling tiling;
46 u32 format;
47 u32 swap;
48
49 bool bottom_up;
50
51
52 struct tegra_plane_legacy_blending_state blending[2];
53 bool opaque;
54};
55
56static inline struct tegra_plane_state *
57to_tegra_plane_state(struct drm_plane_state *state)
58{
59 if (state)
60 return container_of(state, struct tegra_plane_state, base);
61
62 return NULL;
63}
64
65extern const struct drm_plane_funcs tegra_plane_funcs;
66
67int tegra_plane_prepare_fb(struct drm_plane *plane,
68 struct drm_plane_state *state);
69void tegra_plane_cleanup_fb(struct drm_plane *plane,
70 struct drm_plane_state *state);
71
72int tegra_plane_state_add(struct tegra_plane *plane,
73 struct drm_plane_state *state);
74
75int tegra_plane_format(u32 fourcc, u32 *format, u32 *swap);
76bool tegra_plane_format_is_yuv(unsigned int format, bool *planar);
77int tegra_plane_setup_legacy_state(struct tegra_plane *tegra,
78 struct tegra_plane_state *state);
79
80#endif
81