From patchwork Thu Jun 18 09:23:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 6634651 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5EB26C0020 for ; Thu, 18 Jun 2015 09:23:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 71BFF20804 for ; Thu, 18 Jun 2015 09:23:40 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id CFB772069B for ; Thu, 18 Jun 2015 09:23:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 550287A101; Thu, 18 Jun 2015 02:23:34 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by gabe.freedesktop.org (Postfix) with ESMTP id 432857A101 for ; Thu, 18 Jun 2015 02:23:32 -0700 (PDT) Received: by wicnd19 with SMTP id nd19so16491354wic.1 for ; Thu, 18 Jun 2015 02:23:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=FAI3LSmbZntk7oPsiz//utVVybIgmV/4MsvzyrBC9vA=; b=cYeDdsX5EVZjPj61biUPyLfshQNGDSGzLQ55TDT1NTWmj2mqGznAVDU9ZZKNih1Ogu GFIvkoVyybswlhhr6zYdf861qKpr5wwPPz/AXGfFvfj2hNnzY727rWmUesqHTV2R2EOL GT64uo3sF0trSfmp9XwHatEJ8+uLSXBGeHglE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=FAI3LSmbZntk7oPsiz//utVVybIgmV/4MsvzyrBC9vA=; b=gRymZN9AVBnf4WgFQ4wuJtxrFi/HRO8t64bEhI28MUskKtbjbFzbg/lRvr95fOjyiy 4hZeVj2apSvjwi06zbegH+egwQ8qQEccycvXm9vXthZgQ7UCwpQYmBtkkkVYOzUZdVzD SW13zkn7y4UAEdXlrCLSZPnjJf/rOvKGr4VayxOdOiFwrwkF+j0IubvSq48pQKefIf4F E1W1wmwUmb0Fh7xtvmAVgZ0kRzNrSmjUeqGdWC+s3t/q8t/ADJTpzFkFx7/1OPq0eS0T XOzbO/q0JLgtFezE4ozE7Si4PfmIzYtvRhjKfv9wHBpX8IpwOfuBk/OoJqgHRrrPaeKV dYUg== X-Gm-Message-State: ALoCoQlqzIipqdwrk1R/9mQja1E6w8CUW11iuFRxXchpOC/2pzf4Y8fZS+kQXlplR2dHS5Wu756D X-Received: by 10.194.110.100 with SMTP id hz4mr4483078wjb.6.1434619411645; Thu, 18 Jun 2015 02:23:31 -0700 (PDT) Received: from wespe.ffwll.local (212-51-149-109.fiber7.init7.net. [212.51.149.109]) by mx.google.com with ESMTPSA id tl3sm11308709wjc.20.2015.06.18.02.23.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jun 2015 02:23:30 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Thu, 18 Jun 2015 11:23:24 +0200 Message-Id: <1434619404-2870-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.1.0 In-Reply-To: <20150618083253.GO5176@intel.com> References: <20150618083253.GO5176@intel.com> MIME-Version: 1.0 Cc: Daniel Vetter , Daniel Vetter Subject: [Intel-gfx] [PATCH] drm/i915: Clear fb_tracking.busy_bits also for synchronous flips X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The current/old frontbuffer might still have gpu frontbuffer rendering pending. But once flipped it won't have the corresponding frontbuffer bits any more and hence the request retire function won't ever clear the corresponding busy bits. The async flip tracking (with the flip_prepare and flip_complete functions) already does this, but somehow I've forgotten to do this for synchronous flips. Note that we don't track outstanding rendering of the new framebuffer with busy_bits since all our plane update code waits for previous rendering to complete before displaying a new buffer. Hence a new buffer will never be busy. v2: Drop the spurious inline Ville spotted. Reported-by: Paulo Zanoni Cc: Paulo Zanoni Cc: Ville Syrjälä Signed-off-by: Daniel Vetter Tested-by: Paulo Zanoni Reviewed-by: Paulo Zanoni --- Paulo promised to also extend kms_frontbuffer_tracking with flip vs. busy buffer tests. --- drivers/gpu/drm/i915/intel_drv.h | 18 ++---------------- drivers/gpu/drm/i915/intel_frontbuffer.c | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index bcafefcf048b..b7c69460fb20 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -963,23 +963,9 @@ void intel_frontbuffer_flip_complete(struct drm_device *dev, unsigned frontbuffer_bits); void intel_frontbuffer_flush(struct drm_device *dev, unsigned frontbuffer_bits); -/** - * intel_frontbuffer_flip - synchronous frontbuffer flip - * @dev: DRM device - * @frontbuffer_bits: frontbuffer plane tracking bits - * - * This function gets called after scheduling a flip on @obj. This is for - * synchronous plane updates which will happen on the next vblank and which will - * not get delayed by pending gpu rendering. - * - * Can be called without any locks held. - */ -static inline +inline void intel_frontbuffer_flip(struct drm_device *dev, - unsigned frontbuffer_bits) -{ - intel_frontbuffer_flush(dev, frontbuffer_bits); -} + unsigned frontbuffer_bits); unsigned int intel_fb_align_height(struct drm_device *dev, unsigned int height, diff --git a/drivers/gpu/drm/i915/intel_frontbuffer.c b/drivers/gpu/drm/i915/intel_frontbuffer.c index 57095f54c1f2..c3559fde25e5 100644 --- a/drivers/gpu/drm/i915/intel_frontbuffer.c +++ b/drivers/gpu/drm/i915/intel_frontbuffer.c @@ -270,3 +270,29 @@ void intel_frontbuffer_flip_complete(struct drm_device *dev, intel_frontbuffer_flush(dev, frontbuffer_bits); } + +/** + * intel_frontbuffer_flip - synchronous frontbuffer flip + * @dev: DRM device + * @frontbuffer_bits: frontbuffer plane tracking bits + * + * This function gets called after scheduling a flip on @obj. This is for + * synchronous plane updates which will happen on the next vblank and which will + * not get delayed by pending gpu rendering. + * + * Can be called without any locks held. + */ + +void intel_frontbuffer_flip(struct drm_device *dev, + unsigned frontbuffer_bits) +{ + struct drm_i915_private *dev_priv = dev->dev_private; + + mutex_lock(&dev_priv->fb_tracking.lock); + dev_priv->fb_tracking.flip_bits |= frontbuffer_bits; + /* Remove stale busy bits due to the old buffer. */ + dev_priv->fb_tracking.busy_bits &= ~frontbuffer_bits; + mutex_unlock(&dev_priv->fb_tracking.lock); + + intel_frontbuffer_flush(dev, frontbuffer_bits); +}