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 struct tegra_dc; 16 17 struct tegra_plane { 18 struct drm_plane base; 19 struct tegra_dc *dc; 20 unsigned int offset; 21 unsigned int index; 22 }; 23 24 struct tegra_cursor { 25 struct tegra_plane base; 26 27 struct tegra_bo *bo; 28 unsigned int width; 29 unsigned int height; 30 }; 31 32 static inline struct tegra_plane *to_tegra_plane(struct drm_plane *plane) 33 { 34 return container_of(plane, struct tegra_plane, base); 35 } 36 37 struct tegra_plane_state { 38 struct drm_plane_state base; 39 40 struct tegra_bo_tiling tiling; 41 u32 format; 42 u32 swap; 43 }; 44 45 static inline struct tegra_plane_state * 46 to_tegra_plane_state(struct drm_plane_state *state) 47 { 48 if (state) 49 return container_of(state, struct tegra_plane_state, base); 50 51 return NULL; 52 } 53 54 extern const struct drm_plane_funcs tegra_plane_funcs; 55 56 int tegra_plane_state_add(struct tegra_plane *plane, 57 struct drm_plane_state *state); 58 59 int tegra_plane_format(u32 fourcc, u32 *format, u32 *swap); 60 bool tegra_plane_format_is_yuv(unsigned int format, bool *planar); 61 62 #endif /* TEGRA_PLANE_H */ 63