blob: fc7566f630fa35a5657a9d0c7934c95e4d50715f [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;
15
16struct tegra_plane {
17 struct drm_plane base;
Thierry Redingc4755fb2017-11-13 11:08:13 +010018 unsigned int offset;
Thierry Reding5acd3512017-11-10 15:27:25 +010019 unsigned int index;
Thierry Redingc4755fb2017-11-13 11:08:13 +010020 unsigned int depth;
Thierry Reding5acd3512017-11-10 15:27:25 +010021};
22
23struct tegra_cursor {
24 struct tegra_plane base;
25
26 struct tegra_bo *bo;
27 unsigned int width;
28 unsigned int height;
29};
30
31static inline struct tegra_plane *to_tegra_plane(struct drm_plane *plane)
32{
33 return container_of(plane, struct tegra_plane, base);
34}
35
36struct tegra_plane_state {
37 struct drm_plane_state base;
38
39 struct tegra_bo_tiling tiling;
40 u32 format;
41 u32 swap;
42};
43
44static inline struct tegra_plane_state *
45to_tegra_plane_state(struct drm_plane_state *state)
46{
47 if (state)
48 return container_of(state, struct tegra_plane_state, base);
49
50 return NULL;
51}
52
53extern const struct drm_plane_funcs tegra_plane_funcs;
54
55int tegra_plane_state_add(struct tegra_plane *plane,
56 struct drm_plane_state *state);
57
58int tegra_plane_format(u32 fourcc, u32 *format, u32 *swap);
59bool tegra_plane_format_is_yuv(unsigned int format, bool *planar);
60
61#endif /* TEGRA_PLANE_H */