[PATCH 4/4] drm: rcar-du: kms: Configure the CLU
Laurent Pinchart
laurent.pinchart+renesas at ideasonboard.com
Mon Dec 21 01:57:30 UTC 2020
From: Kieran Bingham <kieran.bingham+renesas at ideasonboard.com>
Link the DRM 3D-CLU configuration to the CMM setup configuration.
Signed-off-by: Kieran Bingham <kieran.bingham+renesas at ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas at ideasonboard.com>
---
drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index 426b1870b3cb..5c77017084ed 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -484,19 +484,23 @@ static int rcar_du_cmm_check(struct drm_crtc *crtc,
struct drm_crtc_state *state)
{
struct drm_property_blob *drm_lut = state->gamma_lut;
+ struct drm_property_blob *drm_clu = state->cubic_lut;
struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
struct device *dev = rcrtc->dev->dev;
- if (!drm_lut)
- return 0;
-
- /* We only accept fully populated LUT tables. */
- if (drm_color_lut_size(drm_lut) != CM2_LUT_SIZE) {
+ /* We only accept fully populated LUTs. */
+ if (drm_lut && drm_color_lut_size(drm_lut) != CM2_LUT_SIZE) {
dev_err(dev, "invalid gamma lut size: %zu bytes\n",
drm_lut->length);
return -EINVAL;
}
+ if (drm_clu && drm_color_lut_size(drm_clu) != CM2_CLU_SIZE) {
+ dev_err(dev, "invalid cubic lut size: %zu bytes\n",
+ drm_clu->length);
+ return -EINVAL;
+ }
+
return 0;
}
@@ -518,6 +522,15 @@ static void rcar_du_cmm_setup(struct rcar_du_crtc *rcrtc,
? new_state->gamma_lut->data : NULL;
}
+ if (!old_state ||
+ !old_state->cubic_lut != !new_state->cubic_lut ||
+ (old_state->cubic_lut && new_state->cubic_lut &&
+ old_state->cubic_lut->base.id != new_state->cubic_lut->base.id)) {
+ cmm_config.clu.update = true;
+ cmm_config.clu.table = new_state->cubic_lut
+ ? new_state->cubic_lut->data : NULL;
+ }
+
rcar_cmm_setup(rcrtc->cmm, &cmm_config);
}
--
Regards,
Laurent Pinchart
More information about the dri-devel
mailing list