aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_dma.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_dma.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.c b/drivers/gpu/drm/nouveau/nouveau_dma.c
index 2e3c6caa97ee..82581e600dcd 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dma.c
+++ b/drivers/gpu/drm/nouveau/nouveau_dma.c
@@ -28,6 +28,7 @@
28#include "drm.h" 28#include "drm.h"
29#include "nouveau_drv.h" 29#include "nouveau_drv.h"
30#include "nouveau_dma.h" 30#include "nouveau_dma.h"
31#include "nouveau_ramht.h"
31 32
32void 33void
33nouveau_dma_pre_init(struct nouveau_channel *chan) 34nouveau_dma_pre_init(struct nouveau_channel *chan)
@@ -58,26 +59,17 @@ nouveau_dma_init(struct nouveau_channel *chan)
58{ 59{
59 struct drm_device *dev = chan->dev; 60 struct drm_device *dev = chan->dev;
60 struct drm_nouveau_private *dev_priv = dev->dev_private; 61 struct drm_nouveau_private *dev_priv = dev->dev_private;
61 struct nouveau_gpuobj *m2mf = NULL; 62 struct nouveau_gpuobj *obj = NULL;
62 struct nouveau_gpuobj *nvsw = NULL;
63 int ret, i; 63 int ret, i;
64 64
65 /* Create NV_MEMORY_TO_MEMORY_FORMAT for buffer moves */ 65 /* Create NV_MEMORY_TO_MEMORY_FORMAT for buffer moves */
66 ret = nouveau_gpuobj_gr_new(chan, dev_priv->card_type < NV_50 ? 66 ret = nouveau_gpuobj_gr_new(chan, dev_priv->card_type < NV_50 ?
67 0x0039 : 0x5039, &m2mf); 67 0x0039 : 0x5039, &obj);
68 if (ret) 68 if (ret)
69 return ret; 69 return ret;
70 70
71 ret = nouveau_gpuobj_ref_add(dev, chan, NvM2MF, m2mf, NULL); 71 ret = nouveau_ramht_insert(chan, NvM2MF, obj);
72 if (ret) 72 nouveau_gpuobj_ref(NULL, &obj);
73 return ret;
74
75 /* Create an NV_SW object for various sync purposes */
76 ret = nouveau_gpuobj_sw_new(chan, NV_SW, &nvsw);
77 if (ret)
78 return ret;
79
80 ret = nouveau_gpuobj_ref_add(dev, chan, NvSw, nvsw, NULL);
81 if (ret) 73 if (ret)
82 return ret; 74 return ret;
83 75
@@ -91,11 +83,6 @@ nouveau_dma_init(struct nouveau_channel *chan)
91 if (ret) 83 if (ret)
92 return ret; 84 return ret;
93 85
94 /* Map M2MF notifier object - fbcon. */
95 ret = nouveau_bo_map(chan->notifier_bo);
96 if (ret)
97 return ret;
98
99 /* Insert NOPS for NOUVEAU_DMA_SKIPS */ 86 /* Insert NOPS for NOUVEAU_DMA_SKIPS */
100 ret = RING_SPACE(chan, NOUVEAU_DMA_SKIPS); 87 ret = RING_SPACE(chan, NOUVEAU_DMA_SKIPS);
101 if (ret) 88 if (ret)
@@ -113,13 +100,6 @@ nouveau_dma_init(struct nouveau_channel *chan)
113 BEGIN_RING(chan, NvSubM2MF, NV_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY, 1); 100 BEGIN_RING(chan, NvSubM2MF, NV_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY, 1);
114 OUT_RING(chan, NvNotify0); 101 OUT_RING(chan, NvNotify0);
115 102
116 /* Initialise NV_SW */
117 ret = RING_SPACE(chan, 2);
118 if (ret)
119 return ret;
120 BEGIN_RING(chan, NvSubSw, 0, 1);
121 OUT_RING(chan, NvSw);
122
123 /* Sit back and pray the channel works.. */ 103 /* Sit back and pray the channel works.. */
124 FIRE_RING(chan); 104 FIRE_RING(chan);
125 105
@@ -217,7 +197,7 @@ nv50_dma_push_wait(struct nouveau_channel *chan, int count)
217 197
218 chan->dma.ib_free = get - chan->dma.ib_put; 198 chan->dma.ib_free = get - chan->dma.ib_put;
219 if (chan->dma.ib_free <= 0) 199 if (chan->dma.ib_free <= 0)
220 chan->dma.ib_free += chan->dma.ib_max + 1; 200 chan->dma.ib_free += chan->dma.ib_max;
221 } 201 }
222 202
223 return 0; 203 return 0;