From patchwork Wed May 11 16:09:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Noralf_Tr=C3=B8nnes?= X-Patchwork-Id: 9072501 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8513A9F1C3 for ; Wed, 11 May 2016 16:10:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B2CA42014A for ; Wed, 11 May 2016 16:10:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 57EE120172 for ; Wed, 11 May 2016 16:09:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E6FBE6E741; Wed, 11 May 2016 16:09:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.domeneshop.no (smtp.domeneshop.no [IPv6:2a01:5b40:0:3005::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0CA326E731 for ; Wed, 11 May 2016 16:09:46 +0000 (UTC) Received: from 151.79-160-56.customer.lyse.net ([79.160.56.151]:38474 helo=localhost.localdomain) by smtp.domeneshop.no with esmtpsa (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1b0Whk-0002dh-9q; Wed, 11 May 2016 18:09:44 +0200 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 5/6] drm/atomic: Add drm_atomic_helper_best_encoder() Date: Wed, 11 May 2016 18:09:21 +0200 Message-Id: <1462982962-10530-6-git-send-email-noralf@tronnes.org> X-Mailer: git-send-email 2.8.2 In-Reply-To: <1462982962-10530-1-git-send-email-noralf@tronnes.org> References: <1462982962-10530-1-git-send-email-noralf@tronnes.org> MIME-Version: 1.0 Cc: linux-kernel@vger.kernel.org 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-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add (struct drm_connector_helper_funcs *)->best_encoder callback helper for connectors that support exactly 1 encoder, statically determined at driver init time. Signed-off-by: Noralf Trønnes --- drivers/gpu/drm/drm_atomic_helper.c | 17 +++++++++++++++++ include/drm/drm_atomic_helper.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 46a3201..43a0b3d 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2483,6 +2483,23 @@ backoff: EXPORT_SYMBOL(drm_atomic_helper_connector_dpms); /** + * drm_atomic_helper_best_encoder - Helper for &drm_connector_helper_funcs + * ->best_encoder callback + * @connector: Connector control structure + * + * This is a &drm_connector_helper_funcs ->best_encoder callback helper for + * connectors that support exactly 1 encoder, statically determined at driver + * init time. + */ +struct drm_encoder * +drm_atomic_helper_best_encoder(struct drm_connector *connector) +{ + WARN_ON(connector->encoder_ids[1]); + return drm_encoder_find(connector->dev, connector->encoder_ids[0]); +} +EXPORT_SYMBOL(drm_atomic_helper_best_encoder); + +/** * DOC: atomic state reset and initialization * * Both the drm core and the atomic helpers assume that there is always the full diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h index 0364287..ccca709 100644 --- a/include/drm/drm_atomic_helper.h +++ b/include/drm/drm_atomic_helper.h @@ -110,6 +110,8 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc, uint32_t flags); int drm_atomic_helper_connector_dpms(struct drm_connector *connector, int mode); +struct drm_encoder * +drm_atomic_helper_best_encoder(struct drm_connector *connector); /* default implementations for state handling */ void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc);