Lines Matching +full:wait +full:- +full:state
1 // SPDX-License-Identifier: MIT
16 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); in hsw_ips_enable()
17 struct drm_i915_private *i915 = to_i915(crtc->base.dev); in hsw_ips_enable()
20 if (!crtc_state->ips_enabled) in hsw_ips_enable()
24 * We can only enable IPS after we enable a plane and wait for a vblank in hsw_ips_enable()
26 * a vblank wait. in hsw_ips_enable()
28 drm_WARN_ON(&i915->drm, in hsw_ips_enable()
29 !(crtc_state->active_planes & ~BIT(PLANE_CURSOR))); in hsw_ips_enable()
33 if (i915->display.ips.false_color) in hsw_ips_enable()
37 drm_WARN_ON(&i915->drm, in hsw_ips_enable()
38 snb_pcode_write(&i915->uncore, DISPLAY_IPS_CONTROL, in hsw_ips_enable()
43 * mailbox." Moreover, the mailbox may return a bogus state, in hsw_ips_enable()
49 * The bit only becomes 1 in the next vblank, so this wait here in hsw_ips_enable()
51 * and don't wait for vblanks until the end of crtc_enable, then in hsw_ips_enable()
52 * the HW state readout code will complain that the expected in hsw_ips_enable()
56 drm_err(&i915->drm, in hsw_ips_enable()
63 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); in hsw_ips_disable()
64 struct drm_i915_private *i915 = to_i915(crtc->base.dev); in hsw_ips_disable()
67 if (!crtc_state->ips_enabled) in hsw_ips_disable()
71 drm_WARN_ON(&i915->drm, in hsw_ips_disable()
72 snb_pcode_write(&i915->uncore, DISPLAY_IPS_CONTROL, 0)); in hsw_ips_disable()
74 * Wait for PCODE to finish disabling IPS. The BSpec specified in hsw_ips_disable()
79 drm_err(&i915->drm, in hsw_ips_disable()
86 /* We need to wait for a vblank before we can disable the plane. */ in hsw_ips_disable()
92 static bool hsw_ips_need_disable(struct intel_atomic_state *state, in hsw_ips_need_disable() argument
95 struct drm_i915_private *i915 = to_i915(state->base.dev); in hsw_ips_need_disable()
97 intel_atomic_get_old_crtc_state(state, crtc); in hsw_ips_need_disable()
99 intel_atomic_get_new_crtc_state(state, crtc); in hsw_ips_need_disable()
101 if (!old_crtc_state->ips_enabled) in hsw_ips_need_disable()
115 new_crtc_state->gamma_mode == GAMMA_MODE_MODE_SPLIT) in hsw_ips_need_disable()
118 return !new_crtc_state->ips_enabled; in hsw_ips_need_disable()
121 bool hsw_ips_pre_update(struct intel_atomic_state *state, in hsw_ips_pre_update() argument
125 intel_atomic_get_old_crtc_state(state, crtc); in hsw_ips_pre_update()
127 if (!hsw_ips_need_disable(state, crtc)) in hsw_ips_pre_update()
133 static bool hsw_ips_need_enable(struct intel_atomic_state *state, in hsw_ips_need_enable() argument
136 struct drm_i915_private *i915 = to_i915(state->base.dev); in hsw_ips_need_enable()
138 intel_atomic_get_old_crtc_state(state, crtc); in hsw_ips_need_enable()
140 intel_atomic_get_new_crtc_state(state, crtc); in hsw_ips_need_enable()
142 if (!new_crtc_state->ips_enabled) in hsw_ips_need_enable()
152 * Re-enable IPS after the LUT has been programmed. in hsw_ips_need_enable()
156 new_crtc_state->gamma_mode == GAMMA_MODE_MODE_SPLIT) in hsw_ips_need_enable()
163 if (intel_crtc_needs_fastset(new_crtc_state) && old_crtc_state->inherited) in hsw_ips_need_enable()
166 return !old_crtc_state->ips_enabled; in hsw_ips_need_enable()
169 void hsw_ips_post_update(struct intel_atomic_state *state, in hsw_ips_post_update() argument
173 intel_atomic_get_new_crtc_state(state, crtc); in hsw_ips_post_update()
175 if (!hsw_ips_need_enable(state, crtc)) in hsw_ips_post_update()
184 return HAS_IPS(to_i915(crtc->base.dev)) && crtc->pipe == PIPE_A; in hsw_crtc_supports_ips()
189 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); in hsw_crtc_state_ips_capable()
190 struct drm_i915_private *i915 = to_i915(crtc->base.dev); in hsw_crtc_state_ips_capable()
196 if (!i915->display.params.enable_ips) in hsw_crtc_state_ips_capable()
199 if (crtc_state->pipe_bpp > 24) in hsw_crtc_state_ips_capable()
210 crtc_state->pixel_rate > i915->display.cdclk.max_cdclk_freq * 95 / 100) in hsw_crtc_state_ips_capable()
216 int hsw_ips_compute_config(struct intel_atomic_state *state, in hsw_ips_compute_config() argument
219 struct drm_i915_private *i915 = to_i915(state->base.dev); in hsw_ips_compute_config()
221 intel_atomic_get_new_crtc_state(state, crtc); in hsw_ips_compute_config()
223 crtc_state->ips_enabled = false; in hsw_ips_compute_config()
234 if (crtc_state->crc_enabled) in hsw_ips_compute_config()
238 if (!(crtc_state->active_planes & ~BIT(PLANE_CURSOR))) in hsw_ips_compute_config()
244 cdclk_state = intel_atomic_get_cdclk_state(state); in hsw_ips_compute_config()
249 if (crtc_state->pixel_rate > cdclk_state->logical.cdclk * 95 / 100) in hsw_ips_compute_config()
253 crtc_state->ips_enabled = true; in hsw_ips_compute_config()
260 struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); in hsw_ips_get_config()
261 struct drm_i915_private *i915 = to_i915(crtc->base.dev); in hsw_ips_get_config()
267 crtc_state->ips_enabled = intel_de_read(i915, IPS_CTL) & IPS_ENABLE; in hsw_ips_get_config()
270 * We cannot readout IPS state on broadwell, set to in hsw_ips_get_config()
271 * true so we can set it to a defined state on first in hsw_ips_get_config()
274 crtc_state->ips_enabled = true; in hsw_ips_get_config()
281 struct drm_i915_private *i915 = to_i915(crtc->base.dev); in hsw_ips_debugfs_false_color_get()
283 *val = i915->display.ips.false_color; in hsw_ips_debugfs_false_color_get()
291 struct drm_i915_private *i915 = to_i915(crtc->base.dev); in hsw_ips_debugfs_false_color_set()
295 ret = drm_modeset_lock(&crtc->base.mutex, NULL); in hsw_ips_debugfs_false_color_set()
299 i915->display.ips.false_color = val; in hsw_ips_debugfs_false_color_set()
301 crtc_state = to_intel_crtc_state(crtc->base.state); in hsw_ips_debugfs_false_color_set()
303 if (!crtc_state->hw.active) in hsw_ips_debugfs_false_color_set()
306 if (crtc_state->uapi.commit && in hsw_ips_debugfs_false_color_set()
307 !try_wait_for_completion(&crtc_state->uapi.commit->hw_done)) in hsw_ips_debugfs_false_color_set()
313 drm_modeset_unlock(&crtc->base.mutex); in hsw_ips_debugfs_false_color_set()
325 struct intel_crtc *crtc = m->private; in hsw_ips_debugfs_status_show()
326 struct drm_i915_private *i915 = to_i915(crtc->base.dev); in hsw_ips_debugfs_status_show()
329 wakeref = intel_runtime_pm_get(&i915->runtime_pm); in hsw_ips_debugfs_status_show()
332 str_yes_no(i915->display.params.enable_ips)); in hsw_ips_debugfs_status_show()
343 intel_runtime_pm_put(&i915->runtime_pm, wakeref); in hsw_ips_debugfs_status_show()
355 debugfs_create_file("i915_ips_false_color", 0644, crtc->base.debugfs_entry, in hsw_ips_crtc_debugfs_add()
358 debugfs_create_file("i915_ips_status", 0444, crtc->base.debugfs_entry, in hsw_ips_crtc_debugfs_add()