Skip to content

Commit de0b0eb

Browse files
Alex Hungemersion
authored andcommitted
drm/amd/display: add multiplier colorop
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> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Melissa Wen <mwen@igalia.com> Signed-off-by: Simon Ser <contact@emersion.fr> Link: https://patch.msgid.link/20251115000237.3561250-42-alex.hung@amd.com
1 parent 3410108 commit de0b0eb

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,35 @@ __set_dm_plane_colorop_3x4_matrix(struct drm_plane_state *plane_state,
14191419
return 0;
14201420
}
14211421

1422+
static int
1423+
__set_dm_plane_colorop_multiplier(struct drm_plane_state *plane_state,
1424+
struct dc_plane_state *dc_plane_state,
1425+
struct drm_colorop *colorop)
1426+
{
1427+
struct drm_colorop *old_colorop;
1428+
struct drm_colorop_state *colorop_state = NULL, *new_colorop_state;
1429+
struct drm_atomic_state *state = plane_state->state;
1430+
const struct drm_device *dev = colorop->dev;
1431+
int i = 0;
1432+
1433+
/* Multiplier */
1434+
old_colorop = colorop;
1435+
for_each_new_colorop_in_state(state, colorop, new_colorop_state, i) {
1436+
if (new_colorop_state->colorop == old_colorop &&
1437+
new_colorop_state->colorop->type == DRM_COLOROP_MULTIPLIER) {
1438+
colorop_state = new_colorop_state;
1439+
break;
1440+
}
1441+
}
1442+
1443+
if (colorop_state && !colorop_state->bypass && colorop->type == DRM_COLOROP_MULTIPLIER) {
1444+
drm_dbg(dev, "Multiplier colorop with ID: %d\n", colorop->base.id);
1445+
dc_plane_state->hdr_mult = amdgpu_dm_fixpt_from_s3132(colorop_state->multiplier);
1446+
}
1447+
1448+
return 0;
1449+
}
1450+
14221451
static int
14231452
__set_dm_plane_colorop_shaper(struct drm_plane_state *plane_state,
14241453
struct dc_plane_state *dc_plane_state,
@@ -1633,6 +1662,17 @@ amdgpu_dm_plane_set_colorop_properties(struct drm_plane_state *plane_state,
16331662
if (ret)
16341663
return ret;
16351664

1665+
/* Multiplier */
1666+
colorop = colorop->next;
1667+
if (!colorop) {
1668+
drm_dbg(dev, "no multiplier colorop found\n");
1669+
return -EINVAL;
1670+
}
1671+
1672+
ret = __set_dm_plane_colorop_multiplier(plane_state, dc_plane_state, colorop);
1673+
if (ret)
1674+
return ret;
1675+
16361676
/* 1D Curve & LUT - SHAPER TF & LUT */
16371677
colorop = colorop->next;
16381678
if (!colorop) {

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,21 @@ int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_pr
8989

9090
i++;
9191

92+
/* Multiplier */
93+
ops[i] = kzalloc(sizeof(struct drm_colorop), GFP_KERNEL);
94+
if (!ops[i]) {
95+
ret = -ENOMEM;
96+
goto cleanup;
97+
}
98+
99+
ret = drm_plane_colorop_mult_init(dev, ops[i], plane);
100+
if (ret)
101+
goto cleanup;
102+
103+
drm_colorop_set_next_property(ops[i-1], ops[i]);
104+
105+
i++;
106+
92107
/* 1D curve - SHAPER TF */
93108
ops[i] = kzalloc(sizeof(*ops[0]), GFP_KERNEL);
94109
if (!ops[i]) {

0 commit comments

Comments
 (0)