1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2017 NVIDIA CORPORATION. All rights reserved.
7 #define TEGRA_PLANE_H 1
9 #include <drm/drm_plane.h>
16 struct drm_plane base;
21 struct icc_path *icc_mem;
22 struct icc_path *icc_mem_vfilter;
26 struct tegra_plane base;
33 static inline struct tegra_plane *to_tegra_plane(struct drm_plane *plane)
35 return container_of(plane, struct tegra_plane, base);
38 struct tegra_plane_legacy_blending_state {
43 struct tegra_plane_state {
44 struct drm_plane_state base;
46 struct host1x_bo_mapping *map[3];
49 struct tegra_bo_tiling tiling;
56 /* used for legacy blending support only */
57 struct tegra_plane_legacy_blending_state blending[2];
60 /* bandwidths are in ICC units, i.e. kbytes/sec */
61 u32 total_peak_memory_bandwidth;
62 u32 peak_memory_bandwidth;
63 u32 avg_memory_bandwidth;
66 static inline struct tegra_plane_state *
67 to_tegra_plane_state(struct drm_plane_state *state)
70 return container_of(state, struct tegra_plane_state, base);
75 static inline const struct tegra_plane_state *
76 to_const_tegra_plane_state(const struct drm_plane_state *state)
78 return to_tegra_plane_state((struct drm_plane_state *)state);
81 extern const struct drm_plane_funcs tegra_plane_funcs;
83 int tegra_plane_prepare_fb(struct drm_plane *plane,
84 struct drm_plane_state *state);
85 void tegra_plane_cleanup_fb(struct drm_plane *plane,
86 struct drm_plane_state *state);
88 int tegra_plane_state_add(struct tegra_plane *plane,
89 struct drm_plane_state *state);
91 int tegra_plane_format(u32 fourcc, u32 *format, u32 *swap);
92 bool tegra_plane_format_is_indexed(unsigned int format);
93 bool tegra_plane_format_is_yuv(unsigned int format, unsigned int *planes, unsigned int *bpc);
94 int tegra_plane_setup_legacy_state(struct tegra_plane *tegra,
95 struct tegra_plane_state *state);
96 int tegra_plane_interconnect_init(struct tegra_plane *plane);
98 #endif /* TEGRA_PLANE_H */