aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2012-03-20 00:36:04 -0400
committerBen Skeggs <bskeggs@redhat.com>2012-05-24 02:31:45 -0400
commitc6b7e89582bdb028e1b1763197ff24c77a43e1b0 (patch)
treee3fcb3794462c02758f253183d80ec9fa69c4d56 /drivers
parentf1c65e7c7fb7e109290e969ad17f08c45993b41c (diff)
drm/nve0/ttm: implement buffer moves with weirdo pcopy-on-pgraph methods
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c24
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_dma.h1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_state.c14
3 files changed, 39 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 4435e115b929..1da403123eca 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -489,6 +489,27 @@ nouveau_bo_move_accel_cleanup(struct nouveau_channel *chan,
489} 489}
490 490
491static int 491static int
492nve0_bo_move_copy(struct nouveau_channel *chan, struct ttm_buffer_object *bo,
493 struct ttm_mem_reg *old_mem, struct ttm_mem_reg *new_mem)
494{
495 struct nouveau_mem *node = old_mem->mm_node;
496 int ret = RING_SPACE(chan, 10);
497 if (ret == 0) {
498 BEGIN_NVC0(chan, 2, NvSubCopy, 0x0400, 8);
499 OUT_RING (chan, upper_32_bits(node->vma[0].offset));
500 OUT_RING (chan, lower_32_bits(node->vma[0].offset));
501 OUT_RING (chan, upper_32_bits(node->vma[1].offset));
502 OUT_RING (chan, lower_32_bits(node->vma[1].offset));
503 OUT_RING (chan, PAGE_SIZE);
504 OUT_RING (chan, PAGE_SIZE);
505 OUT_RING (chan, PAGE_SIZE);
506 OUT_RING (chan, new_mem->num_pages);
507 BEGIN_NVC0(chan, 8, NvSubCopy, 0x0300, 0x0386);
508 }
509 return ret;
510}
511
512static int
492nvc0_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo, 513nvc0_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo,
493 struct ttm_mem_reg *old_mem, struct ttm_mem_reg *new_mem) 514 struct ttm_mem_reg *old_mem, struct ttm_mem_reg *new_mem)
494{ 515{
@@ -727,7 +748,10 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr,
727 if (dev_priv->card_type < NV_C0) 748 if (dev_priv->card_type < NV_C0)
728 ret = nv50_bo_move_m2mf(chan, bo, &bo->mem, new_mem); 749 ret = nv50_bo_move_m2mf(chan, bo, &bo->mem, new_mem);
729 else 750 else
751 if (dev_priv->card_type < NV_E0)
730 ret = nvc0_bo_move_m2mf(chan, bo, &bo->mem, new_mem); 752 ret = nvc0_bo_move_m2mf(chan, bo, &bo->mem, new_mem);
753 else
754 ret = nve0_bo_move_copy(chan, bo, &bo->mem, new_mem);
731 if (ret == 0) { 755 if (ret == 0) {
732 ret = nouveau_bo_move_accel_cleanup(chan, nvbo, evict, 756 ret = nouveau_bo_move_accel_cleanup(chan, nvbo, evict,
733 no_wait_reserve, 757 no_wait_reserve,
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.h b/drivers/gpu/drm/nouveau/nouveau_dma.h
index 47896c407284..f776b6af9640 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dma.h
+++ b/drivers/gpu/drm/nouveau/nouveau_dma.h
@@ -53,6 +53,7 @@ enum {
53 NvSubCtxSurf2D = 2, 53 NvSubCtxSurf2D = 2,
54 NvSub2D = 3, 54 NvSub2D = 3,
55 NvSubGdiRect = 3, 55 NvSubGdiRect = 3,
56 NvSubCopy = 4,
56 NvSubImageBlit = 4 57 NvSubImageBlit = 4
57}; 58};
58 59
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
index 2dd7187b08d3..78fb2cbeea23 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -657,6 +657,20 @@ nouveau_card_channel_init(struct drm_device *dev)
657 657
658 BEGIN_NVC0(chan, 2, NvSubM2MF, 0x0000, 1); 658 BEGIN_NVC0(chan, 2, NvSubM2MF, 0x0000, 1);
659 OUT_RING (chan, 0x00009039); 659 OUT_RING (chan, 0x00009039);
660 } else
661 if (dev_priv->card_type <= NV_E0) {
662 /* not used, but created to get a graph context */
663 ret = nouveau_gpuobj_gr_new(chan, 0xa040, 0xa040);
664 if (ret)
665 goto error;
666
667 /* bind strange copy engine to subchannel 4 (fixed...) */
668 ret = RING_SPACE(chan, 2);
669 if (ret)
670 goto error;
671
672 BEGIN_NVC0(chan, 2, NvSubCopy, 0x0000, 1);
673 OUT_RING (chan, 0x0000a0b5);
660 } 674 }
661 675
662 FIRE_RING (chan); 676 FIRE_RING (chan);