History

drm/sun4i: Add basic support for DE3

Display Engine 3 is an upgrade of DE2 with new features like support for 10 bit color formats and support for AFBC. Most of DE2 code works with DE3, except some small details. Implement basic support for DE3. Support for 10 bit colort formats and AFBC, among others missing features, will be added later.

Jernej Skrabec committed 8 years ago

Commit c50519e1 parent 97eb57f9 files · +202 −17Browse files

Unified · Split

9 files
  1. drivers/gpu/drm/sun4i/sun8i_csc.c +83 −0
  2. drivers/gpu/drm/sun4i/sun8i_mixer.c +27 −12
  3. drivers/gpu/drm/sun4i/sun8i_mixer.h +32 −2
  4. drivers/gpu/drm/sun4i/sun8i_ui_scaler.c +8 −2
  5. drivers/gpu/drm/sun4i/sun8i_ui_scaler.h +1 −0
  6. drivers/gpu/drm/sun4i/sun8i_vi_layer.c +8 −0
  7. drivers/gpu/drm/sun4i/sun8i_vi_layer.h +2 −0
  8. drivers/gpu/drm/sun4i/sun8i_vi_scaler.c +18 −1
  9. drivers/gpu/drm/sun4i/sun8i_vi_scaler.h +23 −0
drivers/gpu/drm/sun4i/sun8i_csc.c+83−0
@@ -34,6 +34,41 @@ static const u32 yvu2rgb[] = { · 33 unmodified lines
34 0x000004A8, 0x00000000, 0x00000813, 0xFFFBAC4A,34 0x000004A8, 0x00000000, 0x00000813, 0xFFFBAC4A,
35};35};
36 36
37/*
38 * DE3 has a bit different CSC units. Factors are in two's complement format.
39 * First three factors in a row are multiplication factors which have 17 bits
40 * for fractional part. Fourth value in a row is comprised of two factors.
41 * Upper 16 bits represents difference, which is subtracted from the input
42 * value before multiplication and lower 16 bits represents constant, which
43 * is addes at the end.
44 *
45 * x' = c00 * (x + d0) + c01 * (y + d1) + c02 * (z + d2) + const0
46 * y' = c10 * (x + d0) + c11 * (y + d1) + c12 * (z + d2) + const1
47 * z' = c20 * (x + d0) + c21 * (y + d1) + c22 * (z + d2) + const2
48 *
49 * Please note that above formula is true only for Blender CSC. Other DE3 CSC
50 * units takes only positive value for difference. From what can be deducted
51 * from BSP driver code, those units probably automatically assume that
52 * difference has to be subtracted.
53 *
54 * Layout of factors in table:
55 * c00 c01 c02 [d0 const0]
56 * c10 c11 c12 [d1 const1]
57 * c20 c21 c22 [d2 const2]
58 */
59
60static const u32 yuv2rgb_de3[] = {
61 0x0002542a, 0x00000000, 0x0003312a, 0xffc00000,
62 0x0002542a, 0xffff376b, 0xfffe5fc3, 0xfe000000,
63 0x0002542a, 0x000408d3, 0x00000000, 0xfe000000,
64};
65
66static const u32 yvu2rgb_de3[] = {
67 0x0002542a, 0x0003312a, 0x00000000, 0xffc00000,
68 0x0002542a, 0xfffe5fc3, 0xffff376b, 0xfe000000,
69 0x0002542a, 0x00000000, 0x000408d3, 0xfe000000,
70};
71
37static void sun8i_csc_set_coefficients(struct regmap *map, u32 base,72static void sun8i_csc_set_coefficients(struct regmap *map, u32 base,
38 enum sun8i_csc_mode mode)73 enum sun8i_csc_mode mode)
39{74{
@@ -61,6 +96,28 @@ static void sun8i_csc_set_coefficients(struct regmap *map, u32 base, · 21 unmodified lines
61 }96 }
62}97}
63 98
99static void sun8i_de3_ccsc_set_coefficients(struct regmap *map, int layer,
100 enum sun8i_csc_mode mode)
101{
102 const u32 *table;
103 u32 base_reg;
104
105 switch (mode) {
106 case SUN8I_CSC_MODE_YUV2RGB:
107 table = yuv2rgb_de3;
108 break;
109 case SUN8I_CSC_MODE_YVU2RGB:
110 table = yvu2rgb_de3;
111 break;
112 default:
113 DRM_WARN("Wrong CSC mode specified.\n");
114 return;
115 }
116
117 base_reg = SUN50I_MIXER_BLEND_CSC_COEFF(DE3_BLD_BASE, layer, 0, 0);
118 regmap_bulk_write(map, base_reg, table, 12);
119}
120
64static void sun8i_csc_enable(struct regmap *map, u32 base, bool enable)121static void sun8i_csc_enable(struct regmap *map, u32 base, bool enable)
65{122{
66 u32 val;123 u32 val;
@@ -73,11 +130,32 @@ static void sun8i_csc_enable(struct regmap *map, u32 base, bool enable) · 6 unmodified lines
73 regmap_update_bits(map, SUN8I_CSC_CTRL(base), SUN8I_CSC_CTRL_EN, val);130 regmap_update_bits(map, SUN8I_CSC_CTRL(base), SUN8I_CSC_CTRL_EN, val);
74}131}
75 132
133static void sun8i_de3_ccsc_enable(struct regmap *map, int layer, bool enable)
134{
135 u32 val, mask;
136
137 mask = SUN50I_MIXER_BLEND_CSC_CTL_EN(layer);
138
139 if (enable)
140 val = mask;
141 else
142 val = 0;
143
144 regmap_update_bits(map, SUN50I_MIXER_BLEND_CSC_CTL(DE3_BLD_BASE),
145 mask, val);
146}
147
76void sun8i_csc_set_ccsc_coefficients(struct sun8i_mixer *mixer, int layer,148void sun8i_csc_set_ccsc_coefficients(struct sun8i_mixer *mixer, int layer,
77 enum sun8i_csc_mode mode)149 enum sun8i_csc_mode mode)
78{150{
79 u32 base;151 u32 base;
80 152
153 if (mixer->cfg->is_de3) {
154 sun8i_de3_ccsc_set_coefficients(mixer->engine.regs,
155 layer, mode);
156 return;
157 }
158
81 base = ccsc_base[mixer->cfg->ccsc][layer];159 base = ccsc_base[mixer->cfg->ccsc][layer];
82 160
83 sun8i_csc_set_coefficients(mixer->engine.regs, base, mode);161 sun8i_csc_set_coefficients(mixer->engine.regs, base, mode);
@@ -87,6 +165,11 @@ void sun8i_csc_enable_ccsc(struct sun8i_mixer *mixer, int layer, bool enable) · 3 unmodified lines
87{165{
88 u32 base;166 u32 base;
89 167
168 if (mixer->cfg->is_de3) {
169 sun8i_de3_ccsc_enable(mixer->engine.regs, layer, enable);
170 return;
171 }
172
90 base = ccsc_base[mixer->cfg->ccsc][layer];173 base = ccsc_base[mixer->cfg->ccsc][layer];
91 174
92 sun8i_csc_enable(mixer->engine.regs, base, enable);175 sun8i_csc_enable(mixer->engine.regs, base, enable);
drivers/gpu/drm/sun4i/sun8i_mixer.c+27−12
@@ -459,18 +459,33 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master, · 458 unmodified lines
459 459
460 base = sun8i_blender_base(mixer);460 base = sun8i_blender_base(mixer);
461 461
462 /* Reset the registers */462 /* Reset registers and disable unused sub-engines */
463 for (i = 0; i < DE2_MIXER_UNIT_SIZE; i += 4)463 if (mixer->cfg->is_de3) {
464 regmap_write(mixer->engine.regs, i, 0);464 for (i = 0; i < DE3_MIXER_UNIT_SIZE; i += 4)
465 465 regmap_write(mixer->engine.regs, i, 0);
466 /* Disable unused sub-engines */466
467 regmap_write(mixer->engine.regs, SUN8I_MIXER_FCE_EN, 0);467 regmap_write(mixer->engine.regs, SUN50I_MIXER_FCE_EN, 0);
468 regmap_write(mixer->engine.regs, SUN8I_MIXER_BWS_EN, 0);468 regmap_write(mixer->engine.regs, SUN50I_MIXER_PEAK_EN, 0);
469 regmap_write(mixer->engine.regs, SUN8I_MIXER_LTI_EN, 0);469 regmap_write(mixer->engine.regs, SUN50I_MIXER_LCTI_EN, 0);
470 regmap_write(mixer->engine.regs, SUN8I_MIXER_PEAK_EN, 0);470 regmap_write(mixer->engine.regs, SUN50I_MIXER_BLS_EN, 0);
471 regmap_write(mixer->engine.regs, SUN8I_MIXER_ASE_EN, 0);471 regmap_write(mixer->engine.regs, SUN50I_MIXER_FCC_EN, 0);
472 regmap_write(mixer->engine.regs, SUN8I_MIXER_FCC_EN, 0);472 regmap_write(mixer->engine.regs, SUN50I_MIXER_DNS_EN, 0);
473 regmap_write(mixer->engine.regs, SUN8I_MIXER_DCSC_EN, 0);473 regmap_write(mixer->engine.regs, SUN50I_MIXER_DRC_EN, 0);
474 regmap_write(mixer->engine.regs, SUN50I_MIXER_FMT_EN, 0);
475 regmap_write(mixer->engine.regs, SUN50I_MIXER_CDC0_EN, 0);
476 regmap_write(mixer->engine.regs, SUN50I_MIXER_CDC1_EN, 0);
477 } else {
478 for (i = 0; i < DE2_MIXER_UNIT_SIZE; i += 4)
479 regmap_write(mixer->engine.regs, i, 0);
480
481 regmap_write(mixer->engine.regs, SUN8I_MIXER_FCE_EN, 0);
482 regmap_write(mixer->engine.regs, SUN8I_MIXER_BWS_EN, 0);
483 regmap_write(mixer->engine.regs, SUN8I_MIXER_LTI_EN, 0);
484 regmap_write(mixer->engine.regs, SUN8I_MIXER_PEAK_EN, 0);
485 regmap_write(mixer->engine.regs, SUN8I_MIXER_ASE_EN, 0);
486 regmap_write(mixer->engine.regs, SUN8I_MIXER_FCC_EN, 0);
487 regmap_write(mixer->engine.regs, SUN8I_MIXER_DCSC_EN, 0);
488 }
474 489
475 /* Enable the mixer */490 /* Enable the mixer */
476 regmap_write(mixer->engine.regs, SUN8I_MIXER_GLOBAL_CTL,491 regmap_write(mixer->engine.regs, SUN8I_MIXER_GLOBAL_CTL,
drivers/gpu/drm/sun4i/sun8i_mixer.h+32−2
@@ -30,11 +30,16 @@ · 29 unmodified lines
30#define SUN8I_MIXER_GLOBAL_DBUFF_ENABLE BIT(0)30#define SUN8I_MIXER_GLOBAL_DBUFF_ENABLE BIT(0)
31 31
32#define DE2_MIXER_UNIT_SIZE 0x600032#define DE2_MIXER_UNIT_SIZE 0x6000
33#define DE3_MIXER_UNIT_SIZE 0x3000
33 34
34#define DE2_BLD_BASE 0x100035#define DE2_BLD_BASE 0x1000
35#define DE2_CH_BASE 0x200036#define DE2_CH_BASE 0x2000
36#define DE2_CH_SIZE 0x100037#define DE2_CH_SIZE 0x1000
37 38
39#define DE3_BLD_BASE 0x0800
40#define DE3_CH_BASE 0x1000
41#define DE3_CH_SIZE 0x0800
42
38#define SUN8I_MIXER_BLEND_PIPE_CTL(base) ((base) + 0)43#define SUN8I_MIXER_BLEND_PIPE_CTL(base) ((base) + 0)
39#define SUN8I_MIXER_BLEND_ATTR_FCOLOR(base, x) ((base) + 0x4 + 0x10 * (x))44#define SUN8I_MIXER_BLEND_ATTR_FCOLOR(base, x) ((base) + 0x4 + 0x10 * (x))
40#define SUN8I_MIXER_BLEND_ATTR_INSIZE(base, x) ((base) + 0x8 + 0x10 * (x))45#define SUN8I_MIXER_BLEND_ATTR_INSIZE(base, x) ((base) + 0x8 + 0x10 * (x))
@@ -49,10 +54,16 @@ · 8 unmodified lines
49#define SUN8I_MIXER_BLEND_CK_MAX(base, x) ((base) + 0xc0 + 0x04 * (x))54#define SUN8I_MIXER_BLEND_CK_MAX(base, x) ((base) + 0xc0 + 0x04 * (x))
50#define SUN8I_MIXER_BLEND_CK_MIN(base, x) ((base) + 0xe0 + 0x04 * (x))55#define SUN8I_MIXER_BLEND_CK_MIN(base, x) ((base) + 0xe0 + 0x04 * (x))
51#define SUN8I_MIXER_BLEND_OUTCTL(base) ((base) + 0xfc)56#define SUN8I_MIXER_BLEND_OUTCTL(base) ((base) + 0xfc)
57#define SUN50I_MIXER_BLEND_CSC_CTL(base) ((base) + 0x100)
58#define SUN50I_MIXER_BLEND_CSC_COEFF(base, layer, x, y) \
59 ((base) + 0x110 + (layer) * 0x30 + (x) * 0x10 + 4 * (y))
60#define SUN50I_MIXER_BLEND_CSC_CONST(base, layer, i) \
61 ((base) + 0x110 + (layer) * 0x30 + (i) * 0x10 + 0x0c)
52 62
53#define SUN8I_MIXER_BLEND_PIPE_CTL_EN_MSK GENMASK(12, 8)63#define SUN8I_MIXER_BLEND_PIPE_CTL_EN_MSK GENMASK(12, 8)
54#define SUN8I_MIXER_BLEND_PIPE_CTL_EN(pipe) BIT(8 + pipe)64#define SUN8I_MIXER_BLEND_PIPE_CTL_EN(pipe) BIT(8 + pipe)
55#define SUN8I_MIXER_BLEND_PIPE_CTL_FC_EN(pipe) BIT(pipe)65#define SUN8I_MIXER_BLEND_PIPE_CTL_FC_EN(pipe) BIT(pipe)
66
56/* colors are always in AARRGGBB format */67/* colors are always in AARRGGBB format */
57#define SUN8I_MIXER_BLEND_COLOR_BLACK 0xff00000068#define SUN8I_MIXER_BLEND_COLOR_BLACK 0xff000000
58/* The following numbers are some still unknown magic numbers */69/* The following numbers are some still unknown magic numbers */
@@ -63,6 +74,9 @@ · 4 unmodified lines
63 74
64#define SUN8I_MIXER_BLEND_OUTCTL_INTERLACED BIT(1)75#define SUN8I_MIXER_BLEND_OUTCTL_INTERLACED BIT(1)
65 76
77#define SUN50I_MIXER_BLEND_CSC_CTL_EN(ch) BIT(ch)
78#define SUN50I_MIXER_BLEND_CSC_CONST_VAL(d, c) (((d) << 16) | ((c) & 0xffff))
79
66#define SUN8I_MIXER_FBFMT_ARGB8888 080#define SUN8I_MIXER_FBFMT_ARGB8888 0
67#define SUN8I_MIXER_FBFMT_ABGR8888 181#define SUN8I_MIXER_FBFMT_ABGR8888 1
68#define SUN8I_MIXER_FBFMT_RGBA8888 282#define SUN8I_MIXER_FBFMT_RGBA8888 2
@@ -112,6 +126,17 @@ · 43 unmodified lines
112#define SUN8I_MIXER_FCC_EN 0xaa000126#define SUN8I_MIXER_FCC_EN 0xaa000
113#define SUN8I_MIXER_DCSC_EN 0xb0000127#define SUN8I_MIXER_DCSC_EN 0xb0000
114 128
129#define SUN50I_MIXER_FCE_EN 0x70000
130#define SUN50I_MIXER_PEAK_EN 0x70800
131#define SUN50I_MIXER_LCTI_EN 0x71000
132#define SUN50I_MIXER_BLS_EN 0x71800
133#define SUN50I_MIXER_FCC_EN 0x72000
134#define SUN50I_MIXER_DNS_EN 0x80000
135#define SUN50I_MIXER_DRC_EN 0xa0000
136#define SUN50I_MIXER_FMT_EN 0xa8000
137#define SUN50I_MIXER_CDC0_EN 0xd0000
138#define SUN50I_MIXER_CDC1_EN 0xd8000
139
115struct de2_fmt_info {140struct de2_fmt_info {
116 u32 drm_fmt;141 u32 drm_fmt;
117 u32 de2_fmt;142 u32 de2_fmt;
@@ -133,6 +158,7 @@ struct de2_fmt_info { · 15 unmodified lines
133 * are invalid.158 * are invalid.
134 * @mod_rate: module clock rate that needs to be set in order to have159 * @mod_rate: module clock rate that needs to be set in order to have
135 * a functional block.160 * a functional block.
161 * @is_de3: true, if this is next gen display engine 3.0, false otherwise.
136 */162 */
137struct sun8i_mixer_cfg {163struct sun8i_mixer_cfg {
138 int vi_num;164 int vi_num;
@@ -140,6 +166,7 @@ struct sun8i_mixer_cfg { · 1 unmodified line
140 int scaler_mask;166 int scaler_mask;
141 int ccsc;167 int ccsc;
142 unsigned long mod_rate;168 unsigned long mod_rate;
169 unsigned int is_de3 : 1;
143};170};
144 171
145struct sun8i_mixer {172struct sun8i_mixer {
@@ -162,13 +189,16 @@ engine_to_sun8i_mixer(struct sunxi_engine *engine) · 16 unmodified lines
162static inline u32189static inline u32
163sun8i_blender_base(struct sun8i_mixer *mixer)190sun8i_blender_base(struct sun8i_mixer *mixer)
164{191{
165 return DE2_BLD_BASE;192 return mixer->cfg->is_de3 ? DE3_BLD_BASE : DE2_BLD_BASE;
166}193}
167 194
168static inline u32195static inline u32
169sun8i_channel_base(struct sun8i_mixer *mixer, int channel)196sun8i_channel_base(struct sun8i_mixer *mixer, int channel)
170{197{
171 return DE2_CH_BASE + channel * DE2_CH_SIZE;198 if (mixer->cfg->is_de3)
199 return DE3_CH_BASE + channel * DE3_CH_SIZE;
200 else
201 return DE2_CH_BASE + channel * DE2_CH_SIZE;
172}202}
173 203
174const struct de2_fmt_info *sun8i_mixer_format_info(u32 format);204const struct de2_fmt_info *sun8i_mixer_format_info(u32 format);
drivers/gpu/drm/sun4i/sun8i_ui_scaler.c+8−2
@@ -93,8 +93,14 @@ static u32 sun8i_ui_scaler_base(struct sun8i_mixer *mixer, int channel) · 92 unmodified lines
93{93{
94 int vi_num = mixer->cfg->vi_num;94 int vi_num = mixer->cfg->vi_num;
95 95
96 return DE2_VI_SCALER_UNIT_BASE + DE2_VI_SCALER_UNIT_SIZE * vi_num +96 if (mixer->cfg->is_de3)
97 DE2_UI_SCALER_UNIT_SIZE * (channel - vi_num);97 return DE3_VI_SCALER_UNIT_BASE +
98 DE3_VI_SCALER_UNIT_SIZE * vi_num +
99 DE3_UI_SCALER_UNIT_SIZE * (channel - vi_num);
100 else
101 return DE2_VI_SCALER_UNIT_BASE +
102 DE2_VI_SCALER_UNIT_SIZE * vi_num +
103 DE2_UI_SCALER_UNIT_SIZE * (channel - vi_num);
98}104}
99 105
100static int sun8i_ui_scaler_coef_index(unsigned int step)106static int sun8i_ui_scaler_coef_index(unsigned int step)
drivers/gpu/drm/sun4i/sun8i_ui_scaler.h+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
12#include "sun8i_mixer.h"12#include "sun8i_mixer.h"
13 13
14#define DE2_UI_SCALER_UNIT_SIZE 0x1000014#define DE2_UI_SCALER_UNIT_SIZE 0x10000
15#define DE3_UI_SCALER_UNIT_SIZE 0x08000
15 16
16/* this two macros assumes 16 fractional bits which is standard in DRM */17/* this two macros assumes 16 fractional bits which is standard in DRM */
17#define SUN8I_UI_SCALER_SCALE_MIN 118#define SUN8I_UI_SCALER_SCALE_MIN 1
drivers/gpu/drm/sun4i/sun8i_vi_layer.c+8−0
@@ -202,6 +202,14 @@ static int sun8i_vi_layer_update_formats(struct sun8i_mixer *mixer, int channel, · 201 unmodified lines
202 SUN8I_MIXER_CHAN_VI_LAYER_ATTR(ch_base, overlay),202 SUN8I_MIXER_CHAN_VI_LAYER_ATTR(ch_base, overlay),
203 SUN8I_MIXER_CHAN_VI_LAYER_ATTR_RGB_MODE, val);203 SUN8I_MIXER_CHAN_VI_LAYER_ATTR_RGB_MODE, val);
204 204
205 /* It seems that YUV formats use global alpha setting. */
206 if (mixer->cfg->is_de3)
207 regmap_update_bits(mixer->engine.regs,
208 SUN8I_MIXER_CHAN_VI_LAYER_ATTR(ch_base,
209 overlay),
210 SUN50I_MIXER_CHAN_VI_LAYER_ATTR_ALPHA_MASK,
211 SUN50I_MIXER_CHAN_VI_LAYER_ATTR_ALPHA(0xff));
212
205 return 0;213 return 0;
206}214}
207 215
drivers/gpu/drm/sun4i/sun8i_vi_layer.h+2−0
@@ -30,6 +30,8 @@ · 29 unmodified lines
30#define SUN8I_MIXER_CHAN_VI_LAYER_ATTR_RGB_MODE BIT(15)30#define SUN8I_MIXER_CHAN_VI_LAYER_ATTR_RGB_MODE BIT(15)
31#define SUN8I_MIXER_CHAN_VI_LAYER_ATTR_FBFMT_OFFSET 831#define SUN8I_MIXER_CHAN_VI_LAYER_ATTR_FBFMT_OFFSET 8
32#define SUN8I_MIXER_CHAN_VI_LAYER_ATTR_FBFMT_MASK GENMASK(12, 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)
33 35
34struct sun8i_mixer;36struct sun8i_mixer;
35 37
drivers/gpu/drm/sun4i/sun8i_vi_scaler.c+18−1
@@ -835,7 +835,12 @@ static const u32 bicubic4coefftab32[480] = { · 834 unmodified lines
835 835
836static u32 sun8i_vi_scaler_base(struct sun8i_mixer *mixer, int channel)836static u32 sun8i_vi_scaler_base(struct sun8i_mixer *mixer, int channel)
837{837{
838 return DE2_VI_SCALER_UNIT_BASE + DE2_VI_SCALER_UNIT_SIZE * channel;838 if (mixer->cfg->is_de3)
839 return DE3_VI_SCALER_UNIT_BASE +
840 DE3_VI_SCALER_UNIT_SIZE * channel;
841 else
842 return DE2_VI_SCALER_UNIT_BASE +
843 DE2_VI_SCALER_UNIT_SIZE * channel;
839}844}
840 845
841static int sun8i_vi_scaler_coef_index(unsigned int step)846static int sun8i_vi_scaler_coef_index(unsigned int step)
@@ -951,6 +956,18 @@ void sun8i_vi_scaler_setup(struct sun8i_mixer *mixer, int layer, · 109 unmodified lines
951 cvphase = vphase;956 cvphase = vphase;
952 }957 }
953 958
959 if (mixer->cfg->is_de3) {
960 u32 val;
961
962 if (format->hsub == 1 && format->vsub == 1)
963 val = SUN50I_SCALER_VSU_SCALE_MODE_UI;
964 else
965 val = SUN50I_SCALER_VSU_SCALE_MODE_NORMAL;
966
967 regmap_write(mixer->engine.regs,
968 SUN50I_SCALER_VSU_SCALE_MODE(base), val);
969 }
970
954 regmap_write(mixer->engine.regs,971 regmap_write(mixer->engine.regs,
955 SUN8I_SCALER_VSU_OUTSIZE(base), outsize);972 SUN8I_SCALER_VSU_OUTSIZE(base), outsize);
956 regmap_write(mixer->engine.regs,973 regmap_write(mixer->engine.regs,
drivers/gpu/drm/sun4i/sun8i_vi_scaler.h+23−0
@@ -15,6 +15,9 @@ · 14 unmodified lines
15#define DE2_VI_SCALER_UNIT_BASE 0x2000015#define DE2_VI_SCALER_UNIT_BASE 0x20000
16#define DE2_VI_SCALER_UNIT_SIZE 0x2000016#define DE2_VI_SCALER_UNIT_SIZE 0x20000
17 17
18#define DE3_VI_SCALER_UNIT_BASE 0x20000
19#define DE3_VI_SCALER_UNIT_SIZE 0x08000
20
18/* this two macros assumes 16 fractional bits which is standard in DRM */21/* this two macros assumes 16 fractional bits which is standard in DRM */
19#define SUN8I_VI_SCALER_SCALE_MIN 122#define SUN8I_VI_SCALER_SCALE_MIN 1
20#define SUN8I_VI_SCALER_SCALE_MAX ((1UL << 20) - 1)23#define SUN8I_VI_SCALER_SCALE_MAX ((1UL << 20) - 1)
@@ -25,6 +28,11 @@ · 4 unmodified lines
25#define SUN8I_VI_SCALER_SIZE(w, h) (((h) - 1) << 16 | ((w) - 1))28#define SUN8I_VI_SCALER_SIZE(w, h) (((h) - 1) << 16 | ((w) - 1))
26 29
27#define SUN8I_SCALER_VSU_CTRL(base) ((base) + 0x0)30#define SUN8I_SCALER_VSU_CTRL(base) ((base) + 0x0)
31#define SUN50I_SCALER_VSU_SCALE_MODE(base) ((base) + 0x10)
32#define SUN50I_SCALER_VSU_DIR_THR(base) ((base) + 0x20)
33#define SUN50I_SCALER_VSU_EDGE_THR(base) ((base) + 0x24)
34#define SUN50I_SCALER_VSU_EDSCL_CTRL(base) ((base) + 0x28)
35#define SUN50I_SCALER_VSU_ANGLE_THR(base) ((base) + 0x2c)
28#define SUN8I_SCALER_VSU_OUTSIZE(base) ((base) + 0x40)36#define SUN8I_SCALER_VSU_OUTSIZE(base) ((base) + 0x40)
29#define SUN8I_SCALER_VSU_YINSIZE(base) ((base) + 0x80)37#define SUN8I_SCALER_VSU_YINSIZE(base) ((base) + 0x80)
30#define SUN8I_SCALER_VSU_YHSTEP(base) ((base) + 0x88)38#define SUN8I_SCALER_VSU_YHSTEP(base) ((base) + 0x88)
@@ -46,6 +54,21 @@ · 15 unmodified lines
46#define SUN8I_SCALER_VSU_CTRL_EN BIT(0)54#define SUN8I_SCALER_VSU_CTRL_EN BIT(0)
47#define SUN8I_SCALER_VSU_CTRL_COEFF_RDY BIT(4)55#define SUN8I_SCALER_VSU_CTRL_COEFF_RDY BIT(4)
48 56
57#define SUN50I_SCALER_VSU_SUB_ZERO_DIR_THR(x) (((x) << 24) & 0xFF)
58#define SUN50I_SCALER_VSU_ZERO_DIR_THR(x) (((x) << 16) & 0xFF)
59#define SUN50I_SCALER_VSU_HORZ_DIR_THR(x) (((x) << 8) & 0xFF)
60#define SUN50I_SCALER_VSU_VERT_DIR_THR(x) ((x) & 0xFF)
61
62#define SUN50I_SCALER_VSU_SCALE_MODE_UI 0
63#define SUN50I_SCALER_VSU_SCALE_MODE_NORMAL 1
64#define SUN50I_SCALER_VSU_SCALE_MODE_ED_SCALE 2
65
66#define SUN50I_SCALER_VSU_EDGE_SHIFT(x) (((x) << 16) & 0xF)
67#define SUN50I_SCALER_VSU_EDGE_OFFSET(x) ((x) & 0xFF)
68
69#define SUN50I_SCALER_VSU_ANGLE_SHIFT(x) (((x) << 16) & 0xF)
70#define SUN50I_SCALER_VSU_ANGLE_OFFSET(x) ((x) & 0xFF)
71
49void sun8i_vi_scaler_enable(struct sun8i_mixer *mixer, int layer, bool enable);72void sun8i_vi_scaler_enable(struct sun8i_mixer *mixer, int layer, bool enable);
50void sun8i_vi_scaler_setup(struct sun8i_mixer *mixer, int layer,73void sun8i_vi_scaler_setup(struct sun8i_mixer *mixer, int layer,
51 u32 src_w, u32 src_h, u32 dst_w, u32 dst_h,74 u32 src_w, u32 src_h, u32 dst_w, u32 dst_h,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t