diff mbox series

[v2,3/5] drm: bridge: dw_hdmi: Enable GCP only for Deep Color

Message ID a0f9def7e7438592f78ef0a16cd0a560be0e6133.1649412256.git.Sandor.yu@nxp.com (mailing list archive)
State New, archived
Headers show
Series DRM: Bridge: DW_HDMI: Add new features and bug fix | expand

Commit Message

Sandor Yu April 8, 2022, 10:32 a.m. UTC
HDMI1.4b specification section 6.5.3:
Source shall only send GCPs with non-zero CD to sinks
that indicate support for Deep Color.

DW HDMI GCP default enabled, clear gpc_auto bit for 24-bit color depth.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Neil Armstrong April 8, 2022, 12:40 p.m. UTC | #1
On 08/04/2022 12:32, Sandor Yu wrote:
> HDMI1.4b specification section 6.5.3:
> Source shall only send GCPs with non-zero CD to sinks
> that indicate support for Deep Color.
> 
> DW HDMI GCP default enabled, clear gpc_auto bit for 24-bit color depth.

It's right because we do not handle AVMUTE, Pixel Packing nor Default_Phase.

> 
> Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
> ---
>   drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index 02d8f7e08814..5a7ec066e37a 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -1108,6 +1108,8 @@ static void hdmi_video_packetize(struct dw_hdmi *hdmi)
>   	unsigned int output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_PP;
>   	struct hdmi_data_info *hdmi_data = &hdmi->hdmi_data;
>   	u8 val, vp_conf;
> +	u8 clear_gcp_auto = 0;
> +
>   
>   	if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format) ||
>   	    hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format) ||
> @@ -1117,6 +1119,7 @@ static void hdmi_video_packetize(struct dw_hdmi *hdmi)
>   		case 8:
>   			color_depth = 4;
>   			output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_BYPASS;
> +			clear_gcp_auto = 1;
>   			break;
>   		case 10:
>   			color_depth = 5;
> @@ -1136,6 +1139,7 @@ static void hdmi_video_packetize(struct dw_hdmi *hdmi)
>   		case 0:
>   		case 8:
>   			remap_size = HDMI_VP_REMAP_YCC422_16bit;
> +			clear_gcp_auto = 1;
>   			break;
>   		case 10:
>   			remap_size = HDMI_VP_REMAP_YCC422_20bit;
> @@ -1160,6 +1164,14 @@ static void hdmi_video_packetize(struct dw_hdmi *hdmi)
>   		HDMI_VP_PR_CD_DESIRED_PR_FACTOR_MASK);
>   	hdmi_writeb(hdmi, val, HDMI_VP_PR_CD);
>   
> +	val = hdmi_readb(hdmi, HDMI_FC_DATAUTO3);
> +	if (clear_gcp_auto == 1)
> +		/* disable Auto GCP when 24-bit color */

Maybe add a new define for HDMI_FC_DATAUTO3_GCP_AUTO bit and use it here.

> +		val &= ~0x4;
> +	else
> +		val |= 0x4;
> +	hdmi_writeb(hdmi, val, HDMI_FC_DATAUTO3);

Please also add a comment explaining we clear GCP because we only
transmit CD and do not handle AVMUTE, PP nor Default_Phase (yet).

> +
>   	hdmi_modb(hdmi, HDMI_VP_STUFF_PR_STUFFING_STUFFING_MODE,
>   		  HDMI_VP_STUFF_PR_STUFFING_MASK, HDMI_VP_STUFF);
>   

Thanks,
Neil
Sandor Yu April 11, 2022, 9:24 a.m. UTC | #2
> -----Original Message-----
> From: Neil Armstrong <narmstrong@baylibre.com>
> Sent: 2022年4月8日 20:40
> To: Sandor Yu <sandor.yu@nxp.com>; dri-devel@lists.freedesktop.org;
> linux-kernel@vger.kernel.org; andrzej.hajda@intel.com;
> robert.foss@linaro.org; Laurent.pinchart@ideasonboard.com;
> jonas@kwiboo.se; jernej.skrabec@gmail.com; hverkuil-cisco@xs4all.nl
> Cc: S.J. Wang <shengjiu.wang@nxp.com>; cai.huoqing@linux.dev;
> maxime@cerno.tech; harry.wentland@amd.com
> Subject: [EXT] Re: [PATCH v2 3/5] drm: bridge: dw_hdmi: Enable GCP only for
> Deep Color
> 
> Caution: EXT Email
> 
> On 08/04/2022 12:32, Sandor Yu wrote:
> > HDMI1.4b specification section 6.5.3:
> > Source shall only send GCPs with non-zero CD to sinks that indicate
> > support for Deep Color.
> >
> > DW HDMI GCP default enabled, clear gpc_auto bit for 24-bit color depth.
> 
> It's right because we do not handle AVMUTE, Pixel Packing nor
> Default_Phase.
> 
> >
> > Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
> > ---
> >   drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 12 ++++++++++++
> >   1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> > b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> > index 02d8f7e08814..5a7ec066e37a 100644
> > --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> > +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> > @@ -1108,6 +1108,8 @@ static void hdmi_video_packetize(struct
> dw_hdmi *hdmi)
> >       unsigned int output_select =
> HDMI_VP_CONF_OUTPUT_SELECTOR_PP;
> >       struct hdmi_data_info *hdmi_data = &hdmi->hdmi_data;
> >       u8 val, vp_conf;
> > +     u8 clear_gcp_auto = 0;
> > +
> >
> >       if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format) ||
> >
> hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format)
> > || @@ -1117,6 +1119,7 @@ static void hdmi_video_packetize(struct
> dw_hdmi *hdmi)
> >               case 8:
> >                       color_depth = 4;
> >                       output_select =
> > HDMI_VP_CONF_OUTPUT_SELECTOR_BYPASS;
> > +                     clear_gcp_auto = 1;
> >                       break;
> >               case 10:
> >                       color_depth = 5; @@ -1136,6 +1139,7 @@
> static
> > void hdmi_video_packetize(struct dw_hdmi *hdmi)
> >               case 0:
> >               case 8:
> >                       remap_size =
> HDMI_VP_REMAP_YCC422_16bit;
> > +                     clear_gcp_auto = 1;
> >                       break;
> >               case 10:
> >                       remap_size = HDMI_VP_REMAP_YCC422_20bit;
> @@
> > -1160,6 +1164,14 @@ static void hdmi_video_packetize(struct dw_hdmi
> *hdmi)
> >               HDMI_VP_PR_CD_DESIRED_PR_FACTOR_MASK);
> >       hdmi_writeb(hdmi, val, HDMI_VP_PR_CD);
> >
> > +     val = hdmi_readb(hdmi, HDMI_FC_DATAUTO3);
> > +     if (clear_gcp_auto == 1)
> > +             /* disable Auto GCP when 24-bit color */
> 
> Maybe add a new define for HDMI_FC_DATAUTO3_GCP_AUTO bit and use it
> here.
OK, I will add it.
> 
> > +             val &= ~0x4;
> > +     else
> > +             val |= 0x4;
> > +     hdmi_writeb(hdmi, val, HDMI_FC_DATAUTO3);
> 
> Please also add a comment explaining we clear GCP because we only transmit
> CD and do not handle AVMUTE, PP nor Default_Phase (yet).
> 
OK.

Sandor
> > +
> >       hdmi_modb(hdmi,
> HDMI_VP_STUFF_PR_STUFFING_STUFFING_MODE,
> >                 HDMI_VP_STUFF_PR_STUFFING_MASK,
> HDMI_VP_STUFF);
> >
> 
> Thanks,
> Neil
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 02d8f7e08814..5a7ec066e37a 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -1108,6 +1108,8 @@  static void hdmi_video_packetize(struct dw_hdmi *hdmi)
 	unsigned int output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_PP;
 	struct hdmi_data_info *hdmi_data = &hdmi->hdmi_data;
 	u8 val, vp_conf;
+	u8 clear_gcp_auto = 0;
+
 
 	if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format) ||
 	    hdmi_bus_fmt_is_yuv444(hdmi->hdmi_data.enc_out_bus_format) ||
@@ -1117,6 +1119,7 @@  static void hdmi_video_packetize(struct dw_hdmi *hdmi)
 		case 8:
 			color_depth = 4;
 			output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_BYPASS;
+			clear_gcp_auto = 1;
 			break;
 		case 10:
 			color_depth = 5;
@@ -1136,6 +1139,7 @@  static void hdmi_video_packetize(struct dw_hdmi *hdmi)
 		case 0:
 		case 8:
 			remap_size = HDMI_VP_REMAP_YCC422_16bit;
+			clear_gcp_auto = 1;
 			break;
 		case 10:
 			remap_size = HDMI_VP_REMAP_YCC422_20bit;
@@ -1160,6 +1164,14 @@  static void hdmi_video_packetize(struct dw_hdmi *hdmi)
 		HDMI_VP_PR_CD_DESIRED_PR_FACTOR_MASK);
 	hdmi_writeb(hdmi, val, HDMI_VP_PR_CD);
 
+	val = hdmi_readb(hdmi, HDMI_FC_DATAUTO3);
+	if (clear_gcp_auto == 1)
+		/* disable Auto GCP when 24-bit color */
+		val &= ~0x4;
+	else
+		val |= 0x4;
+	hdmi_writeb(hdmi, val, HDMI_FC_DATAUTO3);
+
 	hdmi_modb(hdmi, HDMI_VP_STUFF_PR_STUFFING_STUFFING_MODE,
 		  HDMI_VP_STUFF_PR_STUFFING_MASK, HDMI_VP_STUFF);