From patchwork Tue May 9 17:00:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jose Abreu X-Patchwork-Id: 9719081 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 401C860364 for ; Wed, 10 May 2017 00:22:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31FB228307 for ; Wed, 10 May 2017 00:22:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26C822845D; Wed, 10 May 2017 00:22:19 +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]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B04D428307 for ; Wed, 10 May 2017 00:22:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 57E6C6E353; Wed, 10 May 2017 00:20:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtprelay.synopsys.com (smtprelay.synopsys.com [198.182.60.111]) by gabe.freedesktop.org (Postfix) with ESMTPS id 034EA6E1C1 for ; Tue, 9 May 2017 17:00:54 +0000 (UTC) Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id C0DA810C0F6B; Tue, 9 May 2017 10:00:53 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 9D49D84C; Tue, 9 May 2017 10:00:53 -0700 (PDT) Received: from joabreu-VirtualBox.internal.synopsys.com (joabreu-e7440.internal.synopsys.com [10.107.19.67]) by mailhost.synopsys.com (Postfix) with ESMTP id 6E15782D; Tue, 9 May 2017 10:00:51 -0700 (PDT) From: Jose Abreu To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/8] drm: Add drm_crtc_mode_valid() Date: Tue, 9 May 2017 18:00:09 +0100 Message-Id: <9fa7d9826e3793989fb52a2911d37b41ddfc0580.1494347165.git.joabreu@synopsys.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 10 May 2017 00:20:18 +0000 Cc: Jose Abreu , Daniel Vetter , Alexey Brodkin , Carlos Palminha 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 Add a new helper to call crtc->mode_valid callback. Suggested-by: Ville Syrjälä Signed-off-by: Jose Abreu Cc: Carlos Palminha Cc: Alexey Brodkin Cc: Ville Syrjälä Cc: Daniel Vetter Cc: Dave Airlie Cc: Andrzej Hajda Cc: Archit Taneja --- drivers/gpu/drm/drm_crtc.c | 22 ++++++++++++++++++++++ drivers/gpu/drm/drm_crtc_internal.h | 3 +++ 2 files changed, 25 insertions(+) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 5af25ce..07ae705 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -741,3 +742,24 @@ int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj, return ret; } + +/** + * drm_crtc_mode_valid - call crtc->mode_valid callback, if any. + * @crtc: crtc + * @mode: mode to be validated + * + * If no mode_valid callback is available this will return MODE_OK. + * + * Returns: drm_mode_status Enum + */ +enum drm_mode_status drm_crtc_mode_valid(struct drm_crtc *crtc, + const struct drm_display_mode *mode) +{ + const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; + + if (!crtc_funcs || !crtc_funcs->mode_valid) + return MODE_OK; + + return crtc_funcs->mode_valid(crtc, mode); +} +EXPORT_SYMBOL(drm_crtc_mode_valid); diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h index d077c54..3800abd 100644 --- a/drivers/gpu/drm/drm_crtc_internal.h +++ b/drivers/gpu/drm/drm_crtc_internal.h @@ -45,6 +45,9 @@ int drm_crtc_check_viewport(const struct drm_crtc *crtc, struct dma_fence *drm_crtc_create_fence(struct drm_crtc *crtc); +enum drm_mode_status drm_crtc_mode_valid(struct drm_crtc *crtc, + const struct drm_display_mode *mode); + /* IOCTLs */ int drm_mode_getcrtc(struct drm_device *dev, void *data, struct drm_file *file_priv);