summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
diff options
context:
space:
mode:
authorJernej Skrabec <jernej.skrabec@siol.net>2019-07-13 15:03:44 +0300
committerMaxime Ripard <maxime.ripard@bootlin.com>2019-07-20 08:38:02 +0300
commit5917e0bdbc90cae408561f713eaa7d60e512e599 (patch)
treeab3437462b066ecd10359cac4718409bd8c5636f /drivers/gpu/drm/sun4i/sun8i_vi_layer.c
parent1eef08cb7dc7f240905071ea18eebd1232f302f6 (diff)
downloadlinux-5917e0bdbc90cae408561f713eaa7d60e512e599.tar.xz
drm/sun4i: Introduce color encoding and range properties
In order to correctly convert YUV color space to RGB, we have to know color encoding and range. Introduce these two properties using helper method. Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190713120346.30349-2-jernej.skrabec@siol.net
Diffstat (limited to 'drivers/gpu/drm/sun4i/sun8i_vi_layer.c')
-rw-r--r--drivers/gpu/drm/sun4i/sun8i_vi_layer.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
index 1bdcbf53dd20..b227e33738f1 100644
--- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
@@ -440,6 +440,7 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
struct sun8i_mixer *mixer,
int index)
{
+ u32 supported_encodings, supported_ranges;
struct sun8i_vi_layer *layer;
unsigned int plane_cnt;
int ret;
@@ -468,6 +469,22 @@ struct sun8i_vi_layer *sun8i_vi_layer_init_one(struct drm_device *drm,
return ERR_PTR(ret);
}
+ supported_encodings = BIT(DRM_COLOR_YCBCR_BT601) |
+ BIT(DRM_COLOR_YCBCR_BT709);
+
+ supported_ranges = BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) |
+ BIT(DRM_COLOR_YCBCR_FULL_RANGE);
+
+ ret = drm_plane_create_color_properties(&layer->plane,
+ supported_encodings,
+ supported_ranges,
+ DRM_COLOR_YCBCR_BT709,
+ DRM_COLOR_YCBCR_LIMITED_RANGE);
+ if (ret) {
+ dev_err(drm->dev, "Couldn't add encoding and range properties!\n");
+ return ERR_PTR(ret);
+ }
+
drm_plane_helper_add(&layer->plane, &sun8i_vi_layer_helper_funcs);
layer->mixer = mixer;
layer->channel = index;