Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Copyright (C) Icenowy Zheng <icenowy@aosc.io>
0004  *
0005  * Based on sun4i_layer.h, which is:
0006  *   Copyright (C) 2015 Free Electrons
0007  *   Copyright (C) 2015 NextThing Co
0008  *
0009  *   Maxime Ripard <maxime.ripard@free-electrons.com>
0010  */
0011 
0012 #ifndef _SUN8I_UI_LAYER_H_
0013 #define _SUN8I_UI_LAYER_H_
0014 
0015 #include <drm/drm_plane.h>
0016 
0017 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR(base, layer) \
0018             ((base) + 0x20 * (layer) + 0x0)
0019 #define SUN8I_MIXER_CHAN_UI_LAYER_SIZE(base, layer) \
0020             ((base) + 0x20 * (layer) + 0x4)
0021 #define SUN8I_MIXER_CHAN_UI_LAYER_COORD(base, layer) \
0022             ((base) + 0x20 * (layer) + 0x8)
0023 #define SUN8I_MIXER_CHAN_UI_LAYER_PITCH(base, layer) \
0024             ((base) + 0x20 * (layer) + 0xc)
0025 #define SUN8I_MIXER_CHAN_UI_LAYER_TOP_LADDR(base, layer) \
0026             ((base) + 0x20 * (layer) + 0x10)
0027 #define SUN8I_MIXER_CHAN_UI_LAYER_BOT_LADDR(base, layer) \
0028             ((base) + 0x20 * (layer) + 0x14)
0029 #define SUN8I_MIXER_CHAN_UI_LAYER_FCOLOR(base, layer) \
0030             ((base) + 0x20 * (layer) + 0x18)
0031 #define SUN8I_MIXER_CHAN_UI_TOP_HADDR(base) \
0032             ((base) + 0x80)
0033 #define SUN8I_MIXER_CHAN_UI_BOT_HADDR(base) \
0034             ((base) + 0x84)
0035 #define SUN8I_MIXER_CHAN_UI_OVL_SIZE(base) \
0036             ((base) + 0x88)
0037 
0038 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_EN       BIT(0)
0039 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MODE_MASK  GENMASK(2, 1)
0040 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_MASK   GENMASK(12, 8)
0041 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_FBFMT_OFFSET 8
0042 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MASK   GENMASK(31, 24)
0043 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA(x)     ((x) << 24)
0044 
0045 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MODE_PIXEL     ((0) << 1)
0046 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MODE_LAYER     ((1) << 1)
0047 #define SUN8I_MIXER_CHAN_UI_LAYER_ATTR_ALPHA_MODE_COMBINED  ((2) << 1)
0048 
0049 struct sun8i_mixer;
0050 
0051 struct sun8i_ui_layer {
0052     struct drm_plane    plane;
0053     struct sun8i_mixer  *mixer;
0054     int         channel;
0055     int         overlay;
0056 };
0057 
0058 static inline struct sun8i_ui_layer *
0059 plane_to_sun8i_ui_layer(struct drm_plane *plane)
0060 {
0061     return container_of(plane, struct sun8i_ui_layer, plane);
0062 }
0063 
0064 struct sun8i_ui_layer *sun8i_ui_layer_init_one(struct drm_device *drm,
0065                            struct sun8i_mixer *mixer,
0066                            int index);
0067 #endif /* _SUN8I_UI_LAYER_H_ */