From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757588AbcH2PLJ (ORCPT ); Mon, 29 Aug 2016 11:11:09 -0400 Received: from mga06.intel.com ([134.134.136.31]:57191 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751983AbcH2PLI (ORCPT ); Mon, 29 Aug 2016 11:11:08 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,596,1464678000"; d="scan'208";a="1048705409" From: Jani Nikula To: Lyude , intel-gfx@lists.freedesktop.org, Maarten Lankhorst Cc: Lyude , Daniel Vetter , David Airlie , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/i915/skl: Don't try to update plane watermarks if they haven't changed In-Reply-To: <1472481944-13357-1-git-send-email-cpaul@redhat.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <1472481944-13357-1-git-send-email-cpaul@redhat.com> User-Agent: Notmuch/0.22.1+62~g2a7b11b (https://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Mon, 29 Aug 2016 18:10:46 +0300 Message-ID: <871t17ipah.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 29 Aug 2016, Lyude wrote: > i915 sometimes needs to disable planes in the middle of an atomic > commit, and then reenable them later in the same commit. Because of > this, we can't make the assumption that the state of the plane actually > changed. Since the state of the plane hasn't actually changed, neither > have it's watermarks. And if the watermarks hasn't changed then we > haven't populated skl_results with anything, which means we'll end up > zeroing out a plane's watermarks in the middle of the atomic commit > without restoring them later. I would appreciate a (brief) description of what the failure mode is in this case. BR, Jani. > > Changes since v1: > - Fix incorrect use of "it's" > > Signed-off-by: Lyude > Cc: Maarten Lankhorst > Fixes: 62e0fb880123 ("drm/i915/skl: Update plane watermarks atomically > during plane updates") > > Signed-off-by: Lyude > --- > drivers/gpu/drm/i915/intel_display.c | 7 ++++++- > drivers/gpu/drm/i915/intel_sprite.c | 9 +++++++-- > 2 files changed, 13 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c > index e4e6141..13e47a7 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -3448,7 +3448,12 @@ static void skylake_disable_primary_plane(struct drm_plane *primary, > struct intel_crtc *intel_crtc = to_intel_crtc(crtc); > int pipe = intel_crtc->pipe; > > - skl_write_plane_wm(intel_crtc, &dev_priv->wm.skl_results, 0); > + /* > + * We only populate skl_results on watermark updates, and if the > + * plane's visiblity isn't actually changing neither is its watermarks. > + */ > + if (!crtc->primary->state->visible) > + skl_write_plane_wm(intel_crtc, &dev_priv->wm.skl_results, 0); > > I915_WRITE(PLANE_CTL(pipe, 0), 0); > I915_WRITE(PLANE_SURF(pipe, 0), 0); > diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c > index 0df783a..73a521f 100644 > --- a/drivers/gpu/drm/i915/intel_sprite.c > +++ b/drivers/gpu/drm/i915/intel_sprite.c > @@ -292,8 +292,13 @@ skl_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc) > const int pipe = intel_plane->pipe; > const int plane = intel_plane->plane + 1; > > - skl_write_plane_wm(to_intel_crtc(crtc), &dev_priv->wm.skl_results, > - plane); > + /* > + * We only populate skl_results on watermark updates, and if the > + * plane's visiblity isn't actually changing neither is its watermarks. > + */ > + if (!dplane->state->visible) > + skl_write_plane_wm(to_intel_crtc(crtc), > + &dev_priv->wm.skl_results, plane); > > I915_WRITE(PLANE_CTL(pipe, plane), 0); -- Jani Nikula, Intel Open Source Technology Center