Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5341982rwb; Mon, 8 Aug 2022 17:24:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR5bl+AMPjy5LhhdMUBMculMewh0Oe7Mqd5GRZirjTNd4H/v5fNDPMweecWBVR/Vxg5oJjWE X-Received: by 2002:a17:90b:224e:b0:1f4:ebed:16f6 with SMTP id hk14-20020a17090b224e00b001f4ebed16f6mr22894395pjb.17.1660004692538; Mon, 08 Aug 2022 17:24:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660004692; cv=none; d=google.com; s=arc-20160816; b=BL9VrCBCb1/LyQyy1cK35ni88EZ5C6tIRjoV9PYpPV4W2mYh3LpCkeowxMOWnUIVkK fxTT5iVEFJmK7yciN/vGaxTIdVCe0zikvJx1sO934//OqNdlWT45K0bVJSAStmIY2ujW JldvsGL64VxFqzYDEqJf9QpvynrhOmPjmmtjxERLZ1mEvGYb9ahP/1Hvi+nHUdn3fFXt Etgi6sY8LdWqjQJwRZnVPEpB5GznfcJ8ai5pcS6oIpqKXuR36NrlCCmqURGcPK5VoEnC 0b81L0lSncZDj5shMAzOz+8lH4OIhaO5596mtUSGkFfgW9cnWJNoIF77THQUNVlDkYhN qkuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=faeZcQ6XXvNVofIu9f1DXkDWsvpbTufhnASKSvVU4UU=; b=fhtgWe50E2ld1qFYfAvUw+J3fWa/1hV1WZLvk6RlUXh2J+OwYpPCT4qtwLzNwTyR+6 EdAF7eIDSU1OV1rqogmaA3bmQLAf4iVL5jOdsZxWZkIVoSlLVnzJQKYf2Qz7mOBFp0bZ bjYFyglOp/k8M4u2BDW8sFergpCYRfMGtQpPri7JMCAhMBz55Lu7LlYzmkv+NEGFKX1G sUL1iY1BRibFWXAtgzKcq4On0hYAncurXqw16baMEKsaj5Gyc9+ypTlqfTfxhxwCkSBS St2RS9Zz4fuTiQy1Ss5D2bjrCh37ba+SbxHzForR7ssZwhnMhAXGpFVu2/Bf60+SfG07 qe3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fy2+vLBm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v202-20020a6361d3000000b004160307346esi6640708pgb.687.2022.08.08.17.24.38; Mon, 08 Aug 2022 17:24:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fy2+vLBm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244631AbiHHXz3 (ORCPT + 99 others); Mon, 8 Aug 2022 19:55:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244524AbiHHXzM (ORCPT ); Mon, 8 Aug 2022 19:55:12 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D7ED01CB22 for ; Mon, 8 Aug 2022 16:54:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660002893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=faeZcQ6XXvNVofIu9f1DXkDWsvpbTufhnASKSvVU4UU=; b=fy2+vLBmfikrPY+/cchzt5SZG4YE0C/ef54DlA0ql+zu84wyatlMC5dwf93K90jjsFyavF z76O/QjBOcztqw1iZ1g9CG3guQr9NtY/a0STgUhBzWttiaalGCsm0XLQHmuOwZ/OxHOdch Pe/uOLRAWXfQS6xSRnC/LJE4mel9qqw= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-438-bjZuMN3cP2y2liQof0grlw-1; Mon, 08 Aug 2022 19:54:50 -0400 X-MC-Unique: bjZuMN3cP2y2liQof0grlw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2F216293248A; Mon, 8 Aug 2022 23:54:50 +0000 (UTC) Received: from emerald.lyude.net (unknown [10.22.17.154]) by smtp.corp.redhat.com (Postfix) with ESMTP id C1999C15BA1; Mon, 8 Aug 2022 23:54:49 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: Jani Nikula , Ben Skeggs , Karol Herbst , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org (open list) Subject: [RFC v2 11/18] drm/nouveau/kms: Cache DP encoders in nouveau_connector Date: Mon, 8 Aug 2022 19:51:56 -0400 Message-Id: <20220808235203.123892-12-lyude@redhat.com> In-Reply-To: <20220808235203.123892-1-lyude@redhat.com> References: <20220808235203.123892-1-lyude@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Post-NV50, the only kind of encoder you'll find for DP connectors on Nvidia GPUs are SORs (serial output resources). Because SORs have fixed associations with their connectors, we can correctly assume that any DP connector on a nvidia GPU will have exactly one SOR encoder routed to it for DisplayPort. Since we're going to need to be able to retrieve this fixed SOR DP encoder much more often as a result of hooking up MST helpers for tracking SST<->MST transitions in atomic states, let's simply cache this encoder in nouveau_connector for any DP connectors on the system to avoid looking it up each time. This isn't safe for NV50 since PIORs then come into play, however there's no code pre-NV50 that would need to look this up anyhow - so it's not really an issue. Signed-off-by: Lyude Paul Acked-by: Jani Nikula --- drivers/gpu/drm/nouveau/nouveau_connector.c | 4 +++- drivers/gpu/drm/nouveau/nouveau_connector.h | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 43a9d1e1cf71..bdaec3427f14 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -1367,7 +1367,7 @@ nouveau_connector_create(struct drm_device *dev, return ERR_PTR(-ENOMEM); } drm_dp_aux_init(&nv_connector->aux); - fallthrough; + break; default: funcs = &nouveau_connector_funcs; break; @@ -1430,6 +1430,8 @@ nouveau_connector_create(struct drm_device *dev, switch (type) { case DRM_MODE_CONNECTOR_DisplayPort: + nv_connector->dp_encoder = find_encoder(&nv_connector->base, DCB_OUTPUT_DP); + fallthrough; case DRM_MODE_CONNECTOR_eDP: drm_dp_cec_register_connector(&nv_connector->aux, connector); break; diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.h b/drivers/gpu/drm/nouveau/nouveau_connector.h index 4bf0c703eee7..f4e17ff68bf9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.h +++ b/drivers/gpu/drm/nouveau/nouveau_connector.h @@ -128,6 +128,9 @@ struct nouveau_connector { struct drm_dp_aux aux; + /* The fixed DP encoder for this connector, if there is one */ + struct nouveau_encoder *dp_encoder; + int dithering_mode; int scaling_mode; -- 2.37.1