@@ -612,6 +612,13 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
return -EINVAL;
}
+ if (new_crtc_state->degamma_lut != old_crtc_state->degamma_lut ||
+ new_crtc_state->ctm != old_crtc_state->ctm ||
+ new_crtc_state->gamma_lut != old_crtc_state->gamma_lut) {
+ DRM_DEBUG_ATOMIC("[CRTC:%d:%s] color management changed\n",
+ crtc->base.id, crtc->name);
+ new_crtc_state->color_mgmt_changed = true;
+ }
}
ret = handle_conflicting_encoders(state, false);
@@ -3948,7 +3955,6 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc,
replaced = drm_property_replace_blob(&crtc_state->degamma_lut, NULL);
replaced |= drm_property_replace_blob(&crtc_state->ctm, NULL);
replaced |= drm_property_replace_blob(&crtc_state->gamma_lut, blob);
- crtc_state->color_mgmt_changed |= replaced;
ret = drm_atomic_commit(state);
@@ -434,29 +434,23 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
drm_property_blob_put(mode);
return ret;
} else if (property == config->degamma_lut_property) {
- ret = drm_atomic_replace_property_blob_from_id(dev,
+ return drm_atomic_replace_property_blob_from_id(dev,
&state->degamma_lut,
val,
-1, sizeof(struct drm_color_lut),
&replaced);
- state->color_mgmt_changed |= replaced;
- return ret;
} else if (property == config->ctm_property) {
- ret = drm_atomic_replace_property_blob_from_id(dev,
+ return drm_atomic_replace_property_blob_from_id(dev,
&state->ctm,
val,
sizeof(struct drm_color_ctm), -1,
&replaced);
- state->color_mgmt_changed |= replaced;
- return ret;
} else if (property == config->gamma_lut_property) {
- ret = drm_atomic_replace_property_blob_from_id(dev,
+ return drm_atomic_replace_property_blob_from_id(dev,
&state->gamma_lut,
val,
-1, sizeof(struct drm_color_lut),
&replaced);
- state->color_mgmt_changed |= replaced;
- return ret;
} else if (property == config->prop_out_fence_ptr) {
s32 __user *fence_ptr = u64_to_user_ptr(val);
@@ -1442,7 +1442,6 @@ static int setcmap_atomic(struct fb_cmap *cmap, struct fb_info *info)
replaced |= drm_property_replace_blob(&crtc_state->ctm, NULL);
replaced |= drm_property_replace_blob(&crtc_state->gamma_lut,
gamma_lut);
- crtc_state->color_mgmt_changed |= replaced;
}
ret = drm_atomic_commit(state);