From patchwork Thu Apr 5 15:44:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10324817 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 F02F36053F for ; Thu, 5 Apr 2018 15:45:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E16FC292C7 for ; Thu, 5 Apr 2018 15:45:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D63E2292CA; Thu, 5 Apr 2018 15:45:29 +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 B418A292C8 for ; Thu, 5 Apr 2018 15:45:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AB1AA6E7AC; Thu, 5 Apr 2018 15:45:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x230.google.com (mail-wm0-x230.google.com [IPv6:2a00:1450:400c:c09::230]) by gabe.freedesktop.org (Postfix) with ESMTPS id E40256E781 for ; Thu, 5 Apr 2018 15:45:06 +0000 (UTC) Received: by mail-wm0-x230.google.com with SMTP id o23so3843218wmf.0 for ; Thu, 05 Apr 2018 08:45:06 -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=h2m5EZNFZhFAH4CJ3PxA/v6UE545+Nho3fBWtK7ACxI=; b=JibokwPaRbUiuMbg5iPJjJFb/Xkh1s0Xj9gLkpiKbOfV9d/33Plrc4oF4Zc+63WvfF tOPFuTLMBZX/zdtenQyvtGSiAkRR29Q+Q5bvl+mT0JHhrLRyqWKfBVn0xByeJ0qY5qX+ jAuKRtLnxwYm7Zl7heiYjM+ptUhpz7Nmmu5m8= 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=h2m5EZNFZhFAH4CJ3PxA/v6UE545+Nho3fBWtK7ACxI=; b=FdG9fdrAXbf47JkOg65//FiicPWPv37QGLoE0JQxhDCvfCwuJVdMaxohJwal2zkIVe iSGRbGolHd7AghEUIm91si1EWfAjMNZQhzBJUYSW5y7pqR7PpB77mSW4VMf2FRJKFeWq 17+mp/WlJuNcQEncd/kPFlBkLW1HgSfjjlxSJmy6GConyy0FrBczc2rjqvj8o3VslQWF wKUkUi3shLpD6a1tijEGBVljAubkHpRdqm+QdcpsQTti9IywALIB+mGfbuSpXRWwv4wO t6PyYEmsZdD3IMuBMhLlwm2H5DNukRZi6jOXLcwPfCLET+XlQeJ/Y5VYg6vJSiRMYH8f wq3Q== X-Gm-Message-State: ALQs6tAlOKTDMtyFFcXOEp7QPONahLXXz69drWXiEB2wQsXnGStKnBt3 eFmVeysIAOLhc3v9yCi8VHagCjiC X-Google-Smtp-Source: AIpwx4/qpNCvDs6HbDJaCxGBK84+d6qNIqYfQwuZZpFkSZ4mIToqPJm+2sTwTOkXVr3MhS+KoAH4dg== X-Received: by 10.80.135.233 with SMTP id 38mr3520079edz.8.1522943105208; Thu, 05 Apr 2018 08:45:05 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-109.fiber7.init7.net. [212.51.149.109]) by smtp.gmail.com with ESMTPSA id i48sm4970247ede.39.2018.04.05.08.45.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Apr 2018 08:45:04 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 7/9] drm/gem-fb-helper: Always do implicit sync Date: Thu, 5 Apr 2018 17:44:47 +0200 Message-Id: <20180405154449.23038-8-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180405154449.23038-1-daniel.vetter@ffwll.ch> References: <20180405154449.23038-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gustavo Padovan , David Airlie , Daniel Vetter , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP I've done a lot of history digging. The first signs of this optimization was introduced in i915: commit 25067bfc060d1a481584dcb51ef4b5680176ecb6 Author: Gustavo Padovan Date: Wed Sep 10 12:03:17 2014 -0300 drm/i915: pin sprite fb only if it changed without much justification. Pinning already pinned stuff is real cheap (it's just obj->pin_count++ really), and the missing implicit sync was entirely forgotten about it seems. It's at least not mentioned anywhere it the commit message. It was also promptly removed shortly afterwards in commit ea2c67bb4affa84080c616920f3899f123786e56 Author: Matt Roper Date: Tue Dec 23 10:41:52 2014 -0800 drm/i915: Move to atomic plane helpers (v9) again without really mentioning the side-effect that plane updates with the same fb now again obey implicit syncing. Note that this only ever applied to the plane_update hook, all other legacy entry points (set_base, page_flip) always obeyed implicit sync in the drm/i915 driver. The real source of this code here seems to be msm, copied to vc4, then copied to tinydrm. I've also tried to dig around in all available msm sources, but the corresponding check for fb != old_fb is present ever since the initial merge in commit cf3a7e4ce08e6876cdcb80390876647f28a7cf8f Author: Rob Clark Date: Sat Nov 8 13:21:06 2014 -0500 drm/msm: atomic core bits The only older version I've found of msm atomic code predates the atomic helpers, and so didn't even use any of this. It also does not have a corresponding check (because it simply did no implicit sync at all). I've chatted with Rob on irc, and he didn't remember the reason for this either. Note we had epic amounts of fun with too much syncing against _vblank_, especially around cursor updates. But I don't ever discussing a need for less syncing against implicit fences. Also note that explicit fencing allows you to sidetrack all of this, at least for all the drivers correctly implemented using drm_atomic_set_fence_for_plane(). Given that it seems to be an accident of history, and that big drivers like i915 (and also nouveau it seems, I didn't follow the amdgpu/radeon sync code to figure this out properly there) never have done it, let's remove this. Cc: Rob Clark Cc: Matt Roper Cc: Gustavo Padovan Cc: Ville Syrjälä Cc: Maarten Lankhorst Cc: Sean Paul Cc: David Airlie Cc: "Noralf Trønnes" Signed-off-by: Daniel Vetter Reviewed-by: Eric Anholt --- drivers/gpu/drm/drm_gem_framebuffer_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c b/drivers/gpu/drm/drm_gem_framebuffer_helper.c index acfbc0641a06..2810d4131411 100644 --- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c +++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c @@ -253,7 +253,7 @@ int drm_gem_fb_prepare_fb(struct drm_plane *plane, struct dma_buf *dma_buf; struct dma_fence *fence; - if (plane->state->fb == state->fb || !state->fb) + if (!state->fb) return 0; dma_buf = drm_gem_fb_get_obj(state->fb, 0)->dma_buf;