summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2020-07-18 18:06:30 +1000
committerBen Skeggs <bskeggs@redhat.com>2020-07-24 18:50:56 +1000
commitfdb06e2b2a18b3650526857ccb1ea95333282b90 (patch)
tree2de1ac26c4ea1163a39aefd1c1863f4534cb0d5f
parent0a96099691c8cd1ac0744ef30b6846869dc2b566 (diff)
downloadlinux-stable-fdb06e2b2a18b3650526857ccb1ea95333282b90.tar.gz
linux-stable-fdb06e2b2a18b3650526857ccb1ea95333282b90.tar.bz2
linux-stable-fdb06e2b2a18b3650526857ccb1ea95333282b90.zip
drm/nouveau: interop with new push macros
Signed-off-by: Ben Skeggs <bskeggs@redhat.com> Reviewed-by: Lyude Paul <lyude@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_chan.c33
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_chan.h6
2 files changed, 39 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c b/drivers/gpu/drm/nouveau/nouveau_chan.c
index d208ef4b158c..27092a6933ee 100644
--- a/drivers/gpu/drm/nouveau/nouveau_chan.c
+++ b/drivers/gpu/drm/nouveau/nouveau_chan.c
@@ -121,6 +121,31 @@ nouveau_channel_del(struct nouveau_channel **pchan)
*pchan = NULL;
}
+static void
+nouveau_channel_kick(struct nvif_push *push)
+{
+ struct nouveau_channel *chan = container_of(push, typeof(*chan), chan._push);
+ chan->dma.cur = chan->dma.cur + (chan->chan._push.cur - chan->chan._push.bgn);
+ FIRE_RING(chan);
+ chan->chan._push.bgn = chan->chan._push.cur;
+}
+
+static int
+nouveau_channel_wait(struct nvif_push *push, u32 size)
+{
+ struct nouveau_channel *chan = container_of(push, typeof(*chan), chan._push);
+ int ret;
+ chan->dma.cur = chan->dma.cur + (chan->chan._push.cur - chan->chan._push.bgn);
+ ret = RING_SPACE(chan, size);
+ if (ret == 0) {
+ chan->chan._push.bgn = chan->chan._push.mem.object.map.ptr;
+ chan->chan._push.bgn = chan->chan._push.bgn + chan->dma.cur;
+ chan->chan._push.cur = chan->chan._push.bgn;
+ chan->chan._push.end = chan->chan._push.bgn + size;
+ }
+ return ret;
+}
+
static int
nouveau_channel_prep(struct nouveau_drm *drm, struct nvif_device *device,
u32 size, struct nouveau_channel **pchan)
@@ -158,6 +183,14 @@ nouveau_channel_prep(struct nouveau_drm *drm, struct nvif_device *device,
return ret;
}
+ chan->chan._push.mem.object.parent = cli->base.object.parent;
+ chan->chan._push.mem.object.client = &cli->base;
+ chan->chan._push.mem.object.name = "chanPush";
+ chan->chan._push.mem.object.map.ptr = chan->push.buffer->kmap.virtual;
+ chan->chan._push.wait = nouveau_channel_wait;
+ chan->chan._push.kick = nouveau_channel_kick;
+ chan->chan.push = &chan->chan._push;
+
/* create dma object covering the *entire* memory space that the
* pushbuf lives in, this is because the GEM code requires that
* we be able to call out to other (indirect) push buffers
diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.h b/drivers/gpu/drm/nouveau/nouveau_chan.h
index 9307357e1361..98ba9d27e6b4 100644
--- a/drivers/gpu/drm/nouveau/nouveau_chan.h
+++ b/drivers/gpu/drm/nouveau/nouveau_chan.h
@@ -3,9 +3,15 @@
#define __NOUVEAU_CHAN_H__
#include <nvif/object.h>
#include <nvif/notify.h>
+#include <nvif/push.h>
struct nvif_device;
struct nouveau_channel {
+ struct {
+ struct nvif_push _push;
+ struct nvif_push *push;
+ } chan;
+
struct nvif_device *device;
struct nouveau_drm *drm;
struct nouveau_vmm *vmm;