Re: [PATCH] drm: bridge: panel: Register connector if DRM device is already registered

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 19, 2022 at 06:16:07PM +0200, Robert Foss wrote:
> On Tue, 19 Apr 2022 at 11:41, Jagan Teki <jagan@xxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > On Tue, Apr 19, 2022 at 2:44 PM Marek Szyprowski
> > <m.szyprowski@xxxxxxxxxxx> wrote:
> > >
> > > If panel_bridge_attach() happens after DRM device registration, the
> > > created connector will not be registered by the DRM core anymore. Fix
> > > this by registering it explicitely in such case.
> > >
> > > This fixes the following issue observed on Samsung Exynos4210-based Trats
> > > board with a DSI panel (the panel driver is registed after the Exynos DRM
> > > component device is bound):
> > >
> > > $ ./modetest -c -Mexynos
> > > could not get connector 56: No such file or directory
> > > Segmentation fault
> > >
> > > While touching this, move the connector reset() call also under the DRM
> > > device registered check, because otherwise it is not really needed.
> > >
> > > Fixes: 934aef885f9d ("drm: bridge: panel: Reset the connector state pointer")
> > > Signed-off-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
> > > ---
> > > Here is a bit more backgroud on this issue is available in this thread:
> > > https://lore.kernel.org/all/f0474a95-4ba3-a74f-d7de-ef7aab12bc86@xxxxxxxxxxx/
> > > ---
> > >  drivers/gpu/drm/bridge/panel.c | 7 +++++--
> > >  1 file changed, 5 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
> > > index ff1c37b2e6e5..0ee563eb2b6f 100644
> > > --- a/drivers/gpu/drm/bridge/panel.c
> > > +++ b/drivers/gpu/drm/bridge/panel.c
> > > @@ -83,8 +83,11 @@ static int panel_bridge_attach(struct drm_bridge *bridge,
> > >         drm_connector_attach_encoder(&panel_bridge->connector,
> > >                                           bridge->encoder);
> > >
> > > -       if (connector->funcs->reset)
> > > -               connector->funcs->reset(connector);
> > > +       if (bridge->dev->registered) {
> > > +               if (connector->funcs->reset)
> > > +                       connector->funcs->reset(connector);
> > > +               drm_connector_register(connector);
> > > +       }
> >
> > Reviewed-by: Jagan Teki <jagan@xxxxxxxxxxxxxxxxxxxx>
> 
> Fixed typos in commit message.
> 
> Reviewed-by: Robert Foss <robert.foss@xxxxxxxxxx>
> 
> Applied to drm-misc-next

Doesn't this open the door to various race conditions ?

Also, what happens if the panel bridge is detached and reattached ? If I
recall correctly, registering new connectors at runtime is at least
partly supported for DP MST, but I'm not sure about unregistration.

-- 
Regards,

Laurent Pinchart



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux