From patchwork Thu Jul 20 17:57:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 9855547 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F0EB960393 for ; Thu, 20 Jul 2017 17:58:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E804328577 for ; Thu, 20 Jul 2017 17:58:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCF29285E1; Thu, 20 Jul 2017 17:58:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 95DD72858F for ; Thu, 20 Jul 2017 17:58:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9AD716E706; Thu, 20 Jul 2017 17:58:12 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id A36096E6FC for ; Thu, 20 Jul 2017 17:58:08 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id 143so4398897wmu.5 for ; Thu, 20 Jul 2017 10:58:08 -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-transfer-encoding; bh=ST9cGMbhtH/QdFbrWO8FaqSSKMZc5H/BTF81YMiIueM=; b=cShP33sGnDRXCVsDersdave7RWZW1iwqZ3dL2jHK6fkDGrEYJRu0kXIHObZmz5FTg1 D8YMoGz/Xzu3TLPKrLEiEuqAE72cO3hbe5c+zZ39kdu1Uw/bXXjLek+b/grxixjvLGnd OfOgYaUNV9S3VkcVJTa7NEaw85KGgcpX1bGBo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ST9cGMbhtH/QdFbrWO8FaqSSKMZc5H/BTF81YMiIueM=; b=iYLllDUDmtneXloPJYGoF5r3iQfna2KADXSkW/mZ8i2dhOYf1GxE3AuLmouaY822Ux 1cK50JU7or9SgzqmdLogZagxe2WPmAjH3SiFQ8UH1FA/Xb+E6Cz6AuXX378LJLn6Zw37 OJ2l0HQ7cXVVMMq362ChpxTfsrG0sxawjRPhyKoYRUSDkAabyqu6b9oGjR4pQ68sIP4H o74eJJszugK3DE88k4Caz96VxJ2hA5631qvJYtsMjd7jo5wMOtpxkfMUf4tS4V92CrlB YLaNZDkmP/UlQr55+gw3GGnJsXDFoHRKv9P4bZN78dp60Yh5qiN+MJY/XMVk1fw8iyXt 6DlA== X-Gm-Message-State: AIVw110E09Uwj03WU7i7QB7/InidWrD0FzVXrtXBbGPEPcuFN5j/1Txz 1xOlme9jy53IyjIrEfE= X-Received: by 10.80.217.4 with SMTP id t4mr3432574edj.225.1500573487042; Thu, 20 Jul 2017 10:58:07 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:5640:0:960b:2678:e223:c1c6]) by smtp.gmail.com with ESMTPSA id b4sm1773591eda.34.2017.07.20.10.58.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jul 2017 10:58:05 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Thu, 20 Jul 2017 19:57:52 +0200 Message-Id: <20170720175754.30751-6-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170720175754.30751-1-daniel.vetter@ffwll.ch> References: <20170720175754.30751-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 5/7] drm/i915: adjust has_pending_fb_unpin to atomic 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-Virus-Scanned: ClamAV using ClamSMTP A bit an oversight - the current code did nothing, since only legacy flips used the unpin_work_count and assorted logic. Cc: Maarten Lankhorst Cc: Ville Syrjälä Reviewed-by: Maarten Lankhorst Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_display.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index fcbd4b7fa96c..bd0488a72503 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -4149,21 +4149,22 @@ static void ironlake_fdi_disable(struct drm_crtc *crtc) bool intel_has_pending_fb_unpin(struct drm_i915_private *dev_priv) { - struct intel_crtc *crtc; - - /* Note that we don't need to be called with mode_config.lock here - * as our list of CRTC objects is static for the lifetime of the - * device and so cannot disappear as we iterate. Similarly, we can - * happily treat the predicates as racy, atomic checks as userspace - * cannot claim and pin a new fb without at least acquring the - * struct_mutex and so serialising with us. - */ - for_each_intel_crtc(&dev_priv->drm, crtc) { - if (atomic_read(&crtc->unpin_work_count) == 0) + struct drm_crtc *crtc; + bool cleanup_done; + + drm_for_each_crtc(crtc, &dev_priv->drm) { + struct drm_crtc_commit *commit; + spin_lock(&crtc->commit_lock); + commit = list_first_entry_or_null(&crtc->commit_list, + struct drm_crtc_commit, commit_entry); + cleanup_done = commit ? + try_wait_for_completion(&commit->cleanup_done) : true; + spin_unlock(&crtc->commit_lock); + + if (cleanup_done) continue; - if (crtc->flip_work) - intel_wait_for_vblank(dev_priv, crtc->pipe); + drm_crtc_wait_one_vblank(crtc); return true; }