- Mar 21, 2025
-
-
Alex Hung authored
The functions are to clean up color pipeline when a device driver fails to create its color pipeline. Signed-off-by:
Alex Hung <alex.hung@amd.com>
-
Add kernel doc for AMD color pipeline. Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
Alex Hung authored
This adds support for a 3D LUT. The color pipeline now consists of the following colorops: 1. 1D curve colorop 2. Multiplier 3. 3x4 CTM 4. 1D curve colorop 5. 1D LUT 6. 3D LUT 7. 1D curve colorop 8. 1D LUT Signed-off-by:
Alex Hung <alex.hung@amd.com>
-
Alex Hung authored
It is to be used to enable HDR by allowing userpace to create and pass 3D LUTs to kernel and hardware. new drm_colorop_type: DRM_COLOROP_3D_LUT. Signed-off-by:
Alex Hung <alex.hung@amd.com>
-
Not all HW will be able to do bypass on all color operations. Introduce an 'allow_bypass' boolean for all colorop init functions and only create the BYPASS property when it's true. Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
We want to make sure userspace is aware of the 1D LUT interpolation. While linear interpolation is common it might not be supported on all HW. Give driver implementers a way to specify their interpolation. 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>
-
Alex Hung authored
Swap the order of matrix and multiplier as designed in hardware. Signed-off-by:
Alex Hung <alex.hung@amd.com>
-
Alex Hung authored
This adds support for a multiplier. This multiplier is programmed via the HDR Multiplier in DCN. With this change the following IGT tests pass: kms_colorop --run plane-XR30-XR30-multiply_125 kms_colorop --run plane-XR30-XR30-multiply_inv_125 The color pipeline now consists of the following colorops: 1. 1D curve colorop 2. 3x4 CTM 3. Multiplier 4. 1D curve colorop 5. 1D LUT 6. 1D curve colorop 7. 1D LUT Signed-off-by:
Alex Hung <alex.hung@amd.com>
-
Alex Hung authored
This introduces a new drm_colorop_type: DRM_COLOROP_MULTIPLIER. It's a simple multiplier to all pixel values. The value is specified via a S31.32 fixed point provided via the "MULTIPLIER" property. Reviewed-by:
Simon Ser <contact@emersion.fr> Signed-off-by:
Alex Hung <alex.hung@amd.com>
-
Alex Hung authored
This adds support for a 3x4 color transformation matrix. With this change the following IGT tests pass: kms_colorop --run plane-XR30-XR30-ctm_3x4_50_desat kms_colorop --run plane-XR30-XR30-ctm_3x4_overdrive kms_colorop --run plane-XR30-XR30-ctm_3x4_oversaturate kms_colorop --run plane-XR30-XR30-ctm_3x4_bt709_enc kms_colorop --run plane-XR30-XR30-ctm_3x4_bt709_dec The color pipeline now consists of the following colorops: 1. 1D curve colorop 2. 3x4 CTM 3. 1D curve colorop 4. 1D LUT 5. 1D curve colorop 6. 1D LUT Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
Alex Hung authored
This patch adds colorops for custom 1D LUTs in the SHAPER and BLND HW blocks. With this change the following IGT tests pass: kms_colorop --run plane-XR30-XR30-srgb_inv_eotf_lut kms_colorop --run plane-XR30-XR30-srgb_inv_eotf_lut-srgb_eotf_lut The color pipeline now consists of the following colorops: 1. 1D curve colorop 2. 1D curve colorop 3. 1D LUT 4. 1D curve colorop 5. 1D LUT The 1D curve colorops support sRGB, BT2020, and PQ scaled to 125.0. Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
Alex Hung authored
We've previously introduced DRM_COLOROP_1D_CURVE for pre-defined 1D curves. But we also have HW that supports custom curves and userspace needs the ability to pass custom curves, aka LUTs. This patch introduces a new colorop type, called DRM_COLOROP_1D_LUT that provides a SIZE property which is used by a driver to advertise the supported SIZE of the LUT, as well as a DATA property which userspace uses to set the LUT. DATA and size function in the same way as current drm_crtc GAMMA and DEGAMMA LUTs. Signed-off-by:
Alex Hung <alex.hung@amd.com> Co-developed-by:
Harry Wentland <harry.wentland@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
This adds support for the BT.709/BT.2020 transfer functions on all current 1D curve plane colorops, i.e., on DEGAM, SHAPER, and BLND blocks. With this change the following IGT subtests pass: kms_colorop --run plane-XR30-XR30-bt2020_inv_oetf kms_colorop --run plane-XR30-XR30-bt2020_oetf Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
The BT.709 and BT.2020 OETFs are the same, the only difference being that the BT.2020 variant is defined with more precision for 10 and 12-bit per color encodings. Both are used as encoding functions for video content, and are therefore defined as OETF (opto-electronic transfer function) instead of as EOTF (electro-optical transfer function). Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
This patchset enables support for the PQ_125 EOTF and its inverse on all existing plane 1D curve colorops, i.e., on DEGAM, SHAPER, and BLND blocks. With this patchset the following IGT subtests are passing: kms_colorop --run plane-XR30-XR30-pq_125_eotf kms_colorop --run plane-XR30-XR30-pq_125_inv_eotf kms_colorop --run plane-XR30-XR30-pq_125_eotf-pq_125_inv_eotf kms_colorop --run plane-XR30-XR30-pq_125_eotf-pq_125_inv_eotf-pq_125_eotf Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@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@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
Alex Hung authored
Expose a 3rd 1D curve colorop, with support for DRM_COLOROP_1D_CURVE_SRGB_EOTF and program the BLND block to perform the sRGB transform when the colorop is not in bypass With this change the following IGT test passes: kms_colorop --run plane-XR30-XR30-srgb_eotf-srgb_inv_eotf-srgb_eotf The color pipeline now consists of the following colorops: 1. 1D curve colorop w/ sRGB EOTF support 2. 1D curve colorop w/ sRGB Inverse EOTF support 3. 1D curve colorop w/ sRGB EOTF support Signed-off-by:
Alex Hung <alex.hung@amd.com> Co-developed-by:
Harry Wentland <harry.wentland@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
Alex Hung authored
Expose a 2nd curve colorop with support for DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF and program HW to perform the sRGB Inverse EOTF on the shaper block when the colorop is not in bypass. With this change the follow IGT tests pass: kms_colorop --run plane-XR30-XR30-srgb_inv_eotf kms_colorop --run plane-XR30-XR30-srgb_eotf-srgb_inv_eotf The color pipeline now consists of the following colorops: 1. 1D curve colorop w/ sRGB EOTF support 2. 1D curve colorop w/ sRGB Inverse EOTF support Signed-off-by:
Alex Hung <alex.hung@amd.com> Co-developed-by:
Harry Wentland <harry.wentland@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
Alex Hung authored
Expose one 1D curve colorop with support for DRM_COLOROP_1D_CURVE_SRGB_EOTF and program HW to perform the sRGB transform when the colorop is not in bypass. With this change the following IGT test passes: kms_colorop --run plane-XR30-XR30-srgb_eotf The color pipeline now consists of a single colorop: 1. 1D curve colorop w/ sRGB EOTF Signed-off-by:
Alex Hung <alex.hung@amd.com> Co-developed-by:
Harry Wentland <harry.wentland@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
Alex Hung authored
cursor plane does not need to have color pipeline. Signed-off-by:
Alex Hung <alex.hung@amd.com>
-
Add the default Bypass pipeline and ensure it passes the kms_colorop test plane-XR30-XR30-bypass. Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
When the plane_color_pipeline bit is set we should ignore deprecated properties, such as COLOR_RANGE and COLOR_ENCODING. Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
Alex Hung authored
Create a new macro for_each_new_colorop_in_state to access new drm_colorop_state updated from uapi. Reviewed-by:
Simon Ser <contact@emersion.fr> Signed-off-by:
Alex Hung <alex.hung@amd.com>
-
Drivers will need to know whether an atomic check/commit originated from a client with DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE so they can ignore deprecated properties, like COLOR_ENCODING and COLOR_RANGE. Pass the plane_color_pipeline bit to drm_atomic_state. Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
A whole slew of tests for CTM handling that greatly helped in debugging the CTM code. The extent of tests might seem a bit silly but they're fast and might someday help save someone else's day when debugging this. Reviewed-by:
Louis Chauvet <louis.chauvet@bootlin.com> Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
While working on the CTM implementation of VKMS I had to ascertain myself of a few assumptions. One of those is whether drm_fixed.h treats its numbers using signed-magnitude or twos-complement. It is twos-complement. In order to make someone else's day easier I am adding the drm_test_int2fixp test that validates the above assumption. I am also adding a test for the new sm2fixp function that converts from a signed-magnitude fixed point to the twos-complement fixed point. Reviewed-by:
Louis Chauvet <louis.chauvet@bootlin.com> Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
We add two 3x4 matrices into the VKMS color pipeline. The reason we're adding matrices is so that we can test that application of a matrix and its inverse yields an output equal to the input image. One complication with the matrix implementation has to do with the fact that the matrix entries are in signed-magnitude fixed point, whereas the drm_fixed.h implementation uses 2s-complement. The latter one is the one that we want for easy addition and subtraction, so we convert all entries to 2s-complement. Reviewed-by:
Louis Chauvet <louis.chauvet@bootlin.com> Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
Certain operations require us to preserve values below 0.0 and above 1.0 (0x0 and 0xffff respectively in 16 bpc unorm). One such operation is a BT709 encoding operation followed by its decoding operation, or the reverse. We'll use s32 values as intermediate in and outputs of our color operations, for the operations where it matters. For now this won't apply to LUT operations. We might want to update those to work on s32 as well, but it's unclear how that should work for unorm LUT definitions. We'll revisit that once we add LUT + CTM tests. In order to allow for this we'll also invert the nesting of our colorop processing loops. We now use the pixel iteration loop on the outside and the colorop iteration on the inside. Reviewed-by:
Louis Chauvet <louis.chauvet@bootlin.com> Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
This type is used to support a 3x4 matrix in colorops. A 3x4 matrix uses the last column as a "bias" column. Some HW exposes support for 3x4. The calculation looks like: out matrix in |R| |0 1 2 3 | | R | |G| = |4 5 6 7 | x | G | |B| |8 9 10 11| | B | |1.0| This is also the first colorop where we need a blob property to program the property. For that we'll introduce a new DATA property that can be used by all colorop TYPEs requiring a blob. The way a DATA blob is read depends on the TYPE of the colorop. We only create the DATA property for property types that need it. Reviewed-by:
Simon Ser <contact@emersion.fr> Reviewed-by:
Louis Chauvet <louis.chauvet@bootlin.com> Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
Two tests are added to VKMS LUT handling: - linear - inv_srgb Reviewed-by:
Louis Chauvet <louis.chauvet@bootlin.com> Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
This patch introduces a VKMS color pipeline that includes two drm_colorops for named transfer functions. For now the only ones supported are sRGB EOTF, sRGB Inverse EOTF, and a Linear TF. We will expand this in the future but I don't want to do so without accompanying IGT tests. We introduce a new vkms_luts.c file that hard-codes sRGB EOTF, sRGB Inverse EOTF, and a linear EOTF LUT. These have been generated with 256 entries each as IGT is currently testing only 8 bpc surfaces. We will likely need higher precision but I'm reluctant to make that change without clear indication that we need it. We'll revisit and, if necessary, regenerate the LUTs when we have IGT tests for higher precision buffers. Signed-off-by:
Harry Wentland <harry.wentland@amd.com> Signed-off-by:
Alex Hung <alex.hung@amd.com>
-
Add kernel doc for drm_colorop objects. Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
With the introduction of the pre-blending color pipeline we can no longer have color operations that don't have a clear position in the color pipeline. We deprecate all existing plane properties. For upstream drivers those are: - COLOR_ENCODING - COLOR_RANGE Drivers are expected to ignore these properties when programming the HW. DRM clients that don't register with DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE will not be allowed to set the COLOR_ENCODING and COLOR_RANGE properties. Setting of the COLOR_PIPELINE plane property or drm_colorop properties is only allowed for userspace that sets this client cap. v8: - Disallow setting of COLOR_RANGE and COLOR_ENCODING when DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE is set Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
We're adding a new enum COLOR PIPELINE property. This property will have entries for each COLOR PIPELINE by referencing the DRM object ID of the first drm_colorop of the pipeline. 0 disables the entire COLOR PIPELINE. Userspace can use this to discover the available color pipelines, as well as set the desired one. The color pipelines are programmed via properties on the actual drm_colorop objects. Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
Print atomic state for drm_colorop in debugfs Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
We'll construct color pipelines out of drm_colorop by chaining them via the NEXT pointer. NEXT will point to the next drm_colorop in the pipeline, or by 0 if we're at the end of the pipeline. Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
We want to be able to bypass each colorop at all times. Introduce a new BYPASS boolean property for this. Reviewed-by:
Simon Ser <contact@emersion.fr> Reviewed-by:
Louis Chauvet <louis.chauvet@bootlin.com> Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
Add a new drm_colorop with DRM_COLOROP_1D_CURVE with two subtypes: DRM_COLOROP_1D_CURVE_SRGB_EOTF and DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF. Reviewed-by:
Simon Ser <contact@emersion.fr> Reviewed-by:
Louis Chauvet <louis.chauvet@bootlin.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com> Co-developed-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Alex Hung <alex.hung@amd.com>
-
Add a read-only TYPE property. The TYPE specifies the colorop type, such as enumerated curve, 1D LUT, CTM, 3D LUT, PWL LUT, etc. For now we're only introducing an enumerated 1D LUT type to illustrate the concept. Reviewed-by:
Simon Ser <contact@emersion.fr> Reviewed-by:
Louis Chauvet <louis.chauvet@bootlin.com> Signed-off-by:
Alex Hung <alex.hung@amd.com> Signed-off-by:
Harry Wentland <harry.wentland@amd.com>
-
This patches introduces a new drm_colorop mode object. This object represents color transformations and can be used to define color pipelines. We also introduce the drm_colorop_state here, as well as various helpers and state tracking bits. 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>
-