Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1413411

Re: [PATCH 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid

From Daniel Vetter <daniel@ffwll.ch>
Newsgroups linux.kernel
Subject Re: [PATCH 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid
Date 2016-06-03 21:10 +0200
Message-ID <rG2DL-7cv-1@gated-at.bofh.it> (permalink)
References <rFBWV-753-1@gated-at.bofh.it> <rFBWX-753-45@gated-at.bofh.it> <rFI2l-2Jx-3@gated-at.bofh.it> <rFIOK-305-15@gated-at.bofh.it> <rFRS1-g0-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Jun 03, 2016 at 09:37:43AM +0200, Boris Brezillon wrote:
> On Thu, 2 Jun 2016 23:57:02 +0200
> Daniel Vetter <daniel@ffwll.ch> wrote:
> 
> > On Thu, Jun 2, 2016 at 11:05 PM, Laurent Pinchart
> > <laurent.pinchart@ideasonboard.com> wrote:
> > > Hi Boris,
> > >
> > > Thank you for the patch.
> > >
> > > On Thursday 02 Jun 2016 16:31:28 Boris Brezillon wrote:  
> > >> Adapt drm_pick_crtcs() and update_connector_routing() to fallback to
> > >> drm_atomic_helper_best_encoder() if funcs->best_encoder() is NULL so
> > >> that DRM drivers can leave this hook unassigned if they know they want
> > >> to use drm_atomic_helper_best_encoder().  
> > >
> > > Could you please update include/drm/drm_modeset_helper_vtables.h to document
> > > this new behaviour ?  
> > 
> > Thanks for reminding me. Please update hooks for both
> > atomic_best_encoder and best_encoder. Also mention that it's only
> > optional for atomic drivers. There's lots of examples in that file for
> > the wording usually used.
> 
> Hm, I haven't changed anything for the ->atomic_best_encoder() hook, or
> am I missing something?

Before you needed atomic_best_encoder or best_encoder (well that's the
idea at least), now both are optional. Kerneldoc needs to be adjusted in
both places to match new reality after your patch.
-Daniel

> 
> > 
> > > The only drawback I see in this patch is the additional object lookup
> > > performed by drm_atomic_helper_best_encoder() at runtime. I wonder if we could
> > > somehow cache the information, as the assignment can't change when there's a
> > > 1:1 correspondence between encoders and connectors.  
> > 
> > drm_encoder_find is an idr lookup. That should be plenty fast,
> > especially for modeset code. Usually what's too expensive even for
> > modeset code is linear list walks. But Chris just submitted patches to
> > convert most of them into simple lookups.
> > -Daniel
> > 
> > >>> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>  
> > >> ---
> > >>  drivers/gpu/drm/drm_atomic_helper.c |  4 +++-
> > >>  drivers/gpu/drm/drm_fb_helper.c     | 13 ++++++++++++-
> > >>  2 files changed, 15 insertions(+), 2 deletions(-)
> > >>
> > >> diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> > >> b/drivers/gpu/drm/drm_atomic_helper.c index f6a3350..849d029 100644
> > >> --- a/drivers/gpu/drm/drm_atomic_helper.c
> > >> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > >> @@ -300,8 +300,10 @@ update_connector_routing(struct drm_atomic_state
> > >> *state, if (funcs->atomic_best_encoder)
> > >>               new_encoder = funcs->atomic_best_encoder(connector,
> > >>                                                        connector_state);
> > >> -     else
> > >> +     else if (funcs->best_encoder)
> > >>               new_encoder = funcs->best_encoder(connector);
> > >> +     else
> > >> +             new_encoder = drm_atomic_helper_best_encoder(connector);
> > >>
> > >>       if (!new_encoder) {
> > >>               DRM_DEBUG_ATOMIC("No suitable encoder found for [CONNECTOR:%d:%s]\n",
> > >> diff --git a/drivers/gpu/drm/drm_fb_helper.c
> > >> b/drivers/gpu/drm/drm_fb_helper.c index 7c2eb75..d44389a 100644
> > >> --- a/drivers/gpu/drm/drm_fb_helper.c
> > >> +++ b/drivers/gpu/drm/drm_fb_helper.c
> > >> @@ -2000,7 +2000,18 @@ static int drm_pick_crtcs(struct drm_fb_helper
> > >> *fb_helper, my_score++;
> > >>
> > >>       connector_funcs = connector->helper_private;
> > >> -     encoder = connector_funcs->best_encoder(connector);
> > >> +
> > >> +     /*
> > >> +      * If the DRM device implements atomic hooks and ->best_encoder() is
> > >> +      * NULL we fallback to the default drm_atomic_helper_best_encoder()
> > >> +      * helper.
> > >> +      */
> > >> +     if (fb_helper->dev->mode_config.funcs->atomic_commit &&
> > >> +         !connector_funcs->best_encoder)
> > >> +             encoder = drm_atomic_helper_best_encoder(connector);
> > >> +     else
> > >> +             encoder = connector_funcs->best_encoder(connector);
> > >> +
> > >>       if (!encoder)
> > >>               goto out;  
> > >
> > > --
> > > Regards,
> > >
> > > Laurent Pinchart
> > >  
> > 
> > 
> > 
> 
> 
> 
> -- 
> Boris Brezillon, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/20] drm/atomic: Provide default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
  [PATCH 18/20] drm/bridge: ptn3460: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
  [PATCH 15/20] drm: virtgpu: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
  [PATCH 10/20] drm: rockchip: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
    Re: [PATCH 10/20] drm: rockchip: Rely on the default ->best_encoder()  behavior Mark yao <mark.yao@rock-chips.com> - 2016-06-07 03:00 +0200
  [PATCH 03/20] drm: atmel-hlcdc: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
  [PATCH 05/20] drm: fsl-dcu: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
  [PATCH 19/20] drm/bridge: ps8622: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
  [PATCH 13/20] drm: tegra: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
  [PATCH 07/20] drm: mediatek: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
  [PATCH 17/20] drm/bridge: anx78xx: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
  [PATCH 09/20] drm: rcar-du: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
    Re: [PATCH 09/20] drm: rcar-du: Rely on the default ->best_encoder() behavior Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2016-06-02 23:00 +0200
      Re: [PATCH 09/20] drm: rcar-du: Rely on the default  ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-03 09:40 +0200
  [PATCH 14/20] drm: vc4: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
  [PATCH 08/20] drm: msm: Rely on the default ->best_encoder() behavior where appropriate Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
  [PATCH 04/20] drm: exynos: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
  [PATCH 16/20] drm: omap: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
    Re: [PATCH 16/20] drm: omap: Rely on the default ->best_encoder() behavior Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2016-06-02 23:10 +0200
  [PATCH 12/20] drm: sun4i: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
  [PATCH 02/20] drm: arc: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
  [PATCH 20/20] drm/bridge: dw-hdmi: Use drm_atomic_helper_best_encoder() Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
  [PATCH 06/20] drm: i915: Rely on the default ->best_encoder() behavior where appropriate Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
  [PATCH 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200
    Re: [PATCH 01/20] drm/atomic: Fix remaining places where !funcs->best_encoder is valid Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2016-06-02 23:10 +0200
      Re: [PATCH 01/20] drm/atomic: Fix remaining places where  !funcs->best_encoder is valid Daniel Vetter <daniel@ffwll.ch> - 2016-06-03 00:00 +0200
        Re: [Intel-gfx] [PATCH 01/20] drm/atomic: Fix remaining places where  !funcs->best_encoder is valid Chris Wilson <chris@chris-wilson.co.uk> - 2016-06-03 00:50 +0200
        Re: [PATCH 01/20] drm/atomic: Fix remaining places where  !funcs->best_encoder is valid Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-03 09:40 +0200
          Re: [PATCH 01/20] drm/atomic: Fix remaining places where  !funcs->best_encoder is valid Daniel Vetter <daniel@ffwll.ch> - 2016-06-03 21:10 +0200
      Re: [PATCH 01/20] drm/atomic: Fix remaining places where  !funcs->best_encoder is valid Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-03 09:40 +0200
  [PATCH 11/20] drm: sti: Rely on the default ->best_encoder() behavior Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-02 16:40 +0200

csiph-web