Skip to content

Commit

Permalink
drm/mediatek: Add gamma property according to hardware capability
Browse files Browse the repository at this point in the history
If there is no gamma function in the crtc
display path, don't add gamma property
for crtc

Fixes: 2f3f4dd ("drm/mediatek: Add gamma correction.")
Signed-off-by: Yongqiang Niu <yongqiang.niu@mediatek.com>
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Signed-off-by: CK Hu <ck.hu@mediatek.com>
  • Loading branch information
Yongqiang Niu authored and CK Hu committed Jan 10, 2020
1 parent 2f965be commit 4cebc1d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/gpu/drm/mediatek/mtk_drm_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
int pipe = priv->num_pipes;
int ret;
int i;
uint gamma_lut_size = 0;

if (!path)
return 0;
Expand Down Expand Up @@ -780,6 +781,9 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
}

mtk_crtc->ddp_comp[i] = comp;

if (comp->funcs && comp->funcs->gamma_set)
gamma_lut_size = MTK_LUT_SIZE;
}

for (i = 0; i < mtk_crtc->ddp_comp_nr; i++)
Expand All @@ -800,8 +804,10 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,
NULL, pipe);
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);

if (gamma_lut_size)
drm_mode_crtc_set_gamma_size(&mtk_crtc->base, gamma_lut_size);
drm_crtc_enable_color_mgmt(&mtk_crtc->base, 0, false, gamma_lut_size);
priv->num_pipes++;
mutex_init(&mtk_crtc->hw_lock);

Expand Down

0 comments on commit 4cebc1d

Please sign in to comment.