From: Daniel Vetter <daniel@ffwll.ch>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Sam Ravnborg <sam@ravnborg.org>,
dri-devel@lists.freedesktop.org, kernel@pengutronix.de,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: Re: [PATCH v4 01/19] drm/encoder: make encoder control functions optional
Date: Wed, 9 Dec 2020 16:59:30 +0100 [thread overview]
Message-ID: <20201209155930.GS401619@phenom.ffwll.local> (raw)
In-Reply-To: <20201209155805.GR401619@phenom.ffwll.local>
On Wed, Dec 09, 2020 at 04:58:05PM +0100, Daniel Vetter wrote:
> On Wed, Dec 09, 2020 at 11:58:44AM +0100, Philipp Zabel wrote:
> > Hi Sam,
> >
> > On Tue, 2020-12-08 at 19:48 +0100, Sam Ravnborg wrote:
> > > Hi Philipp,
> > > On Tue, Dec 08, 2020 at 04:54:33PM +0100, Philipp Zabel wrote:
> > > > Simple managed encoders do not require the .destroy callback,
> > > > make the whole funcs structure optional.
> > > >
> > > > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> > > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > > ---
> > > > New in v4.
> > > > ---
> > > > drivers/gpu/drm/drm_encoder.c | 4 ++--
> > > > drivers/gpu/drm/drm_mode_config.c | 5 +++--
> > > > include/drm/drm_encoder.h | 2 +-
> > > > 3 files changed, 6 insertions(+), 5 deletions(-)
> > > >
> > [...]
> > > > diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
> > > > index f1affc1bb679..87e144155456 100644
> > > > --- a/drivers/gpu/drm/drm_mode_config.c
> > > > +++ b/drivers/gpu/drm/drm_mode_config.c
> > [...]
> > > > @@ -487,7 +487,8 @@ void drm_mode_config_cleanup(struct drm_device *dev)
> > > >
> > > > list_for_each_entry_safe(encoder, enct, &dev->mode_config.encoder_list,
> > > > head) {
> > > > - encoder->funcs->destroy(encoder);
> > > > + if (encoder->funcs)
> > > > + encoder->funcs->destroy(encoder);
> > >
> > > So late_register and early_unregister are both optional.
> > > But if encoder->funcs is set then the destroy callback is mandatory.
> >
> > For encoders that are kept on the mode_config.encoder_list until
> > drm_mode_config_cleanup() is called, the destroy callback is still
> > mandatory.
> >
> > Encoders allocated with drmm_encoder_alloc() on the other hand should
> > have the destroy callback set to NULL, if encoder->funcs is set.
> > These encoders are removed from the mode_config.encoder_list by the drmm
> > cleanup code, before drm_mode_config_cleanup is called.
> >
> > > I am just wondering if this is intended.
> > > Reding the documnetation of drm_encoder_funcs thist matches the
> > > documentation but anyway..
> > >
> > > With this comment considered,
> > > Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> >
> > Thank you for bringing this up, should we just leave
> > drm_mode_config_cleanup() as-is?
>
> Yup, not having a funcs->destroy there is a bug. Maybe should even warn
> about the lack of that in the traditional non-drmm_ encoder init function.
Forgot to add: With that Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> -Daniel
>
> >
> > regards
> > Philipp
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-12-09 15:59 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-08 15:54 [PATCH v4 00/19] drm: managed encoder/plane/crtc allocation Philipp Zabel
2020-12-08 15:54 ` [PATCH v4 01/19] drm/encoder: make encoder control functions optional Philipp Zabel
2020-12-08 18:48 ` Sam Ravnborg
2020-12-09 10:58 ` Philipp Zabel
2020-12-09 15:58 ` Daniel Vetter
2020-12-09 15:59 ` Daniel Vetter [this message]
2020-12-08 15:54 ` [PATCH v4 02/19] drm: add drmm_encoder_alloc() Philipp Zabel
2020-12-09 16:05 ` Daniel Vetter
2020-12-10 11:59 ` Philipp Zabel
2020-12-10 13:13 ` Daniel Vetter
2020-12-08 15:54 ` [PATCH v4 03/19] drm/simple_kms_helper: add drmm_simple_encoder_alloc() Philipp Zabel
2020-12-09 20:04 ` Daniel Vetter
2020-12-08 15:54 ` [PATCH v4 04/19] drm/plane: add drmm_universal_plane_alloc() Philipp Zabel
2020-12-09 20:08 ` Daniel Vetter
2020-12-08 15:54 ` [PATCH v4 05/19] drm/crtc: add drmm_crtc_alloc_with_planes() Philipp Zabel
2020-12-09 20:21 ` Daniel Vetter
2020-12-08 15:54 ` [PATCH v4 06/19] drm/imx: dw_hdmi-imx: move initialization into probe Philipp Zabel
2020-12-08 15:54 ` [PATCH v4 07/19] drm/imx: imx-ldb: use local connector variable Philipp Zabel
2020-12-08 15:54 ` [PATCH v4 08/19] drm/imx: imx-ldb: move initialization into probe Philipp Zabel
2020-12-08 15:54 ` [PATCH v4 09/19] drm/imx: imx-tve: use local encoder and connector variables Philipp Zabel
2020-12-08 15:54 ` [PATCH v4 10/19] drm/imx: imx-tve: move initialization into probe Philipp Zabel
2020-12-08 15:54 ` [PATCH v4 11/19] drm/imx: imx-tve: use devm_clk_register Philipp Zabel
2020-12-08 15:54 ` [PATCH v4 12/19] drm/imx: parallel-display: use local bridge and connector variables Philipp Zabel
2020-12-08 15:54 ` [PATCH v4 13/19] drm/imx: parallel-display: move initialization into probe Philipp Zabel
2020-12-08 15:54 ` [PATCH v4 14/19] drm/imx: dw_hdmi-imx: use drm managed resources Philipp Zabel
2020-12-08 15:54 ` [PATCH v4 15/19] drm/imx: imx-ldb: " Philipp Zabel
2020-12-08 15:54 ` [PATCH v4 16/19] drm/imx: imx-tve: " Philipp Zabel
2020-12-08 15:54 ` [PATCH v4 17/19] drm/imx: parallel-display: " Philipp Zabel
2020-12-08 15:54 ` [PATCH v4 18/19] drm/imx: ipuv3-plane: " Philipp Zabel
2020-12-08 15:54 ` [PATCH v4 19/19] drm/imx: ipuv3-crtc: " Philipp Zabel
2020-12-08 15:59 ` [PATCH v4 00/19] drm: managed encoder/plane/crtc allocation Philipp Zabel
2020-12-09 21:10 ` Daniel Vetter
2020-12-09 21:13 ` Daniel Vetter
2020-12-10 12:19 ` Laurent Pinchart
2020-12-11 10:19 ` Philipp Zabel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201209155930.GS401619@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@pengutronix.de \
--cc=laurent.pinchart@ideasonboard.com \
--cc=p.zabel@pengutronix.de \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox