Message ID | 20170111125725.8086-3-ville.syrjala@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, Jan 11, 2017 at 02:57:22PM +0200, ville.syrjala@linux.intel.com wrote: > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > Make the code selecting the RGB quantization range a little less magicy > by wrapping it up in a small helper. > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Needs cc: for driver maintainers, Eric for vc4 here. -Daniel > --- > drivers/gpu/drm/drm_edid.c | 18 ++++++++++++++++++ > drivers/gpu/drm/i915/intel_dp.c | 4 +++- > drivers/gpu/drm/i915/intel_hdmi.c | 3 ++- > drivers/gpu/drm/vc4/vc4_hdmi.c | 4 +++- > include/drm/drm_edid.h | 2 ++ > 5 files changed, 28 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 4ff04aa84dd0..304c583b8000 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -3768,6 +3768,24 @@ bool drm_rgb_quant_range_selectable(struct edid *edid) > } > EXPORT_SYMBOL(drm_rgb_quant_range_selectable); > > +/** > + * drm_default_rgb_quant_range - default RGB quantization range > + * @mode: display mode > + * > + * Determine the default RGB quantization range for the mode, > + * as specified in CEA-861. > + * > + * Return: The default RGB quantization range for the mode > + */ > +enum hdmi_quantization_range > +drm_default_rgb_quant_range(const struct drm_display_mode *mode) > +{ > + return drm_match_cea_mode(mode) > 1 ? > + HDMI_QUANTIZATION_RANGE_LIMITED : > + HDMI_QUANTIZATION_RANGE_FULL; > +} > +EXPORT_SYMBOL(drm_default_rgb_quant_range); > + > static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector, > const u8 *hdmi) > { > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c > index 343e1d9fa761..d4befbbe834a 100644 > --- a/drivers/gpu/drm/i915/intel_dp.c > +++ b/drivers/gpu/drm/i915/intel_dp.c > @@ -1713,7 +1713,9 @@ intel_dp_compute_config(struct intel_encoder *encoder, > * VESA DisplayPort Ver.1.2a - 5.1.1.1 Video Colorimetry > */ > pipe_config->limited_color_range = > - bpp != 18 && drm_match_cea_mode(adjusted_mode) > 1; > + bpp != 18 && > + drm_default_rgb_quant_range(adjusted_mode) == > + HDMI_QUANTIZATION_RANGE_LIMITED; > } else { > pipe_config->limited_color_range = > intel_dp->limited_color_range; > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c > index 0bcfead14571..19bd13f53729 100644 > --- a/drivers/gpu/drm/i915/intel_hdmi.c > +++ b/drivers/gpu/drm/i915/intel_hdmi.c > @@ -1330,7 +1330,8 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, > /* See CEA-861-E - 5.1 Default Encoding Parameters */ > pipe_config->limited_color_range = > pipe_config->has_hdmi_sink && > - drm_match_cea_mode(adjusted_mode) > 1; > + drm_default_rgb_quant_range(adjusted_mode) == > + HDMI_QUANTIZATION_RANGE_LIMITED; > } else { > pipe_config->limited_color_range = > intel_hdmi->limited_color_range; > diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c > index c4cb2e26de32..d79466a42690 100644 > --- a/drivers/gpu/drm/vc4/vc4_hdmi.c > +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c > @@ -463,7 +463,9 @@ static void vc4_hdmi_encoder_mode_set(struct drm_encoder *encoder, > csc_ctl = VC4_SET_FIELD(VC4_HD_CSC_CTL_ORDER_BGR, > VC4_HD_CSC_CTL_ORDER); > > - if (vc4_encoder->hdmi_monitor && drm_match_cea_mode(mode) > 1) { > + if (vc4_encoder->hdmi_monitor && > + drm_default_rgb_quant_range(adjusted_mode) == > + HDMI_QUANTIZATION_RANGE_LIMITED) { > /* CEA VICs other than #1 requre limited range RGB > * output unless overridden by an AVI infoframe. > * Apply a colorspace conversion to squash 0-255 down > diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h > index 838eaf2b42e9..25cdf5f7a0d8 100644 > --- a/include/drm/drm_edid.h > +++ b/include/drm/drm_edid.h > @@ -441,6 +441,8 @@ enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code); > bool drm_detect_hdmi_monitor(struct edid *edid); > bool drm_detect_monitor_audio(struct edid *edid); > bool drm_rgb_quant_range_selectable(struct edid *edid); > +enum hdmi_quantization_range > +drm_default_rgb_quant_range(const struct drm_display_mode *mode); > int drm_add_modes_noedid(struct drm_connector *connector, > int hdisplay, int vdisplay); > void drm_set_preferred_mode(struct drm_connector *connector, > -- > 2.10.2 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
On Wed, Jan 11, 2017 at 05:16:54PM +0100, Daniel Vetter wrote: > On Wed, Jan 11, 2017 at 02:57:22PM +0200, ville.syrjala@linux.intel.com wrote: > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > Make the code selecting the RGB quantization range a little less magicy > > by wrapping it up in a small helper. > > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > > Needs cc: for driver maintainers, Eric for vc4 here. Eric was cc:d. I was just too lazy to add the cc:s to all the commit messages, and so i just used --cc on the whole lot. > -Daniel > > > --- > > drivers/gpu/drm/drm_edid.c | 18 ++++++++++++++++++ > > drivers/gpu/drm/i915/intel_dp.c | 4 +++- > > drivers/gpu/drm/i915/intel_hdmi.c | 3 ++- > > drivers/gpu/drm/vc4/vc4_hdmi.c | 4 +++- > > include/drm/drm_edid.h | 2 ++ > > 5 files changed, 28 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > > index 4ff04aa84dd0..304c583b8000 100644 > > --- a/drivers/gpu/drm/drm_edid.c > > +++ b/drivers/gpu/drm/drm_edid.c > > @@ -3768,6 +3768,24 @@ bool drm_rgb_quant_range_selectable(struct edid *edid) > > } > > EXPORT_SYMBOL(drm_rgb_quant_range_selectable); > > > > +/** > > + * drm_default_rgb_quant_range - default RGB quantization range > > + * @mode: display mode > > + * > > + * Determine the default RGB quantization range for the mode, > > + * as specified in CEA-861. > > + * > > + * Return: The default RGB quantization range for the mode > > + */ > > +enum hdmi_quantization_range > > +drm_default_rgb_quant_range(const struct drm_display_mode *mode) > > +{ > > + return drm_match_cea_mode(mode) > 1 ? > > + HDMI_QUANTIZATION_RANGE_LIMITED : > > + HDMI_QUANTIZATION_RANGE_FULL; > > +} > > +EXPORT_SYMBOL(drm_default_rgb_quant_range); > > + > > static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector, > > const u8 *hdmi) > > { > > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c > > index 343e1d9fa761..d4befbbe834a 100644 > > --- a/drivers/gpu/drm/i915/intel_dp.c > > +++ b/drivers/gpu/drm/i915/intel_dp.c > > @@ -1713,7 +1713,9 @@ intel_dp_compute_config(struct intel_encoder *encoder, > > * VESA DisplayPort Ver.1.2a - 5.1.1.1 Video Colorimetry > > */ > > pipe_config->limited_color_range = > > - bpp != 18 && drm_match_cea_mode(adjusted_mode) > 1; > > + bpp != 18 && > > + drm_default_rgb_quant_range(adjusted_mode) == > > + HDMI_QUANTIZATION_RANGE_LIMITED; > > } else { > > pipe_config->limited_color_range = > > intel_dp->limited_color_range; > > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c > > index 0bcfead14571..19bd13f53729 100644 > > --- a/drivers/gpu/drm/i915/intel_hdmi.c > > +++ b/drivers/gpu/drm/i915/intel_hdmi.c > > @@ -1330,7 +1330,8 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, > > /* See CEA-861-E - 5.1 Default Encoding Parameters */ > > pipe_config->limited_color_range = > > pipe_config->has_hdmi_sink && > > - drm_match_cea_mode(adjusted_mode) > 1; > > + drm_default_rgb_quant_range(adjusted_mode) == > > + HDMI_QUANTIZATION_RANGE_LIMITED; > > } else { > > pipe_config->limited_color_range = > > intel_hdmi->limited_color_range; > > diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c > > index c4cb2e26de32..d79466a42690 100644 > > --- a/drivers/gpu/drm/vc4/vc4_hdmi.c > > +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c > > @@ -463,7 +463,9 @@ static void vc4_hdmi_encoder_mode_set(struct drm_encoder *encoder, > > csc_ctl = VC4_SET_FIELD(VC4_HD_CSC_CTL_ORDER_BGR, > > VC4_HD_CSC_CTL_ORDER); > > > > - if (vc4_encoder->hdmi_monitor && drm_match_cea_mode(mode) > 1) { > > + if (vc4_encoder->hdmi_monitor && > > + drm_default_rgb_quant_range(adjusted_mode) == > > + HDMI_QUANTIZATION_RANGE_LIMITED) { > > /* CEA VICs other than #1 requre limited range RGB > > * output unless overridden by an AVI infoframe. > > * Apply a colorspace conversion to squash 0-255 down > > diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h > > index 838eaf2b42e9..25cdf5f7a0d8 100644 > > --- a/include/drm/drm_edid.h > > +++ b/include/drm/drm_edid.h > > @@ -441,6 +441,8 @@ enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code); > > bool drm_detect_hdmi_monitor(struct edid *edid); > > bool drm_detect_monitor_audio(struct edid *edid); > > bool drm_rgb_quant_range_selectable(struct edid *edid); > > +enum hdmi_quantization_range > > +drm_default_rgb_quant_range(const struct drm_display_mode *mode); > > int drm_add_modes_noedid(struct drm_connector *connector, > > int hdisplay, int vdisplay); > > void drm_set_preferred_mode(struct drm_connector *connector, > > -- > > 2.10.2 > > > > _______________________________________________ > > Intel-gfx mailing list > > Intel-gfx@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/intel-gfx > > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch
On Wed, Jan 11, 2017 at 06:31:52PM +0200, Ville Syrjälä wrote: > On Wed, Jan 11, 2017 at 05:16:54PM +0100, Daniel Vetter wrote: > > On Wed, Jan 11, 2017 at 02:57:22PM +0200, ville.syrjala@linux.intel.com wrote: > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > > > Make the code selecting the RGB quantization range a little less magicy > > > by wrapping it up in a small helper. > > > > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > Needs cc: for driver maintainers, Eric for vc4 here. > > Eric was cc:d. I was just too lazy to add the cc:s to all the commit > messages, and so i just used --cc on the whole lot. Hm, he's not on the cc: list over here (on the mails, not in the patch body). -Daniel
On 12/01/17 05:00 PM, Daniel Vetter wrote: > On Wed, Jan 11, 2017 at 06:31:52PM +0200, Ville Syrjälä wrote: >> On Wed, Jan 11, 2017 at 05:16:54PM +0100, Daniel Vetter wrote: >>> On Wed, Jan 11, 2017 at 02:57:22PM +0200, ville.syrjala@linux.intel.com wrote: >>>> From: Ville Syrjälä <ville.syrjala@linux.intel.com> >>>> >>>> Make the code selecting the RGB quantization range a little less magicy >>>> by wrapping it up in a small helper. >>>> >>>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> >>> >>> Needs cc: for driver maintainers, Eric for vc4 here. >> >> Eric was cc:d. I was just too lazy to add the cc:s to all the commit >> messages, and so i just used --cc on the whole lot. > > Hm, he's not on the cc: list over here (on the mails, not in the patch > body). That could be because he has "Avoid duplicate copies of messages?" enabled in his mailman subscription options.
ville.syrjala@linux.intel.com writes: > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > Make the code selecting the RGB quantization range a little less magicy > by wrapping it up in a small helper. This series seems good. I won't have the ability to test it on vc4 within a reasonable time frame, so you can add an Acked-by from me if you'd like. Just one comment that you can take or leave: > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > --- > drivers/gpu/drm/drm_edid.c | 18 ++++++++++++++++++ > drivers/gpu/drm/i915/intel_dp.c | 4 +++- > drivers/gpu/drm/i915/intel_hdmi.c | 3 ++- > drivers/gpu/drm/vc4/vc4_hdmi.c | 4 +++- > include/drm/drm_edid.h | 2 ++ > 5 files changed, 28 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 4ff04aa84dd0..304c583b8000 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -3768,6 +3768,24 @@ bool drm_rgb_quant_range_selectable(struct edid *edid) > } > EXPORT_SYMBOL(drm_rgb_quant_range_selectable); > > +/** > + * drm_default_rgb_quant_range - default RGB quantization range > + * @mode: display mode > + * > + * Determine the default RGB quantization range for the mode, > + * as specified in CEA-861. > + * > + * Return: The default RGB quantization range for the mode > + */ > +enum hdmi_quantization_range > +drm_default_rgb_quant_range(const struct drm_display_mode *mode) > +{ > + return drm_match_cea_mode(mode) > 1 ? > + HDMI_QUANTIZATION_RANGE_LIMITED : > + HDMI_QUANTIZATION_RANGE_FULL; It might be nice to add a comment here like /* All CEA modes other than VIC 1 use limited quantization range. */ When I first had to put this logic in vc4, I was surprised by it and figured that it was an off-by-one bug in code that was trying to say "if it's any CEA mode then it should be limited range" > +} > +EXPORT_SYMBOL(drm_default_rgb_quant_range);
On Sat, Jan 21, 2017 at 06:50:57AM +1100, Eric Anholt wrote: > ville.syrjala@linux.intel.com writes: > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > Make the code selecting the RGB quantization range a little less magicy > > by wrapping it up in a small helper. > > This series seems good. I won't have the ability to test it on vc4 > within a reasonable time frame, so you can add an Acked-by from me if > you'd like. Just one comment that you can take or leave: > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > > --- > > drivers/gpu/drm/drm_edid.c | 18 ++++++++++++++++++ > > drivers/gpu/drm/i915/intel_dp.c | 4 +++- > > drivers/gpu/drm/i915/intel_hdmi.c | 3 ++- > > drivers/gpu/drm/vc4/vc4_hdmi.c | 4 +++- > > include/drm/drm_edid.h | 2 ++ > > 5 files changed, 28 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > > index 4ff04aa84dd0..304c583b8000 100644 > > --- a/drivers/gpu/drm/drm_edid.c > > +++ b/drivers/gpu/drm/drm_edid.c > > @@ -3768,6 +3768,24 @@ bool drm_rgb_quant_range_selectable(struct edid *edid) > > } > > EXPORT_SYMBOL(drm_rgb_quant_range_selectable); > > > > +/** > > + * drm_default_rgb_quant_range - default RGB quantization range > > + * @mode: display mode > > + * > > + * Determine the default RGB quantization range for the mode, > > + * as specified in CEA-861. > > + * > > + * Return: The default RGB quantization range for the mode > > + */ > > +enum hdmi_quantization_range > > +drm_default_rgb_quant_range(const struct drm_display_mode *mode) > > +{ > > + return drm_match_cea_mode(mode) > 1 ? > > + HDMI_QUANTIZATION_RANGE_LIMITED : > > + HDMI_QUANTIZATION_RANGE_FULL; > > It might be nice to add a comment here like > > /* All CEA modes other than VIC 1 use limited quantization range. */ > > When I first had to put this logic in vc4, I was surprised by it and > figured that it was an off-by-one bug in code that was trying to say "if > it's any CEA mode then it should be limited range" Seems like a good idea. I could even try to dig up a specific spec quote perhaps? And if I can't find anything succinct in the spec we can always go with your proposal. > > > > +} > > +EXPORT_SYMBOL(drm_default_rgb_quant_range);
On Fri, Jan 20, 2017 at 10:00:34PM +0200, Ville Syrjälä wrote: > On Sat, Jan 21, 2017 at 06:50:57AM +1100, Eric Anholt wrote: > > ville.syrjala@linux.intel.com writes: > > > > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > > > Make the code selecting the RGB quantization range a little less magicy > > > by wrapping it up in a small helper. > > > > This series seems good. I won't have the ability to test it on vc4 > > within a reasonable time frame, so you can add an Acked-by from me if > > you'd like. Just one comment that you can take or leave: > > > > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > --- > > > drivers/gpu/drm/drm_edid.c | 18 ++++++++++++++++++ > > > drivers/gpu/drm/i915/intel_dp.c | 4 +++- > > > drivers/gpu/drm/i915/intel_hdmi.c | 3 ++- > > > drivers/gpu/drm/vc4/vc4_hdmi.c | 4 +++- > > > include/drm/drm_edid.h | 2 ++ > > > 5 files changed, 28 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > > > index 4ff04aa84dd0..304c583b8000 100644 > > > --- a/drivers/gpu/drm/drm_edid.c > > > +++ b/drivers/gpu/drm/drm_edid.c > > > @@ -3768,6 +3768,24 @@ bool drm_rgb_quant_range_selectable(struct edid *edid) > > > } > > > EXPORT_SYMBOL(drm_rgb_quant_range_selectable); > > > > > > +/** > > > + * drm_default_rgb_quant_range - default RGB quantization range > > > + * @mode: display mode > > > + * > > > + * Determine the default RGB quantization range for the mode, > > > + * as specified in CEA-861. > > > + * > > > + * Return: The default RGB quantization range for the mode > > > + */ > > > +enum hdmi_quantization_range > > > +drm_default_rgb_quant_range(const struct drm_display_mode *mode) > > > +{ > > > + return drm_match_cea_mode(mode) > 1 ? > > > + HDMI_QUANTIZATION_RANGE_LIMITED : > > > + HDMI_QUANTIZATION_RANGE_FULL; > > > > It might be nice to add a comment here like > > > > /* All CEA modes other than VIC 1 use limited quantization range. */ > > > > When I first had to put this logic in vc4, I was surprised by it and > > figured that it was an off-by-one bug in code that was trying to say "if > > it's any CEA mode then it should be limited range" > > Seems like a good idea. I could even try to dig up a specific spec > quote perhaps? And if I can't find anything succinct in the spec we > can always go with your proposal. Meh. Didn't manage to dig up anything really nice from the spec, so I'll just go with your idea. > > > > > > > > +} > > > +EXPORT_SYMBOL(drm_default_rgb_quant_range); > > -- > Ville Syrjälä > Intel OTC > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 4ff04aa84dd0..304c583b8000 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -3768,6 +3768,24 @@ bool drm_rgb_quant_range_selectable(struct edid *edid) } EXPORT_SYMBOL(drm_rgb_quant_range_selectable); +/** + * drm_default_rgb_quant_range - default RGB quantization range + * @mode: display mode + * + * Determine the default RGB quantization range for the mode, + * as specified in CEA-861. + * + * Return: The default RGB quantization range for the mode + */ +enum hdmi_quantization_range +drm_default_rgb_quant_range(const struct drm_display_mode *mode) +{ + return drm_match_cea_mode(mode) > 1 ? + HDMI_QUANTIZATION_RANGE_LIMITED : + HDMI_QUANTIZATION_RANGE_FULL; +} +EXPORT_SYMBOL(drm_default_rgb_quant_range); + static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector, const u8 *hdmi) { diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 343e1d9fa761..d4befbbe834a 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -1713,7 +1713,9 @@ intel_dp_compute_config(struct intel_encoder *encoder, * VESA DisplayPort Ver.1.2a - 5.1.1.1 Video Colorimetry */ pipe_config->limited_color_range = - bpp != 18 && drm_match_cea_mode(adjusted_mode) > 1; + bpp != 18 && + drm_default_rgb_quant_range(adjusted_mode) == + HDMI_QUANTIZATION_RANGE_LIMITED; } else { pipe_config->limited_color_range = intel_dp->limited_color_range; diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 0bcfead14571..19bd13f53729 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -1330,7 +1330,8 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, /* See CEA-861-E - 5.1 Default Encoding Parameters */ pipe_config->limited_color_range = pipe_config->has_hdmi_sink && - drm_match_cea_mode(adjusted_mode) > 1; + drm_default_rgb_quant_range(adjusted_mode) == + HDMI_QUANTIZATION_RANGE_LIMITED; } else { pipe_config->limited_color_range = intel_hdmi->limited_color_range; diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index c4cb2e26de32..d79466a42690 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -463,7 +463,9 @@ static void vc4_hdmi_encoder_mode_set(struct drm_encoder *encoder, csc_ctl = VC4_SET_FIELD(VC4_HD_CSC_CTL_ORDER_BGR, VC4_HD_CSC_CTL_ORDER); - if (vc4_encoder->hdmi_monitor && drm_match_cea_mode(mode) > 1) { + if (vc4_encoder->hdmi_monitor && + drm_default_rgb_quant_range(adjusted_mode) == + HDMI_QUANTIZATION_RANGE_LIMITED) { /* CEA VICs other than #1 requre limited range RGB * output unless overridden by an AVI infoframe. * Apply a colorspace conversion to squash 0-255 down diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 838eaf2b42e9..25cdf5f7a0d8 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -441,6 +441,8 @@ enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code); bool drm_detect_hdmi_monitor(struct edid *edid); bool drm_detect_monitor_audio(struct edid *edid); bool drm_rgb_quant_range_selectable(struct edid *edid); +enum hdmi_quantization_range +drm_default_rgb_quant_range(const struct drm_display_mode *mode); int drm_add_modes_noedid(struct drm_connector *connector, int hdisplay, int vdisplay); void drm_set_preferred_mode(struct drm_connector *connector,