From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f41.google.com ([209.85.220.41]:35485 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754248AbbKMN2e (ORCPT ); Fri, 13 Nov 2015 08:28:34 -0500 Received: by pasz6 with SMTP id z6so103856094pas.2 for ; Fri, 13 Nov 2015 05:28:33 -0800 (PST) Message-ID: <1447421309.2593.21.camel@gmail.com> Subject: Re: [Intel-gfx] [PATCH] drm/i915: Do a better job at disabling primary plane in the noatomic case. From: Ander Conselvan De Oliveira To: Maarten Lankhorst , intel-gfx@lists.freedesktop.org Cc: "Tomas M." , stable@vger.kernel.org Date: Fri, 13 Nov 2015 15:28:29 +0200 In-Reply-To: <56449B16.2050001@linux.intel.com> References: <1447252573-26167-1-git-send-email-maarten.lankhorst@linux.intel.com> <1447335466.2774.13.camel@gmail.com> <56449B16.2050001@linux.intel.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: stable-owner@vger.kernel.org List-ID: On Thu, 2015-11-12 at 14:58 +0100, Maarten Lankhorst wrote: > Op 12-11-15 om 14:37 schreef Ander Conselvan De Oliveira: > > On Wed, 2015-11-11 at 15:36 +0100, Maarten Lankhorst wrote: > > > When disable_noatomic is called plane_mask is not reliable yet, > > > and plane_state->visible = true even after disabling the primary plane. > > So the stale value of plane_state->visible causes a subsequent modeset to > > enable > > the primary again? > Probably not because it would get recalculated in calc_changes, but it should > really be set to false afterwards. So basically I didn't understand how the wrong value of plane_state->visible causes the bug that was mentioned. I think a brief explanation in the commit message would be good. > > in intel_plane_atomic_calc_changes: > if (!was_crtc_enabled && WARN_ON(was_visible)) > was_visible = false; > > and in intel_sanitize_crtc when intel_check_plane_mapping fails, it gets set > to true to disable it. > > This is really a special case and it's for disable_noatomic only. As the name > says it can't rely on the atomic state. > > > > Fix this by unsetting plane->visible if it was visible, and calling > > > disable_planes with the primary plane as mask. > > > > > > The other planes are already disabled in intel_sanitize_crtc, so > > > they don't have to be handled here. > > > > > > Cc: stable@vger.kernel.org #v4.3, v4.2? > > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92655 > > > Tested-by: Tomas Mezzadra > > > Signed-off-by: Maarten Lankhorst > > > --- > > > drivers/gpu/drm/i915/intel_display.c | 4 +++- > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/gpu/drm/i915/intel_display.c > > > b/drivers/gpu/drm/i915/intel_display.c > > > index b5f7493213b7..bc3282ab5ed2 100644 > > > --- a/drivers/gpu/drm/i915/intel_display.c > > > +++ b/drivers/gpu/drm/i915/intel_display.c > > > @@ -6267,9 +6267,11 @@ static void intel_crtc_disable_noatomic(struct > > > drm_crtc > > > *crtc) > > > WARN_ON(intel_crtc->unpin_work); > > > > > > intel_pre_disable_primary(crtc); > > > + > > > + intel_crtc_disable_planes(crtc, 1 << drm_plane_index(crtc > > > ->primary)); > > > + to_intel_plane_state(crtc->primary->state)->visible = > > > false; > > > } > > > > > > - intel_crtc_disable_planes(crtc, crtc->state->plane_mask); > > Can't we just make plane_mask reliable? We know whether the primary plane is > > enabled and all others were disabled prior to that. Or did I miss something. > > > In the case of hardware readout you can't. The plane_mask gets set only if we > can preserve the initial framebuffer > else the primary plane gets disabled. What I meant to say is that before a call to disable_noatomic but after we disabled all other planes, plane_mask could have the appropriate value. As in we could set plane_mask to 0 or drm_plane_index(primary) in readout_plane_state. It would have to be update in disable_noatomic() though, the same way as 'visible' is. Anyway, I think the code is fine either way. Ander