Commit | Line | Data |
---|---|---|
5bb5f5da JS |
1 | /* |
2 | * Copyright (C) Icenowy Zheng <icenowy@aosc.io> | |
3 | * | |
4 | * Based on sun4i_layer.h, which is: | |
5 | * Copyright (C) 2015 Free Electrons | |
6 | * Copyright (C) 2015 NextThing Co | |
7 | * | |
8 | * Maxime Ripard <maxime.ripard@free-electrons.com> | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or | |
11 | * modify it under the terms of the GNU General Public License as | |
12 | * published by the Free Software Foundation; either version 2 of | |
13 | * the License, or (at your option) any later version. | |
14 | */ | |
15 | ||
16 | #ifndef _SUN8I_UI_LAYER_H_ | |
17 | #define _SUN8I_UI_LAYER_H_ | |
18 | ||
19 | #include <drm/drm_plane.h> | |
20 | ||
4b09c073 JS |
21 | #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR(base, layer) \ |
22 | ((base) + 0x20 * (layer) + 0x0) | |
23 | #define SUN8I_MIXER_CHAN_UI_LAYER_SIZE(base, layer) \ | |
24 | ((base) + 0x20 * (layer) + 0x4) | |
25 | #define SUN8I_MIXER_CHAN_UI_LAYER_COORD(base, layer) \ | |
26 | ((base) + 0x20 * (layer) + 0x8) | |
27 | #define SUN8I_MIXER_CHAN_UI_LAYER_PITCH(base, layer) \ | |
28 | ((base) + 0x20 * (layer) + 0xc) | |
29 | #define SUN8I_MIXER_CHAN_UI_LAYER_TOP_LADDR(base, layer) \ | |
30 | ((base) + 0x20 * (layer) + 0x10) | |
31 | #define SUN8I_MIXER_CHAN_UI_LAYER_BOT_LADDR(base, layer) \ | |
32 | ((base) + 0x20 * (layer) + 0x14) | |
33 | #define SUN8I_MIXER_CHAN_UI_LAYER_FCOLOR(base, layer) \ | |
34 | ((base) + 0x20 * (layer) + 0x18) | |
35 | #define SUN8I_MIXER_CHAN_UI_TOP_HADDR(base) \ | |
36 | ((base) + 0x80) | |
37 | #define SUN8I_MIXER_CHAN_UI_BOT_HADDR(base) \ | |
38 | ((base) + 0x84) | |
39 | #define SUN8I_MIXER_CHAN_UI_OVL_SIZE(base) \ | |
40 | ((base) + 0x88) | |
5bb5f5da JS |
41 | |
42 | #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_EN BIT(0) | |
43 | #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MODE_MASK GENMASK(2, 1) | |
44 | #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_MASK GENMASK(12, 8) | |
45 | #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_OFFSET 8 | |
46 | #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MASK GENMASK(31, 24) | |
47 | ||
48 | struct sun8i_mixer; | |
49 | ||
50 | struct sun8i_ui_layer { | |
51 | struct drm_plane plane; | |
52 | struct sun8i_mixer *mixer; | |
53 | int channel; | |
54 | int overlay; | |
55 | }; | |
56 | ||
57 | static inline struct sun8i_ui_layer * | |
58 | plane_to_sun8i_ui_layer(struct drm_plane *plane) | |
59 | { | |
60 | return container_of(plane, struct sun8i_ui_layer, plane); | |
61 | } | |
62 | ||
63 | struct sun8i_ui_layer *sun8i_ui_layer_init_one(struct drm_device *drm, | |
64 | struct sun8i_mixer *mixer, | |
65 | int index); | |
66 | #endif /* _SUN8I_UI_LAYER_H_ */ |