diff mbox

[5/5] drm/edid: Set YQ bits in the AVI infoframe according to CEA-861-F

Message ID 20170111125725.8086-6-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä Jan. 11, 2017, 12:57 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

CEA-861-F tells us:
"When transmitting any RGB colorimetry, the Source should set the
 YQ-field to match the RGB Quantization Range being transmitted
 (e.g., when Limited Range RGB, set YQ=0 or when Full Range RGB,
 set YQ=1) and the Sink shall ignore the YQ-field."

So let's go ahead and do that. Perhaps there are sinks that don't
ignore the YQ as they should for RGB?

I wasn't able to find similar text in CEA-861-E, so it would seem
to be a fairly "recent" addition.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_edid.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Jani Nikula Jan. 12, 2017, 10:13 a.m. UTC | #1
On Wed, 11 Jan 2017, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> CEA-861-F tells us:
> "When transmitting any RGB colorimetry, the Source should set the
>  YQ-field to match the RGB Quantization Range being transmitted
>  (e.g., when Limited Range RGB, set YQ=0 or when Full Range RGB,
>  set YQ=1) and the Sink shall ignore the YQ-field."
>
> So let's go ahead and do that. Perhaps there are sinks that don't
> ignore the YQ as they should for RGB?
>
> I wasn't able to find similar text in CEA-861-E, so it would seem
> to be a fairly "recent" addition.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_edid.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index caa2435bac31..6ba9a1a6eae4 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -4320,6 +4320,20 @@ drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
>  		frame->quantization_range = rgb_quant_range;
>  	else
>  		frame->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
> +
> +	/*
> +	 * CEA-861-F:
> +	 * "When transmitting any RGB colorimetry, the Source should set the
> +	 *  YQ-field to match the RGB Quantization Range being transmitted
> +	 *  (e.g., when Limited Range RGB, set YQ=0 or when Full Range RGB,
> +	 *  set YQ=1) and the Sink shall ignore the YQ-field."
> +	 */

*rolls eyes* but that's what the spec says.

> +	if (rgb_quant_range == HDMI_QUANTIZATION_RANGE_LIMITED)
> +		frame->ycc_quantization_range =
> +			HDMI_YCC_QUANTIZATION_RANGE_LIMITED;
> +	else
> +		frame->ycc_quantization_range =
> +			HDMI_YCC_QUANTIZATION_RANGE_FULL;

Shouldn't this take into account QS=0 and rgb_quant_range != default?

BR,
Jani.



>  }
>  EXPORT_SYMBOL(drm_hdmi_avi_infoframe_quant_range);
Ville Syrjälä Jan. 12, 2017, 10:35 a.m. UTC | #2
On Thu, Jan 12, 2017 at 12:13:47PM +0200, Jani Nikula wrote:
> On Wed, 11 Jan 2017, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > CEA-861-F tells us:
> > "When transmitting any RGB colorimetry, the Source should set the
> >  YQ-field to match the RGB Quantization Range being transmitted
> >  (e.g., when Limited Range RGB, set YQ=0 or when Full Range RGB,
> >  set YQ=1) and the Sink shall ignore the YQ-field."
> >
> > So let's go ahead and do that. Perhaps there are sinks that don't
> > ignore the YQ as they should for RGB?
> >
> > I wasn't able to find similar text in CEA-861-E, so it would seem
> > to be a fairly "recent" addition.
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/drm_edid.c | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> > index caa2435bac31..6ba9a1a6eae4 100644
> > --- a/drivers/gpu/drm/drm_edid.c
> > +++ b/drivers/gpu/drm/drm_edid.c
> > @@ -4320,6 +4320,20 @@ drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
> >  		frame->quantization_range = rgb_quant_range;
> >  	else
> >  		frame->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
> > +
> > +	/*
> > +	 * CEA-861-F:
> > +	 * "When transmitting any RGB colorimetry, the Source should set the
> > +	 *  YQ-field to match the RGB Quantization Range being transmitted
> > +	 *  (e.g., when Limited Range RGB, set YQ=0 or when Full Range RGB,
> > +	 *  set YQ=1) and the Sink shall ignore the YQ-field."
> > +	 */
> 
> *rolls eyes* but that's what the spec says.
> 
> > +	if (rgb_quant_range == HDMI_QUANTIZATION_RANGE_LIMITED)
> > +		frame->ycc_quantization_range =
> > +			HDMI_YCC_QUANTIZATION_RANGE_LIMITED;
> > +	else
> > +		frame->ycc_quantization_range =
> > +			HDMI_YCC_QUANTIZATION_RANGE_FULL;
> 
> Shouldn't this take into account QS=0 and rgb_quant_range != default?

There is no YQ setting similar to the default Q=0. YQ=0 means "limited",
YQ=1 means "full", others values are reserved. So we can't really not
specify the YCC quantization range. So I can't really see any better
option than telling the truth.
Jani Nikula Jan. 12, 2017, 11:13 a.m. UTC | #3
On Thu, 12 Jan 2017, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Thu, Jan 12, 2017 at 12:13:47PM +0200, Jani Nikula wrote:
>> On Wed, 11 Jan 2017, ville.syrjala@linux.intel.com wrote:
>> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> >
>> > CEA-861-F tells us:
>> > "When transmitting any RGB colorimetry, the Source should set the
>> >  YQ-field to match the RGB Quantization Range being transmitted
>> >  (e.g., when Limited Range RGB, set YQ=0 or when Full Range RGB,
>> >  set YQ=1) and the Sink shall ignore the YQ-field."
>> >
>> > So let's go ahead and do that. Perhaps there are sinks that don't
>> > ignore the YQ as they should for RGB?
>> >
>> > I wasn't able to find similar text in CEA-861-E, so it would seem
>> > to be a fairly "recent" addition.
>> >
>> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> > ---
>> >  drivers/gpu/drm/drm_edid.c | 14 ++++++++++++++
>> >  1 file changed, 14 insertions(+)
>> >
>> > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
>> > index caa2435bac31..6ba9a1a6eae4 100644
>> > --- a/drivers/gpu/drm/drm_edid.c
>> > +++ b/drivers/gpu/drm/drm_edid.c
>> > @@ -4320,6 +4320,20 @@ drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
>> >  		frame->quantization_range = rgb_quant_range;
>> >  	else
>> >  		frame->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
>> > +
>> > +	/*
>> > +	 * CEA-861-F:
>> > +	 * "When transmitting any RGB colorimetry, the Source should set the
>> > +	 *  YQ-field to match the RGB Quantization Range being transmitted
>> > +	 *  (e.g., when Limited Range RGB, set YQ=0 or when Full Range RGB,
>> > +	 *  set YQ=1) and the Sink shall ignore the YQ-field."
>> > +	 */
>> 
>> *rolls eyes* but that's what the spec says.
>> 
>> > +	if (rgb_quant_range == HDMI_QUANTIZATION_RANGE_LIMITED)
>> > +		frame->ycc_quantization_range =
>> > +			HDMI_YCC_QUANTIZATION_RANGE_LIMITED;
>> > +	else
>> > +		frame->ycc_quantization_range =
>> > +			HDMI_YCC_QUANTIZATION_RANGE_FULL;
>> 
>> Shouldn't this take into account QS=0 and rgb_quant_range != default?
>
> There is no YQ setting similar to the default Q=0. YQ=0 means "limited",
> YQ=1 means "full", others values are reserved. So we can't really not
> specify the YCC quantization range. So I can't really see any better
> option than telling the truth.

Hmm, I was confused about the caller choosing the range based on the
mode already.

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index caa2435bac31..6ba9a1a6eae4 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -4320,6 +4320,20 @@  drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame,
 		frame->quantization_range = rgb_quant_range;
 	else
 		frame->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT;
+
+	/*
+	 * CEA-861-F:
+	 * "When transmitting any RGB colorimetry, the Source should set the
+	 *  YQ-field to match the RGB Quantization Range being transmitted
+	 *  (e.g., when Limited Range RGB, set YQ=0 or when Full Range RGB,
+	 *  set YQ=1) and the Sink shall ignore the YQ-field."
+	 */
+	if (rgb_quant_range == HDMI_QUANTIZATION_RANGE_LIMITED)
+		frame->ycc_quantization_range =
+			HDMI_YCC_QUANTIZATION_RANGE_LIMITED;
+	else
+		frame->ycc_quantization_range =
+			HDMI_YCC_QUANTIZATION_RANGE_FULL;
 }
 EXPORT_SYMBOL(drm_hdmi_avi_infoframe_quant_range);