Re: [PATCH v2] drm/mediatek: add ctm property support

From: CK Hu
Date: Thu Dec 05 2019 - 03:08:58 EST


Hi, Yongqiang:

On Mon, 2019-12-02 at 17:03 +0800, yongqiang.niu@xxxxxxxxxxxx wrote:
> From: Yongqiang Niu <yongqiang.niu@xxxxxxxxxxxx>
>
> add ctm property support
>
> Change-Id: I8111da7b309b1809c6302e7748dd9fd06dc97bde
> Signed-off-by: Yongqiang Niu <yongqiang.niu@xxxxxxxxxxxx>
> ---
> drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 15 ++++++-
> drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 61 ++++++++++++++++++++++++++++-
> drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 11 ++++++
> 3 files changed, 84 insertions(+), 3 deletions(-)
>

[snip]


> @@ -870,6 +875,12 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
> }
>
> mtk_crtc->ddp_comp[i] = comp;
> +
> + if (comp_id == DDP_COMPONENT_CCORR)
> + has_ctm = true;
> +
> + if (comp_id == DDP_COMPONENT_GAMMA)

Not only DDP_COMPONENT_GAMMA has gamma function, but also
DDP_COMPONENT_AAL0 and DDP_COMPONENT_AAL1. I think it's no good to use
comp_id to decide what function of this component has. The easy way is
just to check weather the function point exist.

Regards,
CK

> + gamma_lut_size = MTK_LUT_SIZE;
> }
>
> for (i = 0; i < mtk_crtc->ddp_comp_nr; i++)
> @@ -891,7 +902,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
> if (ret < 0)
> return ret;
> drm_mode_crtc_set_gamma_size(&mtk_crtc->base, MTK_LUT_SIZE);
> - drm_crtc_enable_color_mgmt(&mtk_crtc->base, 0, false, MTK_LUT_SIZE);
> + drm_crtc_enable_color_mgmt(&mtk_crtc->base, 0, has_ctm, gamma_lut_size);
> priv->num_pipes++;
> #ifdef CONFIG_MTK_CMDQ
> mtk_crtc->cmdq_client =