Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2270059ybl; Thu, 29 Aug 2019 06:06:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqzI12AWCxFtga6KyliRVsK0f2dw5llvFJOS3gorKCU7s1zOL730lD641sc2c2U2urxmM/cX X-Received: by 2002:a17:90a:b290:: with SMTP id c16mr9615459pjr.34.1567083992454; Thu, 29 Aug 2019 06:06:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567083992; cv=none; d=google.com; s=arc-20160816; b=B+ZuHrzB7oyhDzBLM7mpI8XeZIC76W1RmFU2Y2Cc0K0s2gPe6qj7W4teeG5S1GT305 GNi0wHWQDcsw8PP8Vs/5cIZWsfmHXkcSCf7Llw+GYYnud6K2J+MY2k56q1dZ8jh3t/iC z5qrS6+5ll0JQiiioBlctgrYHTUOh/ot2+VlnuZc4jPQAANvfvLSxBAZu7PUBua25wSA Yn571o2yaPA481Q0b4HKcthMhoELY4YxqosKFootwqfXgISRlPlCAHGqXqtI7biMDZ9m yJCz4RkLSg6ffE+qfo4CbIYbQU7SK8nybJRrIMzLOqu3BJTMpckGDZDL6Qe3Vu1m2c1g w5nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=jbt8QVuKSyj/sWQ72n57ax07Z6OSVIi5b7yOSbu/iaA=; b=R2iwCYNIzYSkQlcQ2vq5wdTgGaFBCwZS+tHmzgfZu2fgXVQDntahDVplyLP07m+tBi 9Srf3JyRl0Nr1e1MzACrVni3qRWQtkQV8MiobnoyFYYBqUL2aZR1Bhhhpnc470Qavd6l TpS/HbEmCuitLLqMCj3fuOOjMaWRvOa1QmV4ggzh4dI+U3Ywqqhyf9S6y7FJ/53fX9iJ 1PkCshjUSot6UxixLMjOK51iMn8OTnuda1KtjnN4tXyaF3Lqt5BB3t/jzZqXMluOpbPX FaOxONT0IHTwXaiQCS6Tl0IHaR/U4X5uVun2kGj4ianoaZEqxehc6A0CcE049mWqFxwx LgVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=cnNhSiUI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 144si1921716pgh.176.2019.08.29.06.06.09; Thu, 29 Aug 2019 06:06:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=cnNhSiUI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727103AbfH2NEj (ORCPT + 99 others); Thu, 29 Aug 2019 09:04:39 -0400 Received: from mail-yw1-f68.google.com ([209.85.161.68]:45600 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726518AbfH2NEj (ORCPT ); Thu, 29 Aug 2019 09:04:39 -0400 Received: by mail-yw1-f68.google.com with SMTP id n69so1080055ywd.12 for ; Thu, 29 Aug 2019 06:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=jbt8QVuKSyj/sWQ72n57ax07Z6OSVIi5b7yOSbu/iaA=; b=cnNhSiUI5Y8Aorow788RFQl6zZ3NHK14DJ8y8HvjApt1P5EMwS0HUx4q/gfDtXDqNw lkpAaomVKvQ1tcAUf+q77rRaPCJJZKV/0rGryQWXskP/OBBCDrY+Nd89tqoxenRGQqLR yDn9TS/LcOz3pYNOQcO9sObX7Rtc/YPSDIb6C6/IVjel/dSqJ9mGJzedqjbb9OL+N6+o SrFnm9Wq9BsLPzjIrxBbiMAyTDAms2dmvCeJer+1LnLbxkChyf8x3Up7RNh1a69dGqu/ O67aNQa3bDPxRASG7Bt2kbInLkEp12AVR2/+iXvwpQGG27M+FzdcWE7hB6+M5znGCUsz WNPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=jbt8QVuKSyj/sWQ72n57ax07Z6OSVIi5b7yOSbu/iaA=; b=A/HpZpzpeSGoJRG+S+zctp837buiJ9DvXdagIX3LIS4JK73sclJwukNf18Dm4QJiNg K5Gqql+6cp8u3KryBouzZItg/rnrCEfu2hxBDTLxTASUItgdmI43F9Fp6E+v0/mJ/jcs SsdTTxXbI11RCL5o1D6VcCDHEOaZF6ceEswwr2cVdXYkaYVMZdeCbfkaN3AsXw/OKVNm PpNeWAMr1b0Y/OfAL766L+EmJ0NThnT5NtJFgc18sDSHxwz+8HQ4hKQA8yaUWMO30ePC WFABrCxS6+PYI8U3axFDdUUh14F7JqQpPP/Yz9KZru/DRbIsMgKt5rMMoZQDlFEYxAC2 U4fg== X-Gm-Message-State: APjAAAVr9jNrmw+HQZ8/xT5Yq8pjZVIp53AWQuumoTGvBZW6yl9kTxFg O7c6RlGOerFOhEQ9GGWRXKSKtA== X-Received: by 2002:a81:a6c1:: with SMTP id d184mr6487059ywh.468.1567083878220; Thu, 29 Aug 2019 06:04:38 -0700 (PDT) Received: from localhost ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id d195sm450214ywb.101.2019.08.29.06.04.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 06:04:36 -0700 (PDT) Date: Thu, 29 Aug 2019 09:04:33 -0400 From: Sean Paul To: Rob Clark Cc: dri-devel@lists.freedesktop.org, Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Jeykumar Sankaran , Jordan Crouse , Greg Kroah-Hartman , Sravanthi Kollukuduru , Bruce Wang , Jonathan Marek , Thomas Gleixner , Allison Randal , Mamta Shukla , Enrico Weigelt , Georgi Djakov , "open list:DRM DRIVER FOR MSM ADRENO GPU" , "open list:DRM DRIVER FOR MSM ADRENO GPU" , open list Subject: Re: [PATCH 4/9] drm/msm: add kms->wait_flush() Message-ID: <20190829130433.GE218215@art_vandelay> References: <20190827213421.21917-1-robdclark@gmail.com> <20190827213421.21917-5-robdclark@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190827213421.21917-5-robdclark@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 27, 2019 at 02:33:34PM -0700, Rob Clark wrote: > From: Rob Clark > > First step in re-working the atomic related internal API to prepare for > async updates pending.. ->wait_flush() is intended to block until there > is no in-progress flush. > > A crtc_mask is used, rather than an atomic state object, as this will > later be used for async flush after the atomic state is destroyed. > > This replaces ->wait_for_crtc_commit_done() > > Signed-off-by: Rob Clark Hi Rob, A few nits below, but lgtm overall > --- > drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 11 ++++++- > drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 17 ++++++---- > drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 17 ++++++---- > drivers/gpu/drm/msm/msm_atomic.c | 42 ++++++++++-------------- > drivers/gpu/drm/msm/msm_kms.h | 9 +++-- > 5 files changed, 54 insertions(+), 42 deletions(-) > /snip > index e5aae1645933..639cc88c31a1 100644 > --- a/drivers/gpu/drm/msm/msm_atomic.c > +++ b/drivers/gpu/drm/msm/msm_atomic.c > @@ -10,28 +10,6 @@ > #include "msm_gem.h" > #include "msm_kms.h" > > -static void msm_atomic_wait_for_commit_done(struct drm_device *dev, > - struct drm_atomic_state *old_state) > -{ > - struct drm_crtc *crtc; > - struct drm_crtc_state *new_crtc_state; > - struct msm_drm_private *priv = old_state->dev->dev_private; > - struct msm_kms *kms = priv->kms; > - int i; > - > - for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) { > - if (!new_crtc_state->active) > - continue; > - > - if (drm_crtc_vblank_get(crtc)) > - continue; > - > - kms->funcs->wait_for_crtc_commit_done(kms, crtc); > - > - drm_crtc_vblank_put(crtc); > - } > -} > - > int msm_atomic_prepare_fb(struct drm_plane *plane, > struct drm_plane_state *new_state) > { > @@ -51,11 +29,28 @@ int msm_atomic_prepare_fb(struct drm_plane *plane, > return msm_framebuffer_prepare(new_state->fb, kms->aspace); > } > > +/* Get bitmask of crtcs that will need to be flushed. The bitmask > + * can be used with for_each_crtc_mask() iterator, to iterate > + * effected crtcs without needing to preserve the atomic state. > + */ > +static unsigned get_crtc_mask(struct drm_atomic_state *state) > +{ > + struct drm_crtc_state *crtc_state; > + struct drm_crtc *crtc; > + unsigned i, mask = 0; > + > + for_each_new_crtc_in_state(state, crtc, crtc_state, i) > + mask |= BIT(crtc->index); mask |= drm_crtc_mask(crtc); > + > + return mask; > +} > + > void msm_atomic_commit_tail(struct drm_atomic_state *state) > { > struct drm_device *dev = state->dev; > struct msm_drm_private *priv = dev->dev_private; > struct msm_kms *kms = priv->kms; > + unsigned crtc_mask = get_crtc_mask(state); > > kms->funcs->prepare_commit(kms, state); > > @@ -70,8 +65,7 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state) > kms->funcs->commit(kms, state); > } > > - msm_atomic_wait_for_commit_done(dev, state); > - > + kms->funcs->wait_flush(kms, crtc_mask); > kms->funcs->complete_commit(kms, state); > > drm_atomic_helper_commit_hw_done(state); > diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h > index c7588a42635e..8562bbfd5dca 100644 > --- a/drivers/gpu/drm/msm/msm_kms.h > +++ b/drivers/gpu/drm/msm/msm_kms.h > @@ -34,9 +34,8 @@ struct msm_kms_funcs { > void (*prepare_commit)(struct msm_kms *kms, struct drm_atomic_state *state); > void (*commit)(struct msm_kms *kms, struct drm_atomic_state *state); > void (*complete_commit)(struct msm_kms *kms, struct drm_atomic_state *state); > - /* functions to wait for atomic commit completed on each CRTC */ > - void (*wait_for_crtc_commit_done)(struct msm_kms *kms, > - struct drm_crtc *crtc); > + void (*wait_flush)(struct msm_kms *kms, unsigned crtc_mask); > + > /* get msm_format w/ optional format modifiers from drm_mode_fb_cmd2 */ > const struct msm_format *(*get_format)(struct msm_kms *kms, > const uint32_t format, > @@ -98,4 +97,8 @@ struct msm_mdss { > int mdp5_mdss_init(struct drm_device *dev); > int dpu_mdss_init(struct drm_device *dev); > > +#define for_each_crtc_mask(dev, crtc, crtc_mask) \ > + list_for_each_entry(crtc, &(dev)->mode_config.crtc_list, head) \ drm_for_each_crtc > + for_each_if (BIT((crtc)->index) & (crtc_mask)) > + > #endif /* __MSM_KMS_H__ */ > -- > 2.21.0 > -- Sean Paul, Software Engineer, Google / Chromium OS