Skip to content

Commit 20896ef

Browse files
committed
drm/sun4i: Fix DE2 VI layer format support
DE2 VI layer doesn't support blending which means alpha channel is ignored. Replace all formats with alpha with "don't care" (X) channel. Fixes: 7480ba4 ("drm/sun4i: Add support for DE2 VI planes") Acked-by: Maxime Ripard <[email protected]> Signed-off-by: Jernej Skrabec <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 169ca4b commit 20896ef

File tree

2 files changed

+67
-11
lines changed

2 files changed

+67
-11
lines changed

drivers/gpu/drm/sun4i/sun8i_mixer.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,48 +106,104 @@ static const struct de2_fmt_info de2_formats[] = {
106106
.rgb = true,
107107
.csc = SUN8I_CSC_MODE_OFF,
108108
},
109+
{
110+
/* for DE2 VI layer which ignores alpha */
111+
.drm_fmt = DRM_FORMAT_XRGB4444,
112+
.de2_fmt = SUN8I_MIXER_FBFMT_ARGB4444,
113+
.rgb = true,
114+
.csc = SUN8I_CSC_MODE_OFF,
115+
},
109116
{
110117
.drm_fmt = DRM_FORMAT_ABGR4444,
111118
.de2_fmt = SUN8I_MIXER_FBFMT_ABGR4444,
112119
.rgb = true,
113120
.csc = SUN8I_CSC_MODE_OFF,
114121
},
122+
{
123+
/* for DE2 VI layer which ignores alpha */
124+
.drm_fmt = DRM_FORMAT_XBGR4444,
125+
.de2_fmt = SUN8I_MIXER_FBFMT_ABGR4444,
126+
.rgb = true,
127+
.csc = SUN8I_CSC_MODE_OFF,
128+
},
115129
{
116130
.drm_fmt = DRM_FORMAT_RGBA4444,
117131
.de2_fmt = SUN8I_MIXER_FBFMT_RGBA4444,
118132
.rgb = true,
119133
.csc = SUN8I_CSC_MODE_OFF,
120134
},
135+
{
136+
/* for DE2 VI layer which ignores alpha */
137+
.drm_fmt = DRM_FORMAT_RGBX4444,
138+
.de2_fmt = SUN8I_MIXER_FBFMT_RGBA4444,
139+
.rgb = true,
140+
.csc = SUN8I_CSC_MODE_OFF,
141+
},
121142
{
122143
.drm_fmt = DRM_FORMAT_BGRA4444,
123144
.de2_fmt = SUN8I_MIXER_FBFMT_BGRA4444,
124145
.rgb = true,
125146
.csc = SUN8I_CSC_MODE_OFF,
126147
},
148+
{
149+
/* for DE2 VI layer which ignores alpha */
150+
.drm_fmt = DRM_FORMAT_BGRX4444,
151+
.de2_fmt = SUN8I_MIXER_FBFMT_BGRA4444,
152+
.rgb = true,
153+
.csc = SUN8I_CSC_MODE_OFF,
154+
},
127155
{
128156
.drm_fmt = DRM_FORMAT_ARGB1555,
129157
.de2_fmt = SUN8I_MIXER_FBFMT_ARGB1555,
130158
.rgb = true,
131159
.csc = SUN8I_CSC_MODE_OFF,
132160
},
161+
{
162+
/* for DE2 VI layer which ignores alpha */
163+
.drm_fmt = DRM_FORMAT_XRGB1555,
164+
.de2_fmt = SUN8I_MIXER_FBFMT_ARGB1555,
165+
.rgb = true,
166+
.csc = SUN8I_CSC_MODE_OFF,
167+
},
133168
{
134169
.drm_fmt = DRM_FORMAT_ABGR1555,
135170
.de2_fmt = SUN8I_MIXER_FBFMT_ABGR1555,
136171
.rgb = true,
137172
.csc = SUN8I_CSC_MODE_OFF,
138173
},
174+
{
175+
/* for DE2 VI layer which ignores alpha */
176+
.drm_fmt = DRM_FORMAT_XBGR1555,
177+
.de2_fmt = SUN8I_MIXER_FBFMT_ABGR1555,
178+
.rgb = true,
179+
.csc = SUN8I_CSC_MODE_OFF,
180+
},
139181
{
140182
.drm_fmt = DRM_FORMAT_RGBA5551,
141183
.de2_fmt = SUN8I_MIXER_FBFMT_RGBA5551,
142184
.rgb = true,
143185
.csc = SUN8I_CSC_MODE_OFF,
144186
},
187+
{
188+
/* for DE2 VI layer which ignores alpha */
189+
.drm_fmt = DRM_FORMAT_RGBX5551,
190+
.de2_fmt = SUN8I_MIXER_FBFMT_RGBA5551,
191+
.rgb = true,
192+
.csc = SUN8I_CSC_MODE_OFF,
193+
},
145194
{
146195
.drm_fmt = DRM_FORMAT_BGRA5551,
147196
.de2_fmt = SUN8I_MIXER_FBFMT_BGRA5551,
148197
.rgb = true,
149198
.csc = SUN8I_CSC_MODE_OFF,
150199
},
200+
{
201+
/* for DE2 VI layer which ignores alpha */
202+
.drm_fmt = DRM_FORMAT_BGRX5551,
203+
.de2_fmt = SUN8I_MIXER_FBFMT_BGRA5551,
204+
.rgb = true,
205+
.csc = SUN8I_CSC_MODE_OFF,
206+
},
151207
{
152208
.drm_fmt = DRM_FORMAT_ARGB2101010,
153209
.de2_fmt = SUN8I_MIXER_FBFMT_ARGB2101010,

drivers/gpu/drm/sun4i/sun8i_vi_layer.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -398,26 +398,26 @@ static const struct drm_plane_funcs sun8i_vi_layer_funcs = {
398398
};
399399

400400
/*
401-
* While all RGB formats are supported, VI planes don't support
402-
* alpha blending, so there is no point having formats with alpha
403-
* channel if their opaque analog exist.
401+
* While DE2 VI layer supports same RGB formats as UI layer, alpha
402+
* channel is ignored. This structure lists all unique variants
403+
* where alpha channel is replaced with "don't care" (X) channel.
404404
*/
405405
static const u32 sun8i_vi_layer_formats[] = {
406-
DRM_FORMAT_ABGR1555,
407-
DRM_FORMAT_ABGR4444,
408-
DRM_FORMAT_ARGB1555,
409-
DRM_FORMAT_ARGB4444,
410406
DRM_FORMAT_BGR565,
411407
DRM_FORMAT_BGR888,
412-
DRM_FORMAT_BGRA5551,
413-
DRM_FORMAT_BGRA4444,
408+
DRM_FORMAT_BGRX4444,
409+
DRM_FORMAT_BGRX5551,
414410
DRM_FORMAT_BGRX8888,
415411
DRM_FORMAT_RGB565,
416412
DRM_FORMAT_RGB888,
417-
DRM_FORMAT_RGBA4444,
418-
DRM_FORMAT_RGBA5551,
413+
DRM_FORMAT_RGBX4444,
414+
DRM_FORMAT_RGBX5551,
419415
DRM_FORMAT_RGBX8888,
416+
DRM_FORMAT_XBGR1555,
417+
DRM_FORMAT_XBGR4444,
420418
DRM_FORMAT_XBGR8888,
419+
DRM_FORMAT_XRGB1555,
420+
DRM_FORMAT_XRGB4444,
421421
DRM_FORMAT_XRGB8888,
422422

423423
DRM_FORMAT_NV16,

0 commit comments

Comments
 (0)