Re: [PATCH v6 14/26] drm/bridge: add support for refcounted DRM bridges

Maxime Ripard
2025-03-13T18:07:20Z

[-- Attachment #1: Type: text/plain, Size: 3347 bytes --]

On Thu, Mar 13, 2025 at 12:56:56PM +0100, Luca Ceresoli wrote:
> Hello Maxime,
>
> On Fri, 7 Feb 2025 12:47:51 +0100
> Maxime Ripard <mripard@kernel.org> wrote:
> > On Thu, Feb 06, 2025 at 07:14:29PM +0100, Luca Ceresoli wrote:
> > > DRM bridges are currently considered as a fixed element of a DRM card, and
> > > thus their lifetime is assumed to extend for as long as the card
> > > exists. New use cases, such as hot-pluggable hardware with video bridges,
> > > require DRM bridges to be added and removed to a DRM card without tearing
> > > the card down. This is possible for connectors already (used by DP MST), so
> > > add this possibility to DRM bridges as well.
> > >
> > > Implementation is based on drm_connector_init() as far as it makes sense,
> > > and differs when it doesn't. A difference is that bridges are not exposed
> > > to userspace, hence struct drm_bridge does not embed a struct
> > > drm_mode_object which would provide the refcount. Instead we add to struct
> > > drm_bridge a refcount field (we don't need other struct drm_mode_object
> > > fields here) and instead of using the drm_mode_object_*() functions we
> > > reimplement from those functions the few lines that drm_bridge needs for
> > > refcounting.
> > >
> > > Also add a new devm_drm_bridge_alloc() macro to allocate a new refcounted
> > > bridge.
> > >
> > > Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> >
> > So, a couple of general comments:
> >
> > - I've said it a couple of times already, but I really think you're
> > making it harder than necessary for you here. This (and only this!)
> > should be the very first series you should be pushing. The rest can
> > only ever work if that work goes through, and it's already hard enough
> > as it is. So, split that patch into a series of its own, get that
> > merged, and then we will be able to deal with panels conversion and
> > whatever. That's even more true with panels since there's ongoing work
> > that will make it easier for you too. So the best thing here is
> > probably to wait.
> >
> > - This patch really needs to be split into several patches, something
> > along the lines of:
> >
> > + Creating devm_drm_bridge_alloc()
> > + Adding refcounting
> > + Taking the references in all the needed places
> > + Converting a bunch of drivers
>
> After reading Anusha's "[PATCH RFC 0/2] drm/panel: Refcounted panel
> allocation" [0] I think I need a clarification about the 4 steps you had
> outlined in the above quoted text. Are you suggesting those are four
> _series_, and you'd want to see a series only creating
> devm_drm_bridge_alloc() as a first step, similarly to Anusha's work?
>
> That was not my understanding so far, and so I've been working on a
> series containing all 4 items, and it's growing very long due to item 3
> needing to touch many dozen drivers which need to put a bridge (many
> are identical oneliner patches though).

I believe I've clarified it already in Anusha's series, but I think a
reasonable series for *early* work would be the bullet points 1, 2, a
bit of 3 and a bit of 4.

Once the API is agreed upon, 1, 2 and 4 should be in the same series. As
you've pointed out, item 3 can be large, so I don't really mind either
way.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]