[PATCH 147/156] drm/nouveau/nvif: rework engobj "mthd" api

Ben Skeggs bskeggs at nvidia.com
Tue Apr 16 23:39:53 UTC 2024


- transition from "ioctl" interface

Signed-off-by: Ben Skeggs <bskeggs at nvidia.com>
---
 drivers/gpu/drm/nouveau/include/nvif/driverif.h  | 1 +
 drivers/gpu/drm/nouveau/nv04_fence.c             | 7 +++++--
 drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c | 9 +++++++++
 drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c   | 1 -
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/include/nvif/driverif.h b/drivers/gpu/drm/nouveau/include/nvif/driverif.h
index b25c91542e66..d8a30af9eae7 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/driverif.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/driverif.h
@@ -434,6 +434,7 @@ struct nvif_disp_impl {
 
 struct nvif_engobj_impl {
 	void (*del)(struct nvif_engobj_priv *);
+	int (*mthd)(struct nvif_engobj_priv *, u32 mthd, void *argv, u32 argc);
 };
 
 struct nvif_chan_impl {
diff --git a/drivers/gpu/drm/nouveau/nv04_fence.c b/drivers/gpu/drm/nouveau/nv04_fence.c
index 802a051428e2..45398b3a825e 100644
--- a/drivers/gpu/drm/nouveau/nv04_fence.c
+++ b/drivers/gpu/drm/nouveau/nv04_fence.c
@@ -59,8 +59,11 @@ static u32
 nv04_fence_read(struct nouveau_channel *chan)
 {
 	struct nv04_nvsw_get_ref_v0 args = {};
-	WARN_ON(nvif_object_mthd(&chan->nvsw.object, NV04_NVSW_GET_REF,
-				 &args, sizeof(args)));
+	int ret;
+
+	ret = chan->nvsw.impl->mthd(chan->nvsw.priv, NV04_NVSW_GET_REF, &args, sizeof(args));
+	WARN_ON(ret);
+
 	return args.ref;
 }
 
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c
index 6e5a0d980446..6682245e4928 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c
@@ -46,6 +46,14 @@ struct nvkm_uobj {
 	int hash;
 };
 
+static int
+nvkm_uchan_object_mthd(struct nvif_engobj_priv *priv, u32 mthd, void *argv, u32 argc)
+{
+	struct nvkm_uobj *uobj = (void *)priv;
+
+	return nvkm_object_mthd(&uobj->oproxy.base, mthd, argv, argc);
+}
+
 static void
 nvkm_uchan_object_del(struct nvif_engobj_priv *priv)
 {
@@ -59,6 +67,7 @@ nvkm_uchan_object_del(struct nvif_engobj_priv *priv)
 static const struct nvif_engobj_impl
 nvkm_uchan_object_impl = {
 	.del = nvkm_uchan_object_del,
+	.mthd = nvkm_uchan_object_mthd,
 };
 
 static int
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
index 986e8d547c94..8ecc53ff6487 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
@@ -230,7 +230,6 @@ gf100_fermi_mthd_zbc_depth(struct nvkm_object *object, void *data, u32 size)
 static int
 gf100_fermi_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size)
 {
-	nvif_ioctl(object, "fermi mthd %08x\n", mthd);
 	switch (mthd) {
 	case FERMI_A_ZBC_COLOR:
 		return gf100_fermi_mthd_zbc_color(object, data, size);
-- 
2.41.0



More information about the Nouveau mailing list