mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lyude Paul <lyude@redhat.com>
To: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org
Cc: Ben Skeggs <bskeggs@redhat.com>, Danilo Krummrich <me@dakr.org>,
	Karol Herbst <kherbst@redhat.com>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH v3 11/44] drm/nouveau/disp: shuffle to make upcoming diffs prettier
Date: Tue, 19 Sep 2023 17:56:06 -0400	[thread overview]
Message-ID: <20230919220442.202488-12-lyude@redhat.com> (raw)
In-Reply-To: <20230919220442.202488-1-lyude@redhat.com>

From: Ben Skeggs <bskeggs@redhat.com>

- preparing to move protocol-specific args out of acquire() again
- no code changes

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Acked-by: Danilo Krummrich <me@dakr.org>
Signed-off-by: Lyude Paul <lyude@redhat.com>
---
 drivers/gpu/drm/nouveau/nvif/outp.c           | 106 +++++++++---------
 .../gpu/drm/nouveau/nvkm/engine/disp/uoutp.c  |  74 ++++++------
 2 files changed, 91 insertions(+), 89 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvif/outp.c b/drivers/gpu/drm/nouveau/nvif/outp.c
index 795658f0c920c..eecccfc17c1c6 100644
--- a/drivers/gpu/drm/nouveau/nvif/outp.c
+++ b/drivers/gpu/drm/nouveau/nvif/outp.c
@@ -54,6 +54,28 @@ nvif_outp_dp_retrain(struct nvif_outp *outp)
 	return ret;
 }
 
+static inline int nvif_outp_acquire(struct nvif_outp *, u8, struct nvif_outp_acquire_v0 *);
+
+int
+nvif_outp_acquire_dp(struct nvif_outp *outp, u8 dpcd[DP_RECEIVER_CAP_SIZE],
+		     int link_nr, int link_bw, bool hda, bool mst)
+{
+	struct nvif_outp_acquire_v0 args;
+	int ret;
+
+	args.dp.link_nr = link_nr;
+	args.dp.link_bw = link_bw;
+	args.dp.hda = hda;
+	args.dp.mst = mst;
+	memcpy(args.dp.dpcd, dpcd, sizeof(args.dp.dpcd));
+
+	ret = nvif_outp_acquire(outp, NVIF_OUTP_ACQUIRE_V0_DP, &args);
+	NVIF_ERRON(ret, &outp->object,
+		   "[ACQUIRE proto:DP link_nr:%d link_bw:%02x hda:%d mst:%d] or:%d link:%d",
+		   args.dp.link_nr, args.dp.link_bw, args.dp.hda, args.dp.mst, args.or, args.link);
+	return ret;
+}
+
 int
 nvif_outp_dp_aux_pwr(struct nvif_outp *outp, bool enable)
 {
@@ -101,48 +123,26 @@ nvif_outp_infoframe(struct nvif_outp *outp, u8 type, struct nvif_outp_infoframe_
 	return ret;
 }
 
-void
-nvif_outp_release(struct nvif_outp *outp)
-{
-	int ret = nvif_mthd(&outp->object, NVIF_OUTP_V0_RELEASE, NULL, 0);
-	NVIF_ERRON(ret, &outp->object, "[RELEASE]");
-	outp->or.id = -1;
-}
-
-static inline int
-nvif_outp_acquire(struct nvif_outp *outp, u8 proto, struct nvif_outp_acquire_v0 *args)
-{
-	int ret;
-
-	args->version = 0;
-	args->proto = proto;
-
-	ret = nvif_mthd(&outp->object, NVIF_OUTP_V0_ACQUIRE, args, sizeof(*args));
-	if (ret)
-		return ret;
-
-	outp->or.id = args->or;
-	outp->or.link = args->link;
-	return 0;
-}
-
 int
-nvif_outp_acquire_dp(struct nvif_outp *outp, u8 dpcd[DP_RECEIVER_CAP_SIZE],
-		     int link_nr, int link_bw, bool hda, bool mst)
+nvif_outp_acquire_tmds(struct nvif_outp *outp, int head,
+		       bool hdmi, u8 max_ac_packet, u8 rekey, u8 scdc, bool hda)
 {
 	struct nvif_outp_acquire_v0 args;
 	int ret;
 
-	args.dp.link_nr = link_nr;
-	args.dp.link_bw = link_bw;
-	args.dp.hda = hda;
-	args.dp.mst = mst;
-	memcpy(args.dp.dpcd, dpcd, sizeof(args.dp.dpcd));
+	args.tmds.head = head;
+	args.tmds.hdmi = hdmi;
+	args.tmds.hdmi_max_ac_packet = max_ac_packet;
+	args.tmds.hdmi_rekey = rekey;
+	args.tmds.hdmi_scdc = scdc;
+	args.tmds.hdmi_hda = hda;
 
-	ret = nvif_outp_acquire(outp, NVIF_OUTP_ACQUIRE_V0_DP, &args);
+	ret = nvif_outp_acquire(outp, NVIF_OUTP_ACQUIRE_V0_TMDS, &args);
 	NVIF_ERRON(ret, &outp->object,
-		   "[ACQUIRE proto:DP link_nr:%d link_bw:%02x hda:%d mst:%d] or:%d link:%d",
-		   args.dp.link_nr, args.dp.link_bw, args.dp.hda, args.dp.mst, args.or, args.link);
+		   "[ACQUIRE proto:TMDS head:%d hdmi:%d max_ac_packet:%d rekey:%d scdc:%d hda:%d]"
+		   " or:%d link:%d", args.tmds.head, args.tmds.hdmi, args.tmds.hdmi_max_ac_packet,
+		   args.tmds.hdmi_rekey, args.tmds.hdmi_scdc, args.tmds.hdmi_hda,
+		   args.or, args.link);
 	return ret;
 }
 
@@ -162,27 +162,29 @@ nvif_outp_acquire_lvds(struct nvif_outp *outp, bool dual, bool bpc8)
 	return ret;
 }
 
-int
-nvif_outp_acquire_tmds(struct nvif_outp *outp, int head,
-		       bool hdmi, u8 max_ac_packet, u8 rekey, u8 scdc, bool hda)
+void
+nvif_outp_release(struct nvif_outp *outp)
+{
+	int ret = nvif_mthd(&outp->object, NVIF_OUTP_V0_RELEASE, NULL, 0);
+	NVIF_ERRON(ret, &outp->object, "[RELEASE]");
+	outp->or.id = -1;
+}
+
+static inline int
+nvif_outp_acquire(struct nvif_outp *outp, u8 proto, struct nvif_outp_acquire_v0 *args)
 {
-	struct nvif_outp_acquire_v0 args;
 	int ret;
 
-	args.tmds.head = head;
-	args.tmds.hdmi = hdmi;
-	args.tmds.hdmi_max_ac_packet = max_ac_packet;
-	args.tmds.hdmi_rekey = rekey;
-	args.tmds.hdmi_scdc = scdc;
-	args.tmds.hdmi_hda = hda;
+	args->version = 0;
+	args->proto = proto;
 
-	ret = nvif_outp_acquire(outp, NVIF_OUTP_ACQUIRE_V0_TMDS, &args);
-	NVIF_ERRON(ret, &outp->object,
-		   "[ACQUIRE proto:TMDS head:%d hdmi:%d max_ac_packet:%d rekey:%d scdc:%d hda:%d]"
-		   " or:%d link:%d", args.tmds.head, args.tmds.hdmi, args.tmds.hdmi_max_ac_packet,
-		   args.tmds.hdmi_rekey, args.tmds.hdmi_scdc, args.tmds.hdmi_hda,
-		   args.or, args.link);
-	return ret;
+	ret = nvif_mthd(&outp->object, NVIF_OUTP_V0_ACQUIRE, args, sizeof(*args));
+	if (ret)
+		return ret;
+
+	outp->or.id = args->or;
+	outp->or.link = args->link;
+	return 0;
 }
 
 int
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c
index 31b76f17fa70a..d56a87ae5b265 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c
@@ -57,6 +57,23 @@ nvkm_uoutp_mthd_dp_retrain(struct nvkm_outp *outp, void *argv, u32 argc)
 	return outp->func->acquire(outp);
 }
 
+static int
+nvkm_uoutp_mthd_acquire_dp(struct nvkm_outp *outp, u8 dpcd[DP_RECEIVER_CAP_SIZE],
+			   u8 link_nr, u8 link_bw, bool hda, bool mst)
+{
+	int ret;
+
+	ret = nvkm_outp_acquire_or(outp, NVKM_OUTP_USER, hda);
+	if (ret)
+		return ret;
+
+	memcpy(outp->dp.dpcd, dpcd, sizeof(outp->dp.dpcd));
+	outp->dp.lt.nr = link_nr;
+	outp->dp.lt.bw = link_bw;
+	outp->dp.lt.mst = mst;
+	return 0;
+}
+
 static int
 nvkm_uoutp_mthd_dp_aux_pwr(struct nvkm_outp *outp, void *argv, u32 argc)
 {
@@ -125,43 +142,6 @@ nvkm_uoutp_mthd_infoframe(struct nvkm_outp *outp, void *argv, u32 argc)
 	return -EINVAL;
 }
 
-static int
-nvkm_uoutp_mthd_release(struct nvkm_outp *outp, void *argv, u32 argc)
-{
-	struct nvkm_head *head = outp->asy.head;
-	struct nvkm_ior *ior = outp->ior;
-	union nvif_outp_release_args *args = argv;
-
-	if (argc != sizeof(args->vn))
-		return -ENOSYS;
-
-	if (ior->func->hdmi && head) {
-		ior->func->hdmi->infoframe_avi(ior, head->id, NULL, 0);
-		ior->func->hdmi->infoframe_vsi(ior, head->id, NULL, 0);
-		ior->func->hdmi->ctrl(ior, head->id, false, 0, 0);
-	}
-
-	nvkm_outp_release(outp);
-	return 0;
-}
-
-static int
-nvkm_uoutp_mthd_acquire_dp(struct nvkm_outp *outp, u8 dpcd[DP_RECEIVER_CAP_SIZE],
-			   u8 link_nr, u8 link_bw, bool hda, bool mst)
-{
-	int ret;
-
-	ret = nvkm_outp_acquire_or(outp, NVKM_OUTP_USER, hda);
-	if (ret)
-		return ret;
-
-	memcpy(outp->dp.dpcd, dpcd, sizeof(outp->dp.dpcd));
-	outp->dp.lt.nr = link_nr;
-	outp->dp.lt.bw = link_bw;
-	outp->dp.lt.mst = mst;
-	return 0;
-}
-
 static int
 nvkm_uoutp_mthd_acquire_tmds(struct nvkm_outp *outp, u8 head, u8 hdmi, u8 hdmi_max_ac_packet,
 			     u8 hdmi_rekey, u8 hdmi_scdc, u8 hdmi_hda)
@@ -206,6 +186,26 @@ nvkm_uoutp_mthd_acquire_lvds(struct nvkm_outp *outp, bool dual, bool bpc8)
 	return nvkm_outp_acquire_or(outp, NVKM_OUTP_USER, false);
 }
 
+static int
+nvkm_uoutp_mthd_release(struct nvkm_outp *outp, void *argv, u32 argc)
+{
+	struct nvkm_head *head = outp->asy.head;
+	struct nvkm_ior *ior = outp->ior;
+	union nvif_outp_release_args *args = argv;
+
+	if (argc != sizeof(args->vn))
+		return -ENOSYS;
+
+	if (ior->func->hdmi && head) {
+		ior->func->hdmi->infoframe_avi(ior, head->id, NULL, 0);
+		ior->func->hdmi->infoframe_vsi(ior, head->id, NULL, 0);
+		ior->func->hdmi->ctrl(ior, head->id, false, 0, 0);
+	}
+
+	nvkm_outp_release(outp);
+	return 0;
+}
+
 static int
 nvkm_uoutp_mthd_acquire(struct nvkm_outp *outp, void *argv, u32 argc)
 {
-- 
2.41.0


  parent reply	other threads:[~2023-09-19 22:06 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230919220442.202488-1-lyude@redhat.com>
2023-09-19 21:55 ` [PATCH v3 01/44] drm/nouveau/devinit/tu102-: remove attempt at loading PreOS Lyude Paul
2023-09-19 21:55 ` [PATCH v3 02/44] drm/nouveau/imem: support allocations not preserved across suspend Lyude Paul
2023-09-19 21:55 ` [PATCH v3 03/44] drm/nouveau/gr/gf100-: lose contents of global ctxbufs " Lyude Paul
2023-09-19 21:55 ` [PATCH v3 04/44] drm/nouveau/mmu/gp100-: always invalidate TLBs at CACHE_LEVEL_ALL Lyude Paul
2023-09-19 21:56 ` [PATCH v3 05/44] drm/nouveau/kms/nv50-: fix mst payload alloc fail crashing evo Lyude Paul
2023-09-19 21:56 ` [PATCH v3 06/44] drm/nouveau/disp: rearrange output methods Lyude Paul
2023-09-19 21:56 ` [PATCH v3 07/44] drm/nouveau/disp: add output detect method Lyude Paul
2023-09-19 21:56 ` [PATCH v3 08/44] drm/nouveau/disp: add output method to fetch edid Lyude Paul
2023-09-19 21:56 ` [PATCH v3 09/44] drm/nouveau/disp: rename internal output acquire/release functions Lyude Paul
2023-09-19 21:56 ` [PATCH v3 10/44] drm/nouveau/kms: Add INHERIT ioctl to nvkm/nvif for reading IOR state Lyude Paul
2023-09-19 21:56 ` Lyude Paul [this message]
2023-09-19 21:56 ` [PATCH v3 12/44] drm/nouveau/disp: add acquire_dac() Lyude Paul
2023-09-19 21:56 ` [PATCH v3 13/44] drm/nouveau/disp: add acquire_sor/pior() Lyude Paul
2023-09-19 21:56 ` [PATCH v3 14/44] drm/nouveau/disp: update SOR routing immediately on acquire() Lyude Paul
2023-09-19 21:56 ` [PATCH v3 15/44] drm/nouveau/kms/nv50-: pull some common init out of OR-specific code Lyude Paul
2023-09-19 21:56 ` [PATCH v3 16/44] drm/nouveau/kms/nv50-: remove nv_encoder.audio.connector Lyude Paul
2023-09-19 21:56 ` [PATCH v3 17/44] drm/nouveau/kms/nv50-: keep output state around until modeset complete Lyude Paul
2023-09-19 21:56 ` [PATCH v3 18/44] drm/nouveau/kms/nv50-: move audio enable post-modeset Lyude Paul
2023-09-19 21:56 ` [PATCH v3 19/44] drm/nouveau/disp: add output hdmi config method Lyude Paul
2023-09-19 21:56 ` [PATCH v3 20/44] drm/nouveau/disp: move hdmi disable out of release() Lyude Paul
2023-09-19 21:56 ` [PATCH v3 21/44] drm/nouveau/disp: release outputs post-modeset Lyude Paul
2023-09-19 21:56 ` [PATCH v3 22/44] drm/nouveau/disp: remove SOR routing updates from supervisor Lyude Paul
2023-09-19 21:56 ` [PATCH v3 23/44] drm/nouveau/disp: add output backlight control methods Lyude Paul
2023-09-20 19:29   ` [Nouveau] " Timur Tabi
2023-09-19 21:56 ` [PATCH v3 24/44] drm/nouveau/disp: add output lvds config method Lyude Paul
2023-09-19 21:56 ` [PATCH v3 25/44] drm/nouveau/disp: add hdmi audio hal function Lyude Paul
2023-09-19 21:56 ` [PATCH v3 26/44] drm/nouveau/disp: move dp aux pwr method to HAL Lyude Paul
2023-09-19 21:56 ` [PATCH v3 27/44] drm/nouveau/disp: add dp aux xfer method Lyude Paul
2023-09-19 21:56 ` [PATCH v3 28/44] drm/nouveau/disp: add dp rates method Lyude Paul
2023-09-19 21:56 ` [PATCH v3 29/44] drm/nouveau/kms/nv50-: split DP disable+enable into two modesets Lyude Paul
2023-09-19 21:56 ` [PATCH v3 30/44] drm/nouveau/kms/nv50-: flush mst disables together Lyude Paul
2023-09-19 21:56 ` [PATCH v3 31/44] drm/nouveau/kms/nv50-: fixup sink D3 before tearing down link Lyude Paul
2023-09-19 21:56 ` [PATCH v3 32/44] drm/nouveau/disp: add dp train method Lyude Paul
2023-09-19 21:56 ` [PATCH v3 33/44] drm/nouveau/disp: move link training out of supervisor Lyude Paul
2023-09-19 21:56 ` [PATCH v3 34/44] drm/nouveau/disp: add dp sst config method Lyude Paul
2023-09-19 21:56 ` [PATCH v3 35/44] drm/nouveau/disp: add dp mst id get/put methods Lyude Paul
2023-09-19 21:56 ` [PATCH v3 36/44] drm/nouveau/disp: move outp/conn construction to chipset code Lyude Paul
2023-09-19 21:56 ` [PATCH v3 37/44] drm/nouveau/disp: move outp init/fini paths " Lyude Paul
2023-09-19 21:56 ` [PATCH v3 38/44] drm/nouveau/disp/nv50-: skip DCB_OUTPUT_TV Lyude Paul
2023-09-19 21:56 ` [PATCH v3 39/44] drm/nouveau/kms/nv50-: create heads based on nvkm head mask Lyude Paul
2023-09-19 21:56 ` [PATCH v3 40/44] drm/nouveau/kms/nv50-: create heads after outps/conns Lyude Paul
2023-09-20 21:28   ` [Nouveau] " Timur Tabi
2023-09-19 21:56 ` [PATCH v3 41/44] drm/nouveau/kms/nv50-: name aux channels after their connector Lyude Paul
2023-09-19 21:56 ` [PATCH v3 42/44] drm/nouveau/kms/nv50-: create connectors based on nvkm info Lyude Paul
2023-09-20 21:33   ` [Nouveau] " Timur Tabi
2023-09-19 21:56 ` [PATCH v3 43/44] drm/nouveau/kms/nv50-: create outputs " Lyude Paul
2023-09-19 21:56 ` [PATCH v3 44/44] drm/nouveau/kms/nv50-: disable dcb parsing Lyude Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230919220442.202488-12-lyude@redhat.com \
    --to=lyude@redhat.com \
    --cc=airlied@gmail.com \
    --cc=bskeggs@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kherbst@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=me@dakr.org \
    --cc=nouveau@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®