[PATCH v8 16/27] drm/connector: hdmi: Add Broadcast RGB property

Pekka Paalanen pekka.paalanen at collabora.com
Fri Mar 8 15:26:23 UTC 2024


On Fri, 08 Mar 2024 12:26:14 +0100
Alexander Stein <alexander.stein at ew.tq-group.com> wrote:

> Hi Maxime,
> 
> Am Donnerstag, 7. März 2024, 14:38:43 CET schrieb Maxime Ripard:
> > The i915 driver has a property to force the RGB range of an HDMI output.
> > The vc4 driver then implemented the same property with the same
> > semantics. KWin has support for it, and a PR for mutter is also there to
> > support it.
> > 
> > Both drivers implementing the same property with the same semantics,
> > plus the userspace having support for it, is proof enough that it's
> > pretty much a de-facto standard now and we can provide helpers for it.
> > 
> > Let's plumb it into the newly created HDMI connector.
> > 
> > Reviewed-by: Dave Stevenson <dave.stevenson at raspberrypi.com>
> > Acked-by: Pekka Paalanen <pekka.paalanen at collabora.com>
> > Reviewed-by: Sebastian Wick <sebastian.wick at redhat.com>
> > Signed-off-by: Maxime Ripard <mripard at kernel.org>
> > ---
> >  Documentation/gpu/kms-properties.csv      |  1 -
> >  drivers/gpu/drm/drm_atomic.c              |  2 +
> >  drivers/gpu/drm/drm_atomic_state_helper.c |  4 +-
> >  drivers/gpu/drm/drm_atomic_uapi.c         |  4 ++
> >  drivers/gpu/drm/drm_connector.c           | 88 +++++++++++++++++++++++++++++++
> >  include/drm/drm_connector.h               | 36 +++++++++++++
> >  6 files changed, 133 insertions(+), 2 deletions(-)

...

> > diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> > index 591d2d500f61..0272e1d05cc6 100644
> > --- a/drivers/gpu/drm/drm_connector.c
> > +++ b/drivers/gpu/drm/drm_connector.c
> > @@ -1210,10 +1210,33 @@ static const u32 dp_colorspaces =
> >  	BIT(DRM_MODE_COLORIMETRY_SYCC_601) |
> >  	BIT(DRM_MODE_COLORIMETRY_OPYCC_601) |
> >  	BIT(DRM_MODE_COLORIMETRY_BT2020_CYCC) |
> >  	BIT(DRM_MODE_COLORIMETRY_BT2020_YCC);
> >  
> > +static const struct drm_prop_enum_list broadcast_rgb_names[] = {
> > +	{ DRM_HDMI_BROADCAST_RGB_AUTO, "Automatic" },
> > +	{ DRM_HDMI_BROADCAST_RGB_FULL, "Full" },
> > +	{ DRM_HDMI_BROADCAST_RGB_LIMITED, "Limited 16:235" },
> > +};
> > +
> > +/*
> > + * drm_hdmi_connector_get_broadcast_rgb_name - Return a string for HDMI connector RGB broadcast selection
> > + * @broadcast_rgb: Broadcast RGB selection to compute name of
> > + *
> > + * Returns: the name of the Broadcast RGB selection, or NULL if the type
> > + * is not valid.
> > + */
> > +const char *
> > +drm_hdmi_connector_get_broadcast_rgb_name(enum drm_hdmi_broadcast_rgb broadcast_rgb)
> > +{
> > +	if (broadcast_rgb > DRM_HDMI_BROADCAST_RGB_LIMITED)  
> 
> I don't know if this was brought up before. IMHO it's easier to read checking:
>  if (broadcast_rgb > ARRAY_SIZE(broadcast_rgb_names)

You have an off-by-one bug in that suggestion. ;-)


Thanks,
pq

> 
> Best regards,
> Alexander
> 
> > +		return NULL;
> > +
> > +	return broadcast_rgb_names[broadcast_rgb].name;
> > +}
> > +EXPORT_SYMBOL(drm_hdmi_connector_get_broadcast_rgb_name);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20240308/b49d56a2/attachment.sig>


More information about the dri-devel mailing list