Blob Blame History Raw
From 7b9bc477c3fa20c397b0ece867b31bd7b89ffff1 Mon Sep 17 00:00:00 2001
From: Ben Skeggs <bskeggs@redhat.com>
Date: Mon, 22 Jun 2020 11:31:45 +1000
Subject: drm/nouveau/fbcon: convert copyarea() to new push macros
Git-commit: a535aa677521f63acbca3804ae42e062a912add0
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/nouveau_dma.h |  1 -
 drivers/gpu/drm/nouveau/nv04_fbcon.c  | 12 ++++++------
 drivers/gpu/drm/nouveau/nv50_fbcon.c  | 26 ++++++++++++--------------
 drivers/gpu/drm/nouveau/nvc0_fbcon.c  | 26 ++++++++++++--------------
 4 files changed, 30 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.h b/drivers/gpu/drm/nouveau/nouveau_dma.h
index bb1b89adaf73..72de20437542 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dma.h
+++ b/drivers/gpu/drm/nouveau/nouveau_dma.h
@@ -50,7 +50,6 @@ enum {
 	NvSubSw		= 1,
 	NvSubImageBlit  = 2,
 
-	NvSub2D		= 3, /* DO NOT CHANGE - hardcoded for kepler gr fifo */
 	NvSubCopy	= 4, /* DO NOT CHANGE - hardcoded for kepler gr fifo */
 };
 
diff --git a/drivers/gpu/drm/nouveau/nv04_fbcon.c b/drivers/gpu/drm/nouveau/nv04_fbcon.c
index 397dd1799613..92f3fb6765ab 100644
--- a/drivers/gpu/drm/nouveau/nv04_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nv04_fbcon.c
@@ -34,17 +34,17 @@ nv04_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region)
 	struct nouveau_fbdev *nfbdev = info->par;
 	struct nouveau_drm *drm = nouveau_drm(nfbdev->helper.dev);
 	struct nouveau_channel *chan = drm->channel;
+	struct nvif_push *push = chan->chan.push;
 	int ret;
 
-	ret = RING_SPACE(chan, 4);
+	ret = PUSH_WAIT(push, 4);
 	if (ret)
 		return ret;
 
-	BEGIN_NV04(chan, NvSubImageBlit, 0x0300, 3);
-	OUT_RING(chan, (region->sy << 16) | region->sx);
-	OUT_RING(chan, (region->dy << 16) | region->dx);
-	OUT_RING(chan, (region->height << 16) | region->width);
-	FIRE_RING(chan);
+	PUSH_NVSQ(push, NV05F, 0x0300, (region->sy << 16) | region->sx,
+			       0x0304, (region->dy << 16) | region->dx,
+			       0x0308, (region->height << 16) | region->width);
+	PUSH_KICK(push);
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/nouveau/nv50_fbcon.c b/drivers/gpu/drm/nouveau/nv50_fbcon.c
index 6d122b045f4c..cbdd473acd9f 100644
--- a/drivers/gpu/drm/nouveau/nv50_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nv50_fbcon.c
@@ -73,25 +73,23 @@ nv50_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region)
 	struct nouveau_fbdev *nfbdev = info->par;
 	struct nouveau_drm *drm = nouveau_drm(nfbdev->helper.dev);
 	struct nouveau_channel *chan = drm->channel;
+	struct nvif_push *push = chan->chan.push;
 	int ret;
 
-	ret = RING_SPACE(chan, 12);
+	ret = PUSH_WAIT(push, 12);
 	if (ret)
 		return ret;
 
-	BEGIN_NV04(chan, NvSub2D, 0x0110, 1);
-	OUT_RING(chan, 0);
-	BEGIN_NV04(chan, NvSub2D, 0x08b0, 4);
-	OUT_RING(chan, region->dx);
-	OUT_RING(chan, region->dy);
-	OUT_RING(chan, region->width);
-	OUT_RING(chan, region->height);
-	BEGIN_NV04(chan, NvSub2D, 0x08d0, 4);
-	OUT_RING(chan, 0);
-	OUT_RING(chan, region->sx);
-	OUT_RING(chan, 0);
-	OUT_RING(chan, region->sy);
-	FIRE_RING(chan);
+	PUSH_NVSQ(push, NV502D, 0x0110, 0);
+	PUSH_NVSQ(push, NV502D, 0x08b0, region->dx,
+				0x08b4, region->dy,
+				0x08b8, region->width,
+				0x08bc, region->height);
+	PUSH_NVSQ(push, NV502D, 0x08d0, 0,
+				0x08d4, region->sx,
+				0x08d8, 0,
+				0x08dc, region->sy);
+	PUSH_KICK(push);
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/nouveau/nvc0_fbcon.c b/drivers/gpu/drm/nouveau/nvc0_fbcon.c
index 414025a43540..ab1dbf03de7b 100644
--- a/drivers/gpu/drm/nouveau/nvc0_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nvc0_fbcon.c
@@ -73,25 +73,23 @@ nvc0_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *region)
 	struct nouveau_fbdev *nfbdev = info->par;
 	struct nouveau_drm *drm = nouveau_drm(nfbdev->helper.dev);
 	struct nouveau_channel *chan = drm->channel;
+	struct nvif_push *push = chan->chan.push;
 	int ret;
 
-	ret = RING_SPACE(chan, 12);
+	ret = PUSH_WAIT(push, 11);
 	if (ret)
 		return ret;
 
-	BEGIN_NVC0(chan, NvSub2D, 0x0110, 1);
-	OUT_RING  (chan, 0);
-	BEGIN_NVC0(chan, NvSub2D, 0x08b0, 4);
-	OUT_RING  (chan, region->dx);
-	OUT_RING  (chan, region->dy);
-	OUT_RING  (chan, region->width);
-	OUT_RING  (chan, region->height);
-	BEGIN_NVC0(chan, NvSub2D, 0x08d0, 4);
-	OUT_RING  (chan, 0);
-	OUT_RING  (chan, region->sx);
-	OUT_RING  (chan, 0);
-	OUT_RING  (chan, region->sy);
-	FIRE_RING(chan);
+	PUSH_NVIM(push, NV902D, 0x0110, 0);
+	PUSH_NVSQ(push, NV902D, 0x08b0, region->dx,
+				0x08b4, region->dy,
+				0x08b8, region->width,
+				0x08bc, region->height);
+	PUSH_NVSQ(push, NV902D, 0x08d0, 0,
+				0x08d4, region->sx,
+				0x08d8, 0,
+				0x08dc, region->sy);
+	PUSH_KICK(push);
 	return 0;
 }
 
-- 
2.29.2