]> Gentwo Git Trees - linux/.git/commitdiff
drm/colorop: Add PQ 125 EOTF and its inverse
authorHarry Wentland <harry.wentland@amd.com>
Sat, 15 Nov 2025 00:01:56 +0000 (17:01 -0700)
committerSimon Ser <contact@emersion.fr>
Wed, 26 Nov 2025 22:03:34 +0000 (23:03 +0100)
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.

Reviewed-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Signed-off-by: Simon Ser <contact@emersion.fr>
Link: https://patch.msgid.link/20251115000237.3561250-32-alex.hung@amd.com
drivers/gpu/drm/drm_colorop.c
include/drm/drm_colorop.h

index c68b85a7b26151a89389248cb9c9866951b60142..feaca07b429c9dd4a16616677cf7889774360db3 100644 (file)
@@ -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",
 };
 
 /* Init Helpers */
index 8b5f8aaac2f469b246160f92340eb835e145db8e..139c9cb38b67bdacc861de562c9b869d84a3c310 100644 (file)
@@ -58,6 +58,30 @@ enum drm_colorop_curve_1d_type {
         */
        DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF,
 
+       /**
+        * @DRM_COLOROP_1D_CURVE_PQ_125_EOTF:
+        *
+        * enum string "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,
+        * represented by H.273 TransferCharacteristics code point 16.
+        */
+       DRM_COLOROP_1D_CURVE_PQ_125_EOTF,
+
+       /**
+        * @DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF:
+        *
+        * enum string "PQ 125 Inverse EOTF"
+        *
+        * The inverse of DRM_COLOROP_1D_CURVE_PQ_125_EOTF.
+        */
+       DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF,
+
        /**
         * @DRM_COLOROP_1D_CURVE_COUNT:
         *