Benjamin Gaignard | 9bbf86f | 2014-07-31 09:39:11 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) STMicroelectronics SA 2014 |
| 3 | * Author: Benjamin Gaignard <benjamin.gaignard@st.com> for STMicroelectronics. |
| 4 | * License terms: GNU General Public License (GPL), version 2 |
| 5 | */ |
| 6 | |
Vincent Abriou | 9e1f05b | 2015-07-31 11:32:34 +0200 | [diff] [blame] | 7 | #ifndef _STI_PLANE_H_ |
| 8 | #define _STI_PLANE_H_ |
Benjamin Gaignard | 9bbf86f | 2014-07-31 09:39:11 +0200 | [diff] [blame] | 9 | |
| 10 | #include <drm/drmP.h> |
Vincent Abriou | 29d1dc6 | 2015-08-03 14:22:16 +0200 | [diff] [blame] | 11 | #include <drm/drm_atomic_helper.h> |
| 12 | #include <drm/drm_plane_helper.h> |
| 13 | |
| 14 | extern struct drm_plane_funcs sti_plane_helpers_funcs; |
Benjamin Gaignard | 9bbf86f | 2014-07-31 09:39:11 +0200 | [diff] [blame] | 15 | |
Vincent Abriou | 871bcdf | 2015-07-31 11:32:13 +0200 | [diff] [blame] | 16 | #define to_sti_plane(x) container_of(x, struct sti_plane, drm_plane) |
| 17 | |
| 18 | #define STI_PLANE_TYPE_SHIFT 8 |
| 19 | #define STI_PLANE_TYPE_MASK (~((1 << STI_PLANE_TYPE_SHIFT) - 1)) |
| 20 | |
| 21 | enum sti_plane_type { |
| 22 | STI_GDP = 1 << STI_PLANE_TYPE_SHIFT, |
| 23 | STI_VDP = 2 << STI_PLANE_TYPE_SHIFT, |
| 24 | STI_CUR = 3 << STI_PLANE_TYPE_SHIFT, |
| 25 | STI_BCK = 4 << STI_PLANE_TYPE_SHIFT |
| 26 | }; |
| 27 | |
| 28 | enum sti_plane_id_of_type { |
| 29 | STI_ID_0 = 0, |
| 30 | STI_ID_1 = 1, |
| 31 | STI_ID_2 = 2, |
| 32 | STI_ID_3 = 3 |
| 33 | }; |
| 34 | |
| 35 | enum sti_plane_desc { |
| 36 | STI_GDP_0 = STI_GDP | STI_ID_0, |
| 37 | STI_GDP_1 = STI_GDP | STI_ID_1, |
| 38 | STI_GDP_2 = STI_GDP | STI_ID_2, |
| 39 | STI_GDP_3 = STI_GDP | STI_ID_3, |
| 40 | STI_HQVDP_0 = STI_VDP | STI_ID_0, |
| 41 | STI_CURSOR = STI_CUR, |
| 42 | STI_BACK = STI_BCK |
| 43 | }; |
| 44 | |
Vincent Abriou | 29d1dc6 | 2015-08-03 14:22:16 +0200 | [diff] [blame] | 45 | enum sti_plane_status { |
| 46 | STI_PLANE_READY, |
| 47 | STI_PLANE_UPDATED, |
| 48 | STI_PLANE_DISABLING, |
| 49 | STI_PLANE_FLUSHING, |
| 50 | STI_PLANE_DISABLED, |
| 51 | }; |
| 52 | |
Vincent Abriou | 871bcdf | 2015-07-31 11:32:13 +0200 | [diff] [blame] | 53 | /** |
| 54 | * STI plane structure |
| 55 | * |
| 56 | * @plane: drm plane it is bound to (if any) |
Vincent Abriou | 871bcdf | 2015-07-31 11:32:13 +0200 | [diff] [blame] | 57 | * @desc: plane type & id |
Vincent Abriou | 29d1dc6 | 2015-08-03 14:22:16 +0200 | [diff] [blame] | 58 | * @status: to know the status of the plane |
Vincent Abriou | 871bcdf | 2015-07-31 11:32:13 +0200 | [diff] [blame] | 59 | * @zorder: plane z-order |
Vincent Abriou | 871bcdf | 2015-07-31 11:32:13 +0200 | [diff] [blame] | 60 | */ |
| 61 | struct sti_plane { |
| 62 | struct drm_plane drm_plane; |
Vincent Abriou | 871bcdf | 2015-07-31 11:32:13 +0200 | [diff] [blame] | 63 | enum sti_plane_desc desc; |
Vincent Abriou | 29d1dc6 | 2015-08-03 14:22:16 +0200 | [diff] [blame] | 64 | enum sti_plane_status status; |
Vincent Abriou | 871bcdf | 2015-07-31 11:32:13 +0200 | [diff] [blame] | 65 | int zorder; |
Vincent Abriou | 871bcdf | 2015-07-31 11:32:13 +0200 | [diff] [blame] | 66 | }; |
| 67 | |
Vincent Abriou | 871bcdf | 2015-07-31 11:32:13 +0200 | [diff] [blame] | 68 | const char *sti_plane_to_str(struct sti_plane *plane); |
Vincent Abriou | 29d1dc6 | 2015-08-03 14:22:16 +0200 | [diff] [blame] | 69 | void sti_plane_init_property(struct sti_plane *plane, |
| 70 | enum drm_plane_type type); |
Benjamin Gaignard | 9bbf86f | 2014-07-31 09:39:11 +0200 | [diff] [blame] | 71 | #endif |