On Mon, Feb 17, 2025 at 09:36:35PM +0200, Dmitry Baryshkov wrote: > On Mon, Feb 17, 2025 at 05:41:24PM +0100, Simona Vetter wrote: > > On Thu, Feb 13, 2025 at 03:43:50PM +0100, Maxime Ripard wrote: > > > Now that connectors are no longer necessarily created by the bridges > > > drivers themselves but might be created by drm_bridge_connector, it's > > > pretty hard for bridge drivers to retrieve pointers to the connector and > > > CRTC they are attached to. > > > > > > Indeed, the only way to retrieve the CRTC is to follow the drm_bridge > > > encoder field, and then the drm_encoder crtc field, both of them being > > > deprecated. > > > > Eh, this isn't quite how this works. So unless bridges have become very > > dynamic and gained flexible routing the bridge(->bridge->...)->encoder > > chain is static. And the crtc for an encoder you find by walking the > > connector states in a drm_atomic_state, finding the right one that points > > at your encoder, and then return the ->crtc pointer from that connector > > state. > > > > It's a bit bonkers, but I think it's better to compute this than adding > > more pointers that potentially diverge. Unless there's a grand plan here, > > but then I think we want some safety checks that all the pointers never > > get out of sync here. > > Luca is working on bridges hotplug, so connectors are dynamic now. And > at least my humble opinion is that we'd better provide the corresponding > pointers rather than having a lot of boilerplate code in the drivers. > (there are enough drivers which look up connector and/or CRTC) and there > are even more drivers (I think, I haven't actually checked the source > tree) that could have benefited from thaving the connector or CRTC in > the state. Instead they store a pointer to the connector or perform > other fancy tricks. Yeah definitely don't replicate this across drivers, it needs to be a helper function. What I meant to say is that we have a way to do this already, and it also works for dp mst drivers. So full blast fun of dynamically selecting the right encoder _and_ hotplug/unplug of connectors. Unless bridge is very special, this should work for bridges too. -Sima -- Simona Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch