diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv04_fence.c')
| -rw-r--r-- | drivers/gpu/drm/nouveau/nv04_fence.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/gpu/drm/nouveau/nv04_fence.c b/drivers/gpu/drm/nouveau/nv04_fence.c index 94eadd1dd10a..fa5c6029f783 100644 --- a/drivers/gpu/drm/nouveau/nv04_fence.c +++ b/drivers/gpu/drm/nouveau/nv04_fence.c @@ -21,13 +21,13 @@ * * Authors: Ben Skeggs */ - -#include <engine/fifo.h> - -#include "nouveau_drm.h" +#include "nouveau_drv.h" #include "nouveau_dma.h" #include "nouveau_fence.h" +#include <nvif/if0004.h> +#include <nvif/push006c.h> + struct nv04_fence_chan { struct nouveau_fence_chan base; }; @@ -39,12 +39,11 @@ struct nv04_fence_priv { static int nv04_fence_emit(struct nouveau_fence *fence) { - struct nouveau_channel *chan = fence->channel; - int ret = RING_SPACE(chan, 2); + struct nvif_push *push = &unrcu_pointer(fence->channel)->chan.push; + int ret = PUSH_WAIT(push, 2); if (ret == 0) { - BEGIN_NV04(chan, NvSubSw, 0x0150, 1); - OUT_RING (chan, fence->sequence); - FIRE_RING (chan); + PUSH_NVSQ(push, NV_SW, 0x0150, fence->base.seqno); + PUSH_KICK(push); } return ret; } @@ -59,8 +58,10 @@ nv04_fence_sync(struct nouveau_fence *fence, static u32 nv04_fence_read(struct nouveau_channel *chan) { - struct nouveau_fifo_chan *fifo = (void *)chan->object; - return atomic_read(&fifo->refcnt); + struct nv04_nvsw_get_ref_v0 args = {}; + WARN_ON(nvif_object_mthd(&chan->nvsw, NV04_NVSW_GET_REF, + &args, sizeof(args))); + return args.ref; } static void @@ -69,7 +70,7 @@ nv04_fence_context_del(struct nouveau_channel *chan) struct nv04_fence_chan *fctx = chan->fence; nouveau_fence_context_del(&fctx->base); chan->fence = NULL; - kfree(fctx); + nouveau_fence_context_free(&fctx->base); } static int @@ -77,7 +78,7 @@ nv04_fence_context_new(struct nouveau_channel *chan) { struct nv04_fence_chan *fctx = kzalloc(sizeof(*fctx), GFP_KERNEL); if (fctx) { - nouveau_fence_context_new(&fctx->base); + nouveau_fence_context_new(chan, &fctx->base); fctx->base.emit = nv04_fence_emit; fctx->base.sync = nv04_fence_sync; fctx->base.read = nv04_fence_read; |
