hc
2024-05-10 61598093bbdd283a7edc367d900f223070ead8d2
kernel/drivers/gpu/drm/nouveau/nv17_fence.c
....@@ -21,14 +21,16 @@
2121 *
2222 * Authors: Ben Skeggs <bskeggs@redhat.com>
2323 */
24
-
25
-#include <nvif/os.h>
26
-#include <nvif/class.h>
27
-#include <nvif/cl0002.h>
28
-
2924 #include "nouveau_drv.h"
3025 #include "nouveau_dma.h"
3126 #include "nv10_fence.h"
27
+
28
+#include <nvif/push006c.h>
29
+
30
+#include <nvif/class.h>
31
+#include <nvif/cl0002.h>
32
+
33
+#include <nvhw/class/cl176e.h>
3234
3335 int
3436 nv17_fence_sync(struct nouveau_fence *fence,
....@@ -37,6 +39,8 @@
3739 struct nouveau_cli *cli = (void *)prev->user.client;
3840 struct nv10_fence_priv *priv = chan->drm->fence;
3941 struct nv10_fence_chan *fctx = chan->fence;
42
+ struct nvif_push *ppush = prev->chan.push;
43
+ struct nvif_push *npush = chan->chan.push;
4044 u32 value;
4145 int ret;
4246
....@@ -48,23 +52,21 @@
4852 priv->sequence += 2;
4953 spin_unlock(&priv->lock);
5054
51
- ret = RING_SPACE(prev, 5);
55
+ ret = PUSH_WAIT(ppush, 5);
5256 if (!ret) {
53
- BEGIN_NV04(prev, 0, NV11_SUBCHAN_DMA_SEMAPHORE, 4);
54
- OUT_RING (prev, fctx->sema.handle);
55
- OUT_RING (prev, 0);
56
- OUT_RING (prev, value + 0);
57
- OUT_RING (prev, value + 1);
58
- FIRE_RING (prev);
57
+ PUSH_MTHD(ppush, NV176E, SET_CONTEXT_DMA_SEMAPHORE, fctx->sema.handle,
58
+ SEMAPHORE_OFFSET, 0,
59
+ SEMAPHORE_ACQUIRE, value + 0,
60
+ SEMAPHORE_RELEASE, value + 1);
61
+ PUSH_KICK(ppush);
5962 }
6063
61
- if (!ret && !(ret = RING_SPACE(chan, 5))) {
62
- BEGIN_NV04(chan, 0, NV11_SUBCHAN_DMA_SEMAPHORE, 4);
63
- OUT_RING (chan, fctx->sema.handle);
64
- OUT_RING (chan, 0);
65
- OUT_RING (chan, value + 1);
66
- OUT_RING (chan, value + 2);
67
- FIRE_RING (chan);
64
+ if (!ret && !(ret = PUSH_WAIT(npush, 5))) {
65
+ PUSH_MTHD(npush, NV176E, SET_CONTEXT_DMA_SEMAPHORE, fctx->sema.handle,
66
+ SEMAPHORE_OFFSET, 0,
67
+ SEMAPHORE_ACQUIRE, value + 1,
68
+ SEMAPHORE_RELEASE, value + 2);
69
+ PUSH_KICK(npush);
6870 }
6971
7072 mutex_unlock(&cli->mutex);
....@@ -76,7 +78,7 @@
7678 {
7779 struct nv10_fence_priv *priv = chan->drm->fence;
7880 struct nv10_fence_chan *fctx;
79
- struct ttm_mem_reg *reg = &priv->bo->bo.mem;
81
+ struct ttm_resource *reg = &priv->bo->bo.mem;
8082 u32 start = reg->start * PAGE_SIZE;
8183 u32 limit = start + reg->size - 1;
8284 int ret = 0;
....@@ -90,7 +92,8 @@
9092 fctx->base.read = nv10_fence_read;
9193 fctx->base.sync = nv17_fence_sync;
9294
93
- ret = nvif_object_init(&chan->user, NvSema, NV_DMA_FROM_MEMORY,
95
+ ret = nvif_object_ctor(&chan->user, "fenceCtxDma", NvSema,
96
+ NV_DMA_FROM_MEMORY,
9497 &(struct nv_dma_v0) {
9598 .target = NV_DMA_V0_TARGET_VRAM,
9699 .access = NV_DMA_V0_ACCESS_RDWR,
....@@ -127,10 +130,11 @@
127130 priv->base.context_del = nv10_fence_context_del;
128131 spin_lock_init(&priv->lock);
129132
130
- ret = nouveau_bo_new(&drm->client, 4096, 0x1000, TTM_PL_FLAG_VRAM,
133
+ ret = nouveau_bo_new(&drm->client, 4096, 0x1000,
134
+ NOUVEAU_GEM_DOMAIN_VRAM,
131135 0, 0x0000, NULL, NULL, &priv->bo);
132136 if (!ret) {
133
- ret = nouveau_bo_pin(priv->bo, TTM_PL_FLAG_VRAM, false);
137
+ ret = nouveau_bo_pin(priv->bo, NOUVEAU_GEM_DOMAIN_VRAM, false);
134138 if (!ret) {
135139 ret = nouveau_bo_map(priv->bo);
136140 if (ret)