drm/i915: Introduce intel_crtc_needs_color_update()
Add a common helper to answer the question "do we need to update color management stuff?". Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20221021162442.27283-5-ville.syrjala@linux.intel.com
This commit is contained in:
@@ -104,8 +104,7 @@ static bool hsw_ips_need_disable(struct intel_atomic_state *state,
|
||||
* Disable IPS before we program the LUT.
|
||||
*/
|
||||
if (IS_HASWELL(i915) &&
|
||||
(new_crtc_state->uapi.color_mgmt_changed ||
|
||||
intel_crtc_needs_fastset(new_crtc_state)) &&
|
||||
intel_crtc_needs_color_update(new_crtc_state) &&
|
||||
new_crtc_state->gamma_mode == GAMMA_MODE_MODE_SPLIT)
|
||||
return true;
|
||||
|
||||
@@ -146,8 +145,7 @@ static bool hsw_ips_need_enable(struct intel_atomic_state *state,
|
||||
* Re-enable IPS after the LUT has been programmed.
|
||||
*/
|
||||
if (IS_HASWELL(i915) &&
|
||||
(new_crtc_state->uapi.color_mgmt_changed ||
|
||||
intel_crtc_needs_fastset(new_crtc_state)) &&
|
||||
intel_crtc_needs_color_update(new_crtc_state) &&
|
||||
new_crtc_state->gamma_mode == GAMMA_MODE_MODE_SPLIT)
|
||||
return true;
|
||||
|
||||
|
||||
@@ -386,8 +386,7 @@ static bool intel_crtc_needs_vblank_work(const struct intel_crtc_state *crtc_sta
|
||||
return crtc_state->hw.active &&
|
||||
!intel_crtc_needs_modeset(crtc_state) &&
|
||||
!crtc_state->preload_luts &&
|
||||
(crtc_state->uapi.color_mgmt_changed ||
|
||||
intel_crtc_needs_fastset(crtc_state));
|
||||
intel_crtc_needs_color_update(crtc_state);
|
||||
}
|
||||
|
||||
static void intel_crtc_vblank_work(struct kthread_work *base)
|
||||
|
||||
@@ -4851,9 +4851,7 @@ static int intel_crtc_atomic_check(struct intel_atomic_state *state,
|
||||
if (c8_planes_changed(crtc_state))
|
||||
crtc_state->uapi.color_mgmt_changed = true;
|
||||
|
||||
if (intel_crtc_needs_modeset(crtc_state) ||
|
||||
intel_crtc_needs_fastset(crtc_state) ||
|
||||
crtc_state->uapi.color_mgmt_changed) {
|
||||
if (intel_crtc_needs_color_update(crtc_state)) {
|
||||
ret = intel_color_check(crtc_state);
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -6934,11 +6932,8 @@ static int intel_atomic_prepare_commit(struct intel_atomic_state *state)
|
||||
return ret;
|
||||
|
||||
for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) {
|
||||
if (intel_crtc_needs_modeset(crtc_state) ||
|
||||
intel_crtc_needs_fastset(crtc_state) ||
|
||||
crtc_state->uapi.color_mgmt_changed) {
|
||||
if (intel_crtc_needs_color_update(crtc_state))
|
||||
intel_dsb_prepare(crtc_state);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -7019,8 +7014,7 @@ static void commit_pipe_pre_planes(struct intel_atomic_state *state,
|
||||
* CRTC was enabled.
|
||||
*/
|
||||
if (!modeset) {
|
||||
if (new_crtc_state->uapi.color_mgmt_changed ||
|
||||
intel_crtc_needs_fastset(new_crtc_state))
|
||||
if (intel_crtc_needs_color_update(new_crtc_state))
|
||||
intel_color_commit_arm(new_crtc_state);
|
||||
|
||||
if (DISPLAY_VER(dev_priv) >= 9 || IS_BROADWELL(dev_priv))
|
||||
@@ -7085,8 +7079,7 @@ static void intel_update_crtc(struct intel_atomic_state *state,
|
||||
|
||||
if (!modeset) {
|
||||
if (new_crtc_state->preload_luts &&
|
||||
(new_crtc_state->uapi.color_mgmt_changed ||
|
||||
intel_crtc_needs_fastset(new_crtc_state)))
|
||||
intel_crtc_needs_color_update(new_crtc_state))
|
||||
intel_color_load_luts(new_crtc_state);
|
||||
|
||||
intel_pre_plane_update(state, crtc);
|
||||
@@ -7102,8 +7095,7 @@ static void intel_update_crtc(struct intel_atomic_state *state,
|
||||
intel_fbc_update(state, crtc);
|
||||
|
||||
if (!modeset &&
|
||||
(new_crtc_state->uapi.color_mgmt_changed ||
|
||||
intel_crtc_needs_fastset(new_crtc_state)))
|
||||
intel_crtc_needs_color_update(new_crtc_state))
|
||||
intel_color_commit_noarm(new_crtc_state);
|
||||
|
||||
intel_crtc_planes_update_noarm(state, crtc);
|
||||
|
||||
@@ -2064,6 +2064,14 @@ intel_crtc_needs_fastset(const struct intel_crtc_state *crtc_state)
|
||||
return crtc_state->update_pipe;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
intel_crtc_needs_color_update(const struct intel_crtc_state *crtc_state)
|
||||
{
|
||||
return crtc_state->uapi.color_mgmt_changed ||
|
||||
intel_crtc_needs_fastset(crtc_state) ||
|
||||
intel_crtc_needs_modeset(crtc_state);
|
||||
}
|
||||
|
||||
static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *plane_state)
|
||||
{
|
||||
return i915_ggtt_offset(plane_state->ggtt_vma);
|
||||
|
||||
Reference in New Issue
Block a user