Commit 1b89dba5 authored by Paul Kocialkowski's avatar Paul Kocialkowski Committed by Maxime Ripard

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: default avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Acked-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190118145133.21281-6-paul.kocialkowski@bootlin.com
parent 915bf9fe
...@@ -108,14 +108,12 @@ static int ...@@ -108,14 +108,12 @@ static int
sun4i_frontend_drm_format_to_input_fmt(const struct drm_format_info *format, sun4i_frontend_drm_format_to_input_fmt(const struct drm_format_info *format,
u32 *val) u32 *val)
{ {
switch (format->format) { if (!format->is_yuv)
case DRM_FORMAT_XRGB8888:
*val = SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_RGB; *val = SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_RGB;
return 0; else
default:
return -EINVAL; return -EINVAL;
}
return 0;
} }
static int static int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment