aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2010-12-07 20:19:30 -0500
committerBen Skeggs <bskeggs@redhat.com>2010-12-21 02:18:42 -0500
commit6d86951a45013ac5b060c5e6307b11b7c685c76f (patch)
tree807f1b82c3b04d89ba089498a5e1f1b7e5dcc975 /drivers/gpu/drm
parentddbaf79a8b047dcccf766d0518626cdc0f43d58e (diff)
drm/nvc0: initial support for tiled buffer objects
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c3
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_dma.h3
-rw-r--r--drivers/gpu/drm/nouveau/nv50_crtc.c18
-rw-r--r--drivers/gpu/drm/nouveau/nv50_evo.c53
-rw-r--r--drivers/gpu/drm/nouveau/nvc0_vram.c10
5 files changed, 62 insertions, 25 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 5dc639e0c969..74d0ef41118d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -120,9 +120,6 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan,
120 align >>= PAGE_SHIFT; 120 align >>= PAGE_SHIFT;
121 121
122 if (!nvbo->no_vm && dev_priv->chan_vm) { 122 if (!nvbo->no_vm && dev_priv->chan_vm) {
123 if (dev_priv->card_type == NV_C0)
124 page_shift = 12;
125
126 ret = nouveau_vm_get(dev_priv->chan_vm, size, page_shift, 123 ret = nouveau_vm_get(dev_priv->chan_vm, size, page_shift,
127 NV_MEM_ACCESS_RW, &nvbo->vma); 124 NV_MEM_ACCESS_RW, &nvbo->vma);
128 if (ret) { 125 if (ret) {
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.h b/drivers/gpu/drm/nouveau/nouveau_dma.h
index c118a331b5bc..c36f1763feaa 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dma.h
+++ b/drivers/gpu/drm/nouveau/nouveau_dma.h
@@ -77,7 +77,8 @@ enum {
77 /* G80+ display objects */ 77 /* G80+ display objects */
78 NvEvoVRAM = 0x01000000, 78 NvEvoVRAM = 0x01000000,
79 NvEvoFB16 = 0x01000001, 79 NvEvoFB16 = 0x01000001,
80 NvEvoFB32 = 0x01000002 80 NvEvoFB32 = 0x01000002,
81 NvEvoVRAM_LP = 0x01000003
81}; 82};
82 83
83#define NV_MEMORY_TO_MEMORY_FORMAT 0x00000039 84#define NV_MEMORY_TO_MEMORY_FORMAT 0x00000039
diff --git a/drivers/gpu/drm/nouveau/nv50_crtc.c b/drivers/gpu/drm/nouveau/nv50_crtc.c
index 2c346f797285..9023c4dbb449 100644
--- a/drivers/gpu/drm/nouveau/nv50_crtc.c
+++ b/drivers/gpu/drm/nouveau/nv50_crtc.c
@@ -115,15 +115,16 @@ nv50_crtc_blank(struct nouveau_crtc *nv_crtc, bool blanked)
115 OUT_RING(evo, 0); 115 OUT_RING(evo, 0);
116 BEGIN_RING(evo, 0, NV50_EVO_CRTC(index, FB_DMA), 1); 116 BEGIN_RING(evo, 0, NV50_EVO_CRTC(index, FB_DMA), 1);
117 if (dev_priv->chipset != 0x50) 117 if (dev_priv->chipset != 0x50)
118 if (nv_crtc->fb.tile_flags == 0x7a00) 118 if (nv_crtc->fb.tile_flags == 0x7a00 ||
119 nv_crtc->fb.tile_flags == 0xfe00)
119 OUT_RING(evo, NvEvoFB32); 120 OUT_RING(evo, NvEvoFB32);
120 else 121 else
121 if (nv_crtc->fb.tile_flags == 0x7000) 122 if (nv_crtc->fb.tile_flags == 0x7000)
122 OUT_RING(evo, NvEvoFB16); 123 OUT_RING(evo, NvEvoFB16);
123 else 124 else
124 OUT_RING(evo, NvEvoVRAM); 125 OUT_RING(evo, NvEvoVRAM_LP);
125 else 126 else
126 OUT_RING(evo, NvEvoVRAM); 127 OUT_RING(evo, NvEvoVRAM_LP);
127 } 128 }
128 129
129 nv_crtc->fb.blanked = blanked; 130 nv_crtc->fb.blanked = blanked;
@@ -555,13 +556,14 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc,
555 return ret; 556 return ret;
556 557
557 BEGIN_RING(evo, 0, NV50_EVO_CRTC(nv_crtc->index, FB_DMA), 1); 558 BEGIN_RING(evo, 0, NV50_EVO_CRTC(nv_crtc->index, FB_DMA), 1);
558 if (nv_crtc->fb.tile_flags == 0x7a00) 559 if (nv_crtc->fb.tile_flags == 0x7a00 ||
560 nv_crtc->fb.tile_flags == 0xfe00)
559 OUT_RING(evo, NvEvoFB32); 561 OUT_RING(evo, NvEvoFB32);
560 else 562 else
561 if (nv_crtc->fb.tile_flags == 0x7000) 563 if (nv_crtc->fb.tile_flags == 0x7000)
562 OUT_RING(evo, NvEvoFB16); 564 OUT_RING(evo, NvEvoFB16);
563 else 565 else
564 OUT_RING(evo, NvEvoVRAM); 566 OUT_RING(evo, NvEvoVRAM_LP);
565 } 567 }
566 568
567 ret = RING_SPACE(evo, 12); 569 ret = RING_SPACE(evo, 12);
@@ -575,8 +577,10 @@ nv50_crtc_do_mode_set_base(struct drm_crtc *crtc,
575 if (!nv_crtc->fb.tile_flags) { 577 if (!nv_crtc->fb.tile_flags) {
576 OUT_RING(evo, drm_fb->pitch | (1 << 20)); 578 OUT_RING(evo, drm_fb->pitch | (1 << 20));
577 } else { 579 } else {
578 OUT_RING(evo, ((drm_fb->pitch / 4) << 4) | 580 u32 tile_mode = fb->nvbo->tile_mode;
579 fb->nvbo->tile_mode); 581 if (dev_priv->card_type >= NV_C0)
582 tile_mode >>= 4;
583 OUT_RING(evo, ((drm_fb->pitch / 4) << 4) | tile_mode);
580 } 584 }
581 if (dev_priv->chipset == 0x50) 585 if (dev_priv->chipset == 0x50)
582 OUT_RING(evo, (nv_crtc->fb.tile_flags << 8) | format); 586 OUT_RING(evo, (nv_crtc->fb.tile_flags << 8) | format);
diff --git a/drivers/gpu/drm/nouveau/nv50_evo.c b/drivers/gpu/drm/nouveau/nv50_evo.c
index 887b2a97e2a2..14e24e906ee8 100644
--- a/drivers/gpu/drm/nouveau/nv50_evo.c
+++ b/drivers/gpu/drm/nouveau/nv50_evo.c
@@ -53,7 +53,8 @@ nv50_evo_channel_del(struct nouveau_channel **pevo)
53 53
54int 54int
55nv50_evo_dmaobj_new(struct nouveau_channel *evo, u32 class, u32 name, 55nv50_evo_dmaobj_new(struct nouveau_channel *evo, u32 class, u32 name,
56 u32 tile_flags, u32 magic_flags, u32 offset, u32 limit) 56 u32 tile_flags, u32 magic_flags, u32 offset, u32 limit,
57 u32 flags5)
57{ 58{
58 struct drm_nouveau_private *dev_priv = evo->dev->dev_private; 59 struct drm_nouveau_private *dev_priv = evo->dev->dev_private;
59 struct drm_device *dev = evo->dev; 60 struct drm_device *dev = evo->dev;
@@ -70,10 +71,7 @@ nv50_evo_dmaobj_new(struct nouveau_channel *evo, u32 class, u32 name,
70 nv_wo32(obj, 8, offset); 71 nv_wo32(obj, 8, offset);
71 nv_wo32(obj, 12, 0x00000000); 72 nv_wo32(obj, 12, 0x00000000);
72 nv_wo32(obj, 16, 0x00000000); 73 nv_wo32(obj, 16, 0x00000000);
73 if (dev_priv->card_type < NV_C0) 74 nv_wo32(obj, 20, flags5);
74 nv_wo32(obj, 20, 0x00010000);
75 else
76 nv_wo32(obj, 20, 0x00020000);
77 dev_priv->engine.instmem.flush(dev); 75 dev_priv->engine.instmem.flush(dev);
78 76
79 ret = nouveau_ramht_insert(evo, name, obj); 77 ret = nouveau_ramht_insert(evo, name, obj);
@@ -264,9 +262,31 @@ nv50_evo_create(struct drm_device *dev)
264 } 262 }
265 263
266 /* create some default objects for the scanout memtypes we support */ 264 /* create some default objects for the scanout memtypes we support */
265 if (dev_priv->card_type >= NV_C0) {
266 ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB32, 0xfe, 0x19,
267 0, 0xffffffff, 0x00000000);
268 if (ret) {
269 nv50_evo_channel_del(&dev_priv->evo);
270 return ret;
271 }
272
273 ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM, 0, 0x19,
274 0, dev_priv->vram_size, 0x00020000);
275 if (ret) {
276 nv50_evo_channel_del(&dev_priv->evo);
277 return ret;
278 }
279
280 ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM_LP, 0, 0x19,
281 0, dev_priv->vram_size, 0x00000000);
282 if (ret) {
283 nv50_evo_channel_del(&dev_priv->evo);
284 return ret;
285 }
286 } else
267 if (dev_priv->chipset != 0x50) { 287 if (dev_priv->chipset != 0x50) {
268 ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB16, 0x70, 0x19, 288 ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB16, 0x70, 0x19,
269 0, 0xffffffff); 289 0, 0xffffffff, 0x00010000);
270 if (ret) { 290 if (ret) {
271 nv50_evo_channel_del(&dev_priv->evo); 291 nv50_evo_channel_del(&dev_priv->evo);
272 return ret; 292 return ret;
@@ -274,18 +294,25 @@ nv50_evo_create(struct drm_device *dev)
274 294
275 295
276 ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB32, 0x7a, 0x19, 296 ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB32, 0x7a, 0x19,
277 0, 0xffffffff); 297 0, 0xffffffff, 0x00010000);
278 if (ret) { 298 if (ret) {
279 nv50_evo_channel_del(&dev_priv->evo); 299 nv50_evo_channel_del(&dev_priv->evo);
280 return ret; 300 return ret;
281 } 301 }
282 }
283 302
284 ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM, 0, 0x19, 303 ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM, 0, 0x19,
285 0, dev_priv->vram_size); 304 0, dev_priv->vram_size, 0x00010000);
286 if (ret) { 305 if (ret) {
287 nv50_evo_channel_del(&dev_priv->evo); 306 nv50_evo_channel_del(&dev_priv->evo);
288 return ret; 307 return ret;
308 }
309
310 ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoVRAM_LP, 0, 0x19,
311 0, dev_priv->vram_size, 0x00010000);
312 if (ret) {
313 nv50_evo_channel_del(&dev_priv->evo);
314 return ret;
315 }
289 } 316 }
290 317
291 return 0; 318 return 0;
diff --git a/drivers/gpu/drm/nouveau/nvc0_vram.c b/drivers/gpu/drm/nouveau/nvc0_vram.c
index 41fcae5ffba4..858eda5dedd1 100644
--- a/drivers/gpu/drm/nouveau/nvc0_vram.c
+++ b/drivers/gpu/drm/nouveau/nvc0_vram.c
@@ -29,8 +29,16 @@
29bool 29bool
30nvc0_vram_flags_valid(struct drm_device *dev, u32 tile_flags) 30nvc0_vram_flags_valid(struct drm_device *dev, u32 tile_flags)
31{ 31{
32 if (likely(!(tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK))) 32 switch (tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK) {
33 case 0x0000:
34 case 0xfe00:
35 case 0xdb00:
36 case 0x1100:
33 return true; 37 return true;
38 default:
39 break;
40 }
41
34 return false; 42 return false;
35} 43}
36 44