Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5363845yba; Wed, 8 May 2019 12:03:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqybEJVXooN7L2ENe+DvhVoogroZ1hUBl2S7QybXX8LZJEIDNUp8bM6BeuexC9WUzngVHofg X-Received: by 2002:a17:902:e213:: with SMTP id ce19mr24476409plb.30.1557342220754; Wed, 08 May 2019 12:03:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557342220; cv=none; d=google.com; s=arc-20160816; b=YK/gHUrJPTLJFluSQx+EwxKc9gbBka3IwomOYb/e6Iln82Jks4vVhimN5f08aq+/Ro QXoYnzuN3wagq1duJ54+c5F7ngxVX6KdPYlMV6k4FAGqr53okIw6OUA0+B48BRddgzlt H9QBSSdE8ur4T2F3x2A18nx+AqVbI7gdkvj9W9X/SlKzop7TxLZbgHPf5DnnvTx+FhUo 9yuN8dxUQ9uTe96PHC2bm4Jwm71SDnjwwqtkpDiheciJOy/87rp8ptdGQU6OSpr9df1g 6UPU0r42Rq616FrDixwYaNz6xMFaSsWkglL3IhT9VBfUPbjYEs/95ny8b4ok6B3xyFdf cvdg== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:to:from:date:dkim-signature; bh=kbAhrbAD1+9aEWfsTS7QE2zb4dTStOFnf7mafivs+FA=; b=QGEri+akpMaN+Zwi0I2vrKtEVH70zJN6r02pZXsybWB7J2iFKs64wl42xk9H4MwXn/ e2TUwsYdA/X9gpGs8ZEvEGjZ8Dmv9s/836uVbnPh+Ae41ORJPOzDlS1vbJxeVnRG/dDj 3YdVnIYJJ0Dy5cCB7buKfWZrt5h6WWTJtoyVjmEFelaOsJuEbMvvJEcPuv7EEu69rjX5 Ee8DooVWZHwrSDo7VOOB1pM0CfOZsbAp2tySQbqjHzujCdgjMkIkDxVAKe+W0lSF2Dej U8edZtETo2Af8sPpgY3NpcKLcAuU+u50HtVtXwx0Z26SSnmjj02F60BRNiU2qlZeSRrv 8xZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@poorly.run header.s=google header.b=gaikjg5P; 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 cn16si25905469plb.174.2019.05.08.12.03.24; Wed, 08 May 2019 12:03:40 -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=gaikjg5P; 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 S1727917AbfEHSSF (ORCPT + 99 others); Wed, 8 May 2019 14:18:05 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:35239 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727352AbfEHSSF (ORCPT ); Wed, 8 May 2019 14:18:05 -0400 Received: by mail-qt1-f193.google.com with SMTP id d20so6784336qto.2 for ; Wed, 08 May 2019 11:18:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=date:from:to:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=kbAhrbAD1+9aEWfsTS7QE2zb4dTStOFnf7mafivs+FA=; b=gaikjg5PPqIrxRrfn6rKpqudx87JmN/ZdE1x9g5e0xESCSRlRaH2iobUjBHFMcMYZv 70VCdLXLZQ+pVPjnAhNVAk18Qf6qV35wza7iXRc06trK2DkMtFUPYHlwOYg4DBcov6v5 AwPLJu9uIviNGGmFsAP3p2KfPzBLSC0pAzXfuhAXl6LfimnpDDyX9yyjnULQ3+gHLLOa vftNQvFI0wi7q8hC4dSJ1THLLsjB58oglADtrtcCRhGUiG4quma6FpwR9q/IVaCkNK8C mEeBxWBkqLzwTVd6/E3v5aIsYluVDcZraYlvjNL+054thDIqgnFypNPyuspluHFkIGgc w7wQ== 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:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=kbAhrbAD1+9aEWfsTS7QE2zb4dTStOFnf7mafivs+FA=; b=eGWJol5yA06oIalq+/BM+UhXkaeqMwl1HR046ePzDk5hbec+ufT/OAYlwSRTDbcREs l3MgYxDuQ5YcPBeukcdOUGMHYa04/55JnAtmQfu93ON4/STHwA7f5M0GU6oBhc0JdXof 9+HoYdfpdbsfXOCel5dpovX8amKPb6NKzDDpVNM0YYLMQRftjW99AHeejI8VbJUEYhCb NydRAIyijUIdaUsEpO980V6/6rtIXiPLuW3YO5p/tMZPGZo7Zb68fIErfeG4uVZtE+H4 eTElW4KI6SmkYVAf8ILMPaaLEHTBq9a1nGO++vR/US45oL9kQ1BSYl9mSaYwsOvUJcVq b1Hw== X-Gm-Message-State: APjAAAUBWPNQn1+pe/dgogjJVwTHbVsvvwS1NQpjFYK5A94vyIlHrgR4 ChcdwzHkiBtq/l8m5joot+kQag== X-Received: by 2002:a0c:b5ef:: with SMTP id o47mr14137466qvf.142.1557339484159; Wed, 08 May 2019 11:18:04 -0700 (PDT) Received: from localhost ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id i9sm8449950qkl.12.2019.05.08.11.18.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 May 2019 11:18:03 -0700 (PDT) Date: Wed, 8 May 2019 14:18:02 -0400 From: Sean Paul To: Sean Paul , dri-devel@lists.freedesktop.org, Sean Paul , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Maarten Lankhorst , Maxime Ripard , David Airlie , linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 01/11] drm: Add atomic variants of enable/disable to encoder helper funcs Message-ID: <20190508181802.GK17077@art_vandelay> References: <20190508160920.144739-1-sean@poorly.run> <20190508160920.144739-2-sean@poorly.run> <20190508163124.GY17751@phenom.ffwll.local> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190508163124.GY17751@phenom.ffwll.local> 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 Wed, May 08, 2019 at 06:31:24PM +0200, Daniel Vetter wrote: > On Wed, May 08, 2019 at 12:09:06PM -0400, Sean Paul wrote: > > From: Sean Paul > > > > This patch adds atomic_enable and atomic_disable callbacks to the > > encoder helpers. This will allow encoders to make informed decisions in > > their start-up/shutdown based on the committed state. > > > > Aside from the new hooks, this patch also introduces the new signature > > for .atomic_* functions going forward. Instead of passing object state > > (well, encoders don't have atomic state, but let's ignore that), we pass > > the entire atomic state so the driver can inspect more than what's > > happening locally. > > > > This is particularly important for the upcoming self refresh helpers. > > > > Changes in v3: > > - Added patch to the set > > Changes in v4: > > - Move atomic_disable above prepare (Daniel) > > - Add breadcrumb to .enable() docbook (Daniel) > > Why no r-b: me or did you not apply all my suggestions? Too lazy to read > it all again :-) Sorry, I was being a bit conservative slapping your R-b on the patches I changed. I've incorporated all of your suggestions AFAICT, so I've applied R-b on patches 01/03/04/05 (conveniently the same patch numbers between v3 & v4). Unless there's other review feedback I'll probably not send those out. I will send out an update to Laurent's patch with your suggestions and R-b after a bit of soak time on the list. Sean > -Daniel > > > > > Link to v3: https://patchwork.freedesktop.org/patch/msgid/20190502194956.218441-2-sean@poorly.run > > > > Cc: Daniel Vetter > > Cc: Ville Syrj?l? > > Signed-off-by: Sean Paul > > --- > > drivers/gpu/drm/drm_atomic_helper.c | 8 +++- > > include/drm/drm_modeset_helper_vtables.h | 48 ++++++++++++++++++++++++ > > 2 files changed, 54 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c > > index 553415fe8ede..ccf01831f265 100644 > > --- a/drivers/gpu/drm/drm_atomic_helper.c > > +++ b/drivers/gpu/drm/drm_atomic_helper.c > > @@ -999,7 +999,9 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) > > > > /* Right function depends upon target state. */ > > if (funcs) { > > - if (new_conn_state->crtc && funcs->prepare) > > + if (funcs->atomic_disable) > > + funcs->atomic_disable(encoder, old_state); > > + else if (new_conn_state->crtc && funcs->prepare) > > funcs->prepare(encoder); > > else if (funcs->disable) > > funcs->disable(encoder); > > @@ -1309,7 +1311,9 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, > > drm_bridge_pre_enable(encoder->bridge); > > > > if (funcs) { > > - if (funcs->enable) > > + if (funcs->atomic_enable) > > + funcs->atomic_enable(encoder, old_state); > > + else if (funcs->enable) > > funcs->enable(encoder); > > else if (funcs->commit) > > funcs->commit(encoder); > > diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h > > index 8f3602811eb5..aa509c107083 100644 > > --- a/include/drm/drm_modeset_helper_vtables.h > > +++ b/include/drm/drm_modeset_helper_vtables.h > > @@ -675,6 +675,51 @@ struct drm_encoder_helper_funcs { > > enum drm_connector_status (*detect)(struct drm_encoder *encoder, > > struct drm_connector *connector); > > > > + /** > > + * @atomic_disable: > > + * > > + * This callback should be used to disable the encoder. With the atomic > > + * drivers it is called before this encoder's CRTC has been shut off > > + * using their own &drm_crtc_helper_funcs.atomic_disable hook. If that > > + * sequence is too simple drivers can just add their own driver private > > + * encoder hooks and call them from CRTC's callback by looping over all > > + * encoders connected to it using for_each_encoder_on_crtc(). > > + * > > + * This callback is a variant of @disable that provides the atomic state > > + * to the driver. It takes priority over @disable during atomic commits. > > + * > > + * This hook is used only by atomic helpers. Atomic drivers don't need > > + * to implement it if there's no need to disable anything at the encoder > > + * level. To ensure that runtime PM handling (using either DPMS or the > > + * new "ACTIVE" property) works @atomic_disable must be the inverse of > > + * @atomic_enable. > > + */ > > + void (*atomic_disable)(struct drm_encoder *encoder, > > + struct drm_atomic_state *state); > > + > > + /** > > + * @atomic_enable: > > + * > > + * This callback should be used to enable the encoder. It is called > > + * after this encoder's CRTC has been enabled using their own > > + * &drm_crtc_helper_funcs.atomic_enable hook. If that sequence is > > + * too simple drivers can just add their own driver private encoder > > + * hooks and call them from CRTC's callback by looping over all encoders > > + * connected to it using for_each_encoder_on_crtc(). > > + * > > + * This callback is a variant of @enable that provides the atomic state > > + * to the driver. It is called in place of @enable during atomic > > + * commits. > > + * > > + * This hook is used only by atomic helpers, for symmetry with @disable. > > + * Atomic drivers don't need to implement it if there's no need to > > + * enable anything at the encoder level. To ensure that runtime PM > > + * handling (using either DPMS or the new "ACTIVE" property) works > > + * @enable must be the inverse of @disable for atomic drivers. > > + */ > > + void (*atomic_enable)(struct drm_encoder *encoder, > > + struct drm_atomic_state *state); > > + > > /** > > * @disable: > > * > > @@ -691,6 +736,9 @@ struct drm_encoder_helper_funcs { > > * handling (using either DPMS or the new "ACTIVE" property) works > > * @disable must be the inverse of @enable for atomic drivers. > > * > > + * For atomic drivers also consider @atomic_disable and save yourself > > + * from having to read the NOTE below! > > + * > > * NOTE: > > * > > * With legacy CRTC helpers there's a big semantic difference between > > -- > > Sean Paul, Software Engineer, Google / Chromium OS > > > > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch -- Sean Paul, Software Engineer, Google / Chromium OS