aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nvd0_display.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2011-07-04 21:58:58 -0400
committerBen Skeggs <bskeggs@redhat.com>2011-09-20 02:06:07 -0400
commitefd272a7a03148ca3115da07d849156d0976feaf (patch)
treee0993427c5a26c2dcda4a15ce4cb9083398a949d /drivers/gpu/drm/nouveau/nvd0_display.c
parent4600522a8f93dda05e5fa8bd5261e6c6e888dafa (diff)
drm/nvd0/disp: setup a couple of dma objects we'll need
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvd0_display.c')
-rw-r--r--drivers/gpu/drm/nouveau/nvd0_display.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/drivers/gpu/drm/nouveau/nvd0_display.c b/drivers/gpu/drm/nouveau/nvd0_display.c
index 10a44a1d44fc..6339a3d00363 100644
--- a/drivers/gpu/drm/nouveau/nvd0_display.c
+++ b/drivers/gpu/drm/nouveau/nvd0_display.c
@@ -30,6 +30,9 @@
30#include "nouveau_encoder.h" 30#include "nouveau_encoder.h"
31#include "nouveau_crtc.h" 31#include "nouveau_crtc.h"
32 32
33#define MEM_SYNC 0xe0000001
34#define MEM_VRAM 0xe0010000
35
33struct nvd0_display { 36struct nvd0_display {
34 struct nouveau_gpuobj *mem; 37 struct nouveau_gpuobj *mem;
35 struct { 38 struct {
@@ -172,6 +175,7 @@ int
172nvd0_display_init(struct drm_device *dev) 175nvd0_display_init(struct drm_device *dev)
173{ 176{
174 struct nvd0_display *disp = nvd0_display(dev); 177 struct nvd0_display *disp = nvd0_display(dev);
178 u32 *push;
175 int i; 179 int i;
176 180
177 if (nv_rd32(dev, 0x6100ac) & 0x00000100) { 181 if (nv_rd32(dev, 0x6100ac) & 0x00000100) {
@@ -189,7 +193,7 @@ nvd0_display_init(struct drm_device *dev)
189 /* init master */ 193 /* init master */
190 nv_wr32(dev, 0x610494, (disp->evo[0].handle >> 8) | 3); 194 nv_wr32(dev, 0x610494, (disp->evo[0].handle >> 8) | 3);
191 nv_wr32(dev, 0x610498, 0x00010000); 195 nv_wr32(dev, 0x610498, 0x00010000);
192 nv_wr32(dev, 0x61049c, 0x00000000); 196 nv_wr32(dev, 0x61049c, 0x00000001);
193 nv_mask(dev, 0x610490, 0x00000010, 0x00000010); 197 nv_mask(dev, 0x610490, 0x00000010, 0x00000010);
194 nv_wr32(dev, 0x640000, 0x00000000); 198 nv_wr32(dev, 0x640000, 0x00000000);
195 nv_wr32(dev, 0x610490, 0x01000013); 199 nv_wr32(dev, 0x610490, 0x01000013);
@@ -214,6 +218,19 @@ nvd0_display_init(struct drm_device *dev)
214 nv_mask(dev, 0x6100a0, 1 << i, 1 << i); 218 nv_mask(dev, 0x6100a0, 1 << i, 1 << i);
215 } 219 }
216 220
221 push = evo_wait(dev, 0, 32);
222 if (!push)
223 return -EBUSY;
224 evo_mthd(push, 0x0088, 1);
225 evo_data(push, MEM_SYNC);
226 evo_mthd(push, 0x0084, 1);
227 evo_data(push, 0x00000000);
228 evo_mthd(push, 0x0084, 1);
229 evo_data(push, 0x80000000);
230 evo_mthd(push, 0x008c, 1);
231 evo_data(push, 0x00000000);
232 evo_kick(push, dev, 0);
233
217 return 0; 234 return 0;
218} 235}
219 236
@@ -238,6 +255,7 @@ int
238nvd0_display_create(struct drm_device *dev) 255nvd0_display_create(struct drm_device *dev)
239{ 256{
240 struct drm_nouveau_private *dev_priv = dev->dev_private; 257 struct drm_nouveau_private *dev_priv = dev->dev_private;
258 struct nouveau_instmem_engine *pinstmem = &dev_priv->engine.instmem;
241 struct pci_dev *pdev = dev->pdev; 259 struct pci_dev *pdev = dev->pdev;
242 struct nvd0_display *disp; 260 struct nvd0_display *disp;
243 int ret; 261 int ret;
@@ -251,10 +269,31 @@ nvd0_display_create(struct drm_device *dev)
251 nouveau_irq_register(dev, 26, nvd0_display_intr); 269 nouveau_irq_register(dev, 26, nvd0_display_intr);
252 270
253 /* hash table and dma objects for the memory areas we care about */ 271 /* hash table and dma objects for the memory areas we care about */
254 ret = nouveau_gpuobj_new(dev, NULL, 4 * 1024, 0x1000, 0, &disp->mem); 272 ret = nouveau_gpuobj_new(dev, NULL, 0x4000, 0x10000,
273 NVOBJ_FLAG_ZERO_ALLOC, &disp->mem);
255 if (ret) 274 if (ret)
256 goto out; 275 goto out;
257 276
277 nv_wo32(disp->mem, 0x1000, 0x00000049);
278 nv_wo32(disp->mem, 0x1004, (disp->mem->vinst + 0x2000) >> 8);
279 nv_wo32(disp->mem, 0x1008, (disp->mem->vinst + 0x2fff) >> 8);
280 nv_wo32(disp->mem, 0x100c, 0x00000000);
281 nv_wo32(disp->mem, 0x1010, 0x00000000);
282 nv_wo32(disp->mem, 0x1014, 0x00000000);
283 nv_wo32(disp->mem, 0x0000, MEM_SYNC);
284 nv_wo32(disp->mem, 0x0004, (0x1000 << 9) | 0x00000001);
285
286 nv_wo32(disp->mem, 0x1020, 0x00000009);
287 nv_wo32(disp->mem, 0x1024, 0x00000000);
288 nv_wo32(disp->mem, 0x1028, (dev_priv->vram_size - 1) >> 8);
289 nv_wo32(disp->mem, 0x102c, 0x00000000);
290 nv_wo32(disp->mem, 0x1030, 0x00000000);
291 nv_wo32(disp->mem, 0x1034, 0x00000000);
292 nv_wo32(disp->mem, 0x0008, MEM_VRAM);
293 nv_wo32(disp->mem, 0x000c, (0x1020 << 9) | 0x00000001);
294
295 pinstmem->flush(dev);
296
258 /* push buffers for evo channels */ 297 /* push buffers for evo channels */
259 disp->evo[0].ptr = 298 disp->evo[0].ptr =
260 pci_alloc_consistent(pdev, PAGE_SIZE, &disp->evo[0].handle); 299 pci_alloc_consistent(pdev, PAGE_SIZE, &disp->evo[0].handle);