Thierry Reding | 5acd351 | 2017-11-10 15:27:25 +0100 | [diff] [blame] | 1 | /* |
| 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 | |
| 14 | struct tegra_bo; |
| 15 | |
| 16 | struct tegra_plane { |
| 17 | struct drm_plane base; |
Thierry Reding | c4755fb | 2017-11-13 11:08:13 +0100 | [diff] [blame^] | 18 | unsigned int offset; |
Thierry Reding | 5acd351 | 2017-11-10 15:27:25 +0100 | [diff] [blame] | 19 | unsigned int index; |
Thierry Reding | c4755fb | 2017-11-13 11:08:13 +0100 | [diff] [blame^] | 20 | unsigned int depth; |
Thierry Reding | 5acd351 | 2017-11-10 15:27:25 +0100 | [diff] [blame] | 21 | }; |
| 22 | |
| 23 | struct tegra_cursor { |
| 24 | struct tegra_plane base; |
| 25 | |
| 26 | struct tegra_bo *bo; |
| 27 | unsigned int width; |
| 28 | unsigned int height; |
| 29 | }; |
| 30 | |
| 31 | static inline struct tegra_plane *to_tegra_plane(struct drm_plane *plane) |
| 32 | { |
| 33 | return container_of(plane, struct tegra_plane, base); |
| 34 | } |
| 35 | |
| 36 | struct tegra_plane_state { |
| 37 | struct drm_plane_state base; |
| 38 | |
| 39 | struct tegra_bo_tiling tiling; |
| 40 | u32 format; |
| 41 | u32 swap; |
| 42 | }; |
| 43 | |
| 44 | static inline struct tegra_plane_state * |
| 45 | to_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 | |
| 53 | extern const struct drm_plane_funcs tegra_plane_funcs; |
| 54 | |
| 55 | int tegra_plane_state_add(struct tegra_plane *plane, |
| 56 | struct drm_plane_state *state); |
| 57 | |
| 58 | int tegra_plane_format(u32 fourcc, u32 *format, u32 *swap); |
| 59 | bool tegra_plane_format_is_yuv(unsigned int format, bool *planar); |
| 60 | |
| 61 | #endif /* TEGRA_PLANE_H */ |