Blob Blame History Raw
From bbf0cbcd945ed10cd5a88832824a37d3a7da683c Mon Sep 17 00:00:00 2001
From: Ben Skeggs <bskeggs@redhat.com>
Date: Sun, 21 Jun 2020 09:20:29 +1000
Subject: drm/nouveau/kms/nv50-: convert core head_ovly() to new push macros
Git-commit: db2a20693ef9e3cd1d7a2b6c5695f572b29b1251
Patch-mainline: v5.9-rc1
References: jsc#SLE-12680, jsc#SLE-12880, jsc#SLE-12882, jsc#SLE-12883, jsc#SLE-13496, jsc#SLE-15322

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Patrik Jakobsson <pjakobsson@suse.de>
---
 drivers/gpu/drm/nouveau/dispnv50/head.h     |  6 +++---
 drivers/gpu/drm/nouveau/dispnv50/head507d.c | 17 +++++++++--------
 drivers/gpu/drm/nouveau/dispnv50/head907d.c | 17 +++++++++--------
 3 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.h b/drivers/gpu/drm/nouveau/dispnv50/head.h
index d8d6cf798769..b5b08b4a6cf7 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/head.h
+++ b/drivers/gpu/drm/nouveau/dispnv50/head.h
@@ -42,7 +42,7 @@ struct nv50_head_func {
 	int (*curs_set)(struct nv50_head *, struct nv50_head_atom *);
 	int (*curs_clr)(struct nv50_head *);
 	int (*base)(struct nv50_head *, struct nv50_head_atom *);
-	void (*ovly)(struct nv50_head *, struct nv50_head_atom *);
+	int (*ovly)(struct nv50_head *, struct nv50_head_atom *);
 	void (*dither)(struct nv50_head *, struct nv50_head_atom *);
 	void (*procamp)(struct nv50_head *, struct nv50_head_atom *);
 	void (*or)(struct nv50_head *, struct nv50_head_atom *);
@@ -60,7 +60,7 @@ int head507d_curs_layout(struct nv50_head *, struct nv50_wndw_atom *,
 int head507d_curs_format(struct nv50_head *, struct nv50_wndw_atom *,
 			 struct nv50_head_atom *);
 int head507d_base(struct nv50_head *, struct nv50_head_atom *);
-void head507d_ovly(struct nv50_head *, struct nv50_head_atom *);
+int head507d_ovly(struct nv50_head *, struct nv50_head_atom *);
 void head507d_dither(struct nv50_head *, struct nv50_head_atom *);
 void head507d_procamp(struct nv50_head *, struct nv50_head_atom *);
 
@@ -76,7 +76,7 @@ int head907d_core_set(struct nv50_head *, struct nv50_head_atom *);
 int head907d_core_clr(struct nv50_head *);
 int head907d_curs_set(struct nv50_head *, struct nv50_head_atom *);
 int head907d_curs_clr(struct nv50_head *);
-void head907d_ovly(struct nv50_head *, struct nv50_head_atom *);
+int head907d_ovly(struct nv50_head *, struct nv50_head_atom *);
 void head907d_procamp(struct nv50_head *, struct nv50_head_atom *);
 void head907d_or(struct nv50_head *, struct nv50_head_atom *);
 
diff --git a/drivers/gpu/drm/nouveau/dispnv50/head507d.c b/drivers/gpu/drm/nouveau/dispnv50/head507d.c
index 3e56c3da504b..16598e100795 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/head507d.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/head507d.c
@@ -51,12 +51,13 @@ head507d_dither(struct nv50_head *head, struct nv50_head_atom *asyh)
 	}
 }
 
-void
+int
 head507d_ovly(struct nv50_head *head, struct nv50_head_atom *asyh)
 {
-	struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
+	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
+	const int i = head->base.index;
 	u32 bounds = 0;
-	u32 *push;
+	int ret;
 
 	if (asyh->ovly.cpp) {
 		switch (asyh->ovly.cpp) {
@@ -71,11 +72,11 @@ head507d_ovly(struct nv50_head *head, struct nv50_head_atom *asyh)
 		bounds |= 0x00000100;
 	}
 
-	if ((push = evo_wait(core, 2))) {
-		evo_mthd(push, 0x0904 + head->base.index * 0x400, 1);
-		evo_data(push, bounds);
-		evo_kick(push, core);
-	}
+	if ((ret = PUSH_WAIT(push, 2)))
+		return ret;
+
+	PUSH_NVSQ(push, NV507D, 0x0904 + (i * 0x400), bounds);
+	return 0;
 }
 
 int
diff --git a/drivers/gpu/drm/nouveau/dispnv50/head907d.c b/drivers/gpu/drm/nouveau/dispnv50/head907d.c
index a7202794d9c4..fe5f1a9d59b3 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/head907d.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/head907d.c
@@ -75,12 +75,13 @@ head907d_dither(struct nv50_head *head, struct nv50_head_atom *asyh)
 	}
 }
 
-void
+int
 head907d_ovly(struct nv50_head *head, struct nv50_head_atom *asyh)
 {
-	struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan;
+	struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push;
+	const int i = head->base.index;
 	u32 bounds = 0;
-	u32 *push;
+	int ret;
 
 	if (asyh->ovly.cpp) {
 		switch (asyh->ovly.cpp) {
@@ -96,11 +97,11 @@ head907d_ovly(struct nv50_head *head, struct nv50_head_atom *asyh)
 		bounds |= 0x00000100;
 	}
 
-	if ((push = evo_wait(core, 2))) {
-		evo_mthd(push, 0x04d4 + head->base.index * 0x300, 1);
-		evo_data(push, bounds);
-		evo_kick(push, core);
-	}
+	if ((ret = PUSH_WAIT(push, 2)))
+		return ret;
+
+	PUSH_NVSQ(push, NV907D, 0x04d4 + (i * 0x300), bounds);
+	return 0;
 }
 
 static int
-- 
2.29.2