Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp976611rdb; Tue, 19 Sep 2023 16:46:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGCMT8WzDSB8pZFgnYpa2QQuL3WI4qRXJL2tN7X+76Od6n2Gtsc+kBIXZlAH3f6BeWGfGnv X-Received: by 2002:a17:90b:e8e:b0:274:9be9:7ee3 with SMTP id fv14-20020a17090b0e8e00b002749be97ee3mr1321435pjb.8.1695167182406; Tue, 19 Sep 2023 16:46:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695167182; cv=none; d=google.com; s=arc-20160816; b=VnH5oVlp2Esq+wt4OrTNyK8GhOwwKF/BUF0ZZaCya6B172snL7nizwyBhXCsUndDeo 7LKA+KOQ3qkrww9uKIrHhC1TIj6LhoNhX3EwW/ESGvFO7T4xNg2UrBvBQSlHvN2StXTJ Lv18PXijnDNDPU0nGCImroVtY2dHay4ZWSEV/C68CacBHDwpJIH5sxTkUC6Vr01jpRZn 8AzQFqnUtVyN8qCmUFngySdYba8S2PtX4bD2hltrPQdtzKtr/ZoF+GTX2IU4W/Kszues kBSzUz9DtxnYkmWw+w5n8FTBgfwyrZuNb/IHejL0NcwiUd42xjnx6YUiUmG9wo/XEGmW WgmQ== 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=SGNXwGho401OXuG8J+wfT9EaRZIHXAHAHeEbMijFI2M=; fh=AodwY8PWYSHY96qkv1Z/fYALuYBCq9SjvL4oBLQf31s=; b=klDxDowNZmeDqn1k6hr9jNL+SYsXLxlCCeElT8Bk4IjuRvNla2ntGRrnI7ZQzQAVmM 94RHJvn6OIRkuSnToRLMhjkaAx2XS4m4AFAo+8lmLotZXLyjM9Wvk3NWRIl8oEN+NWkQ 5+bShNCVpvd2Ls3OZPV4JNyVpLtrLzWmymYyuJXEEuqJ26+i1XBUPdZb8G5qya0bBKY6 9SppeTg9+Kd0Dh6HDgkbNxQVm0fuzzK+yegXkgLvMOvWV8ETl0C0YVHejLcN0SDYeeem EU6phj0SUJeS5aCaUYOq1h4f83rYf4Squrm9nShxJH8Rfxi8IxcYCZJEu6JznT8gofaV nFEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GOB8GcID; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id d15-20020a17090a2a4f00b002683f507990si265373pjg.109.2023.09.19.16.46.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 16:46:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GOB8GcID; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 5C65181ECCE1; Tue, 19 Sep 2023 15:07:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233436AbjISWGv (ORCPT + 99 others); Tue, 19 Sep 2023 18:06:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233284AbjISWGn (ORCPT ); Tue, 19 Sep 2023 18:06:43 -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 ESMTPS id 17129D7 for ; Tue, 19 Sep 2023 15:05:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695161148; 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=SGNXwGho401OXuG8J+wfT9EaRZIHXAHAHeEbMijFI2M=; b=GOB8GcIDU4M0SggP0Z2DrNzc8hBopcXEh3uHo46JPqjhidv2OL4o+P9/XMuKI3b20obHh5 uT5pO3UorVEWIY8LwHgLWkFpU1zs50OPDgpgHPFLKPPA1WaS5l8DI0KlGK3t7d/cYgm9Zc /4K3gdaulGzxbjo1IVUoCPa/45XpJ9o= 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-664-z8f89xifMaujjjgtQb7GMw-1; Tue, 19 Sep 2023 18:05:44 -0400 X-MC-Unique: z8f89xifMaujjjgtQb7GMw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A074185A5BD; Tue, 19 Sep 2023 22:05:41 +0000 (UTC) Received: from emerald.lyude.net (unknown [10.22.18.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3877A40C2064; Tue, 19 Sep 2023 22:05:41 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org Cc: Ben Skeggs , Danilo Krummrich , Karol Herbst , David Airlie , Daniel Vetter , Wayne Lin , Kees Cook , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v3 12/44] drm/nouveau/disp: add acquire_dac() Date: Tue, 19 Sep 2023 17:56:07 -0400 Message-ID: <20230919220442.202488-13-lyude@redhat.com> In-Reply-To: <20230919220442.202488-1-lyude@redhat.com> References: <20230919220442.202488-1-lyude@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 19 Sep 2023 15:07:33 -0700 (PDT) From: Ben Skeggs - preparing to move protocol-specific args out of acquire() again - avoid re-acquiring acquired output, will matter when enforced later - this one is basically just a rename Signed-off-by: Ben Skeggs Reviewed-by: Lyude Paul Acked-by: Danilo Krummrich Signed-off-by: Lyude Paul --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 3 ++- drivers/gpu/drm/nouveau/include/nvif/if0012.h | 5 ++--- drivers/gpu/drm/nouveau/include/nvif/outp.h | 9 ++++++++- drivers/gpu/drm/nouveau/nvif/outp.c | 10 +++++----- drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c | 4 ++-- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c index 290f3c80ba4eb..62fd910ffef61 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c @@ -502,7 +502,8 @@ nv50_dac_atomic_enable(struct drm_encoder *encoder, struct drm_atomic_state *sta ctrl |= NVDEF(NV507D, DAC_SET_CONTROL, PROTOCOL, RGB_CRT); - nvif_outp_acquire_rgb_crt(&nv_encoder->outp); + if (!nvif_outp_acquired(&nv_encoder->outp)) + nvif_outp_acquire_dac(&nv_encoder->outp); core->func->dac->ctrl(core, nv_encoder->outp.or.id, ctrl, asyh); asyh->or.depth = 0; diff --git a/drivers/gpu/drm/nouveau/include/nvif/if0012.h b/drivers/gpu/drm/nouveau/include/nvif/if0012.h index 6cfc885e0aa9a..d139d070c0bc6 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/if0012.h +++ b/drivers/gpu/drm/nouveau/include/nvif/if0012.h @@ -59,12 +59,11 @@ union nvif_outp_load_detect_args { union nvif_outp_acquire_args { struct nvif_outp_acquire_v0 { __u8 version; -#define NVIF_OUTP_ACQUIRE_V0_RGB_CRT 0x00 -#define NVIF_OUTP_ACQUIRE_V0_TV 0x01 +#define NVIF_OUTP_ACQUIRE_V0_DAC 0x00 #define NVIF_OUTP_ACQUIRE_V0_TMDS 0x02 #define NVIF_OUTP_ACQUIRE_V0_LVDS 0x03 #define NVIF_OUTP_ACQUIRE_V0_DP 0x04 - __u8 proto; + __u8 type; __u8 or; __u8 link; __u8 pad04[4]; diff --git a/drivers/gpu/drm/nouveau/include/nvif/outp.h b/drivers/gpu/drm/nouveau/include/nvif/outp.h index 23776057bfea8..c6d8823ef782c 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/outp.h +++ b/drivers/gpu/drm/nouveau/include/nvif/outp.h @@ -28,7 +28,7 @@ enum nvif_outp_detect_status nvif_outp_detect(struct nvif_outp *); int nvif_outp_edid_get(struct nvif_outp *, u8 **pedid); int nvif_outp_load_detect(struct nvif_outp *, u32 loadval); -int nvif_outp_acquire_rgb_crt(struct nvif_outp *); +int nvif_outp_acquire_dac(struct nvif_outp *); int nvif_outp_acquire_tmds(struct nvif_outp *, int head, bool hdmi, u8 max_ac_packet, u8 rekey, u8 scdc, bool hda); int nvif_outp_acquire_lvds(struct nvif_outp *, bool dual, bool bpc8); @@ -40,6 +40,13 @@ int nvif_outp_inherit_tmds(struct nvif_outp *outp, u8 *proto_out); int nvif_outp_inherit_dp(struct nvif_outp *outp, u8 *proto_out); void nvif_outp_release(struct nvif_outp *); + +static inline bool +nvif_outp_acquired(struct nvif_outp *outp) +{ + return outp->or.id >= 0; +} + int nvif_outp_infoframe(struct nvif_outp *, u8 type, struct nvif_outp_infoframe_v0 *, u32 size); int nvif_outp_hda_eld(struct nvif_outp *, int head, void *data, u32 size); int nvif_outp_dp_aux_pwr(struct nvif_outp *, bool enable); diff --git a/drivers/gpu/drm/nouveau/nvif/outp.c b/drivers/gpu/drm/nouveau/nvif/outp.c index eecccfc17c1c6..41c4de40895f0 100644 --- a/drivers/gpu/drm/nouveau/nvif/outp.c +++ b/drivers/gpu/drm/nouveau/nvif/outp.c @@ -171,12 +171,12 @@ nvif_outp_release(struct nvif_outp *outp) } static inline int -nvif_outp_acquire(struct nvif_outp *outp, u8 proto, struct nvif_outp_acquire_v0 *args) +nvif_outp_acquire(struct nvif_outp *outp, u8 type, struct nvif_outp_acquire_v0 *args) { int ret; args->version = 0; - args->proto = proto; + args->type = type; ret = nvif_mthd(&outp->object, NVIF_OUTP_V0_ACQUIRE, args, sizeof(*args)); if (ret) @@ -188,13 +188,13 @@ nvif_outp_acquire(struct nvif_outp *outp, u8 proto, struct nvif_outp_acquire_v0 } int -nvif_outp_acquire_rgb_crt(struct nvif_outp *outp) +nvif_outp_acquire_dac(struct nvif_outp *outp) { struct nvif_outp_acquire_v0 args; int ret; - ret = nvif_outp_acquire(outp, NVIF_OUTP_ACQUIRE_V0_RGB_CRT, &args); - NVIF_ERRON(ret, &outp->object, "[ACQUIRE proto:RGB_CRT] or:%d", args.or); + ret = nvif_outp_acquire(outp, NVIF_OUTP_ACQUIRE_V0_DAC, &args); + NVIF_ERRON(ret, &outp->object, "[ACQUIRE DAC] or:%d", args.or); return ret; } diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c index d56a87ae5b265..73c6227446fb8 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c @@ -217,8 +217,8 @@ nvkm_uoutp_mthd_acquire(struct nvkm_outp *outp, void *argv, u32 argc) if (outp->ior) return -EBUSY; - switch (args->v0.proto) { - case NVIF_OUTP_ACQUIRE_V0_RGB_CRT: + switch (args->v0.type) { + case NVIF_OUTP_ACQUIRE_V0_DAC: ret = nvkm_outp_acquire_or(outp, NVKM_OUTP_USER, false); break; case NVIF_OUTP_ACQUIRE_V0_TMDS: -- 2.41.0