Skip to content

Commit 169ca4b

Browse files
committed
drm/sun4i: Add separate DE3 VI layer formats
DE3 VI layers support alpha blending, but DE2 VI layers do not. Additionally, DE3 VI layers support 10-bit RGB and YUV formats. Make a separate list for DE3. Fixes: c50519e ("drm/sun4i: Add basic support for DE3") Acked-by: Maxime Ripard <[email protected]> Signed-off-by: Jernej Skrabec <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent a476990 commit 169ca4b

File tree

3 files changed

+102
-3
lines changed

3 files changed

+102
-3
lines changed

drivers/gpu/drm/sun4i/sun8i_mixer.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,30 @@ static const struct de2_fmt_info de2_formats[] = {
148148
.rgb = true,
149149
.csc = SUN8I_CSC_MODE_OFF,
150150
},
151+
{
152+
.drm_fmt = DRM_FORMAT_ARGB2101010,
153+
.de2_fmt = SUN8I_MIXER_FBFMT_ARGB2101010,
154+
.rgb = true,
155+
.csc = SUN8I_CSC_MODE_OFF,
156+
},
157+
{
158+
.drm_fmt = DRM_FORMAT_ABGR2101010,
159+
.de2_fmt = SUN8I_MIXER_FBFMT_ABGR2101010,
160+
.rgb = true,
161+
.csc = SUN8I_CSC_MODE_OFF,
162+
},
163+
{
164+
.drm_fmt = DRM_FORMAT_RGBA1010102,
165+
.de2_fmt = SUN8I_MIXER_FBFMT_RGBA1010102,
166+
.rgb = true,
167+
.csc = SUN8I_CSC_MODE_OFF,
168+
},
169+
{
170+
.drm_fmt = DRM_FORMAT_BGRA1010102,
171+
.de2_fmt = SUN8I_MIXER_FBFMT_BGRA1010102,
172+
.rgb = true,
173+
.csc = SUN8I_CSC_MODE_OFF,
174+
},
151175
{
152176
.drm_fmt = DRM_FORMAT_UYVY,
153177
.de2_fmt = SUN8I_MIXER_FBFMT_UYVY,
@@ -232,6 +256,18 @@ static const struct de2_fmt_info de2_formats[] = {
232256
.rgb = false,
233257
.csc = SUN8I_CSC_MODE_YVU2RGB,
234258
},
259+
{
260+
.drm_fmt = DRM_FORMAT_P010,
261+
.de2_fmt = SUN8I_MIXER_FBFMT_P010_YUV,
262+
.rgb = false,
263+
.csc = SUN8I_CSC_MODE_YUV2RGB,
264+
},
265+
{
266+
.drm_fmt = DRM_FORMAT_P210,
267+
.de2_fmt = SUN8I_MIXER_FBFMT_P210_YUV,
268+
.rgb = false,
269+
.csc = SUN8I_CSC_MODE_YUV2RGB,
270+
},
235271
};
236272

237273
const struct de2_fmt_info *sun8i_mixer_format_info(u32 format)

drivers/gpu/drm/sun4i/sun8i_mixer.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@
9393
#define SUN8I_MIXER_FBFMT_ABGR1555 17
9494
#define SUN8I_MIXER_FBFMT_RGBA5551 18
9595
#define SUN8I_MIXER_FBFMT_BGRA5551 19
96+
#define SUN8I_MIXER_FBFMT_ARGB2101010 20
97+
#define SUN8I_MIXER_FBFMT_ABGR2101010 21
98+
#define SUN8I_MIXER_FBFMT_RGBA1010102 22
99+
#define SUN8I_MIXER_FBFMT_BGRA1010102 23
96100

97101
#define SUN8I_MIXER_FBFMT_YUYV 0
98102
#define SUN8I_MIXER_FBFMT_UYVY 1
@@ -109,6 +113,13 @@
109113
/* format 12 is semi-planar YUV411 UVUV */
110114
/* format 13 is semi-planar YUV411 VUVU */
111115
#define SUN8I_MIXER_FBFMT_YUV411 14
116+
/* format 15 doesn't exist */
117+
/* format 16 is P010 YVU */
118+
#define SUN8I_MIXER_FBFMT_P010_YUV 17
119+
/* format 18 is P210 YVU */
120+
#define SUN8I_MIXER_FBFMT_P210_YUV 19
121+
/* format 20 is packed YVU444 10-bit */
122+
/* format 21 is packed YUV444 10-bit */
112123

113124
/*
114125
* Sub-engines listed bellow are unused for now. The EN registers are here only

drivers/gpu/drm/sun4i/sun8i_vi_layer.c

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,24 +436,76 @@ static const u32 sun8i_vi_layer_formats[] = {
436436
DRM_FORMAT_YVU422,
437437
};
438438

439+
static const u32 sun8i_vi_layer_de3_formats[] = {
440+
DRM_FORMAT_ABGR1555,
441+
DRM_FORMAT_ABGR2101010,
442+
DRM_FORMAT_ABGR4444,
443+
DRM_FORMAT_ABGR8888,
444+
DRM_FORMAT_ARGB1555,
445+
DRM_FORMAT_ARGB2101010,
446+
DRM_FORMAT_ARGB4444,
447+
DRM_FORMAT_ARGB8888,
448+
DRM_FORMAT_BGR565,
449+
DRM_FORMAT_BGR888,
450+
DRM_FORMAT_BGRA1010102,
451+
DRM_FORMAT_BGRA5551,
452+
DRM_FORMAT_BGRA4444,
453+
DRM_FORMAT_BGRA8888,
454+
DRM_FORMAT_BGRX8888,
455+
DRM_FORMAT_RGB565,
456+
DRM_FORMAT_RGB888,
457+
DRM_FORMAT_RGBA1010102,
458+
DRM_FORMAT_RGBA4444,
459+
DRM_FORMAT_RGBA5551,
460+
DRM_FORMAT_RGBA8888,
461+
DRM_FORMAT_RGBX8888,
462+
DRM_FORMAT_XBGR8888,
463+
DRM_FORMAT_XRGB8888,
464+
465+
DRM_FORMAT_NV16,
466+
DRM_FORMAT_NV12,
467+
DRM_FORMAT_NV21,
468+
DRM_FORMAT_NV61,
469+
DRM_FORMAT_P010,
470+
DRM_FORMAT_P210,
471+
DRM_FORMAT_UYVY,
472+
DRM_FORMAT_VYUY,
473+
DRM_FORMAT_YUYV,
474+
DRM_FORMAT_YVYU,
475+
DRM_FORMAT_YUV411,
476+
DRM_FORMAT_YUV420,
477+
DRM_FORMAT_YUV422,
478+
DRM_FORMAT_YVU411,
479+
DRM_FORMAT_YVU420,
480+
DRM_FORMAT_YVU422,
481+
};
482+
439483
struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
440484
struct sun8i_mixer *mixer,
441485
int index)
442486
{
443487
u32 supported_encodings, supported_ranges;
488+
unsigned int plane_cnt, format_count;
444489
struct sun8i_vi_layer *layer;
445-
unsigned int plane_cnt;
490+
const u32 *formats;
446491
int ret;
447492

448493
layer = devm_kzalloc(drm->dev, sizeof(*layer), GFP_KERNEL);
449494
if (!layer)
450495
return ERR_PTR(-ENOMEM);
451496

497+
if (mixer->cfg->is_de3) {
498+
formats = sun8i_vi_layer_de3_formats;
499+
format_count = ARRAY_SIZE(sun8i_vi_layer_de3_formats);
500+
} else {
501+
formats = sun8i_vi_layer_formats;
502+
format_count = ARRAY_SIZE(sun8i_vi_layer_formats);
503+
}
504+
452505
/* possible crtcs are set later */
453506
ret = drm_universal_plane_init(drm, &layer->plane, 0,
454507
&sun8i_vi_layer_funcs,
455-
sun8i_vi_layer_formats,
456-
ARRAY_SIZE(sun8i_vi_layer_formats),
508+
formats, format_count,
457509
NULL, DRM_PLANE_TYPE_OVERLAY, NULL);
458510
if (ret) {
459511
dev_err(drm->dev, "Couldn't initialize layer\n");

0 commit comments

Comments
 (0)