From patchwork Wed Jun 1 16:03:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris BREZILLON X-Patchwork-Id: 9147743 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B150360751 for ; Wed, 1 Jun 2016 16:03:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A36EB24B5B for ; Wed, 1 Jun 2016 16:03:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97A69269DB; Wed, 1 Jun 2016 16:03:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD4F324B5B for ; Wed, 1 Jun 2016 16:03:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 734AA6E946; Wed, 1 Jun 2016 16:03:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.free-electrons.com (down.free-electrons.com [37.187.137.238]) by gabe.freedesktop.org (Postfix) with ESMTP id E4BFA6E946 for ; Wed, 1 Jun 2016 16:03:48 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id B8F28219; Wed, 1 Jun 2016 18:03:47 +0200 (CEST) Received: from bbrezillon (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 2F72C1BE; Wed, 1 Jun 2016 18:03:37 +0200 (CEST) Date: Wed, 1 Jun 2016 18:03:37 +0200 From: Boris Brezillon To: Daniel Vetter Subject: Re: [PATCH v4 1/2] drm: bridge: Add sii902x driver Message-ID: <20160601180337.28e0917b@bbrezillon> In-Reply-To: <20160517064711.GF27098@phenom.ffwll.local> References: <1463407469-21819-1-git-send-email-boris.brezillon@free-electrons.com> <20160517064711.GF27098@phenom.ffwll.local> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Cc: Mark Rutland , Meng Yi , Xiubo Li , Pawel Moll , Ian Campbell , Alison Wang , Nicolas Ferre , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, Rob Herring , Alexandre Belloni , Kumar Gala , Jean-Christophe Plagniol-Villard , Jianwei Wang X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Tue, 17 May 2016 08:47:11 +0200 Daniel Vetter 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 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 --- 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))) {