@@ -521,19 +521,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->lut3d;
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;
}
@@ -555,6 +559,15 @@ static void rcar_du_cmm_setup(struct rcar_du_crtc *rcrtc,
? new_state->gamma_lut->data : NULL;
}
+ if (!old_state ||
+ !old_state->lut3d != !new_state->lut3d ||
+ (old_state->lut3d && new_state->lut3d &&
+ old_state->lut3d->base.id != new_state->lut3d->base.id)) {
+ cmm_config.clu.update = true;
+ cmm_config.clu.table = new_state->lut3d
+ ? new_state->lut3d->data : NULL;
+ }
+
rcar_cmm_setup(rcrtc->cmm, &cmm_config);
}