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 3x4 matrix colorop

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>
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-40-alex.hung@amd.com

authored by

Alex Hung and committed by
Simon Ser
16e0f785 5ed78b44

+67
+52
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
··· 1379 1379 } 1380 1380 1381 1381 static int 1382 + __set_dm_plane_colorop_3x4_matrix(struct drm_plane_state *plane_state, 1383 + struct dc_plane_state *dc_plane_state, 1384 + struct drm_colorop *colorop) 1385 + { 1386 + struct drm_colorop *old_colorop; 1387 + struct drm_colorop_state *colorop_state = NULL, *new_colorop_state; 1388 + struct drm_atomic_state *state = plane_state->state; 1389 + const struct drm_device *dev = colorop->dev; 1390 + const struct drm_property_blob *blob; 1391 + struct drm_color_ctm_3x4 *ctm = NULL; 1392 + int i = 0; 1393 + 1394 + /* 3x4 matrix */ 1395 + old_colorop = colorop; 1396 + for_each_new_colorop_in_state(state, colorop, new_colorop_state, i) { 1397 + if (new_colorop_state->colorop == old_colorop && 1398 + new_colorop_state->colorop->type == DRM_COLOROP_CTM_3X4) { 1399 + colorop_state = new_colorop_state; 1400 + break; 1401 + } 1402 + } 1403 + 1404 + if (colorop_state && !colorop_state->bypass && colorop->type == DRM_COLOROP_CTM_3X4) { 1405 + drm_dbg(dev, "3x4 matrix colorop with ID: %d\n", colorop->base.id); 1406 + blob = colorop_state->data; 1407 + if (blob->length == sizeof(struct drm_color_ctm_3x4)) { 1408 + ctm = (struct drm_color_ctm_3x4 *) blob->data; 1409 + __drm_ctm_3x4_to_dc_matrix(ctm, dc_plane_state->gamut_remap_matrix.matrix); 1410 + dc_plane_state->gamut_remap_matrix.enable_remap = true; 1411 + dc_plane_state->input_csc_color_matrix.enable_adjustment = false; 1412 + } else { 1413 + drm_warn(dev, "blob->length (%zu) isn't equal to drm_color_ctm_3x4 (%zu)\n", 1414 + blob->length, sizeof(struct drm_color_ctm_3x4)); 1415 + return -EINVAL; 1416 + } 1417 + } 1418 + 1419 + return 0; 1420 + } 1421 + 1422 + static int 1382 1423 __set_dm_plane_colorop_shaper(struct drm_plane_state *plane_state, 1383 1424 struct dc_plane_state *dc_plane_state, 1384 1425 struct drm_colorop *colorop) ··· 1619 1578 return -EINVAL; 1620 1579 1621 1580 ret = __set_dm_plane_colorop_degamma(plane_state, dc_plane_state, colorop); 1581 + if (ret) 1582 + return ret; 1583 + 1584 + /* 3x4 matrix */ 1585 + colorop = colorop->next; 1586 + if (!colorop) { 1587 + drm_dbg(dev, "no 3x4 matrix colorop found\n"); 1588 + return -EINVAL; 1589 + } 1590 + 1591 + ret = __set_dm_plane_colorop_3x4_matrix(plane_state, dc_plane_state, colorop); 1622 1592 if (ret) 1623 1593 return ret; 1624 1594
+15
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c
··· 74 74 75 75 i++; 76 76 77 + /* 3x4 matrix */ 78 + ops[i] = kzalloc(sizeof(struct drm_colorop), GFP_KERNEL); 79 + if (!ops[i]) { 80 + ret = -ENOMEM; 81 + goto cleanup; 82 + } 83 + 84 + ret = drm_plane_colorop_ctm_3x4_init(dev, ops[i], plane); 85 + if (ret) 86 + goto cleanup; 87 + 88 + drm_colorop_set_next_property(ops[i-1], ops[i]); 89 + 90 + i++; 91 + 77 92 /* 1D curve - SHAPER TF */ 78 93 ops[i] = kzalloc(sizeof(*ops[0]), GFP_KERNEL); 79 94 if (!ops[i]) {