On Wed, 1 Jun 2016 23:56:02 +0200 Daniel Vetter <daniel at ffwll.ch> wrote:
> On Wed, Jun 01, 2016 at 06:03:37PM +0200, Boris Brezillon wrote: > > On Tue, 17 May 2016 08:47:11 +0200 > > Daniel Vetter <daniel at ffwll.ch> wrote: > > > > > > +static struct drm_encoder *sii902x_best_encoder(struct drm_connector > > > > *connector) > > > > +{ > > > > + struct sii902x *sii902x = connector_to_sii902x(connector); > > > > + > > > > + return sii902x->bridge.encoder; > > > > +} > > > > > > drm_atomic_helper_best_encoder should do exactly this for you. If you feel > > > board pimp the atomic helpers to call that one by default to even remove > > > the vfunc assingment line ;-) > > > > Just to be sure, is that what you had in mind? > > Exactly, I'll pick this one up for drm-misc. btw if you're even more > motivated, you can go through all drivers with a static mapping from > connector to encoder, and nuke those functions. Since if it's just a > static mapping, the only way to do it is like the helper does. > > Thanks, Daniel > > > > --->8--- > > From d218b7ea16ca35452b3174c83a207ecd406e5c88 Mon Sep 17 00:00:00 2001 > > From: Boris Brezillon <boris.brezillon at free-electrons.com> > > Date: Wed, 1 Jun 2016 17:57:18 +0200 > > Subject: [PATCH] drm: atomic: Handle funcs->best_encoder == NULL case > > > > Fallback drm_atomic_helper_best_encoder() is 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(). Please don't apply the patch, it's buggy. > > > > Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com> > > --- > > drivers/gpu/drm/drm_atomic_helper.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c > > b/drivers/gpu/drm/drm_atomic_helper.c > > index ddfa0d1..f6a3350 100644 > > --- a/drivers/gpu/drm/drm_atomic_helper.c > > +++ b/drivers/gpu/drm/drm_atomic_helper.c > > @@ -110,8 +110,10 @@ static int handle_conflicting_encoders(struct > > drm_atomic_state *state, > > > > if (funcs->atomic_best_encoder) > > new_encoder = funcs->atomic_best_encoder(connector, > > conn_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) { > > if (encoder_mask & (1 << > > drm_encoder_index(new_encoder))) { > > > > > > > -- Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com