diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2010-11-23 19:26:24 -0500 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2010-12-21 02:17:34 -0500 |
commit | 96545299d7405d4c0f44b727718e263653fc11aa (patch) | |
tree | d5c9ffd220778e11e026dab5cabbf74ae8a7cf2d /drivers/gpu/drm | |
parent | 5216782bf8c195de3befe0742a877c987dd3c4fd (diff) |
drm/nvc0: fix channel dma init paths
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_channel.c | 20 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_dma.c | 22 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_dma.h | 6 |
3 files changed, 38 insertions, 10 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_channel.c b/drivers/gpu/drm/nouveau/nouveau_channel.c index 6f37995aee2d..e37977d02463 100644 --- a/drivers/gpu/drm/nouveau/nouveau_channel.c +++ b/drivers/gpu/drm/nouveau/nouveau_channel.c | |||
@@ -38,9 +38,14 @@ nouveau_channel_pushbuf_ctxdma_init(struct nouveau_channel *chan) | |||
38 | int ret; | 38 | int ret; |
39 | 39 | ||
40 | if (dev_priv->card_type >= NV_50) { | 40 | if (dev_priv->card_type >= NV_50) { |
41 | ret = nouveau_gpuobj_dma_new(chan, NV_CLASS_DMA_IN_MEMORY, 0, | 41 | if (dev_priv->card_type < NV_C0) { |
42 | (1ULL << 40), NV_MEM_ACCESS_RO, | 42 | ret = nouveau_gpuobj_dma_new(chan, |
43 | NV_MEM_TARGET_VM, &pushbuf); | 43 | NV_CLASS_DMA_IN_MEMORY, 0, |
44 | (1ULL << 40), | ||
45 | NV_MEM_ACCESS_RO, | ||
46 | NV_MEM_TARGET_VM, | ||
47 | &pushbuf); | ||
48 | } | ||
44 | chan->pushbuf_base = pb->bo.offset; | 49 | chan->pushbuf_base = pb->bo.offset; |
45 | } else | 50 | } else |
46 | if (pb->bo.mem.mem_type == TTM_PL_TT) { | 51 | if (pb->bo.mem.mem_type == TTM_PL_TT) { |
@@ -71,7 +76,7 @@ nouveau_channel_pushbuf_ctxdma_init(struct nouveau_channel *chan) | |||
71 | 76 | ||
72 | nouveau_gpuobj_ref(pushbuf, &chan->pushbuf); | 77 | nouveau_gpuobj_ref(pushbuf, &chan->pushbuf); |
73 | nouveau_gpuobj_ref(NULL, &pushbuf); | 78 | nouveau_gpuobj_ref(NULL, &pushbuf); |
74 | return 0; | 79 | return ret; |
75 | } | 80 | } |
76 | 81 | ||
77 | static struct nouveau_bo * | 82 | static struct nouveau_bo * |
@@ -99,6 +104,13 @@ nouveau_channel_user_pushbuf_alloc(struct drm_device *dev) | |||
99 | return NULL; | 104 | return NULL; |
100 | } | 105 | } |
101 | 106 | ||
107 | ret = nouveau_bo_map(pushbuf); | ||
108 | if (ret) { | ||
109 | nouveau_bo_unpin(pushbuf); | ||
110 | nouveau_bo_ref(NULL, &pushbuf); | ||
111 | return NULL; | ||
112 | } | ||
113 | |||
102 | return pushbuf; | 114 | return pushbuf; |
103 | } | 115 | } |
104 | 116 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.c b/drivers/gpu/drm/nouveau/nouveau_dma.c index 6ff77cedc008..65699bfaaaea 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.c +++ b/drivers/gpu/drm/nouveau/nouveau_dma.c | |||
@@ -36,7 +36,7 @@ nouveau_dma_pre_init(struct nouveau_channel *chan) | |||
36 | struct drm_nouveau_private *dev_priv = chan->dev->dev_private; | 36 | struct drm_nouveau_private *dev_priv = chan->dev->dev_private; |
37 | struct nouveau_bo *pushbuf = chan->pushbuf_bo; | 37 | struct nouveau_bo *pushbuf = chan->pushbuf_bo; |
38 | 38 | ||
39 | if (dev_priv->card_type == NV_50) { | 39 | if (dev_priv->card_type >= NV_50) { |
40 | const int ib_size = pushbuf->bo.mem.size / 2; | 40 | const int ib_size = pushbuf->bo.mem.size / 2; |
41 | 41 | ||
42 | chan->dma.ib_base = (pushbuf->bo.mem.size - ib_size) >> 2; | 42 | chan->dma.ib_base = (pushbuf->bo.mem.size - ib_size) >> 2; |
@@ -61,6 +61,21 @@ nouveau_dma_init(struct nouveau_channel *chan) | |||
61 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 61 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
62 | int ret, i; | 62 | int ret, i; |
63 | 63 | ||
64 | if (dev_priv->card_type >= NV_C0) { | ||
65 | ret = nouveau_gpuobj_gr_new(chan, 0x9039, 0x9039); | ||
66 | if (ret) | ||
67 | return ret; | ||
68 | |||
69 | ret = RING_SPACE(chan, 2); | ||
70 | if (ret) | ||
71 | return ret; | ||
72 | |||
73 | BEGIN_NVC0(chan, 2, NvSubM2MF, 0x0000, 1); | ||
74 | OUT_RING (chan, 0x00009039); | ||
75 | FIRE_RING (chan); | ||
76 | return 0; | ||
77 | } | ||
78 | |||
64 | /* Create NV_MEMORY_TO_MEMORY_FORMAT for buffer moves */ | 79 | /* Create NV_MEMORY_TO_MEMORY_FORMAT for buffer moves */ |
65 | ret = nouveau_gpuobj_gr_new(chan, NvM2MF, dev_priv->card_type < NV_50 ? | 80 | ret = nouveau_gpuobj_gr_new(chan, NvM2MF, dev_priv->card_type < NV_50 ? |
66 | 0x0039 : 0x5039); | 81 | 0x0039 : 0x5039); |
@@ -72,11 +87,6 @@ nouveau_dma_init(struct nouveau_channel *chan) | |||
72 | if (ret) | 87 | if (ret) |
73 | return ret; | 88 | return ret; |
74 | 89 | ||
75 | /* Map push buffer */ | ||
76 | ret = nouveau_bo_map(chan->pushbuf_bo); | ||
77 | if (ret) | ||
78 | return ret; | ||
79 | |||
80 | /* Insert NOPS for NOUVEAU_DMA_SKIPS */ | 90 | /* Insert NOPS for NOUVEAU_DMA_SKIPS */ |
81 | ret = RING_SPACE(chan, NOUVEAU_DMA_SKIPS); | 91 | ret = RING_SPACE(chan, NOUVEAU_DMA_SKIPS); |
82 | if (ret) | 92 | if (ret) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.h b/drivers/gpu/drm/nouveau/nouveau_dma.h index d578c21d3c8d..c118a331b5bc 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.h +++ b/drivers/gpu/drm/nouveau/nouveau_dma.h | |||
@@ -125,6 +125,12 @@ extern void | |||
125 | OUT_RINGp(struct nouveau_channel *chan, const void *data, unsigned nr_dwords); | 125 | OUT_RINGp(struct nouveau_channel *chan, const void *data, unsigned nr_dwords); |
126 | 126 | ||
127 | static inline void | 127 | static inline void |
128 | BEGIN_NVC0(struct nouveau_channel *chan, int op, int subc, int mthd, int size) | ||
129 | { | ||
130 | OUT_RING(chan, (op << 28) | (size << 16) | (subc << 13) | (mthd >> 2)); | ||
131 | } | ||
132 | |||
133 | static inline void | ||
128 | BEGIN_RING(struct nouveau_channel *chan, int subc, int mthd, int size) | 134 | BEGIN_RING(struct nouveau_channel *chan, int subc, int mthd, int size) |
129 | { | 135 | { |
130 | OUT_RING(chan, (subc << 13) | (size << 18) | mthd); | 136 | OUT_RING(chan, (subc << 13) | (size << 18) | mthd); |