drm/sun4i: frontend: Determine input format based on colorspace

Since all the RGB input formats have the same value for the DATA_FMT
field of the INPUT_FMT register, we can group them when the format is
known to be RGB. Here, we assume that a non-YUV format is RGB, because
the hardware does not support any other colorspace than RGB and YUV.

Use the DRM format info structure to check whether the format uses a
YUV colorspace.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190118145133.21281-6-paul.kocialkowski@bootlin.com
This commit is contained in:
Paul Kocialkowski 2019-01-18 15:51:15 +01:00 committed by Maxime Ripard
parent 915bf9fe64
commit 1b89dba5f7
No known key found for this signature in database
GPG Key ID: E3EF0D6F671851C5
1 changed files with 4 additions and 6 deletions

View File

@ -108,14 +108,12 @@ static int
sun4i_frontend_drm_format_to_input_fmt(const struct drm_format_info *format,
u32 *val)
{
switch (format->format) {
case DRM_FORMAT_XRGB8888:
if (!format->is_yuv)
*val = SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_RGB;
return 0;
default:
else
return -EINVAL;
}
return 0;
}
static int