},
 };
 
+static void intel_csc_clear(struct intel_csc_matrix *csc)
+{
+       memset(csc, 0, sizeof(*csc));
+}
+
 static bool lut_is_legacy(const struct drm_property_blob *lut)
 {
        return lut && drm_color_lut_size(lut) == LEGACY_LUT_LENGTH;
        return !ilk_lut_limited_range(crtc_state);
 }
 
+static void ilk_csc_copy(struct drm_i915_private *i915,
+                        struct intel_csc_matrix *dst,
+                        const struct intel_csc_matrix *src)
+{
+       *dst = *src;
+
+       if (DISPLAY_VER(i915) < 7)
+               memset(dst->postoff, 0, sizeof(dst->postoff));
+}
+
 static void ilk_csc_convert_ctm(const struct intel_crtc_state *crtc_state,
                                struct intel_csc_matrix *csc,
                                bool limited_color_range)
 {
+       struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
        const struct drm_color_ctm *ctm = crtc_state->hw.ctm->data;
        const u64 *input;
        u64 temp[9];
 
        /* for preoff/postoff */
        if (limited_color_range)
-               *csc = ilk_csc_matrix_limited_range;
+               ilk_csc_copy(i915, csc, &ilk_csc_matrix_limited_range);
        else
-               *csc = ilk_csc_matrix_identity;
+               ilk_csc_copy(i915, csc, &ilk_csc_matrix_identity);
 
        if (limited_color_range)
                input = ctm_mult_by_limited(temp, ctm->matrix);
        }
 }
 
-static void ilk_load_csc_matrix(const struct intel_crtc_state *crtc_state)
+static void ilk_assign_csc(struct intel_crtc_state *crtc_state)
 {
-       struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
-       struct drm_i915_private *i915 = to_i915(crtc->base.dev);
+       struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
        bool limited_color_range = ilk_csc_limited_range(crtc_state);
 
        if (crtc_state->hw.ctm) {
-               struct intel_csc_matrix tmp;
-
-               ilk_csc_convert_ctm(crtc_state, &tmp, limited_color_range);
-
-               ilk_update_pipe_csc(crtc, &tmp);
+               ilk_csc_convert_ctm(crtc_state, &crtc_state->csc, limited_color_range);
        } else if (crtc_state->output_format != INTEL_OUTPUT_FORMAT_RGB) {
-               ilk_update_pipe_csc(crtc, &ilk_csc_matrix_rgb_to_ycbcr);
+               ilk_csc_copy(i915, &crtc_state->csc, &ilk_csc_matrix_rgb_to_ycbcr);
        } else if (limited_color_range) {
-               ilk_update_pipe_csc(crtc, &ilk_csc_matrix_limited_range);
+               ilk_csc_copy(i915, &crtc_state->csc, &ilk_csc_matrix_limited_range);
        } else if (crtc_state->csc_enable) {
                /*
                 * On GLK both pipe CSC and degamma LUT are controlled
                 */
                drm_WARN_ON(&i915->drm, !IS_GEMINILAKE(i915));
 
-               ilk_update_pipe_csc(crtc, &ilk_csc_matrix_identity);
+               ilk_csc_copy(i915, &crtc_state->csc, &ilk_csc_matrix_identity);
+       } else {
+               intel_csc_clear(&crtc_state->csc);
        }
 }
 
-static void icl_load_csc_matrix(const struct intel_crtc_state *crtc_state)
+static void ilk_load_csc_matrix(const struct intel_crtc_state *crtc_state)
 {
        struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
 
-       if (crtc_state->hw.ctm) {
-               struct intel_csc_matrix tmp;
+       if (crtc_state->csc_enable)
+               ilk_update_pipe_csc(crtc, &crtc_state->csc);
+}
 
-               ilk_csc_convert_ctm(crtc_state, &tmp, false);
+static void icl_assign_csc(struct intel_crtc_state *crtc_state)
+{
+       struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
 
-               ilk_update_pipe_csc(crtc, &tmp);
-       }
+       if (crtc_state->hw.ctm)
+               ilk_csc_convert_ctm(crtc_state, &crtc_state->csc, false);
+       else
+               intel_csc_clear(&crtc_state->csc);
 
-       if (crtc_state->output_format != INTEL_OUTPUT_FORMAT_RGB) {
-               icl_update_output_csc(crtc, &ilk_csc_matrix_rgb_to_ycbcr);
-       } else if (crtc_state->limited_color_range) {
-               icl_update_output_csc(crtc, &ilk_csc_matrix_limited_range);
-       }
+       if (crtc_state->output_format != INTEL_OUTPUT_FORMAT_RGB)
+               ilk_csc_copy(i915, &crtc_state->output_csc, &ilk_csc_matrix_rgb_to_ycbcr);
+       else if (crtc_state->limited_color_range)
+               ilk_csc_copy(i915, &crtc_state->output_csc, &ilk_csc_matrix_limited_range);
+       else
+               intel_csc_clear(&crtc_state->output_csc);
+}
+
+static void icl_load_csc_matrix(const struct intel_crtc_state *crtc_state)
+{
+       struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
+
+       if (crtc_state->csc_mode & ICL_CSC_ENABLE)
+               ilk_update_pipe_csc(crtc, &crtc_state->csc);
+
+       if (crtc_state->csc_mode & ICL_OUTPUT_CSC_ENABLE)
+               icl_update_output_csc(crtc, &crtc_state->output_csc);
 }
 
 static void chv_cgm_csc_convert_ctm(struct intel_csc_matrix *csc,
        if (ret)
                return ret;
 
+       ilk_assign_csc(crtc_state);
+
        crtc_state->preload_luts = intel_can_preload_luts(crtc_state);
 
        return 0;
        if (ret)
                return ret;
 
+       ilk_assign_csc(crtc_state);
+
        crtc_state->preload_luts = intel_can_preload_luts(crtc_state);
 
        return 0;
        if (ret)
                return ret;
 
+       ilk_assign_csc(crtc_state);
+
        crtc_state->preload_luts = intel_can_preload_luts(crtc_state);
 
        return 0;
 
        intel_assign_luts(crtc_state);
 
+       icl_assign_csc(crtc_state);
+
        crtc_state->preload_luts = intel_can_preload_luts(crtc_state);
 
        return 0;