* [PATCH v2 1/4] drm/colorop: Define Gamma 2.4 and 2.6 and its Inverse
2026-11-19 19:51 [PATCH v2 0/4] drm/amd/display: Add Gamma 2.4 and 2.6 colorop support Harry Wentland
@ 2026-11-19 19:51 ` Harry Wentland
2026-11-30 21:16 ` Harry Wentland
2026-11-19 19:51 ` [PATCH v2 2/4] drm/amd/display: Use the wide curve for gamma 2.4 and 2.6 Harry Wentland
` (4 subsequent siblings)
5 siblings, 1 reply; 9+ messages in thread
From: Harry Wentland @ 2026-11-19 19:51 UTC (permalink / raw)
To: dri-devel, amd-gfx; +Cc: Harry Wentland
Add new 1D curve colorop types for the Gamma 2.4 and Gamma 2.6 power
functions and their inverses.
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
---
drivers/gpu/drm/drm_colorop.c | 4 ++++
include/drm/drm_colorop.h | 39 +++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
diff --git a/drivers/gpu/drm/drm_colorop.c b/drivers/gpu/drm/drm_colorop.c
index 682fcc651525..d62153fd9c71 100644
--- a/drivers/gpu/drm/drm_colorop.c
+++ b/drivers/gpu/drm/drm_colorop.c
@@ -79,6 +79,10 @@ static const char * const colorop_curve_1d_type_names[] = {
[DRM_COLOROP_1D_CURVE_BT2020_OETF] = "BT.2020 OETF",
[DRM_COLOROP_1D_CURVE_GAMMA22] = "Gamma 2.2",
[DRM_COLOROP_1D_CURVE_GAMMA22_INV] = "Gamma 2.2 Inverse",
+ [DRM_COLOROP_1D_CURVE_GAMMA24] = "Gamma 2.4",
+ [DRM_COLOROP_1D_CURVE_GAMMA24_INV] = "Gamma 2.4 Inverse",
+ [DRM_COLOROP_1D_CURVE_GAMMA26] = "Gamma 2.6",
+ [DRM_COLOROP_1D_CURVE_GAMMA26_INV] = "Gamma 2.6 Inverse",
};
static const struct drm_prop_enum_list drm_colorop_lut1d_interpolation_list[] = {
diff --git a/include/drm/drm_colorop.h b/include/drm/drm_colorop.h
index 224fae40ed2b..5c4c763da83e 100644
--- a/include/drm/drm_colorop.h
+++ b/include/drm/drm_colorop.h
@@ -126,6 +126,45 @@ enum drm_colorop_curve_1d_type {
* The inverse of &DRM_COLOROP_1D_CURVE_GAMMA22
*/
DRM_COLOROP_1D_CURVE_GAMMA22_INV,
+
+ /**
+ * @DRM_COLOROP_1D_CURVE_GAMMA24:
+ *
+ * enum string "Gamma 2.4"
+ *
+ * A gamma 2.4 power function. This applies a power curve with
+ * gamma value of 2.4 to the input values.
+ */
+ DRM_COLOROP_1D_CURVE_GAMMA24,
+
+ /**
+ * @DRM_COLOROP_1D_CURVE_GAMMA24_INV:
+ *
+ * enum string "Gamma 2.4 Inverse"
+ *
+ * The inverse of &DRM_COLOROP_1D_CURVE_GAMMA24
+ */
+ DRM_COLOROP_1D_CURVE_GAMMA24_INV,
+
+ /**
+ * @DRM_COLOROP_1D_CURVE_GAMMA26:
+ *
+ * enum string "Gamma 2.6"
+ *
+ * A gamma 2.6 power function. This applies a power curve with
+ * gamma value of 2.6 to the input values.
+ */
+ DRM_COLOROP_1D_CURVE_GAMMA26,
+
+ /**
+ * @DRM_COLOROP_1D_CURVE_GAMMA26_INV:
+ *
+ * enum string "Gamma 2.6 Inverse"
+ *
+ * The inverse of &DRM_COLOROP_1D_CURVE_GAMMA26
+ */
+ DRM_COLOROP_1D_CURVE_GAMMA26_INV,
+
/**
* @DRM_COLOROP_1D_CURVE_COUNT:
*
--
2.56.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v2 1/4] drm/colorop: Define Gamma 2.4 and 2.6 and its Inverse
2026-11-19 19:51 ` [PATCH v2 1/4] drm/colorop: Define Gamma 2.4 and 2.6 and its Inverse Harry Wentland
@ 2026-11-30 21:16 ` Harry Wentland
0 siblings, 0 replies; 9+ messages in thread
From: Harry Wentland @ 2026-11-30 21:16 UTC (permalink / raw)
To: Dave Airlie, Simona Vetter; +Cc: amd-gfx, dri-devel
Dave, Simona, any objections to merging this via amd-staging-drm-next?
If not, could I get an ACK?
Thanks,
Harry
On 11/19/26 14:51, Harry Wentland wrote:
> Add new 1D curve colorop types for the Gamma 2.4 and Gamma 2.6 power
> functions and their inverses.
>
> Signed-off-by: Harry Wentland <harry.wentland@amd.com>
> ---
> drivers/gpu/drm/drm_colorop.c | 4 ++++
> include/drm/drm_colorop.h | 39 +++++++++++++++++++++++++++++++++++
> 2 files changed, 43 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_colorop.c b/drivers/gpu/drm/drm_colorop.c
> index 682fcc651525..d62153fd9c71 100644
> --- a/drivers/gpu/drm/drm_colorop.c
> +++ b/drivers/gpu/drm/drm_colorop.c
> @@ -79,6 +79,10 @@ static const char * const colorop_curve_1d_type_names[] = {
> [DRM_COLOROP_1D_CURVE_BT2020_OETF] = "BT.2020 OETF",
> [DRM_COLOROP_1D_CURVE_GAMMA22] = "Gamma 2.2",
> [DRM_COLOROP_1D_CURVE_GAMMA22_INV] = "Gamma 2.2 Inverse",
> + [DRM_COLOROP_1D_CURVE_GAMMA24] = "Gamma 2.4",
> + [DRM_COLOROP_1D_CURVE_GAMMA24_INV] = "Gamma 2.4 Inverse",
> + [DRM_COLOROP_1D_CURVE_GAMMA26] = "Gamma 2.6",
> + [DRM_COLOROP_1D_CURVE_GAMMA26_INV] = "Gamma 2.6 Inverse",
> };
>
> static const struct drm_prop_enum_list drm_colorop_lut1d_interpolation_list[] = {
> diff --git a/include/drm/drm_colorop.h b/include/drm/drm_colorop.h
> index 224fae40ed2b..5c4c763da83e 100644
> --- a/include/drm/drm_colorop.h
> +++ b/include/drm/drm_colorop.h
> @@ -126,6 +126,45 @@ enum drm_colorop_curve_1d_type {
> * The inverse of &DRM_COLOROP_1D_CURVE_GAMMA22
> */
> DRM_COLOROP_1D_CURVE_GAMMA22_INV,
> +
> + /**
> + * @DRM_COLOROP_1D_CURVE_GAMMA24:
> + *
> + * enum string "Gamma 2.4"
> + *
> + * A gamma 2.4 power function. This applies a power curve with
> + * gamma value of 2.4 to the input values.
> + */
> + DRM_COLOROP_1D_CURVE_GAMMA24,
> +
> + /**
> + * @DRM_COLOROP_1D_CURVE_GAMMA24_INV:
> + *
> + * enum string "Gamma 2.4 Inverse"
> + *
> + * The inverse of &DRM_COLOROP_1D_CURVE_GAMMA24
> + */
> + DRM_COLOROP_1D_CURVE_GAMMA24_INV,
> +
> + /**
> + * @DRM_COLOROP_1D_CURVE_GAMMA26:
> + *
> + * enum string "Gamma 2.6"
> + *
> + * A gamma 2.6 power function. This applies a power curve with
> + * gamma value of 2.6 to the input values.
> + */
> + DRM_COLOROP_1D_CURVE_GAMMA26,
> +
> + /**
> + * @DRM_COLOROP_1D_CURVE_GAMMA26_INV:
> + *
> + * enum string "Gamma 2.6 Inverse"
> + *
> + * The inverse of &DRM_COLOROP_1D_CURVE_GAMMA26
> + */
> + DRM_COLOROP_1D_CURVE_GAMMA26_INV,
> +
> /**
> * @DRM_COLOROP_1D_CURVE_COUNT:
> *
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 2/4] drm/amd/display: Use the wide curve for gamma 2.4 and 2.6
2026-11-19 19:51 [PATCH v2 0/4] drm/amd/display: Add Gamma 2.4 and 2.6 colorop support Harry Wentland
2026-11-19 19:51 ` [PATCH v2 1/4] drm/colorop: Define Gamma 2.4 and 2.6 and its Inverse Harry Wentland
@ 2026-11-19 19:51 ` Harry Wentland
2026-11-25 3:42 ` Alex Hung
2026-11-19 19:51 ` [PATCH v2 3/4] drm/amd/display: Add support for 2.4 and 2.6 Gamma and its Inverse Harry Wentland
` (3 subsequent siblings)
5 siblings, 1 reply; 9+ messages in thread
From: Harry Wentland @ 2026-11-19 19:51 UTC (permalink / raw)
To: dri-devel, amd-gfx; +Cc: Harry Wentland
cm3_helper_translate_curve_to_hw_format() puts PQ, gamma 2.2, and HLG
on 32 regions from 2^-25 to 2^7. Gamma 2.4 and 2.6 used the other
layout, 12 regions from 2^-12 to 2^0.
cm_helper_translate_curve_to_hw_format() has the same split, for PQ
and gamma 2.2 only. DCN 3.0, 3.01, 3.1, and 3.14 program the plane
shaper through dcn20_set_shaper_3dlut(), which calls that helper.
The inverse curve is the shaper, and its input is linear light from
degamma. A 10-bit code v becomes (v/1023)^g. That is below 2^-12 for
v = 1..31 at gamma 2.4 and v = 1..41 at gamma 2.6, so those codes come
back as 0. On a gray ramp the round trip then misses the IGT bracket
of 13. Gamma 2.4 needs a bracket of 33 and gamma 2.6 needs 41. Gamma
2.2 already uses the wide curve and its round trip is exact.
Use the 32-region curve for gamma 2.4 and 2.6 in both helpers. Its low
end is 2^-25, which covers those dark codes. On DCN 4.0.1 the gamma
2.4 round trip is exact and gamma 2.6 is off by one 10-bit code, so
the original bracket of 13 passes. The DCN 3.0 family path was not
tested.
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
---
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c | 4 +++-
drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c | 2 ++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c
index 502a2d9b155f..6b3cc0d81e34 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c
@@ -355,7 +355,9 @@ bool cm_helper_translate_curve_to_hw_format(struct dc_context *ctx,
memset(lut_params, 0, sizeof(struct pwl_params));
memset(seg_distr, 0, sizeof(seg_distr));
- if (output_tf->tf == TRANSFER_FUNCTION_PQ || output_tf->tf == TRANSFER_FUNCTION_GAMMA22) {
+ if (output_tf->tf == TRANSFER_FUNCTION_PQ || output_tf->tf == TRANSFER_FUNCTION_GAMMA22 ||
+ output_tf->tf == TRANSFER_FUNCTION_GAMMA24 ||
+ output_tf->tf == TRANSFER_FUNCTION_GAMMA26) {
/* 32 segments
* segments are from 2^-25 to 2^7
*/
diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c
index eb299f7f9c41..8a76e985d359 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c
@@ -133,6 +133,8 @@ bool cm3_helper_translate_curve_to_hw_format(struct dc_context *ctx,
memset(seg_distr, 0, sizeof(seg_distr));
if (output_tf->tf == TRANSFER_FUNCTION_PQ || output_tf->tf == TRANSFER_FUNCTION_GAMMA22 ||
+ output_tf->tf == TRANSFER_FUNCTION_GAMMA24 ||
+ output_tf->tf == TRANSFER_FUNCTION_GAMMA26 ||
output_tf->tf == TRANSFER_FUNCTION_HLG) {
/* 32 segments
* segments are from 2^-25 to 2^7
--
2.56.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v2 2/4] drm/amd/display: Use the wide curve for gamma 2.4 and 2.6
2026-11-19 19:51 ` [PATCH v2 2/4] drm/amd/display: Use the wide curve for gamma 2.4 and 2.6 Harry Wentland
@ 2026-11-25 3:42 ` Alex Hung
0 siblings, 0 replies; 9+ messages in thread
From: Alex Hung @ 2026-11-25 3:42 UTC (permalink / raw)
To: Harry Wentland, dri-devel, amd-gfx
On 11/19/26 13:51, Harry Wentland wrote:
> cm3_helper_translate_curve_to_hw_format() puts PQ, gamma 2.2, and HLG
> on 32 regions from 2^-25 to 2^7. Gamma 2.4 and 2.6 used the other
> layout, 12 regions from 2^-12 to 2^0.
>
> cm_helper_translate_curve_to_hw_format() has the same split, for PQ
> and gamma 2.2 only. DCN 3.0, 3.01, 3.1, and 3.14 program the plane
> shaper through dcn20_set_shaper_3dlut(), which calls that helper.
>
> The inverse curve is the shaper, and its input is linear light from
> degamma. A 10-bit code v becomes (v/1023)^g. That is below 2^-12 for
> v = 1..31 at gamma 2.4 and v = 1..41 at gamma 2.6, so those codes come
> back as 0. On a gray ramp the round trip then misses the IGT bracket
> of 13. Gamma 2.4 needs a bracket of 33 and gamma 2.6 needs 41. Gamma
> 2.2 already uses the wide curve and its round trip is exact.
>
> Use the 32-region curve for gamma 2.4 and 2.6 in both helpers. Its low
> end is 2^-25, which covers those dark codes. On DCN 4.0.1 the gamma
> 2.4 round trip is exact and gamma 2.6 is off by one 10-bit code, so
> the original bracket of 13 passes. The DCN 3.0 family path was not
> tested.
>
> Signed-off-by: Harry Wentland <harry.wentland@amd.com>
> ---
> drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c | 4 +++-
> drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c | 2 ++
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c
> index 502a2d9b155f..6b3cc0d81e34 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c
> @@ -355,7 +355,9 @@ bool cm_helper_translate_curve_to_hw_format(struct dc_context *ctx,
> memset(lut_params, 0, sizeof(struct pwl_params));
> memset(seg_distr, 0, sizeof(seg_distr));
>
> - if (output_tf->tf == TRANSFER_FUNCTION_PQ || output_tf->tf == TRANSFER_FUNCTION_GAMMA22) {
> + if (output_tf->tf == TRANSFER_FUNCTION_PQ || output_tf->tf == TRANSFER_FUNCTION_GAMMA22 ||
> + output_tf->tf == TRANSFER_FUNCTION_GAMMA24 ||
> + output_tf->tf == TRANSFER_FUNCTION_GAMMA26) {
nitpick - it is better if new code can be aligned to above.
> /* 32 segments
> * segments are from 2^-25 to 2^7
> */
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c
> index eb299f7f9c41..8a76e985d359 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c
> +++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c
> @@ -133,6 +133,8 @@ bool cm3_helper_translate_curve_to_hw_format(struct dc_context *ctx,
> memset(seg_distr, 0, sizeof(seg_distr));
>
> if (output_tf->tf == TRANSFER_FUNCTION_PQ || output_tf->tf == TRANSFER_FUNCTION_GAMMA22 ||
> + output_tf->tf == TRANSFER_FUNCTION_GAMMA24 ||
> + output_tf->tf == TRANSFER_FUNCTION_GAMMA26 ||
nitpick - it is better if new code can be aligned to above.
> output_tf->tf == TRANSFER_FUNCTION_HLG) {
> /* 32 segments
> * segments are from 2^-25 to 2^7
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 3/4] drm/amd/display: Add support for 2.4 and 2.6 Gamma and its Inverse
2026-11-19 19:51 [PATCH v2 0/4] drm/amd/display: Add Gamma 2.4 and 2.6 colorop support Harry Wentland
2026-11-19 19:51 ` [PATCH v2 1/4] drm/colorop: Define Gamma 2.4 and 2.6 and its Inverse Harry Wentland
2026-11-19 19:51 ` [PATCH v2 2/4] drm/amd/display: Use the wide curve for gamma 2.4 and 2.6 Harry Wentland
@ 2026-11-19 19:51 ` Harry Wentland
2026-11-19 19:51 ` [PATCH v2 4/4] drm/amd/display: Add KUnit cases for gamma 2.4 and 2.6 colorops Harry Wentland
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Harry Wentland @ 2026-11-19 19:51 UTC (permalink / raw)
To: dri-devel, amd-gfx; +Cc: Harry Wentland
Wire up the newly defined Gamma 2.4 and Gamma 2.6 curve types in the
amdgpu DM color pipeline. Map them to the corresponding DC transfer
functions and advertise them in the supported degamma, shaper, and
blend transfer function masks.
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
---
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c | 6 ++++++
.../drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 12 +++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
index 45cea72111c7..c4df67aa421e 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
@@ -945,6 +945,12 @@ amdgpu_colorop_tf_to_dc_tf(enum drm_colorop_curve_1d_type tf)
case DRM_COLOROP_1D_CURVE_GAMMA22:
case DRM_COLOROP_1D_CURVE_GAMMA22_INV:
return TRANSFER_FUNCTION_GAMMA22;
+ case DRM_COLOROP_1D_CURVE_GAMMA24:
+ case DRM_COLOROP_1D_CURVE_GAMMA24_INV:
+ return TRANSFER_FUNCTION_GAMMA24;
+ case DRM_COLOROP_1D_CURVE_GAMMA26:
+ case DRM_COLOROP_1D_CURVE_GAMMA26_INV:
+ return TRANSFER_FUNCTION_GAMMA26;
default:
return TRANSFER_FUNCTION_LINEAR;
}
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c
index d32bf2bf2847..935c041c1d31 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c
@@ -38,21 +38,27 @@ const u64 amdgpu_dm_supported_degam_tfs =
BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF) |
BIT(DRM_COLOROP_1D_CURVE_PQ_125_EOTF) |
BIT(DRM_COLOROP_1D_CURVE_BT2020_INV_OETF) |
- BIT(DRM_COLOROP_1D_CURVE_GAMMA22);
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA22) |
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA24) |
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA26);
EXPORT_IF_KUNIT(amdgpu_dm_supported_degam_tfs);
const u64 amdgpu_dm_supported_shaper_tfs =
BIT(DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF) |
BIT(DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF) |
BIT(DRM_COLOROP_1D_CURVE_BT2020_OETF) |
- BIT(DRM_COLOROP_1D_CURVE_GAMMA22_INV);
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA22_INV) |
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA24_INV) |
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA26_INV);
EXPORT_IF_KUNIT(amdgpu_dm_supported_shaper_tfs);
const u64 amdgpu_dm_supported_blnd_tfs =
BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF) |
BIT(DRM_COLOROP_1D_CURVE_PQ_125_EOTF) |
BIT(DRM_COLOROP_1D_CURVE_BT2020_INV_OETF) |
- BIT(DRM_COLOROP_1D_CURVE_GAMMA22);
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA22) |
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA24) |
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA26);
EXPORT_IF_KUNIT(amdgpu_dm_supported_blnd_tfs);
#define MAX_COLOR_PIPELINE_OPS 10
--
2.56.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v2 4/4] drm/amd/display: Add KUnit cases for gamma 2.4 and 2.6 colorops
2026-11-19 19:51 [PATCH v2 0/4] drm/amd/display: Add Gamma 2.4 and 2.6 colorop support Harry Wentland
` (2 preceding siblings ...)
2026-11-19 19:51 ` [PATCH v2 3/4] drm/amd/display: Add support for 2.4 and 2.6 Gamma and its Inverse Harry Wentland
@ 2026-11-19 19:51 ` Harry Wentland
2026-11-20 20:57 ` [PATCH v2 0/4] drm/amd/display: Add Gamma 2.4 and 2.6 colorop support Robert Mader
2026-11-25 3:43 ` Alex Hung
5 siblings, 0 replies; 9+ messages in thread
From: Harry Wentland @ 2026-11-19 19:51 UTC (permalink / raw)
To: dri-devel, amd-gfx; +Cc: Harry Wentland
Check that amdgpu_colorop_tf_to_dc_tf() maps the gamma 2.4 and 2.6
curves and their inverses to TRANSFER_FUNCTION_GAMMA24 and
TRANSFER_FUNCTION_GAMMA26.
Check that the degamma and blend masks include gamma 2.4 and 2.6, and
that the shaper mask includes their inverses. Update the
*_no_extra_bits cases for the new mask values.
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
---
.../amdgpu_dm/tests/amdgpu_dm_color_test.c | 18 +++++++
.../amdgpu_dm/tests/amdgpu_dm_colorop_test.c | 54 +++++++++++++++++--
2 files changed, 69 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_color_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_color_test.c
index 7ad8c56cbcf3..7a2c137f2967 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_color_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_color_test.c
@@ -330,6 +330,22 @@ static void dm_test_colorop_tf_to_dc_tf_gamma22(struct kunit *test)
(int)TRANSFER_FUNCTION_GAMMA22);
}
+static void dm_test_colorop_tf_to_dc_tf_gamma24(struct kunit *test)
+{
+ KUNIT_EXPECT_EQ(test, (int)amdgpu_colorop_tf_to_dc_tf(DRM_COLOROP_1D_CURVE_GAMMA24),
+ (int)TRANSFER_FUNCTION_GAMMA24);
+ KUNIT_EXPECT_EQ(test, (int)amdgpu_colorop_tf_to_dc_tf(DRM_COLOROP_1D_CURVE_GAMMA24_INV),
+ (int)TRANSFER_FUNCTION_GAMMA24);
+}
+
+static void dm_test_colorop_tf_to_dc_tf_gamma26(struct kunit *test)
+{
+ KUNIT_EXPECT_EQ(test, (int)amdgpu_colorop_tf_to_dc_tf(DRM_COLOROP_1D_CURVE_GAMMA26),
+ (int)TRANSFER_FUNCTION_GAMMA26);
+ KUNIT_EXPECT_EQ(test, (int)amdgpu_colorop_tf_to_dc_tf(DRM_COLOROP_1D_CURVE_GAMMA26_INV),
+ (int)TRANSFER_FUNCTION_GAMMA26);
+}
+
static void dm_test_colorop_tf_to_dc_tf_default(struct kunit *test)
{
KUNIT_EXPECT_EQ(test, (int)amdgpu_colorop_tf_to_dc_tf(DRM_COLOROP_1D_CURVE_COUNT),
@@ -2928,6 +2944,8 @@ static struct kunit_case dm_color_test_cases[] = {
KUNIT_CASE(dm_test_colorop_tf_to_dc_tf_pq),
KUNIT_CASE(dm_test_colorop_tf_to_dc_tf_bt2020),
KUNIT_CASE(dm_test_colorop_tf_to_dc_tf_gamma22),
+ KUNIT_CASE(dm_test_colorop_tf_to_dc_tf_gamma24),
+ KUNIT_CASE(dm_test_colorop_tf_to_dc_tf_gamma26),
KUNIT_CASE(dm_test_colorop_tf_to_dc_tf_default),
/* __drm_lut_to_dc_gamma */
KUNIT_CASE(dm_test_drm_lut_to_dc_gamma_legacy_zero),
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c
index 27cd4b8500e8..9195a2c827ab 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_colorop_test.c
@@ -40,12 +40,26 @@ static void dm_test_supported_degam_tfs_has_gamma22(struct kunit *test)
BIT(DRM_COLOROP_1D_CURVE_GAMMA22));
}
+static void dm_test_supported_degam_tfs_has_gamma24(struct kunit *test)
+{
+ KUNIT_EXPECT_TRUE(test, amdgpu_dm_supported_degam_tfs &
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA24));
+}
+
+static void dm_test_supported_degam_tfs_has_gamma26(struct kunit *test)
+{
+ KUNIT_EXPECT_TRUE(test, amdgpu_dm_supported_degam_tfs &
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA26));
+}
+
static void dm_test_supported_degam_tfs_no_extra_bits(struct kunit *test)
{
u64 expected = BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF) |
BIT(DRM_COLOROP_1D_CURVE_PQ_125_EOTF) |
BIT(DRM_COLOROP_1D_CURVE_BT2020_INV_OETF) |
- BIT(DRM_COLOROP_1D_CURVE_GAMMA22);
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA22) |
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA24) |
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA26);
KUNIT_EXPECT_EQ(test, amdgpu_dm_supported_degam_tfs, expected);
}
@@ -76,12 +90,26 @@ static void dm_test_supported_shaper_tfs_has_gamma22_inv(struct kunit *test)
BIT(DRM_COLOROP_1D_CURVE_GAMMA22_INV));
}
+static void dm_test_supported_shaper_tfs_has_gamma24_inv(struct kunit *test)
+{
+ KUNIT_EXPECT_TRUE(test, amdgpu_dm_supported_shaper_tfs &
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA24_INV));
+}
+
+static void dm_test_supported_shaper_tfs_has_gamma26_inv(struct kunit *test)
+{
+ KUNIT_EXPECT_TRUE(test, amdgpu_dm_supported_shaper_tfs &
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA26_INV));
+}
+
static void dm_test_supported_shaper_tfs_no_extra_bits(struct kunit *test)
{
u64 expected = BIT(DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF) |
BIT(DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF) |
BIT(DRM_COLOROP_1D_CURVE_BT2020_OETF) |
- BIT(DRM_COLOROP_1D_CURVE_GAMMA22_INV);
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA22_INV) |
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA24_INV) |
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA26_INV);
KUNIT_EXPECT_EQ(test, amdgpu_dm_supported_shaper_tfs, expected);
}
@@ -112,12 +140,26 @@ static void dm_test_supported_blnd_tfs_has_gamma22(struct kunit *test)
BIT(DRM_COLOROP_1D_CURVE_GAMMA22));
}
+static void dm_test_supported_blnd_tfs_has_gamma24(struct kunit *test)
+{
+ KUNIT_EXPECT_TRUE(test, amdgpu_dm_supported_blnd_tfs &
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA24));
+}
+
+static void dm_test_supported_blnd_tfs_has_gamma26(struct kunit *test)
+{
+ KUNIT_EXPECT_TRUE(test, amdgpu_dm_supported_blnd_tfs &
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA26));
+}
+
static void dm_test_supported_blnd_tfs_no_extra_bits(struct kunit *test)
{
u64 expected = BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF) |
BIT(DRM_COLOROP_1D_CURVE_PQ_125_EOTF) |
BIT(DRM_COLOROP_1D_CURVE_BT2020_INV_OETF) |
- BIT(DRM_COLOROP_1D_CURVE_GAMMA22);
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA22) |
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA24) |
+ BIT(DRM_COLOROP_1D_CURVE_GAMMA26);
KUNIT_EXPECT_EQ(test, amdgpu_dm_supported_blnd_tfs, expected);
}
@@ -497,18 +539,24 @@ static struct kunit_case dm_colorop_test_cases[] = {
KUNIT_CASE(dm_test_supported_degam_tfs_has_pq125_eotf),
KUNIT_CASE(dm_test_supported_degam_tfs_has_bt2020_inv_oetf),
KUNIT_CASE(dm_test_supported_degam_tfs_has_gamma22),
+ KUNIT_CASE(dm_test_supported_degam_tfs_has_gamma24),
+ KUNIT_CASE(dm_test_supported_degam_tfs_has_gamma26),
KUNIT_CASE(dm_test_supported_degam_tfs_no_extra_bits),
/* shaper TFs */
KUNIT_CASE(dm_test_supported_shaper_tfs_has_srgb_inv_eotf),
KUNIT_CASE(dm_test_supported_shaper_tfs_has_pq125_inv_eotf),
KUNIT_CASE(dm_test_supported_shaper_tfs_has_bt2020_oetf),
KUNIT_CASE(dm_test_supported_shaper_tfs_has_gamma22_inv),
+ KUNIT_CASE(dm_test_supported_shaper_tfs_has_gamma24_inv),
+ KUNIT_CASE(dm_test_supported_shaper_tfs_has_gamma26_inv),
KUNIT_CASE(dm_test_supported_shaper_tfs_no_extra_bits),
/* blnd TFs */
KUNIT_CASE(dm_test_supported_blnd_tfs_has_srgb_eotf),
KUNIT_CASE(dm_test_supported_blnd_tfs_has_pq125_eotf),
KUNIT_CASE(dm_test_supported_blnd_tfs_has_bt2020_inv_oetf),
KUNIT_CASE(dm_test_supported_blnd_tfs_has_gamma22),
+ KUNIT_CASE(dm_test_supported_blnd_tfs_has_gamma24),
+ KUNIT_CASE(dm_test_supported_blnd_tfs_has_gamma26),
KUNIT_CASE(dm_test_supported_blnd_tfs_no_extra_bits),
/* cross-check */
KUNIT_CASE(dm_test_degam_and_blnd_tfs_match),
--
2.56.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v2 0/4] drm/amd/display: Add Gamma 2.4 and 2.6 colorop support
2026-11-19 19:51 [PATCH v2 0/4] drm/amd/display: Add Gamma 2.4 and 2.6 colorop support Harry Wentland
` (3 preceding siblings ...)
2026-11-19 19:51 ` [PATCH v2 4/4] drm/amd/display: Add KUnit cases for gamma 2.4 and 2.6 colorops Harry Wentland
@ 2026-11-20 20:57 ` Robert Mader
2026-11-25 3:43 ` Alex Hung
5 siblings, 0 replies; 9+ messages in thread
From: Robert Mader @ 2026-11-20 20:57 UTC (permalink / raw)
To: Harry Wentland, dri-devel, amd-gfx
Thanks a lot!
I added the patches to my kernel branch at
https://gitlab.com/rmader/linux/-/tree/testing-post-blend-2026-11-20 [1]
and tested it with my Weston test branch for the post-blend pipeline
(https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/2157). I
can confirm it works on AMD for SDR video playback - below is some DRM
debug output confirming the Gamma 2.4 -> Gamma 2.2 Inverse use we'd
expect. The kernel and Weston branches further add and use gamma 2.4 on
VKMS, successfully comparing the output to the GL renderer.
Thus the the whole series is:
Tested-by: Robert Mader <robert.mader@collabora.com>
Best regards,
Robert
[atomic] drmModeAtomicCommit
[repaint] Using plane-only state composition
[repaint] paint node 0:4-2-1 on primary plane 224
[repaint] paint node 0:4-1-1 using renderer composition
[repaint] paint node 0:comp-3-1 using renderer composition
[repaint] paint node 0:2-1-1 using renderer composition
[repaint] paint node 0:2-2-1 using renderer composition
[atomic] applying output 0 (eDP-1) state
[CRTC:411] MODE_ID (24) -> 1920x1200@60.001Hz (0x248)
[CRTC:411] ACTIVE (23) -> 1 (0x1)
[COLOROP:412] BYPASS (414) -> 1 (0x1)
[COLOROP:417] BYPASS (419) -> 0 (0x0)
[COLOROP:417] CURVE_1D_TYPE (421) -> Gamma 2.2 Inverse (0x7)
[COLOROP:422] BYPASS (424) -> 1 (0x1)
[CRTC:411] COLOR_PIPELINE (429) -> 412 (0x19c)
[CRTC:411] VRR_ENABLED (25) -> 0 (0x0)
[CONN:503] CRTC_ID (21) -> 411 (0x19b)
[CONN:503] Content Protection (508) -> Undesired (0x0)
[CONN:503] HDCP Content Type (509) -> HDCP Type0 (0x0)
[CONN:503] HDR_OUTPUT_METADATA (8) -> 0 (0x0)
[CONN:503] max bpc (504) -> 16 (0x10)
[CONN:503] Colorspace (505) -> Default (0x0)
[CONN:503] underscan (38) -> off (0x0)
[CONN:503] underscan hborder (39) -> 0 (0x0)
[CONN:503] underscan vborder (40) -> 0 (0x0)
[CONN:503] color format (507) -> AUTO (0x0)
[PLANE:224 pri] FB_ID (18) -> 586 (0x24a)
[PLANE:224 pri] CRTC_ID (21) -> 411 (0x19b)
[PLANE:224 pri] SRC_X (10) -> 0.00 (0x0)
[PLANE:224 pri] SRC_Y (11) -> 0.00 (0x0)
[PLANE:224 pri] SRC_W (12) -> 3840.00 (0xf000000)
[PLANE:224 pri] SRC_H (13) -> 2160.00 (0x8700000)
[PLANE:224 pri] CRTC_X (14) -> 0 (0x0)
[PLANE:224 pri] CRTC_Y (15) -> 60 (0x3c)
[PLANE:224 pri] CRTC_W (16) -> 1920 (0x780)
[PLANE:224 pri] CRTC_H (17) -> 1080 (0x438)
[PLANE:224 pri] FB_DAMAGE_CLIPS (22) -> 0 (0x0)
[COLOROP:232] BYPASS (234) -> 0 (0x0)
[COLOROP:232] FIXED_MATRIX_TYPE (236) -> YCbCr 709 Limited
to RGB (0x3)
[COLOROP:237] BYPASS (239) -> 0 (0x0)
[COLOROP:237] CURVE_1D_TYPE (241) -> Gamma 2.4 (0x8)
[COLOROP:242] BYPASS (244) -> 1 (0x1)
[COLOROP:247] BYPASS (249) -> 1 (0x1)
[COLOROP:252] BYPASS (254) -> 1 (0x1)
[COLOROP:257] BYPASS (259) -> 1 (0x1)
[COLOROP:264] BYPASS (266) -> 1 (0x1)
[COLOROP:271] BYPASS (273) -> 1 (0x1)
[COLOROP:276] BYPASS (278) -> 1 (0x1)
[PLANE:224 pri] COLOR_PIPELINE (283) -> 232 (0xe8)
[PLANE:224] FORMAT: NV12 MODIFIER:
AMD_GFX11,64KB_R_X,PIPE_XOR_BITS=2,PACKERS=2 (0x200000010401b04)
[PLANE:224 pri] rotation (231) -> 1 (0x1)
[PLANE:224 pri] pixel blend mode (227) -> None (0x2)
1: A heavily rebased version of Melissas branch from
https://gitlab.freedesktop.org/mwen/drm-misc/-/commits/gamescope_pipeline_w_colorop
On 19.11.26 20:51, Harry Wentland wrote:
> Mutter needs a pure 2.4 power curve. The color pipeline only has 2.2.
> This series adds 2.4, and 2.6 for completeness.
>
> Tested on Navi 48.
>
> IGT patches for the Gamma 2.4 and 2.6 tests are on the igt-dev mailing
> list.
>
> Changes in v2:
> - Put gamma 2.4 and 2.6 on the wide curve in
> cm_helper_translate_curve_to_hw_format() as well (Sashiko).
>
> Harry Wentland (4):
> drm/colorop: Define Gamma 2.4 and 2.6 and its Inverse
> drm/amd/display: Use the wide curve for gamma 2.4 and 2.6
> drm/amd/display: Add support for 2.4 and 2.6 Gamma and its Inverse
> drm/amd/display: Add KUnit cases for gamma 2.4 and 2.6 colorops
>
> .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 6 +++
> .../amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 12 +++--
> .../amdgpu_dm/tests/amdgpu_dm_color_test.c | 18 +++++++
> .../amdgpu_dm/tests/amdgpu_dm_colorop_test.c | 54 +++++++++++++++++--
> .../amd/display/dc/dcn10/dcn10_cm_common.c | 4 +-
> .../amd/display/dc/dcn30/dcn30_cm_common.c | 2 +
> drivers/gpu/drm/drm_colorop.c | 4 ++
> include/drm/drm_colorop.h | 39 ++++++++++++++
> 8 files changed, 132 insertions(+), 7 deletions(-)
>
--
Robert Mader
Consultant Software Developer
Collabora Ltd.
Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
Registered in England & Wales, no. 5513718
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v2 0/4] drm/amd/display: Add Gamma 2.4 and 2.6 colorop support
2026-11-19 19:51 [PATCH v2 0/4] drm/amd/display: Add Gamma 2.4 and 2.6 colorop support Harry Wentland
` (4 preceding siblings ...)
2026-11-20 20:57 ` [PATCH v2 0/4] drm/amd/display: Add Gamma 2.4 and 2.6 colorop support Robert Mader
@ 2026-11-25 3:43 ` Alex Hung
5 siblings, 0 replies; 9+ messages in thread
From: Alex Hung @ 2026-11-25 3:43 UTC (permalink / raw)
To: Harry Wentland, dri-devel, amd-gfx
nitpicks in patch 2, and this series is
Reviewed-by: Alex Hung <alex.hung@amd.com>
On 11/19/26 13:51, Harry Wentland wrote:
> Mutter needs a pure 2.4 power curve. The color pipeline only has 2.2.
> This series adds 2.4, and 2.6 for completeness.
>
> Tested on Navi 48.
>
> IGT patches for the Gamma 2.4 and 2.6 tests are on the igt-dev mailing
> list.
>
> Changes in v2:
> - Put gamma 2.4 and 2.6 on the wide curve in
> cm_helper_translate_curve_to_hw_format() as well (Sashiko).
>
> Harry Wentland (4):
> drm/colorop: Define Gamma 2.4 and 2.6 and its Inverse
> drm/amd/display: Use the wide curve for gamma 2.4 and 2.6
> drm/amd/display: Add support for 2.4 and 2.6 Gamma and its Inverse
> drm/amd/display: Add KUnit cases for gamma 2.4 and 2.6 colorops
>
> .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 6 +++
> .../amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 12 +++--
> .../amdgpu_dm/tests/amdgpu_dm_color_test.c | 18 +++++++
> .../amdgpu_dm/tests/amdgpu_dm_colorop_test.c | 54 +++++++++++++++++--
> .../amd/display/dc/dcn10/dcn10_cm_common.c | 4 +-
> .../amd/display/dc/dcn30/dcn30_cm_common.c | 2 +
> drivers/gpu/drm/drm_colorop.c | 4 ++
> include/drm/drm_colorop.h | 39 ++++++++++++++
> 8 files changed, 132 insertions(+), 7 deletions(-)
>
^ permalink raw reply [flat|nested] 9+ messages in thread