Re: [PATCH v2 06/14] drm/i915: Update watermark related members in the crtc_state, v2.

Maarten Lankhorst
2015-11-09T16:12:34Z

Op 09-11-15 om 15:48 schreef Ander Conselvan De Oliveira:
> On Tue, 2015-11-03 at 08:31 +0100, Maarten Lankhorst wrote:
>> This removes another couple of hacks from intel_crtc->atomic, and
>> creates proper atomic state for it.
> Perhaps you could be more verbose about the hacks being removed.
Right!
>> Changes since v1:
>> - Rebase on top of wm changes.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> ---
>> drivers/gpu/drm/i915/intel_atomic.c | 2 ++
>> drivers/gpu/drm/i915/intel_display.c | 41 +++++++++++++++++------------------
>> -
>> drivers/gpu/drm/i915/intel_drv.h | 6 +++---
>> 3 files changed, 24 insertions(+), 25 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_atomic.c
>> b/drivers/gpu/drm/i915/intel_atomic.c
>> index c4eadbc928b7..3e390db9d22b 100644
>> --- a/drivers/gpu/drm/i915/intel_atomic.c
>> +++ b/drivers/gpu/drm/i915/intel_atomic.c
>> @@ -95,6 +95,8 @@ intel_crtc_duplicate_state(struct drm_crtc *crtc)
>>
>> crtc_state->update_pipe = false;
>> crtc_state->disable_lp_wm = false;
>> + crtc_state->visible_changed = false;
>> + crtc_state->wm_changed = false;
>>
>> return &crtc_state->base;
>> }
>> diff --git a/drivers/gpu/drm/i915/intel_display.c
>> b/drivers/gpu/drm/i915/intel_display.c
>> index 54e4f04bb427..356e3a9e1741 100644
>> --- a/drivers/gpu/drm/i915/intel_display.c
>> +++ b/drivers/gpu/drm/i915/intel_display.c
>> @@ -4753,6 +4753,8 @@ intel_pre_disable_primary(struct drm_crtc *crtc)
>> static void intel_post_plane_update(struct intel_crtc *crtc)
>> {
>> struct intel_crtc_atomic_commit *atomic = &crtc->atomic;
>> + struct intel_crtc_state *pipe_config =
>> + to_intel_crtc_state(crtc->base.state);
>> struct drm_device *dev = crtc->base.dev;
>> struct drm_i915_private *dev_priv = dev->dev_private;
>>
>> @@ -4761,10 +4763,9 @@ static void intel_post_plane_update(struct intel_crtc
>> *crtc)
>>
>> intel_frontbuffer_flip(dev, atomic->fb_bits);
>>
>> - if (atomic->disable_cxsr)
>> - crtc->wm.cxsr_allowed = true;
>> + crtc->wm.cxsr_allowed = true;
>>
>> - if (crtc->atomic.update_wm_post)
>> + if (pipe_config->wm_changed)
>> intel_update_watermarks(&crtc->base);
>>
>> if (atomic->update_fbc)
>> @@ -4781,6 +4782,8 @@ static void intel_pre_plane_update(struct intel_crtc
>> *crtc)
>> struct drm_device *dev = crtc->base.dev;
>> struct drm_i915_private *dev_priv = dev->dev_private;
>> struct intel_crtc_atomic_commit *atomic = &crtc->atomic;
>> + struct intel_crtc_state *pipe_config =
>> + to_intel_crtc_state(crtc->base.state);
>>
>> if (atomic->disable_fbc)
>> intel_fbc_disable_crtc(crtc);
>> @@ -4791,10 +4794,13 @@ static void intel_pre_plane_update(struct intel_crtc
>> *crtc)
>> if (atomic->pre_disable_primary)
>> intel_pre_disable_primary(&crtc->base);
>>
>> - if (atomic->disable_cxsr) {
>> + if (pipe_config->visible_changed) {
>> crtc->wm.cxsr_allowed = false;
>> intel_set_memory_cxsr(dev_priv, false);
>> }
>> +
>> + if (!needs_modeset(&pipe_config->base) && pipe_config->wm_changed)
>> + intel_update_watermarks(&crtc->base);
>> }
>>
>> static void intel_crtc_disable_planes(struct drm_crtc *crtc, unsigned
>> plane_mask)
>> @@ -11617,6 +11623,7 @@ static bool needs_scaling(struct intel_plane_state
>> *state)
>> int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
>> struct drm_plane_state *plane_state)
>> {
>> + struct intel_crtc_state *pipe_config =
>> to_intel_crtc_state(crtc_state);
>> struct drm_crtc *crtc = crtc_state->crtc;
>> struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
>> struct drm_plane *plane = plane_state->plane;
>> @@ -11663,25 +11670,18 @@ int intel_plane_atomic_calc_changes(struct
>> drm_crtc_state *crtc_state,
>> plane->base.id, was_visible, visible,
>> turn_off, turn_on, mode_changed);
>>
>> - if (turn_on) {
>> - intel_crtc->atomic.update_wm_pre = true;
>> - /* must disable cxsr around plane enable/disable */
>> - if (plane->type != DRM_PLANE_TYPE_CURSOR) {
>> - intel_crtc->atomic.disable_cxsr = true;
>> - /* to potentially re-enable cxsr */
>> - intel_crtc->atomic.wait_vblank = true;
>> - intel_crtc->atomic.update_wm_post = true;
>> - }
>> - } else if (turn_off) {
>> - intel_crtc->atomic.update_wm_post = true;
>> + if (turn_on || turn_off) {
>> + pipe_config->wm_changed = true;
>> +
>> /* must disable cxsr around plane enable/disable */
>> if (plane->type != DRM_PLANE_TYPE_CURSOR) {
>> + pipe_config->visible_changed = true;
>> if (is_crtc_enabled)
>> intel_crtc->atomic.wait_vblank = true;
>> - intel_crtc->atomic.disable_cxsr = true;
>> }
> I'm a bit confused as to what the value of visible_changed is supposed to be. In
> the comment in intel_drv.h you wrote "plane visibility changed". But that isn't
> set if the cursor plane visibility changed. If the value of this is only
> relevant for cxsr, maybe it make sense to still call it disable_cxsr?
>
Would it be terrible if I were to disable CXSR for cursor changes too?
Else I'll rename it to disable_cxsr.

~Maarten