[V7 29/45] drm/colorop: Add PQ 125 EOTF and its inverse

Pekka Paalanen pekka.paalanen at haloniitty.fi
Fri Jan 17 09:04:01 UTC 2025


On Thu, 19 Dec 2024 21:33:35 -0700
Alex Hung <alex.hung at amd.com> wrote:

> From: Harry Wentland <harry.wentland at amd.com>
> 
> The PQ function defines a mapping of code values to nits (cd/m^2).
> The max code value maps to 10,000 nits.
> 
> Windows DWM's canonical composition color space (CCCS)  defaults
> to composing SDR contents to 80 nits and uses a float value of
> 1.0 to represent this. For this reason AMD HW hard-codes a PQ
> function that is scaled by 125, yielding 80 nit PQ values for
> 1.0 and 10,000 nits at 125.0.
> 
> This patch introduces this scaled PQ EOTF and its inverse as
> 1D curve types.
> 
> Signed-off-by: Alex Hung <alex.hung at amd.com>
> Signed-off-by: Harry Wentland <harry.wentland at amd.com>
> ---
>  drivers/gpu/drm/drm_colorop.c |  2 ++
>  include/drm/drm_colorop.h     | 21 ++++++++++++++++++++-
>  2 files changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_colorop.c b/drivers/gpu/drm/drm_colorop.c
> index 7d4b29c0a0cc..f3391602a577 100644
> --- a/drivers/gpu/drm/drm_colorop.c
> +++ b/drivers/gpu/drm/drm_colorop.c
> @@ -70,6 +70,8 @@ static const struct drm_prop_enum_list drm_colorop_type_enum_list[] = {
>  static const char * const colorop_curve_1d_type_names[] = {
>  	[DRM_COLOROP_1D_CURVE_SRGB_EOTF] = "sRGB EOTF",
>  	[DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF] = "sRGB Inverse EOTF",
> +	[DRM_COLOROP_1D_CURVE_PQ_125_EOTF] = "PQ 125 EOTF",
> +	[DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF] = "PQ 125 Inverse EOTF",
>  };
>  
>  
> diff --git a/include/drm/drm_colorop.h b/include/drm/drm_colorop.h
> index e9f5c1adc2fe..4084a7438032 100644
> --- a/include/drm/drm_colorop.h
> +++ b/include/drm/drm_colorop.h
> @@ -36,7 +36,6 @@
>   * enum drm_colorop_curve_1d_type - type of 1D curve
>   *
>   * Describes a 1D curve to be applied by the DRM_COLOROP_1D_CURVE colorop.
> - *
>   */
>  enum drm_colorop_curve_1d_type {
>  	/**
> @@ -56,6 +55,26 @@ enum drm_colorop_curve_1d_type {
>  	 */
>  	DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF,
>  
> +	/**
> +	 * @DRM_COLOROP_1D_CURVE_PQ_125_EOTF:
> +	 *
> +	 * The PQ transfer function, scaled by 125.0f, so that 10,000
> +	 * nits correspond to 125.0f.
> +	 *
> +	 * Transfer characteristics of the PQ function as defined by
> +	 * SMPTE ST 2084 (2014) for 10-, 12-, 14-, and 16-bit systems
> +	 * and Rec. ITU-R BT.2100-2 perceptual quantization (PQ) system.
> +	 * Equivalent to H.273 TransferCharacteristics code point 16.
> +	 */

Hi,

this all good, I'd just clarify a minor detail.

H.273 code point 16 defines the normalised formula
TF: [0.0, 1.0] -> [0.0, 1.0]
so it is not equivalent to the 125-scaled version.

Maybe you meant something like this?

+	 * Transfer characteristics of the PQ function as defined by
+	 * SMPTE ST 2084 (2014) for 10-, 12-, 14-, and 16-bit systems
+	 * and Rec. ITU-R BT.2100-2 perceptual quantization (PQ) system,
+	 * represented by H.273 TransferCharacteristics code point 16.


Thanks,
pq


> +	DRM_COLOROP_1D_CURVE_PQ_125_EOTF,
> +
> +	/**
> +	 * @DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF:
> +	 *
> +	 * The inverse of DRM_COLOROP_1D_CURVE_PQ_125_EOTF.
> +	 */
> +	DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF,
> +
>  	/**
>  	 * @DRM_COLOROP_1D_CURVE_COUNT:
>  	 *

-------------- 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/wayland-devel/attachments/20250117/01a9a3c9/attachment.sig>


More information about the wayland-devel mailing list