drm/nv98/ttm: add in a (disabled) crypto engine buffer copy method
authorBen Skeggs <bskeggs@redhat.com>
Fri, 4 May 2012 04:34:16 +0000 (14:34 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 24 May 2012 06:56:19 +0000 (16:56 +1000)
Disabled for the moment until some performance issues are sorted out, code
committed as a reference point.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nouveau_bo.c

index f596354f399abc052c43bf72ba65f5fc767d2b51..771ce371c4baf8e6ca930c889fca9f900c463345 100644 (file)
@@ -561,6 +561,24 @@ nvc0_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo,
        return 0;
 }
 
+static int
+nv98_bo_move_exec(struct nouveau_channel *chan, struct ttm_buffer_object *bo,
+                 struct ttm_mem_reg *old_mem, struct ttm_mem_reg *new_mem)
+{
+       struct nouveau_mem *node = old_mem->mm_node;
+       int ret = RING_SPACE(chan, 7);
+       if (ret == 0) {
+               BEGIN_NV04(chan, NvSubCopy, 0x0320, 6);
+               OUT_RING  (chan, upper_32_bits(node->vma[0].offset));
+               OUT_RING  (chan, lower_32_bits(node->vma[0].offset));
+               OUT_RING  (chan, upper_32_bits(node->vma[1].offset));
+               OUT_RING  (chan, lower_32_bits(node->vma[1].offset));
+               OUT_RING  (chan, 0x00000000 /* COPY */);
+               OUT_RING  (chan, new_mem->num_pages << PAGE_SHIFT);
+       }
+       return ret;
+}
+
 static int
 nv84_bo_move_exec(struct nouveau_channel *chan, struct ttm_buffer_object *bo,
                  struct ttm_mem_reg *old_mem, struct ttm_mem_reg *new_mem)
@@ -842,7 +860,8 @@ nouveau_bo_move_init(struct nouveau_channel *chan)
                { "CRYPT", 0x74c1, nv84_bo_move_exec, nv50_bo_move_init },
                {  "M2MF", 0x5039, nv50_bo_move_m2mf, nv50_bo_move_init },
                {  "M2MF", 0x0039, nv04_bo_move_m2mf, nv04_bo_move_init },
-               {}
+               {},
+               { "CRYPT", 0x88b4, nv98_bo_move_exec, nv50_bo_move_init },
        }, *mthd = _methods;
        const char *name = "CPU";
        int ret;