From patchwork Mon Mar 27 22:01:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinclair Yeh X-Patchwork-Id: 9647585 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 54FB2602C8 for ; Mon, 27 Mar 2017 22:03:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46B9E27CF3 for ; Mon, 27 Mar 2017 22:03:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B0292815E; Mon, 27 Mar 2017 22:03:17 +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 B163027CF3 for ; Mon, 27 Mar 2017 22:03:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 09F156E36F; Mon, 27 Mar 2017 22:03:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EX13-EDG-OU-002.vmware.com (ex13-edg-ou-002.vmware.com [208.91.0.190]) by gabe.freedesktop.org (Postfix) with ESMTPS id 806D76E36F for ; Mon, 27 Mar 2017 22:03:15 +0000 (UTC) Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-002.vmware.com (10.113.208.156) with Microsoft SMTP Server id 15.0.1156.6; Mon, 27 Mar 2017 15:02:12 -0700 Received: from vmware.com (unknown [10.16.254.220]) by sc9-mailhost3.vmware.com (Postfix) with SMTP id 506C540427; Mon, 27 Mar 2017 15:02:51 -0700 (PDT) Received: by vmware.com (sSMTP sendmail emulation); Mon, 27 Mar 2017 15:02:48 -0700 From: Sinclair Yeh To: Subject: [PATCH 07/11] drm/vmwgfx: Add and connect connector helper function Date: Mon, 27 Mar 2017 15:01:00 -0700 Message-ID: <1490652064-44817-8-git-send-email-syeh@vmware.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490652064-44817-1-git-send-email-syeh@vmware.com> References: <1490652064-44817-1-git-send-email-syeh@vmware.com> MIME-Version: 1.0 Received-SPF: None (EX13-EDG-OU-002.vmware.com: syeh@vmware.com does not designate permitted sender hosts) Cc: daniel.vetter@ffwll.ch, thellstrom@vmware.com 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 Since the link between connector and encoder is always fixed in our case, just return the one encoder. These helpers won't be called until we flip on the atomic support flag or set drm_crtc_funcs->set_config to using the atomic helper. Signed-off-by: Sinclair Yeh Reviewed-by: Thomas Hellstrom --- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 18 ++++++++++++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 2 ++ drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | 7 +++++++ drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 9 +++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 8 ++++++++ 5 files changed, 44 insertions(+) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index d00ff21..2250a34a 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c @@ -2223,6 +2223,24 @@ vmw_du_connector_atomic_get_property(struct drm_connector *connector, } +/** + * vmw_du_connector_best_encoder - there's only one + * + * @connector - connector the property is associated with + * + * In our case, there is only one encoder per connector + */ +struct drm_encoder * +vmw_du_connector_best_encoder(struct drm_connector *connector) +{ + struct vmw_display_unit *du; + + du = vmw_connector_to_du(connector); + + return &du->encoder; +} + + int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h index de6a0b6..3251562 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h @@ -267,6 +267,8 @@ vmw_du_connector_atomic_get_property(struct drm_connector *connector, const struct drm_connector_state *state, struct drm_property *property, uint64_t *val); +struct drm_encoder * +vmw_du_connector_best_encoder(struct drm_connector *connector); int vmw_du_connector_dpms(struct drm_connector *connector, int mode); void vmw_du_connector_save(struct drm_connector *connector); void vmw_du_connector_restore(struct drm_connector *connector); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c index 1d734de..282a0ef 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c @@ -389,6 +389,11 @@ static const struct drm_connector_funcs vmw_legacy_connector_funcs = { .atomic_get_property = vmw_du_connector_atomic_get_property, }; +static const struct +drm_connector_helper_funcs vmw_ldu_connector_helper_funcs = { + .best_encoder = vmw_du_connector_best_encoder, +}; + /* * Legacy Display Plane Functions */ @@ -555,6 +560,8 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit) DRM_ERROR("Failed to initialize connector\n"); goto err_free; } + + drm_connector_helper_add(connector, &vmw_ldu_connector_helper_funcs); connector->status = vmw_du_connector_detect(connector, true); vmw_connector_state_to_vcs(connector->state)->is_implicit = true; diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c index eca055e..e4154f1 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c @@ -608,6 +608,14 @@ static const struct drm_connector_funcs vmw_sou_connector_funcs = { .atomic_get_property = vmw_du_connector_atomic_get_property, }; + +static const struct +drm_connector_helper_funcs vmw_sou_connector_helper_funcs = { + .best_encoder = vmw_du_connector_best_encoder, +}; + + + /* * Screen Object Display Plane Functions */ @@ -827,6 +835,7 @@ static int vmw_sou_init(struct vmw_private *dev_priv, unsigned unit) goto err_free; } + drm_connector_helper_add(connector, &vmw_sou_connector_helper_funcs); connector->status = vmw_du_connector_detect(connector, true); vmw_connector_state_to_vcs(connector->state)->is_implicit = false; diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c index cce5e5b..708d063 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c @@ -1189,6 +1189,12 @@ static const struct drm_connector_funcs vmw_stdu_connector_funcs = { }; +static const struct +drm_connector_helper_funcs vmw_stdu_connector_helper_funcs = { + .best_encoder = vmw_du_connector_best_encoder, +}; + + /****************************************************************************** * Screen Target Display Plane Functions @@ -1549,6 +1555,8 @@ static int vmw_stdu_init(struct vmw_private *dev_priv, unsigned unit) DRM_ERROR("Failed to initialize connector\n"); goto err_free; } + + drm_connector_helper_add(connector, &vmw_stdu_connector_helper_funcs); connector->status = vmw_du_connector_detect(connector, false); vmw_connector_state_to_vcs(connector->state)->is_implicit = false;