Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Copyright (C) Jernej Skrabec <jernej.skrabec@siol.net>
0004  */
0005 
0006 #ifndef _SUN8I_VI_LAYER_H_
0007 #define _SUN8I_VI_LAYER_H_
0008 
0009 #include <drm/drm_plane.h>
0010 
0011 #define SUN8I_MIXER_CHAN_VI_LAYER_ATTR(base, layer) \
0012         ((base) + 0x30 * (layer) + 0x0)
0013 #define SUN8I_MIXER_CHAN_VI_LAYER_SIZE(base, layer) \
0014         ((base) + 0x30 * (layer) + 0x4)
0015 #define SUN8I_MIXER_CHAN_VI_LAYER_COORD(base, layer) \
0016         ((base) + 0x30 * (layer) + 0x8)
0017 #define SUN8I_MIXER_CHAN_VI_LAYER_PITCH(base, layer, plane) \
0018         ((base) + 0x30 * (layer) + 0xc + 4 * (plane))
0019 #define SUN8I_MIXER_CHAN_VI_LAYER_TOP_LADDR(base, layer, plane) \
0020         ((base) + 0x30 * (layer) + 0x18 + 4 * (plane))
0021 #define SUN8I_MIXER_CHAN_VI_OVL_SIZE(base) \
0022         ((base) + 0xe8)
0023 #define SUN8I_MIXER_CHAN_VI_HDS_Y(base) \
0024         ((base) + 0xf0)
0025 #define SUN8I_MIXER_CHAN_VI_HDS_UV(base) \
0026         ((base) + 0xf4)
0027 #define SUN8I_MIXER_CHAN_VI_VDS_Y(base) \
0028         ((base) + 0xf8)
0029 #define SUN8I_MIXER_CHAN_VI_VDS_UV(base) \
0030         ((base) + 0xfc)
0031 
0032 #define SUN8I_MIXER_FCC_GLOBAL_ALPHA_REG \
0033         (0xAA000 + 0x90)
0034 
0035 #define SUN8I_MIXER_FCC_GLOBAL_ALPHA(x)         ((x) << 24)
0036 #define SUN8I_MIXER_FCC_GLOBAL_ALPHA_MASK       GENMASK(31, 24)
0037 
0038 #define SUN8I_MIXER_CHAN_VI_LAYER_ATTR_EN       BIT(0)
0039 /* RGB mode should be set for RGB formats and cleared for YCbCr */
0040 #define SUN8I_MIXER_CHAN_VI_LAYER_ATTR_RGB_MODE     BIT(15)
0041 #define SUN8I_MIXER_CHAN_VI_LAYER_ATTR_FBFMT_OFFSET 8
0042 #define SUN8I_MIXER_CHAN_VI_LAYER_ATTR_FBFMT_MASK   GENMASK(12, 8)
0043 #define SUN50I_MIXER_CHAN_VI_LAYER_ATTR_ALPHA_MODE_MASK GENMASK(2, 1)
0044 #define SUN50I_MIXER_CHAN_VI_LAYER_ATTR_ALPHA_MASK  GENMASK(31, 24)
0045 #define SUN50I_MIXER_CHAN_VI_LAYER_ATTR_ALPHA(x)    ((x) << 24)
0046 
0047 #define SUN50I_MIXER_CHAN_VI_LAYER_ATTR_ALPHA_MODE_PIXEL    ((0) << 1)
0048 #define SUN50I_MIXER_CHAN_VI_LAYER_ATTR_ALPHA_MODE_LAYER    ((1) << 1)
0049 #define SUN50I_MIXER_CHAN_VI_LAYER_ATTR_ALPHA_MODE_COMBINED ((2) << 1)
0050 
0051 #define SUN8I_MIXER_CHAN_VI_DS_N(x)         ((x) << 16)
0052 #define SUN8I_MIXER_CHAN_VI_DS_M(x)         ((x) << 0)
0053 
0054 struct sun8i_mixer;
0055 
0056 struct sun8i_vi_layer {
0057     struct drm_plane    plane;
0058     struct sun8i_mixer  *mixer;
0059     int         channel;
0060     int         overlay;
0061 };
0062 
0063 static inline struct sun8i_vi_layer *
0064 plane_to_sun8i_vi_layer(struct drm_plane *plane)
0065 {
0066     return container_of(plane, struct sun8i_vi_layer, plane);
0067 }
0068 
0069 struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
0070                            struct sun8i_mixer *mixer,
0071                            int index);
0072 #endif /* _SUN8I_VI_LAYER_H_ */