Commit 529c4959 authored by Ben Skeggs's avatar Ben Skeggs

drm/nvc0: implement fencing

Just simple REF_CNT fencing for the moment.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 96545299
...@@ -32,7 +32,8 @@ ...@@ -32,7 +32,8 @@
#include "nouveau_dma.h" #include "nouveau_dma.h"
#define USE_REFCNT(dev) (nouveau_private(dev)->chipset >= 0x10) #define USE_REFCNT(dev) (nouveau_private(dev)->chipset >= 0x10)
#define USE_SEMA(dev) (nouveau_private(dev)->chipset >= 0x17) #define USE_SEMA(dev) (nouveau_private(dev)->chipset >= 0x17 && \
nouveau_private(dev)->card_type < NV_C0)
struct nouveau_fence { struct nouveau_fence {
struct nouveau_channel *channel; struct nouveau_channel *channel;
...@@ -139,6 +140,7 @@ nouveau_fence_emit(struct nouveau_fence *fence) ...@@ -139,6 +140,7 @@ nouveau_fence_emit(struct nouveau_fence *fence)
{ {
struct nouveau_channel *chan = fence->channel; struct nouveau_channel *chan = fence->channel;
struct drm_device *dev = chan->dev; struct drm_device *dev = chan->dev;
struct drm_nouveau_private *dev_priv = dev->dev_private;
int ret; int ret;
ret = RING_SPACE(chan, 2); ret = RING_SPACE(chan, 2);
...@@ -159,8 +161,15 @@ nouveau_fence_emit(struct nouveau_fence *fence) ...@@ -159,8 +161,15 @@ nouveau_fence_emit(struct nouveau_fence *fence)
list_add_tail(&fence->entry, &chan->fence.pending); list_add_tail(&fence->entry, &chan->fence.pending);
spin_unlock(&chan->fence.lock); spin_unlock(&chan->fence.lock);
BEGIN_RING(chan, NvSubSw, USE_REFCNT(dev) ? 0x0050 : 0x0150, 1); if (USE_REFCNT(dev)) {
OUT_RING(chan, fence->sequence); if (dev_priv->card_type < NV_C0)
BEGIN_RING(chan, NvSubSw, 0x0050, 1);
else
BEGIN_NVC0(chan, 2, NvSubSw, 0x0050, 1);
} else {
BEGIN_RING(chan, NvSubSw, 0x0150, 1);
}
OUT_RING (chan, fence->sequence);
FIRE_RING(chan); FIRE_RING(chan);
return 0; return 0;
...@@ -445,11 +454,14 @@ nouveau_fence_channel_init(struct nouveau_channel *chan) ...@@ -445,11 +454,14 @@ nouveau_fence_channel_init(struct nouveau_channel *chan)
if (ret) if (ret)
return ret; return ret;
ret = RING_SPACE(chan, 2); /* we leave subchannel empty for nvc0 */
if (ret) if (dev_priv->card_type < NV_C0) {
return ret; ret = RING_SPACE(chan, 2);
BEGIN_RING(chan, NvSubSw, 0, 1); if (ret)
OUT_RING(chan, NvSw); return ret;
BEGIN_RING(chan, NvSubSw, 0, 1);
OUT_RING(chan, NvSw);
}
/* Create a DMA object for the shared cross-channel sync area. */ /* Create a DMA object for the shared cross-channel sync area. */
if (USE_SEMA(dev)) { if (USE_SEMA(dev)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment