From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B5FBC433EF for ; Tue, 7 Jun 2022 19:36:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4C80F10EBC4; Tue, 7 Jun 2022 19:36:10 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id AC54F10EBA3 for ; Tue, 7 Jun 2022 19:36:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654630567; 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=l9fvVlfpRHc1wluICGFZYEmBqGMknwCaw3/CMIykLk4=; b=QDeS1oGj2fcNFPsR+QFcC29MWilth32TQeXPnqn4buZtfyJRWr8qhgU1UMRBzIKLNUtc91 9TXVKonbdymhK3+GG8z8KyljYhgAPcz3OdcWGwDzV8npDW3USp0sWZPsTQvY61khE4i8zN 4ol95yHoh2tP4VyXptaEJ5cVlnXGkkA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-450-Qaw9Wa9MMXueauo6eKg78A-1; Tue, 07 Jun 2022 15:36:06 -0400 X-MC-Unique: Qaw9Wa9MMXueauo6eKg78A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EFB1D833976; Tue, 7 Jun 2022 19:35:25 +0000 (UTC) Received: from emerald.redhat.com (unknown [10.22.9.252]) by smtp.corp.redhat.com (Postfix) with ESMTP id C17992C05D2C; Tue, 7 Jun 2022 19:35:02 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [RESEND RFC 11/18] drm/nouveau/kms: Cache DP encoders in nouveau_connector Date: Tue, 7 Jun 2022 15:29:26 -0400 Message-Id: <20220607192933.1333228-12-lyude@redhat.com> In-Reply-To: <20220607192933.1333228-1-lyude@redhat.com> References: <20220607192933.1333228-1-lyude@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Ben Skeggs , Karol Herbst , open list Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- 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 22b83a6577eb..ffbd8a9cf2af 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -1368,7 +1368,7 @@ nouveau_connector_create(struct drm_device *dev, kfree(nv_connector); return ERR_PTR(ret); } - fallthrough; + break; default: funcs = &nouveau_connector_funcs; break; @@ -1422,6 +1422,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 b0773af5a98f..f468c181d9a3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.h +++ b/drivers/gpu/drm/nouveau/nouveau_connector.h @@ -127,6 +127,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.35.3