From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sam Ravnborg Subject: Re: [PATCH 00/22] drm: Convert drivers to drm_simple_encoder_init() Date: Sat, 7 Mar 2020 21:51:56 +0100 Message-ID: <20200307205156.GA19643@ravnborg.org> References: <20200305155950.2705-1-tzimmermann@suse.de> <20200306142212.GF4878@pendragon.ideasonboard.com> <20200307200813.GA15363@ravnborg.org> <20200307203445.GC5021@pendragon.ideasonboard.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20200307203445.GC5021-N3hz7ZxfLydczECFQUw77jytWr6r+dGw0E9HWUfgJXw@public.gmane.org> Sender: linux-tegra-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Laurent Pinchart Cc: Thomas Zimmermann , hamohammed.sa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, alexandre.belloni-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org, airlied-cv59FeDIM0c@public.gmane.org, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, sebastian.reichel-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org, paul-icTtO2rgO2OTuSrc4Mpeew@public.gmane.org, matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, wens-jdAy2FN1RRM@public.gmane.org, thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, kraxel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, jy0922.shim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, tomi.valkeinen-l0cyMroinI0@public.gmane.org, abrodkin-HKixBCOQz3hWk0Htik3J/w@public.gmane.org, linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org, krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org, xinliang.liu-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, kong.kongxinwei-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org, kgene-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, linux-imx-3arQi8VN3Tc@public.gmane.org, nicolas.ferre-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org, puck.chen-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org, s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org, alison.wang-3arQi8VN3Tc@public.gmane.org, jsarha-l0cyMroinI0@public.gmane.org, linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, virtualization-cunTk1MwBs+XwC/5MpYmKg@public.gmane.org List-Id: linux-tegra@vger.kernel.org Hi Laurent. On Sat, Mar 07, 2020 at 10:34:45PM +0200, Laurent Pinchart wrote: > Hi Sam, > > On Sat, Mar 07, 2020 at 09:08:13PM +0100, Sam Ravnborg wrote: > > On Fri, Mar 06, 2020 at 04:18:52PM +0100, Thomas Zimmermann wrote: > > > Am 06.03.20 um 15:22 schrieb Laurent Pinchart: > > > > On Thu, Mar 05, 2020 at 04:59:28PM +0100, Thomas Zimmermann wrote: > > > >> A call to drm_simple_encoder_init() initializes an encoder without > > > >> further functionality. It only provides the destroy callback to > > > >> cleanup the encoder's state. Only few drivers implement more > > > >> sophisticated encoders than that. Most drivers implement such a > > > >> simple encoder and can use drm_simple_encoder_init() instead. > > > >> > > > >> The patchset converts drivers where the encoder's instance is > > > >> embedded in a larger data structure. The driver releases the > > > >> memory during cleanup. Each patch replaces drm_encoder_init() with > > > >> drm_simple_encoder_init() and removes the (now unused) driver's > > > >> encoder functions. > > > >> > > > >> While the patchset is fairly large, the indiviual patches are self- > > > >> contained and can be merged independently from each other. The > > > >> simple-encoder functionality is currently in drm-misc-next, where > > > >> these patches could go as well. > > > > > > > > I've reviewed the whole series, including verifying that the few > > > > instances of struct drm_encoder_funcs that were not declared const were > > > > not modified somewhere to add more function pointers. > > > > > > > > Reviewed-by: Laurent Pinchart > > > > > > Thanks for the detailed review. > > > > > > > for all the patches. > > > > > > > > However, I'd like to note that drm_simple_encoder_init() is a bit of a > > > > misnommer here. Several of the encoders in those drivers to implement > > > > additional functionality. They just expose them through > > > > drm_encoder_helper_funcs, not drm_encoder_funcs. > > > > > > True. It's called 'simple encoder' for the lack of a better name. It's > > > part of the simple KMS helpers, so the name's at least consistent. OTOH > > > I always find drm_simple_display_pipe a bad name. > > > > > > We can still rename the simple-encoder function without much effort. I'm > > > open for suggestions. > > > > IMO this does not belong in drm_simple_kms - but in drm_encoder. > > This only occurs to me after looking a bit more on the patches, > > you would have loved to get this feedback earlier. > > > > Most users do not need their owm drm_encoder_funcs definition, > > and would be happy with the default as provided by drm_simple_* > > > > As the cleanup is handled automatically when the drm device > > is teared down (in mode_config_rest()) I considered if we could here > > use the drmm_ namespace - but that felt wrong. > > > > My proposal is the following: > > - Move the implementation to drm_encoder.c > > - Name it drm_encoder_init_nofuncs() > > Or better, rename the existing drm_encoder_init() to > drm_encoder_init_funcs(), and rename drm_simple_encoder_init() to > drm_encoder_init() ? It's the common case. Agreed. It is a bit more involved which is the only reason I did not suggest it. But if we bite the bullet, then maybe do it properly. Cocinelle for the rescue... Sam