[PATCH v4 1/2] drm: bridge: Add sii902x driver

Boris Brezillon boris.brezillon at free-electrons.com
Wed Jun 1 16:03:37 UTC 2016


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?

--->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().

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))) {





More information about the dri-devel mailing list