aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2010-11-23 19:30:22 -0500
committerBen Skeggs <bskeggs@redhat.com>2010-12-21 02:17:36 -0500
commit529c4959129c7c425aaf3d5b6acc63edf76827ad (patch)
tree67358ba558f5a59fc5bf5cc190af20ca71612aef /drivers/gpu/drm/nouveau
parent96545299d7405d4c0f44b727718e263653fc11aa (diff)
drm/nvc0: implement fencing
Just simple REF_CNT fencing for the moment. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fence.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c
index 374a9793b85f..88b2f29ca3e4 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
@@ -32,7 +32,8 @@
32#include "nouveau_dma.h" 32#include "nouveau_dma.h"
33 33
34#define USE_REFCNT(dev) (nouveau_private(dev)->chipset >= 0x10) 34#define USE_REFCNT(dev) (nouveau_private(dev)->chipset >= 0x10)
35#define USE_SEMA(dev) (nouveau_private(dev)->chipset >= 0x17) 35#define USE_SEMA(dev) (nouveau_private(dev)->chipset >= 0x17 && \
36 nouveau_private(dev)->card_type < NV_C0)
36 37
37struct nouveau_fence { 38struct nouveau_fence {
38 struct nouveau_channel *channel; 39 struct nouveau_channel *channel;
@@ -139,6 +140,7 @@ nouveau_fence_emit(struct nouveau_fence *fence)
139{ 140{
140 struct nouveau_channel *chan = fence->channel; 141 struct nouveau_channel *chan = fence->channel;
141 struct drm_device *dev = chan->dev; 142 struct drm_device *dev = chan->dev;
143 struct drm_nouveau_private *dev_priv = dev->dev_private;
142 int ret; 144 int ret;
143 145
144 ret = RING_SPACE(chan, 2); 146 ret = RING_SPACE(chan, 2);
@@ -159,8 +161,15 @@ nouveau_fence_emit(struct nouveau_fence *fence)
159 list_add_tail(&fence->entry, &chan->fence.pending); 161 list_add_tail(&fence->entry, &chan->fence.pending);
160 spin_unlock(&chan->fence.lock); 162 spin_unlock(&chan->fence.lock);
161 163
162 BEGIN_RING(chan, NvSubSw, USE_REFCNT(dev) ? 0x0050 : 0x0150, 1); 164 if (USE_REFCNT(dev)) {
163 OUT_RING(chan, fence->sequence); 165 if (dev_priv->card_type < NV_C0)
166 BEGIN_RING(chan, NvSubSw, 0x0050, 1);
167 else
168 BEGIN_NVC0(chan, 2, NvSubSw, 0x0050, 1);
169 } else {
170 BEGIN_RING(chan, NvSubSw, 0x0150, 1);
171 }
172 OUT_RING (chan, fence->sequence);
164 FIRE_RING(chan); 173 FIRE_RING(chan);
165 174
166 return 0; 175 return 0;
@@ -445,11 +454,14 @@ nouveau_fence_channel_init(struct nouveau_channel *chan)
445 if (ret) 454 if (ret)
446 return ret; 455 return ret;
447 456
448 ret = RING_SPACE(chan, 2); 457 /* we leave subchannel empty for nvc0 */
449 if (ret) 458 if (dev_priv->card_type < NV_C0) {
450 return ret; 459 ret = RING_SPACE(chan, 2);
451 BEGIN_RING(chan, NvSubSw, 0, 1); 460 if (ret)
452 OUT_RING(chan, NvSw); 461 return ret;
462 BEGIN_RING(chan, NvSubSw, 0, 1);
463 OUT_RING(chan, NvSw);
464 }
453 465
454 /* Create a DMA object for the shared cross-channel sync area. */ 466 /* Create a DMA object for the shared cross-channel sync area. */
455 if (USE_SEMA(dev)) { 467 if (USE_SEMA(dev)) {