On 04/29, Alex Hung wrote:
> From: Harry Wentland <harry.wentl...@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.h...@amd.com>
> Signed-off-by: Harry Wentland <harry.wentl...@amd.com>
> Reviewed-by: Daniel Stone <dani...@collabora.com>
> ---
> V9:
>  - Move DRM_COLOROP_1D_CURVE_BT2020_* from middle to end
> 
> v8: 
>  - Move BIT(DRM_COLOROP_1D_CURVE_PQ_125_EOTF) in amdgpu_dm_supported_blnd_tfs
>    to "drm/amd/display: Enable support for PQ 125 EOTF and Inverse" (Leo Li)
> 
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c   | 11 ++++++++---
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c |  9 ++++++---
>  2 files changed, 14 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..f645f9ded95f 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
> @@ -679,6 +679,9 @@ amdgpu_colorop_tf_to_dc_tf(enum drm_colorop_curve_1d_type 
> tf)
>       case DRM_COLOROP_1D_CURVE_PQ_125_EOTF:
>       case DRM_COLOROP_1D_CURVE_PQ_125_INV_EOTF:
>               return TRANSFER_FUNCTION_PQ;
> +     case DRM_COLOROP_1D_CURVE_BT2020_INV_OETF:
> +     case DRM_COLOROP_1D_CURVE_BT2020_OETF:
> +             return TRANSFER_FUNCTION_BT709;
>       default:
>               return TRANSFER_FUNCTION_LINEAR;
>       }
> @@ -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)) {

nitpick: I think these changes to check amdgpu_dm_supported_*_tfs should
happen earlier, together with degamma and shaper curves in the patch 30.

Melissa

>                       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 aa753b0d6f13..b989e1ca19e2 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,15 +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_PQ_125_EOTF);
> +     BIT(DRM_COLOROP_1D_CURVE_PQ_125_EOTF) |
> +     BIT(DRM_COLOROP_1D_CURVE_BT2020_INV_OETF);
>  
>  #define MAX_COLOR_PIPELINE_OPS 10
>  
> -- 
> 2.43.0
> 

Reply via email to