blob: 7360ddfafee8df25387927702f6e0292e02734cc [file] [log] [blame]
Thierry Reding5acd3512017-11-10 15:27:25 +01001/*
2 * Copyright (C) 2017 NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef TEGRA_PLANE_H
10#define TEGRA_PLANE_H 1
11
12#include <drm/drm_plane.h>
13
14struct tegra_bo;
Thierry Reding1087fac2017-12-14 13:37:53 +010015struct tegra_dc;
Thierry Reding5acd3512017-11-10 15:27:25 +010016
17struct tegra_plane {
18 struct drm_plane base;
Thierry Reding1087fac2017-12-14 13:37:53 +010019 struct tegra_dc *dc;
Thierry Redingc4755fb2017-11-13 11:08:13 +010020 unsigned int offset;
Thierry Reding5acd3512017-11-10 15:27:25 +010021 unsigned int index;
Thierry Reding5acd3512017-11-10 15:27:25 +010022};
23
24struct tegra_cursor {
25 struct tegra_plane base;
26
27 struct tegra_bo *bo;
28 unsigned int width;
29 unsigned int height;
30};
31
32static inline struct tegra_plane *to_tegra_plane(struct drm_plane *plane)
33{
34 return container_of(plane, struct tegra_plane, base);
35}
36
Dmitry Osipenko3dae08b2018-05-04 17:39:59 +030037struct tegra_plane_legacy_blending_state {
38 bool alpha;
39 bool top;
40};
41
Thierry Reding5acd3512017-11-10 15:27:25 +010042struct tegra_plane_state {
43 struct drm_plane_state base;
44
45 struct tegra_bo_tiling tiling;
46 u32 format;
47 u32 swap;
Thierry Redingebae8d02017-12-20 09:39:14 +010048
49 /* used for legacy blending support only */
Dmitry Osipenko3dae08b2018-05-04 17:39:59 +030050 struct tegra_plane_legacy_blending_state blending[2];
Thierry Redingebae8d02017-12-20 09:39:14 +010051 bool opaque;
Thierry Reding5acd3512017-11-10 15:27:25 +010052};
53
54static inline struct tegra_plane_state *
55to_tegra_plane_state(struct drm_plane_state *state)
56{
57 if (state)
58 return container_of(state, struct tegra_plane_state, base);
59
60 return NULL;
61}
62
63extern const struct drm_plane_funcs tegra_plane_funcs;
64
65int tegra_plane_state_add(struct tegra_plane *plane,
66 struct drm_plane_state *state);
67
68int tegra_plane_format(u32 fourcc, u32 *format, u32 *swap);
69bool tegra_plane_format_is_yuv(unsigned int format, bool *planar);
Dmitry Osipenko3dae08b2018-05-04 17:39:59 +030070int tegra_plane_setup_legacy_state(struct tegra_plane *tegra,
71 struct tegra_plane_state *state);
Thierry Reding5acd3512017-11-10 15:27:25 +010072
73#endif /* TEGRA_PLANE_H */