diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2011-02-06 22:08:16 -0500 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-02-24 15:45:05 -0500 |
commit | 292deb7a3b6b03df664b8f5024a351d3389543ae (patch) | |
tree | ed3e4ae10b4a9621822e91e6972bbcde28843736 | |
parent | 60f60bf1bc45bef38568244f5c4e0d0f105c5032 (diff) |
drm/nv50-nvc0: tidy evo object creation some more
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_display.h | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_evo.c | 108 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_evo.h | 6 |
3 files changed, 62 insertions, 59 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_display.h b/drivers/gpu/drm/nouveau/nv50_display.h index a51b8853a924..3f5a3d543598 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.h +++ b/drivers/gpu/drm/nouveau/nv50_display.h | |||
@@ -62,4 +62,11 @@ void nv50_display_destroy(struct drm_device *dev); | |||
62 | int nv50_crtc_blank(struct nouveau_crtc *, bool blank); | 62 | int nv50_crtc_blank(struct nouveau_crtc *, bool blank); |
63 | int nv50_crtc_set_clock(struct drm_device *, int head, int pclk); | 63 | int nv50_crtc_set_clock(struct drm_device *, int head, int pclk); |
64 | 64 | ||
65 | int nv50_evo_init(struct drm_device *dev); | ||
66 | void nv50_evo_fini(struct drm_device *dev); | ||
67 | void nv50_evo_dmaobj_init(struct nouveau_gpuobj *, u32 memtype, u64 base, | ||
68 | u64 size); | ||
69 | int nv50_evo_dmaobj_new(struct nouveau_channel *, u32 handle, u32 memtype, | ||
70 | u64 base, u64 size, struct nouveau_gpuobj **); | ||
71 | |||
65 | #endif /* __NV50_DISPLAY_H__ */ | 72 | #endif /* __NV50_DISPLAY_H__ */ |
diff --git a/drivers/gpu/drm/nouveau/nv50_evo.c b/drivers/gpu/drm/nouveau/nv50_evo.c index eea96205fca2..b70208e981fb 100644 --- a/drivers/gpu/drm/nouveau/nv50_evo.c +++ b/drivers/gpu/drm/nouveau/nv50_evo.c | |||
@@ -48,12 +48,34 @@ nv50_evo_channel_del(struct nouveau_channel **pevo) | |||
48 | kfree(evo); | 48 | kfree(evo); |
49 | } | 49 | } |
50 | 50 | ||
51 | void | ||
52 | nv50_evo_dmaobj_init(struct nouveau_gpuobj *obj, u32 memtype, u64 base, u64 size) | ||
53 | { | ||
54 | struct drm_nouveau_private *dev_priv = obj->dev->dev_private; | ||
55 | u32 flags5; | ||
56 | |||
57 | if (dev_priv->chipset < 0xc0) { | ||
58 | /* not supported on 0x50, specified in format mthd */ | ||
59 | if (dev_priv->chipset == 0x50) | ||
60 | memtype = 0; | ||
61 | flags5 = 0x00010000; | ||
62 | } else { | ||
63 | if (memtype & 0x80000000) | ||
64 | flags5 = 0x00000000; /* large pages */ | ||
65 | else | ||
66 | flags5 = 0x00020000; | ||
67 | } | ||
68 | |||
69 | nv50_gpuobj_dma_init(obj, 0, 0x3d, base, size, NV_MEM_TARGET_VRAM, | ||
70 | NV_MEM_ACCESS_RW, (memtype >> 8) & 0xff, 0); | ||
71 | nv_wo32(obj, 0x14, flags5); | ||
72 | dev_priv->engine.instmem.flush(obj->dev); | ||
73 | } | ||
74 | |||
51 | int | 75 | int |
52 | nv50_evo_dmaobj_new(struct nouveau_channel *evo, u32 class, u32 name, | 76 | nv50_evo_dmaobj_new(struct nouveau_channel *evo, u32 handle, u32 memtype, |
53 | u32 tile_flags, u32 magic_flags, u32 offset, u32 limit, | 77 | u64 base, u64 size, struct nouveau_gpuobj **pobj) |
54 | u32 flags5) | ||
55 | { | 78 | { |
56 | struct drm_nouveau_private *dev_priv = evo->dev->dev_private; | ||
57 | struct nv50_display *disp = nv50_display(evo->dev); | 79 | struct nv50_display *disp = nv50_display(evo->dev); |
58 | struct nouveau_gpuobj *obj = NULL; | 80 | struct nouveau_gpuobj *obj = NULL; |
59 | int ret; | 81 | int ret; |
@@ -63,21 +85,17 @@ nv50_evo_dmaobj_new(struct nouveau_channel *evo, u32 class, u32 name, | |||
63 | return ret; | 85 | return ret; |
64 | obj->engine = NVOBJ_ENGINE_DISPLAY; | 86 | obj->engine = NVOBJ_ENGINE_DISPLAY; |
65 | 87 | ||
66 | nv_wo32(obj, 0, (tile_flags << 22) | (magic_flags << 16) | class); | 88 | nv50_evo_dmaobj_init(obj, memtype, base, size); |
67 | nv_wo32(obj, 4, limit); | ||
68 | nv_wo32(obj, 8, offset); | ||
69 | nv_wo32(obj, 12, 0x00000000); | ||
70 | nv_wo32(obj, 16, 0x00000000); | ||
71 | nv_wo32(obj, 20, flags5); | ||
72 | dev_priv->engine.instmem.flush(evo->dev); | ||
73 | 89 | ||
74 | ret = nouveau_ramht_insert(evo, name, obj); | 90 | ret = nouveau_ramht_insert(evo, handle, obj); |
75 | nouveau_gpuobj_ref(NULL, &obj); | 91 | if (ret) |
76 | if (ret) { | 92 | goto out; |
77 | return ret; | ||
78 | } | ||
79 | 93 | ||
80 | return 0; | 94 | if (pobj) |
95 | nouveau_gpuobj_ref(obj, pobj); | ||
96 | out: | ||
97 | nouveau_gpuobj_ref(NULL, &obj); | ||
98 | return ret; | ||
81 | } | 99 | } |
82 | 100 | ||
83 | static int | 101 | static int |
@@ -265,49 +283,33 @@ nv50_evo_create(struct drm_device *dev) | |||
265 | if (ret) | 283 | if (ret) |
266 | goto err; | 284 | goto err; |
267 | 285 | ||
268 | ret = nv50_evo_dmaobj_new(disp->master, 0x3d, NvEvoSync, 0, 0x19, | 286 | ret = nv50_evo_dmaobj_new(disp->master, NvEvoSync, 0x0000, |
269 | disp->ntfy->vinst, disp->ntfy->vinst + | 287 | disp->ntfy->vinst, disp->ntfy->size, NULL); |
270 | disp->ntfy->size, 0x00010000); | ||
271 | if (ret) | 288 | if (ret) |
272 | goto err; | 289 | goto err; |
273 | 290 | ||
274 | /* create some default objects for the scanout memtypes we support */ | 291 | /* create some default objects for the scanout memtypes we support */ |
275 | if (dev_priv->card_type >= NV_C0) { | 292 | ret = nv50_evo_dmaobj_new(disp->master, NvEvoVRAM, 0x0000, |
276 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB32, 0xfe, 0x19, | 293 | 0, dev_priv->vram_size, NULL); |
277 | 0, 0xffffffff, 0x00000000); | 294 | if (ret) |
278 | if (ret) | 295 | goto err; |
279 | goto err; | ||
280 | |||
281 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM, 0, 0x19, | ||
282 | 0, dev_priv->vram_size, 0x00020000); | ||
283 | if (ret) | ||
284 | goto err; | ||
285 | |||
286 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM_LP, 0, 0x19, | ||
287 | 0, dev_priv->vram_size, 0x00000000); | ||
288 | if (ret) | ||
289 | goto err; | ||
290 | } else { | ||
291 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB16, 0x70, 0x19, | ||
292 | 0, 0xffffffff, 0x00010000); | ||
293 | if (ret) | ||
294 | goto err; | ||
295 | 296 | ||
296 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB32, 0x7a, 0x19, | 297 | ret = nv50_evo_dmaobj_new(disp->master, NvEvoVRAM_LP, 0x80000000, |
297 | 0, 0xffffffff, 0x00010000); | 298 | 0, dev_priv->vram_size, NULL); |
298 | if (ret) | 299 | if (ret) |
299 | goto err; | 300 | goto err; |
300 | 301 | ||
301 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM, 0, 0x19, | 302 | ret = nv50_evo_dmaobj_new(disp->master, NvEvoFB32, 0x80000000 | |
302 | 0, dev_priv->vram_size, 0x00010000); | 303 | (dev_priv->chipset < 0xc0 ? 0x7a00 : 0xfe00), |
303 | if (ret) | 304 | 0, dev_priv->vram_size, NULL); |
304 | goto err; | 305 | if (ret) |
306 | goto err; | ||
305 | 307 | ||
306 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM_LP, 0, 0x19, | 308 | ret = nv50_evo_dmaobj_new(disp->master, NvEvoFB16, 0x80000000 | |
307 | 0, dev_priv->vram_size, 0x00010000); | 309 | (dev_priv->chipset < 0xc0 ? 0x7000 : 0xfe00), |
308 | if (ret) | 310 | 0, dev_priv->vram_size, NULL); |
309 | goto err; | 311 | if (ret) |
310 | } | 312 | goto err; |
311 | 313 | ||
312 | return 0; | 314 | return 0; |
313 | 315 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_evo.h b/drivers/gpu/drm/nouveau/nv50_evo.h index 95c411905b16..e6b069fec0bc 100644 --- a/drivers/gpu/drm/nouveau/nv50_evo.h +++ b/drivers/gpu/drm/nouveau/nv50_evo.h | |||
@@ -27,12 +27,6 @@ | |||
27 | #ifndef __NV50_EVO_H__ | 27 | #ifndef __NV50_EVO_H__ |
28 | #define __NV50_EVO_H__ | 28 | #define __NV50_EVO_H__ |
29 | 29 | ||
30 | int nv50_evo_init(struct drm_device *dev); | ||
31 | void nv50_evo_fini(struct drm_device *dev); | ||
32 | int nv50_evo_dmaobj_new(struct nouveau_channel *, u32 class, u32 name, | ||
33 | u32 tile_flags, u32 magic_flags, | ||
34 | u32 offset, u32 limit, u32 flags5); | ||
35 | |||
36 | #define NV50_EVO_UPDATE 0x00000080 | 30 | #define NV50_EVO_UPDATE 0x00000080 |
37 | #define NV50_EVO_UNK84 0x00000084 | 31 | #define NV50_EVO_UNK84 0x00000084 |
38 | #define NV50_EVO_UNK84_NOTIFY 0x40000000 | 32 | #define NV50_EVO_UNK84_NOTIFY 0x40000000 |