lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240305133726.2ebe81b8.pekka.paalanen@collabora.com>
Date: Tue, 5 Mar 2024 13:37:26 +0200
From: Pekka Paalanen <pekka.paalanen@...labora.com>
To: Sebastian Wick <sebastian.wick@...hat.com>
Cc: Harry Wentland <harry.wentland@....com>, Ville Syrjälä
 <ville.syrjala@...ux.intel.com>, Maarten Lankhorst
 <maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
 Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>,
 Daniel Vetter <daniel@...ll.ch>, dri-devel@...ts.freedesktop.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/drm_connector: Document Colorspace property
 variants

On Mon,  4 Mar 2024 18:45:08 +0100
Sebastian Wick <sebastian.wick@...hat.com> wrote:

> The initial idea of the Colorspace prop was that this maps 1:1 to
> InfoFrames/SDP but KMS does not give user space enough information nor
> control over the output format to figure out which variants can be used
> for a given KMS commit. At the same time, properties like Broadcast RGB
> expect full range quantization range being produced by user space from
> the CRTC and drivers to convert to the range expected by the sink for
> the chosen output format, mode, InfoFrames, etc.
> 
> This change documents the reality of the Colorspace property. The
> Default variant unfortunately is very much driver specific and not
> reflected by the EDID. The BT2020 variants are in active use by generic
> compositors which have expectations from the driver about the
> conversions it has to do when selecting certain output formats.
> 
> Everything else is also marked as undefined. Coming up with valid
> behavior that makes it usable from user space and consistent with other
> KMS properties for those variants is left as an exercise for whoever
> wants to use them.
> 
> Signed-off-by: Sebastian Wick <sebastian.wick@...hat.com>
> ---
>  drivers/gpu/drm/drm_connector.c | 67 ++++++++++++++++++++++++---------
>  include/drm/drm_connector.h     |  8 ----
>  2 files changed, 49 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index b0516505f7ae..1c4ce7f90a76 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -2147,24 +2147,55 @@ EXPORT_SYMBOL(drm_mode_create_aspect_ratio_property);
>   * DOC: standard connector properties
>   *
>   * Colorspace:
> - *     This property helps select a suitable colorspace based on the sink
> - *     capability. Modern sink devices support wider gamut like BT2020.
> - *     This helps switch to BT2020 mode if the BT2020 encoded video stream
> - *     is being played by the user, same for any other colorspace. Thereby
> - *     giving a good visual experience to users.
> - *
> - *     The expectation from userspace is that it should parse the EDID
> - *     and get supported colorspaces. Use this property and switch to the
> - *     one supported. Sink supported colorspaces should be retrieved by
> - *     userspace from EDID and driver will not explicitly expose them.
> - *
> - *     Basically the expectation from userspace is:
> - *      - Set up CRTC DEGAMMA/CTM/GAMMA to convert to some sink
> - *        colorspace
> - *      - Set this new property to let the sink know what it
> - *        converted the CRTC output to.
> - *      - This property is just to inform sink what colorspace
> - *        source is trying to drive.
> + *	This property selects the colorimetry and transfer characteristics user
> + *	space configured the CRTC to produce.

Rather than "selects", how about "informs the sink"?

To avoid implying that this changes CRTC pixel operations.

> + *	The transfer characteristics might get overwritten by the
> + *	HDR_OUTPUT_METADATA property.
> + *	The quantization range is always full (see the Broadcast RGB property).

This reads like infoframe data sent to the sink will always indicate
full range. What you meant instead is, userspace configures plane and
CRTC DEGAMMA/CTM/GAMMA to always produce full range regardless of what
is actually sent to the sink, is it not?

Can we refer to DEGAMMA/CTM/GAMMA etc. as "pixel operation properties"
or something? To avoid having to list them (incorrectly) everywhere.

> + *
> + *	The driver is expected to send the right metadata to the sink which can
> + *	depend on the property value, the output mode and the output format.
> + *	It's also responsible for converting to the output format, taking into
> + *	account YCbCr conversion and quantization range.
> + *
> + *	For historical reasons this property exposes a number of variants which
> + *	result in undefined behavior.
> + *
> + *	Default:
> + *		The behavior is driver-specific.
> + *	BT2020_RGB:
> + *	BT2020_YCC:
> + *		User space configures the state such that the CRTC produces RGB
> + *		content with Rec. ITU-R BT.2020 colorimetry, Rec. ITU-R BT.2020
> + *		(Table 4, RGB) transfer characteristics and full quantization
> + *		range.
> + *		User space can use the HDR_OUTPUT_METADATA property to set the
> + *		transfer characteristics to PQ (Rec. ITU-R BT.2100 Table 4) or
> + *		HLG (Rec. ITU-R BT.2100 Table 5) in which case, user space
> + *		configures the CRTC to produce content with the respective
> + *		transfer characteristics.
> + *		Drivers can configure the sink to use an RGB format, tell the
> + *		sink to expect Rec. ITU-R BT.2020 R'G'B' colorimetry and convert
> + *		to the appropriate quantization range.
> + *		Drivers can configure the sink to use a YCbCr format, tell the
> + *		sink to expect Rec. ITU-R BT.2020 Y'C'BC'R colorimetry, convert
> + *		to YCbCr using the Rec. ITU-R BT.2020 non-constant luminance
> + *		conversion matrix and convert to the appropriate quantization
> + *		range.

To avoid misunderstandings, since you have a nice paragraph split
between RGB and YCC, maybe this should underline that BT2020_RGB and
BT2020_YCC are equivalent from userspace perspective, and the driver
chooses between RGB and YCC on its own.

> + *	SMPTE_170M_YCC:
> + *	BT709_YCC:
> + *	XVYCC_601:
> + *	XVYCC_709:
> + *	SYCC_601:
> + *	opYCC_601:
> + *	opRGB:
> + *	BT2020_CYCC:
> + *	DCI-P3_RGB_D65:
> + *	DCI-P3_RGB_Theater:
> + *	RGB_WIDE_FIXED:
> + *	RGB_WIDE_FLOAT:
> + *	BT601_YCC:
> + *		The behavior is undefined.
>   *
>   * Because between HDMI and DP have different colorspaces,
>   * drm_mode_create_hdmi_colorspace_property() is used for HDMI connector and
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index fe88d7fc6b8f..02c42b01a3a7 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -437,14 +437,6 @@ enum drm_privacy_screen_status {
>   *
>   * DP definitions come from the DP v2.0 spec
>   * HDMI definitions come from the CTA-861-H spec
> - *
> - * A note on YCC and RGB variants:
> - *
> - * Since userspace is not aware of the encoding on the wire
> - * (RGB or YCbCr), drivers are free to pick the appropriate
> - * variant, regardless of what userspace selects. E.g., if
> - * BT2020_RGB is selected by userspace a driver will pick
> - * BT2020_YCC if the encoding on the wire is YUV444 or YUV420.
>    *
>   * @DRM_MODE_COLORIMETRY_DEFAULT:
>   *   Driver specific behavior.

Overall, I like this patch.


Thanks,
pq

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ