aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nvc0_fence.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2013-02-13 18:37:35 -0500
committerBen Skeggs <bskeggs@redhat.com>2013-02-20 01:00:52 -0500
commitbba9852feedf3d38f963278e07bdd3db622090b9 (patch)
treea7a62aee22165a817c43caccabf14940bdfdf820 /drivers/gpu/drm/nouveau/nvc0_fence.c
parenta34caf78f26bda63869471cb3f46f354f4658758 (diff)
drm/nv84-/fence: abstract class emit/sync functions to virt+sequence
Now can be used to operate on any buffer mapped into the GPU virtual address and not just the main inter-channel sync buffer. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvc0_fence.c')
-rw-r--r--drivers/gpu/drm/nouveau/nvc0_fence.c40
1 files changed, 14 insertions, 26 deletions
diff --git a/drivers/gpu/drm/nouveau/nvc0_fence.c b/drivers/gpu/drm/nouveau/nvc0_fence.c
index e4c4ead24805..8213f7de92fa 100644
--- a/drivers/gpu/drm/nouveau/nvc0_fence.c
+++ b/drivers/gpu/drm/nouveau/nvc0_fence.c
@@ -35,48 +35,34 @@
35#include "nv50_display.h" 35#include "nv50_display.h"
36 36
37static int 37static int
38nvc0_fence_emit(struct nouveau_fence *fence) 38nvc0_fence_emit32(struct nouveau_channel *chan, u64 virtual, u32 sequence)
39{ 39{
40 struct nouveau_channel *chan = fence->channel; 40 int ret = RING_SPACE(chan, 6);
41 struct nv84_fence_chan *fctx = chan->fence;
42 struct nouveau_fifo_chan *fifo = (void *)chan->object;
43 u64 addr = fctx->vma.offset + fifo->chid * 16;
44 int ret;
45
46 ret = RING_SPACE(chan, 6);
47 if (ret == 0) { 41 if (ret == 0) {
48 BEGIN_NVC0(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 5); 42 BEGIN_NVC0(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 5);
49 OUT_RING (chan, upper_32_bits(addr)); 43 OUT_RING (chan, upper_32_bits(virtual));
50 OUT_RING (chan, lower_32_bits(addr)); 44 OUT_RING (chan, lower_32_bits(virtual));
51 OUT_RING (chan, fence->sequence); 45 OUT_RING (chan, sequence);
52 OUT_RING (chan, NV84_SUBCHAN_SEMAPHORE_TRIGGER_WRITE_LONG); 46 OUT_RING (chan, NV84_SUBCHAN_SEMAPHORE_TRIGGER_WRITE_LONG);
53 OUT_RING (chan, 0x00000000); 47 OUT_RING (chan, 0x00000000);
54 FIRE_RING (chan); 48 FIRE_RING (chan);
55 } 49 }
56
57 return ret; 50 return ret;
58} 51}
59 52
60static int 53static int
61nvc0_fence_sync(struct nouveau_fence *fence, 54nvc0_fence_sync32(struct nouveau_channel *chan, u64 virtual, u32 sequence)
62 struct nouveau_channel *prev, struct nouveau_channel *chan)
63{ 55{
64 struct nv84_fence_chan *fctx = chan->fence; 56 int ret = RING_SPACE(chan, 5);
65 struct nouveau_fifo_chan *fifo = (void *)prev->object;
66 u64 addr = fctx->vma.offset + fifo->chid * 16;
67 int ret;
68
69 ret = RING_SPACE(chan, 5);
70 if (ret == 0) { 57 if (ret == 0) {
71 BEGIN_NVC0(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 4); 58 BEGIN_NVC0(chan, 0, NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH, 4);
72 OUT_RING (chan, upper_32_bits(addr)); 59 OUT_RING (chan, upper_32_bits(virtual));
73 OUT_RING (chan, lower_32_bits(addr)); 60 OUT_RING (chan, lower_32_bits(virtual));
74 OUT_RING (chan, fence->sequence); 61 OUT_RING (chan, sequence);
75 OUT_RING (chan, NV84_SUBCHAN_SEMAPHORE_TRIGGER_ACQUIRE_GEQUAL | 62 OUT_RING (chan, NV84_SUBCHAN_SEMAPHORE_TRIGGER_ACQUIRE_GEQUAL |
76 NVC0_SUBCHAN_SEMAPHORE_TRIGGER_YIELD); 63 NVC0_SUBCHAN_SEMAPHORE_TRIGGER_YIELD);
77 FIRE_RING (chan); 64 FIRE_RING (chan);
78 } 65 }
79
80 return ret; 66 return ret;
81} 67}
82 68
@@ -96,8 +82,10 @@ nvc0_fence_create(struct nouveau_drm *drm)
96 priv->base.resume = nv84_fence_resume; 82 priv->base.resume = nv84_fence_resume;
97 priv->base.context_new = nv84_fence_context_new; 83 priv->base.context_new = nv84_fence_context_new;
98 priv->base.context_del = nv84_fence_context_del; 84 priv->base.context_del = nv84_fence_context_del;
99 priv->base.emit = nvc0_fence_emit; 85 priv->base.emit32 = nvc0_fence_emit32;
100 priv->base.sync = nvc0_fence_sync; 86 priv->base.emit = nv84_fence_emit;
87 priv->base.sync32 = nvc0_fence_sync32;
88 priv->base.sync = nv84_fence_sync;
101 priv->base.read = nv84_fence_read; 89 priv->base.read = nv84_fence_read;
102 90
103 init_waitqueue_head(&priv->base.waiting); 91 init_waitqueue_head(&priv->base.waiting);