1
2
3
4
5
6
7
8
9
10#ifndef _SUN8I_VI_LAYER_H_
11#define _SUN8I_VI_LAYER_H_
12
13#include <drm/drm_plane.h>
14
15#define SUN8I_MIXER_CHAN_VI_LAYER_ATTR(base, layer) \
16 ((base) + 0x30 * (layer) + 0x0)
17#define SUN8I_MIXER_CHAN_VI_LAYER_SIZE(base, layer) \
18 ((base) + 0x30 * (layer) + 0x4)
19#define SUN8I_MIXER_CHAN_VI_LAYER_COORD(base, layer) \
20 ((base) + 0x30 * (layer) + 0x8)
21#define SUN8I_MIXER_CHAN_VI_LAYER_PITCH(base, layer, plane) \
22 ((base) + 0x30 * (layer) + 0xc + 4 * (plane))
23#define SUN8I_MIXER_CHAN_VI_LAYER_TOP_LADDR(base, layer, plane) \
24 ((base) + 0x30 * (layer) + 0x18 + 4 * (plane))
25#define SUN8I_MIXER_CHAN_VI_OVL_SIZE(base) \
26 ((base) + 0xe8)
27
28#define SUN8I_MIXER_CHAN_VI_LAYER_ATTR_EN BIT(0)
29
30#define SUN8I_MIXER_CHAN_VI_LAYER_ATTR_RGB_MODE BIT(15)
31#define SUN8I_MIXER_CHAN_VI_LAYER_ATTR_FBFMT_OFFSET 8
32#define SUN8I_MIXER_CHAN_VI_LAYER_ATTR_FBFMT_MASK GENMASK(12, 8)
33#define SUN50I_MIXER_CHAN_VI_LAYER_ATTR_ALPHA_MASK GENMASK(31, 24)
34#define SUN50I_MIXER_CHAN_VI_LAYER_ATTR_ALPHA(x) ((x) << 24)
35
36struct sun8i_mixer;
37
38struct sun8i_vi_layer {
39 struct drm_plane plane;
40 struct sun8i_mixer *mixer;
41 int channel;
42 int overlay;
43};
44
45static inline struct sun8i_vi_layer *
46plane_to_sun8i_vi_layer(struct drm_plane *plane)
47{
48 return container_of(plane, struct sun8i_vi_layer, plane);
49}
50
51struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
52 struct sun8i_mixer *mixer,
53 int index);
54#endif
55