From patchwork Wed Sep 5 18:16:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10589255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 15C88920 for ; Wed, 5 Sep 2018 18:16:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E6EC2A830 for ; Wed, 5 Sep 2018 18:16:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 027C02A833; Wed, 5 Sep 2018 18:16:23 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 8DA082A830 for ; Wed, 5 Sep 2018 18:16:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EDC1C89E9E; Wed, 5 Sep 2018 18:16:22 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by gabe.freedesktop.org (Postfix) with ESMTPS id D74C16E52C for ; Wed, 5 Sep 2018 18:16:21 +0000 (UTC) Received: by mail-ed1-x542.google.com with SMTP id s10-v6so6814504edb.11 for ; Wed, 05 Sep 2018 11:16:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iaaLOimjf3+wd+WLTo5W/WvI/j/WOIsHElpn5FK/Z20=; b=nAeaXpEpU/jMHdM1F+GVOyGNsnjAYjobOFy3iI0/vNdjucYB1c9vrb667fLnQkQRLP bT5yEEiTJzmesa4Llo3MDokS8fDRo+9zyjpqi8POglV1TInzAGyUP/RQqxI1Bef1+b/X UTizKqoB9mD7ovjFl4HU2aL5TDc8bDsBXMxpxEhmABrWnOj7NKUnmoX06aUg/7KvvROM D/3GZeI3Xf9O5k9RPPmP3ApIqSDAgu0P6g6GbOrfPoz8MKAnnR3LpPDOZWYomLLGZ9aI GtGEHHLAxB3g0pPLwPzl2ZokNABeAXfUcLLFbK/ppY/WywF4uWT4oo0NRRc6TZ6wEIti uS/w== X-Gm-Message-State: APzg51BKqKlTHSUg+Vw1SppWrvG5qyo8XZYuHJREL52e0iXIDaiJWJrA 99p9IYbvfOvxtz2NTYzn+fxPCcwL5AI/nw== X-Google-Smtp-Source: ANB0VdbJMVjpfwYEtY86LXtu/vxgkOFYB8NULobUcYn4bRBQmH/8hZsM9I0UChsSOi64dCBzz2om1Q== X-Received: by 2002:aa7:c699:: with SMTP id n25-v6mr1315257edq.302.1536171380258; Wed, 05 Sep 2018 11:16:20 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id b44-v6sm3292127edd.93.2018.09.05.11.16.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Sep 2018 11:16:16 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Wed, 5 Sep 2018 20:16:09 +0200 Message-Id: <20180905181609.19758-1-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.19.0.rc1 In-Reply-To: <20180905152229.19281-1-daniel.vetter@ffwll.ch> References: <20180905152229.19281-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm/amdgpu: Remove default best_encoder hook from DC X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrey Grodzovsky , "Leo \(Sunpeng\) Li" , Daniel Vetter , DRI Development , Shirish S , Tony Cheng , Alex Deucher , Daniel Vetter , Harry Wentland Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP For atomic driver this is the default, no need to reimplement it. We still need to keep the copypasta for not-atomic drivers though, since no one polished the legacy crtc helpers as much as the atomic ones. v2: amdgpu uses ->best_encoder internally, give it a local copy. It might be a good idea to merge the connector and encoder into one amdgpu_dm_sink structure, that might match DC internals better. At least for non-DPMST outputs. Kudos to Ville for spotting this. Cc: Ville Syrjälä Signed-off-by: Daniel Vetter Cc: Alex Deucher Cc: Harry Wentland Cc: Andrey Grodzovsky Cc: Tony Cheng Cc: "Leo (Sunpeng) Li" Cc: Shirish S --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 36 ++++--------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index af6adffba788..cbc84b7469eb 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -2794,28 +2794,6 @@ static const struct drm_connector_funcs amdgpu_dm_connector_funcs = { .atomic_get_property = amdgpu_dm_connector_atomic_get_property }; -static struct drm_encoder *best_encoder(struct drm_connector *connector) -{ - int enc_id = connector->encoder_ids[0]; - struct drm_mode_object *obj; - struct drm_encoder *encoder; - - DRM_DEBUG_DRIVER("Finding the best encoder\n"); - - /* pick the encoder ids */ - if (enc_id) { - obj = drm_mode_object_find(connector->dev, NULL, enc_id, DRM_MODE_OBJECT_ENCODER); - if (!obj) { - DRM_ERROR("Couldn't find a matching encoder for our connector\n"); - return NULL; - } - encoder = obj_to_encoder(obj); - return encoder; - } - DRM_ERROR("No encoder id\n"); - return NULL; -} - static int get_modes(struct drm_connector *connector) { return amdgpu_dm_connector_get_modes(connector); @@ -2934,7 +2912,6 @@ amdgpu_dm_connector_helper_funcs = { */ .get_modes = get_modes, .mode_valid = amdgpu_dm_connector_mode_valid, - .best_encoder = best_encoder }; static void dm_crtc_helper_disable(struct drm_crtc *crtc) @@ -3332,14 +3309,17 @@ static int to_drm_connector_type(enum signal_type st) } } +static struct drm_encoder *amdgpu_dm_connector_to_encoder(struct drm_connector *connector) +{ + return drm_encoder_find(connector->dev, NULL, connector->encoder_ids[0]); +} + static void amdgpu_dm_get_native_mode(struct drm_connector *connector) { - const struct drm_connector_helper_funcs *helper = - connector->helper_private; struct drm_encoder *encoder; struct amdgpu_encoder *amdgpu_encoder; - encoder = helper->best_encoder(connector); + encoder = amdgpu_dm_connector_to_encoder(connector); if (encoder == NULL) return; @@ -3466,14 +3446,12 @@ static void amdgpu_dm_connector_ddc_get_modes(struct drm_connector *connector, static int amdgpu_dm_connector_get_modes(struct drm_connector *connector) { - const struct drm_connector_helper_funcs *helper = - connector->helper_private; struct amdgpu_dm_connector *amdgpu_dm_connector = to_amdgpu_dm_connector(connector); struct drm_encoder *encoder; struct edid *edid = amdgpu_dm_connector->edid; - encoder = helper->best_encoder(connector); + encoder = amdgpu_dm_connector_to_encoder(connector); if (!edid || !drm_edid_is_valid(edid)) { drm_add_modes_noedid(connector, 640, 480);