[PATCH 2/5] drm/edid: Introduce drm_default_rgb_quant_range()

Eric Anholt eric at anholt.net
Fri Jan 20 19:50:57 UTC 2017


ville.syrjala at linux.intel.com writes:

> From: Ville Syrjälä <ville.syrjala at 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 at 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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20170121/fa803bbe/attachment.sig>


More information about the dri-devel mailing list