[V7 32/45] drm/amd/display: Add support for BT.709 and BT.2020 TFs

Leo Li sunpeng.li at amd.com
Wed Feb 12 23:03:49 UTC 2025



On 2024-12-19 23:33, Alex Hung wrote:
> From: Harry Wentland <harry.wentland at amd.com>
> 
> This adds support for the BT.709/BT.2020 transfer functions
> on all current 1D curve plane colorops, i.e., on DEGAM, SHAPER,
> and BLND blocks.
> 
> With this change the following IGT subtests pass:
> kms_colorop --run plane-XR30-XR30-bt2020_inv_oetf
> kms_colorop --run plane-XR30-XR30-bt2020_oetf
> 
> Signed-off-by: Alex Hung <alex.hung at amd.com>
> Signed-off-by: Harry Wentland <harry.wentland at amd.com>
> ---
>   .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c   | 11 ++++++++---
>   .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 10 +++++++---
>   2 files changed, 15 insertions(+), 6 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 63044e0296cb..1765402bc122 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
> @@ -676,6 +676,9 @@ amdgpu_colorop_tf_to_dc_tf(enum drm_colorop_curve_1d_type tf)
>   	case DRM_COLOROP_1D_CURVE_SRGB_EOTF:
>   	case DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF:
>   		return TRANSFER_FUNCTION_SRGB;
> +	case DRM_COLOROP_1D_CURVE_BT2020_INV_OETF:
> +	case DRM_COLOROP_1D_CURVE_BT2020_OETF:
> +		return TRANSFER_FUNCTION_BT709;
>   	case DRM_COLOROP_1D_CURVE_PQ_125_EOTF:
>   	case DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF:
>   		return TRANSFER_FUNCTION_PQ;
> @@ -1284,8 +1287,10 @@ __set_colorop_1d_curve_blend_tf_lut(struct dc_plane_state *dc_plane_state,
>   	const struct drm_color_lut *blend_lut;
>   	uint32_t blend_size = 0;
>   
> -	if (colorop->type != DRM_COLOROP_1D_CURVE &&
> -	    colorop_state->curve_1d_type != DRM_COLOROP_1D_CURVE_SRGB_EOTF)
> +	if (colorop->type != DRM_COLOROP_1D_CURVE)
> +		return -EINVAL;
> +
> +	if (!(BIT(colorop_state->curve_1d_type) & amdgpu_dm_supported_blnd_tfs))
>   		return -EINVAL;
>   
>   	if (colorop_state->bypass) {
> @@ -1321,7 +1326,7 @@ __set_dm_plane_colorop_blend(struct drm_plane_state *plane_state,
>   	/* 3nd op: 1d curve - blend */
>   	for_each_new_colorop_in_state(state, colorop, new_colorop_state, i) {
>   		if (new_colorop_state->colorop == old_colorop &&
> -		    new_colorop_state->curve_1d_type == DRM_COLOROP_1D_CURVE_SRGB_EOTF) {
> +		    (BIT(new_colorop_state->curve_1d_type) & amdgpu_dm_supported_blnd_tfs)) {
>   			colorop_state = new_colorop_state;
>   			break;
>   		}
> 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 a9d94018a207..ff5828a1e8cd 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
> @@ -33,14 +33,18 @@
>   
>   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_PQ_125_EOTF) |
> +	BIT(DRM_COLOROP_1D_CURVE_BT2020_INV_OETF);
>   
>   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_PQ_125_INV_EOTF) |
> +	BIT(DRM_COLOROP_1D_CURVE_BT2020_OETF);
>   
>   const u64 amdgpu_dm_supported_blnd_tfs =
> -	BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF);
> +	BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF) |
> +	BIT(DRM_COLOROP_1D_CURVE_PQ_125_EOTF) |
> +	BIT(DRM_COLOROP_1D_CURVE_BT2020_INV_OETF);

Should the PQ_125 bit + the changes for __set_colorop_1d_curve_blend_tf_lut() be 
moved to patch 30/45 "Enable support for PQ 125 EOTF and Inverse"?

- Leo

>   
>   #define MAX_COLOR_PIPELINE_OPS 10
>   



More information about the wayland-devel mailing list