Skip to content

Commit ef3d703

Browse files
Harry Wentlandemersion
authored andcommitted
drm/amd/display: Enable support for PQ 125 EOTF and Inverse
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> Reviewed-by: Daniel Stone <daniels@collabora.com> Signed-off-by: Simon Ser <contact@emersion.fr> Link: https://patch.msgid.link/20251115000237.3561250-33-alex.hung@amd.com
1 parent 1b75447 commit ef3d703

2 files changed

Lines changed: 25 additions & 12 deletions

File tree

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "amdgpu.h"
2727
#include "amdgpu_mode.h"
2828
#include "amdgpu_dm.h"
29+
#include "amdgpu_dm_colorop.h"
2930
#include "dc.h"
3031
#include "modules/color/color_gamma.h"
3132

@@ -674,6 +675,9 @@ amdgpu_colorop_tf_to_dc_tf(enum drm_colorop_curve_1d_type tf)
674675
case DRM_COLOROP_1D_CURVE_SRGB_EOTF:
675676
case DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF:
676677
return TRANSFER_FUNCTION_SRGB;
678+
case DRM_COLOROP_1D_CURVE_PQ_125_EOTF:
679+
case DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF:
680+
return TRANSFER_FUNCTION_PQ;
677681
default:
678682
return TRANSFER_FUNCTION_LINEAR;
679683
}
@@ -1197,8 +1201,10 @@ __set_colorop_in_tf_1d_curve(struct dc_plane_state *dc_plane_state,
11971201
struct drm_colorop *colorop = colorop_state->colorop;
11981202
struct drm_device *drm = colorop->dev;
11991203

1200-
if (colorop->type != DRM_COLOROP_1D_CURVE ||
1201-
colorop_state->curve_1d_type != DRM_COLOROP_1D_CURVE_SRGB_EOTF)
1204+
if (colorop->type != DRM_COLOROP_1D_CURVE)
1205+
return -EINVAL;
1206+
1207+
if (!(BIT(colorop_state->curve_1d_type) & amdgpu_dm_supported_degam_tfs))
12021208
return -EINVAL;
12031209

12041210
if (colorop_state->bypass) {
@@ -1230,7 +1236,7 @@ __set_dm_plane_colorop_degamma(struct drm_plane_state *plane_state,
12301236
/* 1st op: 1d curve - degamma */
12311237
for_each_new_colorop_in_state(state, colorop, new_colorop_state, i) {
12321238
if (new_colorop_state->colorop == old_colorop &&
1233-
new_colorop_state->curve_1d_type == DRM_COLOROP_1D_CURVE_SRGB_EOTF) {
1239+
(BIT(new_colorop_state->curve_1d_type) & amdgpu_dm_supported_degam_tfs)) {
12341240
colorop_state = new_colorop_state;
12351241
break;
12361242
}
@@ -1250,8 +1256,10 @@ __set_colorop_in_shaper_1d_curve(struct dc_plane_state *dc_plane_state,
12501256
struct drm_colorop *colorop = colorop_state->colorop;
12511257
struct drm_device *drm = colorop->dev;
12521258

1253-
if (colorop->type != DRM_COLOROP_1D_CURVE &&
1254-
colorop_state->curve_1d_type != DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF)
1259+
if (colorop->type != DRM_COLOROP_1D_CURVE)
1260+
return -EINVAL;
1261+
1262+
if (!(BIT(colorop_state->curve_1d_type) & amdgpu_dm_supported_shaper_tfs))
12551263
return -EINVAL;
12561264

12571265
if (colorop_state->bypass) {
@@ -1287,7 +1295,7 @@ __set_dm_plane_colorop_shaper(struct drm_plane_state *plane_state,
12871295
/* 2nd op: 1d curve - shaper */
12881296
for_each_new_colorop_in_state(state, colorop, new_colorop_state, i) {
12891297
if (new_colorop_state->colorop == old_colorop &&
1290-
new_colorop_state->curve_1d_type == DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF) {
1298+
(BIT(new_colorop_state->curve_1d_type) & amdgpu_dm_supported_shaper_tfs)) {
12911299
colorop_state = new_colorop_state;
12921300
break;
12931301
}
@@ -1314,8 +1322,10 @@ __set_colorop_1d_curve_blend_tf_lut(struct dc_plane_state *dc_plane_state,
13141322
const struct drm_color_lut *blend_lut = NULL;
13151323
u32 blend_size = 0;
13161324

1317-
if (colorop->type != DRM_COLOROP_1D_CURVE &&
1318-
colorop_state->curve_1d_type != DRM_COLOROP_1D_CURVE_SRGB_EOTF)
1325+
if (colorop->type != DRM_COLOROP_1D_CURVE)
1326+
return -EINVAL;
1327+
1328+
if (!(BIT(colorop_state->curve_1d_type) & amdgpu_dm_supported_blnd_tfs))
13191329
return -EINVAL;
13201330

13211331
if (colorop_state->bypass) {
@@ -1351,7 +1361,7 @@ __set_dm_plane_colorop_blend(struct drm_plane_state *plane_state,
13511361
/* 3nd op: 1d curve - blend */
13521362
for_each_new_colorop_in_state(state, colorop, new_colorop_state, i) {
13531363
if (new_colorop_state->colorop == old_colorop &&
1354-
new_colorop_state->curve_1d_type == DRM_COLOROP_1D_CURVE_SRGB_EOTF) {
1364+
(BIT(new_colorop_state->curve_1d_type) & amdgpu_dm_supported_blnd_tfs)) {
13551365
colorop_state = new_colorop_state;
13561366
break;
13571367
}

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@
3232
#include "amdgpu_dm_colorop.h"
3333

3434
const u64 amdgpu_dm_supported_degam_tfs =
35-
BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF);
35+
BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF) |
36+
BIT(DRM_COLOROP_1D_CURVE_PQ_125_EOTF);
3637

3738
const u64 amdgpu_dm_supported_shaper_tfs =
38-
BIT(DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF);
39+
BIT(DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF) |
40+
BIT(DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF);
3941

4042
const u64 amdgpu_dm_supported_blnd_tfs =
41-
BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF);
43+
BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF) |
44+
BIT(DRM_COLOROP_1D_CURVE_PQ_125_EOTF);
4245

4346
#define MAX_COLOR_PIPELINE_OPS 10
4447

0 commit comments

Comments
 (0)