[PATCH 5/5] drm/imx: add exclusive fence to plane state

Lucas Stach l.stach at pengutronix.de
Tue Sep 20 07:02:42 UTC 2016


Am Montag, den 19.09.2016, 22:48 +0200 schrieb Daniel Vetter:
> On Thu, Aug 11, 2016 at 11:18 AM, Lucas Stach <l.stach at pengutronix.de> wrote:
> > This allows the atomic helper to wait on them, instead of open-coding
> > the same in the imx-drm driver.
> >
> > Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
> > ---
> >  drivers/gpu/drm/imx/imx-drm-core.c | 63 +++++++++++++++++---------------------
> >  1 file changed, 28 insertions(+), 35 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
> > index 66b3556f7b79..2d3f32f1b13b 100644
> > --- a/drivers/gpu/drm/imx/imx-drm-core.c
> > +++ b/drivers/gpu/drm/imx/imx-drm-core.c
> > @@ -152,50 +152,43 @@ static void imx_drm_output_poll_changed(struct drm_device *drm)
> >         drm_fbdev_cma_hotplug_event(imxdrm->fbhelper);
> >  }
> >
> > +static int imx_drm_atomic_commit(struct drm_device *dev,
> > +                                struct drm_atomic_state *state,
> > +                                bool nonblock)
> > +{
> > +       struct drm_plane_state *plane_state;
> > +       struct drm_plane *plane;
> > +       struct dma_buf *dma_buf;
> > +       int i;
> > +
> > +       /*
> > +        * If the plane fb has an dma-buf attached, fish out the exclusive
> > +        * fence for the atomic helper to wait on.
> > +        */
> > +       for_each_plane_in_state(state, plane, plane_state, i) {
> > +               if ((plane->state->fb != plane_state->fb) && plane_state->fb) {
> > +                       dma_buf = drm_fb_cma_get_gem_obj(plane_state->fb,
> > +                                                        0)->base.dma_buf;
> > +                       if (!dma_buf)
> > +                               continue;
> > +                       plane_state->fence =
> > +                               reservation_object_get_excl_rcu(dma_buf->resv);
> > +               }
> > +       }
> 
> Just an fyi, but the idea was that you could do this in youre
> prepare_plane hook, assuming that only when userspace flips is it
> interested in syncing (for backwards compat reasons). But this gets
> the job done too.
> 
> The upshot of doing this consistently in a prepare_plane hook is that
> it would then allow us to have a shared implementation for all cma
> based kms drivers. If you feel bored, I'd be happy to take a look at a
> refactor patch which would extract that helper (and wire it up for
> imx).
> 
Thanks for letting me know.

As our original flight to XDC has been canceled and we are re-routed to
the evening flight the boredom might actually kick in. :)

Regards,
Lucas



More information about the dri-devel mailing list