aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_fence.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2012-07-19 18:17:34 -0400
committerBen Skeggs <bskeggs@redhat.com>2012-10-02 23:12:56 -0400
commitebb945a94bba2ce8dff7b0942ff2b3f2a52a0a69 (patch)
tree07cad59be501458e6ae1304b7c0352e322ac3387 /drivers/gpu/drm/nouveau/nouveau_fence.c
parentac1499d9573f4aadd1d2beac11fe23af8ce90c24 (diff)
drm/nouveau: port all engines to new engine module format
This is a HUGE commit, but it's not nearly as bad as it looks - any problems can be isolated to a particular chipset and engine combination. It was simply too difficult to port each one at a time, the compat layers are *already* ridiculous. Most of the changes here are simply to the glue, the process for each of the engine modules was to start with a standard skeleton and copy+paste the old code into the appropriate places, fixing up variable names etc as needed. v2: Marcin Slusarz <marcin.slusarz@gmail.com> - fix find/replace bug in license header v3: Ben Skeggs <bskeggs@redhat.com> - bump indirect pushbuf size to 8KiB, 4KiB barely enough for userspace and left no space for kernel's requirements during GEM pushbuf submission. - fix duplicate assignments noticed by clang v4: Marcin Slusarz <marcin.slusarz@gmail.com> - add sparse annotations to nv04_fifo_pause/nv04_fifo_start - use ioread32_native/iowrite32_native for fifo control registers v5: Ben Skeggs <bskeggs@redhat.com> - rebase on v3.6-rc4, modified to keep copy engine fix intact - nv10/fence: unmap fence bo before destroying - fixed fermi regression when using nvidia gr fuc - fixed typo in supported dma_mask checking Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_fence.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_fence.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c
index a1835d710f73..5b5471ba6eda 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
@@ -30,11 +30,9 @@
30#include <linux/ktime.h> 30#include <linux/ktime.h>
31#include <linux/hrtimer.h> 31#include <linux/hrtimer.h>
32 32
33#include "nouveau_drv.h" 33#include "nouveau_drm.h"
34#include <core/ramht.h>
35#include "nouveau_fence.h"
36#include "nouveau_software.h"
37#include "nouveau_dma.h" 34#include "nouveau_dma.h"
35#include "nouveau_fence.h"
38 36
39void 37void
40nouveau_fence_context_del(struct nouveau_fence_chan *fctx) 38nouveau_fence_context_del(struct nouveau_fence_chan *fctx)
@@ -59,12 +57,10 @@ nouveau_fence_context_new(struct nouveau_fence_chan *fctx)
59 spin_lock_init(&fctx->lock); 57 spin_lock_init(&fctx->lock);
60} 58}
61 59
62void 60static void
63nouveau_fence_update(struct nouveau_channel *chan) 61nouveau_fence_update(struct nouveau_channel *chan)
64{ 62{
65 struct drm_device *dev = chan->dev; 63 struct nouveau_fence_priv *priv = chan->drm->fence;
66 struct drm_nouveau_private *dev_priv = dev->dev_private;
67 struct nouveau_fence_priv *priv = dev_priv->fence.func;
68 struct nouveau_fence_chan *fctx = chan->fence; 64 struct nouveau_fence_chan *fctx = chan->fence;
69 struct nouveau_fence *fence, *fnext; 65 struct nouveau_fence *fence, *fnext;
70 66
@@ -85,9 +81,7 @@ nouveau_fence_update(struct nouveau_channel *chan)
85int 81int
86nouveau_fence_emit(struct nouveau_fence *fence, struct nouveau_channel *chan) 82nouveau_fence_emit(struct nouveau_fence *fence, struct nouveau_channel *chan)
87{ 83{
88 struct drm_device *dev = chan->dev; 84 struct nouveau_fence_priv *priv = chan->drm->fence;
89 struct drm_nouveau_private *dev_priv = dev->dev_private;
90 struct nouveau_fence_priv *priv = dev_priv->fence.func;
91 struct nouveau_fence_chan *fctx = chan->fence; 85 struct nouveau_fence_chan *fctx = chan->fence;
92 int ret; 86 int ret;
93 87
@@ -150,20 +144,17 @@ nouveau_fence_wait(struct nouveau_fence *fence, bool lazy, bool intr)
150int 144int
151nouveau_fence_sync(struct nouveau_fence *fence, struct nouveau_channel *chan) 145nouveau_fence_sync(struct nouveau_fence *fence, struct nouveau_channel *chan)
152{ 146{
153 struct drm_device *dev = chan->dev; 147 struct nouveau_fence_priv *priv = chan->drm->fence;
154 struct drm_nouveau_private *dev_priv = dev->dev_private;
155 struct nouveau_fence_priv *priv = dev_priv->fence.func;
156 struct nouveau_channel *prev; 148 struct nouveau_channel *prev;
157 int ret = 0; 149 int ret = 0;
158 150
159 prev = fence ? nouveau_channel_get_unlocked(fence->channel) : NULL; 151 prev = fence ? fence->channel : NULL;
160 if (prev) { 152 if (prev) {
161 if (unlikely(prev != chan && !nouveau_fence_done(fence))) { 153 if (unlikely(prev != chan && !nouveau_fence_done(fence))) {
162 ret = priv->sync(fence, prev, chan); 154 ret = priv->sync(fence, prev, chan);
163 if (unlikely(ret)) 155 if (unlikely(ret))
164 ret = nouveau_fence_wait(fence, true, false); 156 ret = nouveau_fence_wait(fence, true, false);
165 } 157 }
166 nouveau_channel_put_unlocked(&prev);
167 } 158 }
168 159
169 return ret; 160 return ret;