diff options
| author | Narender Ankam <nankam@codeaurora.org> | 2019-09-10 18:01:14 +0530 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2020-03-03 02:32:12 -0800 |
| commit | c16979421d575ade720afef19e14d7d0e4c8238a (patch) | |
| tree | 8721df3cf8724b2cfa5a8bcfcd81712c7b6e5cd7 /drivers/video/fbdev | |
| parent | 6f43fdaba403ee9ebe37d18b931714b3563ea3f8 (diff) | |
msm: mdss: mdp: configure CSC_10 to set correct quantization range
For external HDMI display, as per CEA-861 spec, any CE video format
shall be encoded either in RGB or YCbCr using Limited Range levels.
And any IT video format shall be encoded in RGB using Full Range
levels.
Add 8bit and 10bit CSC config parameters for missing YCbCr_709_FR and
RGB_L colorspaces and use MDP_CDM_0 module to set RGB or YCbCr
quantization range levels for a CE or IT video format accordingly.
Change-Id: Icecfdf0d1d49e17672df2360933d33a48d485892
Signed-off-by: Narender Ankam <nankam@codeaurora.org>
Signed-off-by: Ramendra Kumar <ramendra@codeaurora.org>
Diffstat (limited to 'drivers/video/fbdev')
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp.h | 4 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_cdm.c | 19 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_cdm.h | 3 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_intf_video.c | 31 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_pp.c | 50 |
5 files changed, 95 insertions, 12 deletions
diff --git a/drivers/video/fbdev/msm/mdss_mdp.h b/drivers/video/fbdev/msm/mdss_mdp.h index 90a38b79e561..9c93c500d127 100644 --- a/drivers/video/fbdev/msm/mdss_mdp.h +++ b/drivers/video/fbdev/msm/mdss_mdp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -271,10 +271,12 @@ enum mdss_mdp_csc_type { MDSS_MDP_CSC_RGB2YUV_601L, MDSS_MDP_CSC_RGB2YUV_601FR, MDSS_MDP_CSC_RGB2YUV_709L, + MDSS_MDP_CSC_RGB2YUV_709FR, MDSS_MDP_CSC_RGB2YUV_2020L, MDSS_MDP_CSC_RGB2YUV_2020FR, MDSS_MDP_CSC_YUV2YUV, MDSS_MDP_CSC_RGB2RGB, + MDSS_MDP_CSC_RGB2RGB_L, MDSS_MDP_MAX_CSC }; diff --git a/drivers/video/fbdev/msm/mdss_mdp_cdm.c b/drivers/video/fbdev/msm/mdss_mdp_cdm.c index 10928e6bceaa..9bc7c514fc65 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_cdm.c +++ b/drivers/video/fbdev/msm/mdss_mdp_cdm.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -116,6 +116,7 @@ struct mdss_mdp_cdm *mdss_mdp_cdm_init(struct mdss_mdp_ctl *ctl, u32 intf_type) cdm->out_intf = intf_type; cdm->is_bypassed = true; + cdm->is_only_clamped = false; memset(&cdm->setup, 0x0, sizeof(struct mdp_cdm_cfg)); return cdm; @@ -137,11 +138,20 @@ static int mdss_mdp_cdm_csc_setup(struct mdss_mdp_cdm *cdm, if ((data->csc_type == MDSS_MDP_CSC_RGB2YUV_601L) || (data->csc_type == MDSS_MDP_CSC_RGB2YUV_601FR) || - (data->csc_type == MDSS_MDP_CSC_RGB2YUV_709L)) { + (data->csc_type == MDSS_MDP_CSC_RGB2YUV_709L) || + (data->csc_type == MDSS_MDP_CSC_RGB2YUV_709FR)) { op_mode |= BIT(2); /* DST_DATA_FORMAT = YUV */ op_mode &= ~BIT(1); /* SRC_DATA_FORMAT = RGB */ op_mode |= BIT(0); /* EN = 1 */ cdm->is_bypassed = false; + } else if ((cdm->out_intf == MDP_CDM_CDWN_OUTPUT_HDMI) && + ((data->csc_type == MDSS_MDP_CSC_RGB2RGB_L) || + (data->csc_type == MDSS_MDP_CSC_RGB2RGB))) { + op_mode &= ~BIT(2); /* DST_DATA_FORMAT = RGB */ + op_mode &= ~BIT(1); /* SRC_DATA_FORMAT = RGB */ + op_mode |= BIT(0); /* EN = 1 */ + cdm->is_bypassed = false; + cdm->is_only_clamped = true; } else { op_mode = 0; cdm->is_bypassed = true; @@ -299,8 +309,11 @@ static int mdss_mdp_cdm_out_packer_setup(struct mdss_mdp_cdm *cdm, } opmode &= ~0x6; opmode |= (fmt->chroma_sample << 1); - if (!cdm->is_bypassed) + if (!cdm->is_bypassed) { cdm_enable |= BIT(19); + if (cdm->is_only_clamped) + opmode = 0; + } } else { /* Disable HDMI pacler for WB */ diff --git a/drivers/video/fbdev/msm/mdss_mdp_cdm.h b/drivers/video/fbdev/msm/mdss_mdp_cdm.h index 3b7fdced6623..b2897d41044d 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_cdm.h +++ b/drivers/video/fbdev/msm/mdss_mdp_cdm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014,2016, The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -60,6 +60,7 @@ struct mdss_mdp_cdm { bool is_bypassed; struct mdp_cdm_cfg setup; struct completion free_comp; + bool is_only_clamped; }; struct mdss_mdp_cdm *mdss_mdp_cdm_init(struct mdss_mdp_ctl *ctl, diff --git a/drivers/video/fbdev/msm/mdss_mdp_intf_video.c b/drivers/video/fbdev/msm/mdss_mdp_intf_video.c index e27f6bc49892..f5f5ddf49e72 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_intf_video.c +++ b/drivers/video/fbdev/msm/mdss_mdp_intf_video.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -1955,10 +1955,24 @@ static int mdss_mdp_video_cdm_setup(struct mdss_mdp_cdm *cdm, { struct mdp_cdm_cfg setup; - if (fmt->is_yuv) - setup.csc_type = MDSS_MDP_CSC_RGB2YUV_601FR; - else - setup.csc_type = MDSS_MDP_CSC_RGB2RGB; + if (fmt->is_yuv) { + if (pinfo->is_ce_mode) { + if (pinfo->yres < 720) + setup.csc_type = MDSS_MDP_CSC_RGB2YUV_601L; + else + setup.csc_type = MDSS_MDP_CSC_RGB2YUV_709L; + } else { + if (pinfo->yres < 720) + setup.csc_type = MDSS_MDP_CSC_RGB2YUV_601FR; + else + setup.csc_type = MDSS_MDP_CSC_RGB2YUV_709FR; + } + } else { + if (pinfo->is_ce_mode) + setup.csc_type = MDSS_MDP_CSC_RGB2RGB_L; + else + setup.csc_type = MDSS_MDP_CSC_RGB2RGB; + } switch (fmt->chroma_sample) { case MDSS_MDP_CHROMA_RGB: @@ -2120,6 +2134,7 @@ static int mdss_mdp_video_ctx_setup(struct mdss_mdp_ctl *ctl, } if (mdss_mdp_is_cdm_supported(mdata, ctl->intf_type, 0)) { + bool needs_qr_conversion = false; fmt = mdss_mdp_get_format_params(pinfo->out_format); if (!fmt) { @@ -2127,7 +2142,11 @@ static int mdss_mdp_video_ctx_setup(struct mdss_mdp_ctl *ctl, pinfo->out_format); return -EINVAL; } - if (fmt->is_yuv) { + + if (ctl->intf_type == MDSS_INTF_HDMI && pinfo->is_ce_mode) + needs_qr_conversion = true; + + if (fmt->is_yuv || needs_qr_conversion) { ctl->cdm = mdss_mdp_cdm_init(ctl, MDP_CDM_CDWN_OUTPUT_HDMI); if (!IS_ERR_OR_NULL(ctl->cdm)) { diff --git a/drivers/video/fbdev/msm/mdss_mdp_pp.c b/drivers/video/fbdev/msm/mdss_mdp_pp.c index 5b9798e2c24e..79e1277c9ca6 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_pp.c +++ b/drivers/video/fbdev/msm/mdss_mdp_pp.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -120,6 +120,18 @@ struct mdp_csc_cfg mdp_csc_8bit_convert[MDSS_MDP_MAX_CSC] = { { 0x0, 0xff, 0x0, 0xff, 0x0, 0xff,}, { 0x0010, 0x00eb, 0x0010, 0x00f0, 0x0010, 0x00f0,}, }, + [MDSS_MDP_CSC_RGB2YUV_709FR] = { + 0, + { + 0x006d, 0x016e, 0x0025, + 0xffc5, 0xff3b, 0x0100, + 0x0100, 0xff17, 0xffe9 + }, + { 0x0, 0x0, 0x0,}, + { 0x0, 0x0080, 0x0080,}, + { 0x0, 0xff, 0x0, 0xff, 0x0, 0xff,}, + { 0x0, 0xff, 0x0, 0xff, 0x0, 0xff,}, + }, [MDSS_MDP_CSC_RGB2YUV_2020L] = { 0, { @@ -168,6 +180,18 @@ struct mdp_csc_cfg mdp_csc_8bit_convert[MDSS_MDP_MAX_CSC] = { { 0x0, 0xff, 0x0, 0xff, 0x0, 0xff,}, { 0x0, 0xff, 0x0, 0xff, 0x0, 0xff,}, }, + [MDSS_MDP_CSC_RGB2RGB_L] = { + 0, + { + 0x01b7, 0x0000, 0x0000, + 0x0000, 0x01b7, 0x0000, + 0x0000, 0x0000, 0x01b7, + }, + { 0x0, 0x0, 0x0,}, + { 0x10, 0x10, 0x10,}, + { 0x0, 0xff, 0x0, 0xff, 0x0, 0xff,}, + { 0x10, 0xeb, 0x10, 0xeb, 0x10, 0xeb,}, + }, }; struct mdp_csc_cfg mdp_csc_10bit_convert[MDSS_MDP_MAX_CSC] = { @@ -267,6 +291,18 @@ struct mdp_csc_cfg mdp_csc_10bit_convert[MDSS_MDP_MAX_CSC] = { { 0x0, 0x3ff, 0x0, 0x3ff, 0x0, 0x3ff,}, { 0x0040, 0x03ac, 0x0040, 0x03c0, 0x0040, 0x03c0,}, }, + [MDSS_MDP_CSC_RGB2YUV_709FR] = { + 0, + { + 0x006d, 0x016e, 0x0025, + 0xffc5, 0xff3b, 0x0100, + 0x0100, 0xff17, 0xffe9 + }, + { 0x0, 0x0, 0x0,}, + { 0x0, 0x0200, 0x0200,}, + { 0x0, 0x3ff, 0x0, 0x3ff, 0x0, 0x3ff,}, + { 0x0, 0x3ff, 0x0, 0x3ff, 0x0, 0x3ff,}, + }, [MDSS_MDP_CSC_RGB2YUV_2020L] = { 0, { @@ -315,6 +351,18 @@ struct mdp_csc_cfg mdp_csc_10bit_convert[MDSS_MDP_MAX_CSC] = { { 0x0, 0x3ff, 0x0, 0x3ff, 0x0, 0x3ff,}, { 0x0, 0x3ff, 0x0, 0x3ff, 0x0, 0x3ff,}, }, + [MDSS_MDP_CSC_RGB2RGB_L] = { + 0, + { + 0x01b7, 0x0000, 0x0000, + 0x0000, 0x01b7, 0x0000, + 0x0000, 0x0000, 0x01b7, + }, + { 0x0, 0x0, 0x0,}, + { 0x40, 0x40, 0x40,}, + { 0x0, 0x3ff, 0x0, 0x3ff, 0x0, 0x3ff,}, + { 0x40, 0x3ac, 0x40, 0x3ac, 0x40, 0x3ac,}, + }, }; static struct mdss_mdp_format_params dest_scaler_fmt = { |
