Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Alex Hung and committed by
Simon Ser
de0b0eb2 34101080

+55
+40
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
··· 1420 1420 } 1421 1421 1422 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 + 1451 + static int 1423 1452 __set_dm_plane_colorop_shaper(struct drm_plane_state *plane_state, 1424 1453 struct dc_plane_state *dc_plane_state, 1425 1454 struct drm_colorop *colorop) ··· 1659 1630 } 1660 1631 1661 1632 ret = __set_dm_plane_colorop_3x4_matrix(plane_state, dc_plane_state, colorop); 1633 + if (ret) 1634 + return ret; 1635 + 1636 + /* Multiplier */ 1637 + colorop = colorop->next; 1638 + if (!colorop) { 1639 + drm_dbg(dev, "no multiplier colorop found\n"); 1640 + return -EINVAL; 1641 + } 1642 + 1643 + ret = __set_dm_plane_colorop_multiplier(plane_state, dc_plane_state, colorop); 1662 1644 if (ret) 1663 1645 return ret; 1664 1646
+15
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c
··· 89 89 90 90 i++; 91 91 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 + 92 107 /* 1D curve - SHAPER TF */ 93 108 ops[i] = kzalloc(sizeof(*ops[0]), GFP_KERNEL); 94 109 if (!ops[i]) {