blob: 510c394e6d9a50a16c500908d6709bccb98f2aa0 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Thierry Reding5acd3512017-11-10 15:27:25 +01002/*
3 * Copyright (C) 2017 NVIDIA CORPORATION. All rights reserved.
Thierry Reding5acd3512017-11-10 15:27:25 +01004 */
5
6#ifndef TEGRA_PLANE_H
7#define TEGRA_PLANE_H 1
8
9#include <drm/drm_plane.h>
10
11struct tegra_bo;
Thierry Reding1087fac2017-12-14 13:37:53 +010012struct tegra_dc;
Thierry Reding5acd3512017-11-10 15:27:25 +010013
14struct tegra_plane {
15 struct drm_plane base;
Thierry Reding1087fac2017-12-14 13:37:53 +010016 struct tegra_dc *dc;
Thierry Redingc4755fb2017-11-13 11:08:13 +010017 unsigned int offset;
Thierry Reding5acd3512017-11-10 15:27:25 +010018 unsigned int index;
Thierry Reding5acd3512017-11-10 15:27:25 +010019};
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
Dmitry Osipenko3dae08b2018-05-04 17:39:59 +030034struct tegra_plane_legacy_blending_state {
35 bool alpha;
36 bool top;
37};
38
Thierry Reding5acd3512017-11-10 15:27:25 +010039struct tegra_plane_state {
40 struct drm_plane_state base;
41
42 struct tegra_bo_tiling tiling;
43 u32 format;
44 u32 swap;
Thierry Redingebae8d02017-12-20 09:39:14 +010045
Thierry Reding995c5a52018-03-19 17:20:46 +010046 bool bottom_up;
47
Thierry Redingebae8d02017-12-20 09:39:14 +010048 /* used for legacy blending support only */
Dmitry Osipenko3dae08b2018-05-04 17:39:59 +030049 struct tegra_plane_legacy_blending_state blending[2];
Thierry Redingebae8d02017-12-20 09:39:14 +010050 bool opaque;
Thierry Reding5acd3512017-11-10 15:27:25 +010051};
52
53static inline struct tegra_plane_state *
54to_tegra_plane_state(struct drm_plane_state *state)
55{
56 if (state)
57 return container_of(state, struct tegra_plane_state, base);
58
59 return NULL;
60}
61
62extern const struct drm_plane_funcs tegra_plane_funcs;
63
64int tegra_plane_state_add(struct tegra_plane *plane,
65 struct drm_plane_state *state);
66
67int tegra_plane_format(u32 fourcc, u32 *format, u32 *swap);
68bool tegra_plane_format_is_yuv(unsigned int format, bool *planar);
Dmitry Osipenko3dae08b2018-05-04 17:39:59 +030069int tegra_plane_setup_legacy_state(struct tegra_plane *tegra,
70 struct tegra_plane_state *state);
Thierry Reding5acd3512017-11-10 15:27:25 +010071
72#endif /* TEGRA_PLANE_H */