Call intel_casf_enable and intel_casf_disable
in atomic commit path to enable and disable casf.
Call intel_casf_update_strength to only update
the desired strength value.

v2: Introduce casf_enable here.[Ankit]
v3: Use is_disabling in casf_disabling.[Ankit]
v4: Swap old_state and new_state param.[Ankit]
v5: In disable fn move win_sz after sharpness_ctl.
v6: Rebase and update commit message.

Signed-off-by: Nemesa Garg <[email protected]>
Reviewed-by: Ankit Nautiyal <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 26 ++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 5924a8f5b1c7..7c8a3ef8acd7 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -980,6 +980,24 @@ static bool audio_disabling(const struct intel_crtc_state 
*old_crtc_state,
                 memcmp(old_crtc_state->eld, new_crtc_state->eld, 
MAX_ELD_BYTES) != 0);
 }
 
+static bool intel_casf_enabling(const struct intel_crtc_state *new_crtc_state,
+                               const struct intel_crtc_state *old_crtc_state)
+{
+       if (!new_crtc_state->hw.active)
+               return false;
+
+       return is_enabling(hw.casf_params.casf_enable, old_crtc_state, 
new_crtc_state);
+}
+
+static bool intel_casf_disabling(const struct intel_crtc_state *old_crtc_state,
+                                const struct intel_crtc_state *new_crtc_state)
+{
+       if (!new_crtc_state->hw.active)
+               return false;
+
+       return is_disabling(hw.casf_params.casf_enable, old_crtc_state, 
new_crtc_state);
+}
+
 #undef is_disabling
 #undef is_enabling
 
@@ -1135,6 +1153,9 @@ static void intel_pre_plane_update(struct 
intel_atomic_state *state,
        if (audio_disabling(old_crtc_state, new_crtc_state))
                intel_encoders_audio_disable(state, crtc);
 
+       if (intel_casf_disabling(old_crtc_state, new_crtc_state))
+               intel_casf_disable(new_crtc_state);
+
        intel_drrs_deactivate(old_crtc_state);
 
        if (hsw_ips_pre_update(state, crtc))
@@ -6712,6 +6733,11 @@ static void intel_pre_update_crtc(struct 
intel_atomic_state *state,
                        intel_vrr_set_transcoder_timings(new_crtc_state);
        }
 
+       if (intel_casf_enabling(new_crtc_state, old_crtc_state))
+               intel_casf_enable(new_crtc_state);
+       else if (new_crtc_state->hw.casf_params.strength != 
old_crtc_state->hw.casf_params.strength)
+               intel_casf_update_strength(new_crtc_state);
+
        intel_fbc_update(state, crtc);
 
        drm_WARN_ON(display->drm, !intel_display_power_is_enabled(display, 
POWER_DOMAIN_DC_OFF));
-- 
2.25.1

Reply via email to