drm/radeon/kms: reorganize copy callbacks
authorAlex Deucher <alexander.deucher@amd.com>
Thu, 23 Feb 2012 22:53:42 +0000 (17:53 -0500)
committerDave Airlie <airlied@redhat.com>
Wed, 29 Feb 2012 10:14:14 +0000 (10:14 +0000)
tidy up the radeon_asic struct, handle multiple
rings better.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König<christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/evergreen.c
drivers/gpu/drm/radeon/ni.c
drivers/gpu/drm/radeon/r600.c
drivers/gpu/drm/radeon/radeon.h
drivers/gpu/drm/radeon/radeon_asic.c
drivers/gpu/drm/radeon/radeon_benchmark.c
drivers/gpu/drm/radeon/radeon_ttm.c
drivers/gpu/drm/radeon/rv770.c

index c8dae3f9fa09895d700e55e9d8350ee9bfebec1f..4350a3fe4ec5045f3702e1c09755cd7e1300e9b9 100644 (file)
@@ -3197,7 +3197,7 @@ static int evergreen_startup(struct radeon_device *rdev)
        r = evergreen_blit_init(rdev);
        if (r) {
                r600_blit_fini(rdev);
-               rdev->asic->copy = NULL;
+               rdev->asic->copy.copy = NULL;
                dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r);
        }
 
index db09065e68fd60ee488da280199a382c5b19efb8..6863a053861521c73c69dd0e07b975f1aa373aa4 100644 (file)
@@ -1466,7 +1466,7 @@ static int cayman_startup(struct radeon_device *rdev)
        r = evergreen_blit_init(rdev);
        if (r) {
                r600_blit_fini(rdev);
-               rdev->asic->copy = NULL;
+               rdev->asic->copy.copy = NULL;
                dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r);
        }
 
index 4a4ac8fb7b70f1ae39a035e64ee7916652914ff6..4cfb90be7241aa166ea085b1e211a5869568a0da 100644 (file)
@@ -2449,7 +2449,7 @@ int r600_startup(struct radeon_device *rdev)
        r = r600_blit_init(rdev);
        if (r) {
                r600_blit_fini(rdev);
-               rdev->asic->copy = NULL;
+               rdev->asic->copy.copy = NULL;
                dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r);
        }
 
index 80548b6a86a170166c60acb90071f5dae8376fc4..b4dea5c79847bd4e51311637d1205403fadf32e6 100644 (file)
@@ -1154,21 +1154,30 @@ struct radeon_asic {
        int (*irq_set)(struct radeon_device *rdev);
        int (*irq_process)(struct radeon_device *rdev);
        u32 (*get_vblank_counter)(struct radeon_device *rdev, int crtc);
-       int (*copy_blit)(struct radeon_device *rdev,
-                        uint64_t src_offset,
-                        uint64_t dst_offset,
-                        unsigned num_gpu_pages,
-                        struct radeon_fence *fence);
-       int (*copy_dma)(struct radeon_device *rdev,
-                       uint64_t src_offset,
-                       uint64_t dst_offset,
-                       unsigned num_gpu_pages,
-                       struct radeon_fence *fence);
-       int (*copy)(struct radeon_device *rdev,
-                   uint64_t src_offset,
-                   uint64_t dst_offset,
-                   unsigned num_gpu_pages,
-                   struct radeon_fence *fence);
+
+       struct {
+               int (*blit)(struct radeon_device *rdev,
+                           uint64_t src_offset,
+                           uint64_t dst_offset,
+                           unsigned num_gpu_pages,
+                           struct radeon_fence *fence);
+               u32 blit_ring_index;
+               int (*dma)(struct radeon_device *rdev,
+                          uint64_t src_offset,
+                          uint64_t dst_offset,
+                          unsigned num_gpu_pages,
+                          struct radeon_fence *fence);
+               u32 dma_ring_index;
+               /* method used for bo copy */
+               int (*copy)(struct radeon_device *rdev,
+                           uint64_t src_offset,
+                           uint64_t dst_offset,
+                           unsigned num_gpu_pages,
+                           struct radeon_fence *fence);
+               /* ring used for bo copies */
+               u32 copy_ring_index;
+       } copy;
+
        uint32_t (*get_engine_clock)(struct radeon_device *rdev);
        void (*set_engine_clock)(struct radeon_device *rdev, uint32_t eng_clock);
        uint32_t (*get_memory_clock)(struct radeon_device *rdev);
@@ -1505,8 +1514,6 @@ struct radeon_device {
        unsigned                debugfs_count;
        /* virtual memory */
        struct radeon_vm_manager        vm_manager;
-       /* ring used for bo copies */
-       u32                             copy_ring;
 };
 
 int radeon_device_init(struct radeon_device *rdev,
@@ -1677,9 +1684,12 @@ void radeon_ring_write(struct radeon_ring *ring, uint32_t v);
 #define radeon_get_vblank_counter(rdev, crtc) (rdev)->asic->get_vblank_counter((rdev), (crtc))
 #define radeon_fence_ring_emit(rdev, r, fence) (rdev)->asic->ring[(r)].emit_fence((rdev), (fence))
 #define radeon_semaphore_ring_emit(rdev, r, cp, semaphore, emit_wait) (rdev)->asic->ring[(r)].emit_semaphore((rdev), (cp), (semaphore), (emit_wait))
-#define radeon_copy_blit(rdev, s, d, np, f) (rdev)->asic->copy_blit((rdev), (s), (d), (np), (f))
-#define radeon_copy_dma(rdev, s, d, np, f) (rdev)->asic->copy_dma((rdev), (s), (d), (np), (f))
-#define radeon_copy(rdev, s, d, np, f) (rdev)->asic->copy((rdev), (s), (d), (np), (f))
+#define radeon_copy_blit(rdev, s, d, np, f) (rdev)->asic->copy.blit((rdev), (s), (d), (np), (f))
+#define radeon_copy_dma(rdev, s, d, np, f) (rdev)->asic->copy.dma((rdev), (s), (d), (np), (f))
+#define radeon_copy(rdev, s, d, np, f) (rdev)->asic->copy.copy((rdev), (s), (d), (np), (f))
+#define radeon_copy_blit_ring_index(rdev) (rdev)->asic->copy.blit_ring_index
+#define radeon_copy_dma_ring_index(rdev) (rdev)->asic->copy.dma_ring_index
+#define radeon_copy_ring_index(rdev) (rdev)->asic->copy.copy_ring_index
 #define radeon_get_engine_clock(rdev) (rdev)->asic->get_engine_clock((rdev))
 #define radeon_set_engine_clock(rdev, e) (rdev)->asic->set_engine_clock((rdev), (e))
 #define radeon_get_memory_clock(rdev) (rdev)->asic->get_memory_clock((rdev))
index 38a29bcac5d1703cd093bdfe4af93e2f44d3a4a4..6bd15254f643b3a23cea263b4f04ed862d95c7f4 100644 (file)
@@ -151,9 +151,14 @@ static struct radeon_asic r100_asic = {
        .irq_set = &r100_irq_set,
        .irq_process = &r100_irq_process,
        .get_vblank_counter = &r100_get_vblank_counter,
-       .copy_blit = &r100_copy_blit,
-       .copy_dma = NULL,
-       .copy = &r100_copy_blit,
+       .copy = {
+               .blit = &r100_copy_blit,
+               .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .dma = NULL,
+               .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .copy = &r100_copy_blit,
+               .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+       },
        .get_engine_clock = &radeon_legacy_get_engine_clock,
        .set_engine_clock = &radeon_legacy_set_engine_clock,
        .get_memory_clock = &radeon_legacy_get_memory_clock,
@@ -211,9 +216,14 @@ static struct radeon_asic r200_asic = {
        .irq_set = &r100_irq_set,
        .irq_process = &r100_irq_process,
        .get_vblank_counter = &r100_get_vblank_counter,
-       .copy_blit = &r100_copy_blit,
-       .copy_dma = &r200_copy_dma,
-       .copy = &r100_copy_blit,
+       .copy = {
+               .blit = &r100_copy_blit,
+               .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .dma = &r200_copy_dma,
+               .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .copy = &r100_copy_blit,
+               .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+       },
        .get_engine_clock = &radeon_legacy_get_engine_clock,
        .set_engine_clock = &radeon_legacy_set_engine_clock,
        .get_memory_clock = &radeon_legacy_get_memory_clock,
@@ -270,9 +280,14 @@ static struct radeon_asic r300_asic = {
        .irq_set = &r100_irq_set,
        .irq_process = &r100_irq_process,
        .get_vblank_counter = &r100_get_vblank_counter,
-       .copy_blit = &r100_copy_blit,
-       .copy_dma = &r200_copy_dma,
-       .copy = &r100_copy_blit,
+       .copy = {
+               .blit = &r100_copy_blit,
+               .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .dma = &r200_copy_dma,
+               .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .copy = &r100_copy_blit,
+               .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+       },
        .get_engine_clock = &radeon_legacy_get_engine_clock,
        .set_engine_clock = &radeon_legacy_set_engine_clock,
        .get_memory_clock = &radeon_legacy_get_memory_clock,
@@ -330,9 +345,14 @@ static struct radeon_asic r300_asic_pcie = {
        .irq_set = &r100_irq_set,
        .irq_process = &r100_irq_process,
        .get_vblank_counter = &r100_get_vblank_counter,
-       .copy_blit = &r100_copy_blit,
-       .copy_dma = &r200_copy_dma,
-       .copy = &r100_copy_blit,
+       .copy = {
+               .blit = &r100_copy_blit,
+               .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .dma = &r200_copy_dma,
+               .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .copy = &r100_copy_blit,
+               .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+       },
        .get_engine_clock = &radeon_legacy_get_engine_clock,
        .set_engine_clock = &radeon_legacy_set_engine_clock,
        .get_memory_clock = &radeon_legacy_get_memory_clock,
@@ -389,9 +409,14 @@ static struct radeon_asic r420_asic = {
        .irq_set = &r100_irq_set,
        .irq_process = &r100_irq_process,
        .get_vblank_counter = &r100_get_vblank_counter,
-       .copy_blit = &r100_copy_blit,
-       .copy_dma = &r200_copy_dma,
-       .copy = &r100_copy_blit,
+       .copy = {
+               .blit = &r100_copy_blit,
+               .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .dma = &r200_copy_dma,
+               .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .copy = &r100_copy_blit,
+               .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+       },
        .get_engine_clock = &radeon_atom_get_engine_clock,
        .set_engine_clock = &radeon_atom_set_engine_clock,
        .get_memory_clock = &radeon_atom_get_memory_clock,
@@ -449,9 +474,14 @@ static struct radeon_asic rs400_asic = {
        .irq_set = &r100_irq_set,
        .irq_process = &r100_irq_process,
        .get_vblank_counter = &r100_get_vblank_counter,
-       .copy_blit = &r100_copy_blit,
-       .copy_dma = &r200_copy_dma,
-       .copy = &r100_copy_blit,
+       .copy = {
+               .blit = &r100_copy_blit,
+               .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .dma = &r200_copy_dma,
+               .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .copy = &r100_copy_blit,
+               .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+       },
        .get_engine_clock = &radeon_legacy_get_engine_clock,
        .set_engine_clock = &radeon_legacy_set_engine_clock,
        .get_memory_clock = &radeon_legacy_get_memory_clock,
@@ -509,9 +539,14 @@ static struct radeon_asic rs600_asic = {
        .irq_set = &rs600_irq_set,
        .irq_process = &rs600_irq_process,
        .get_vblank_counter = &rs600_get_vblank_counter,
-       .copy_blit = &r100_copy_blit,
-       .copy_dma = &r200_copy_dma,
-       .copy = &r100_copy_blit,
+       .copy = {
+               .blit = &r100_copy_blit,
+               .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .dma = &r200_copy_dma,
+               .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .copy = &r100_copy_blit,
+               .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+       },
        .get_engine_clock = &radeon_atom_get_engine_clock,
        .set_engine_clock = &radeon_atom_set_engine_clock,
        .get_memory_clock = &radeon_atom_get_memory_clock,
@@ -569,9 +604,14 @@ static struct radeon_asic rs690_asic = {
        .irq_set = &rs600_irq_set,
        .irq_process = &rs600_irq_process,
        .get_vblank_counter = &rs600_get_vblank_counter,
-       .copy_blit = &r100_copy_blit,
-       .copy_dma = &r200_copy_dma,
-       .copy = &r200_copy_dma,
+       .copy = {
+               .blit = &r100_copy_blit,
+               .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .dma = &r200_copy_dma,
+               .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .copy = &r200_copy_dma,
+               .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+       },
        .get_engine_clock = &radeon_atom_get_engine_clock,
        .set_engine_clock = &radeon_atom_set_engine_clock,
        .get_memory_clock = &radeon_atom_get_memory_clock,
@@ -629,9 +669,14 @@ static struct radeon_asic rv515_asic = {
        .irq_set = &rs600_irq_set,
        .irq_process = &rs600_irq_process,
        .get_vblank_counter = &rs600_get_vblank_counter,
-       .copy_blit = &r100_copy_blit,
-       .copy_dma = &r200_copy_dma,
-       .copy = &r100_copy_blit,
+       .copy = {
+               .blit = &r100_copy_blit,
+               .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .dma = &r200_copy_dma,
+               .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .copy = &r100_copy_blit,
+               .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+       },
        .get_engine_clock = &radeon_atom_get_engine_clock,
        .set_engine_clock = &radeon_atom_set_engine_clock,
        .get_memory_clock = &radeon_atom_get_memory_clock,
@@ -689,9 +734,14 @@ static struct radeon_asic r520_asic = {
        .irq_set = &rs600_irq_set,
        .irq_process = &rs600_irq_process,
        .get_vblank_counter = &rs600_get_vblank_counter,
-       .copy_blit = &r100_copy_blit,
-       .copy_dma = &r200_copy_dma,
-       .copy = &r100_copy_blit,
+       .copy = {
+               .blit = &r100_copy_blit,
+               .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .dma = &r200_copy_dma,
+               .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .copy = &r100_copy_blit,
+               .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+       },
        .get_engine_clock = &radeon_atom_get_engine_clock,
        .set_engine_clock = &radeon_atom_set_engine_clock,
        .get_memory_clock = &radeon_atom_get_memory_clock,
@@ -748,9 +798,14 @@ static struct radeon_asic r600_asic = {
        .irq_set = &r600_irq_set,
        .irq_process = &r600_irq_process,
        .get_vblank_counter = &rs600_get_vblank_counter,
-       .copy_blit = &r600_copy_blit,
-       .copy_dma = NULL,
-       .copy = &r600_copy_blit,
+       .copy = {
+               .blit = &r600_copy_blit,
+               .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .dma = NULL,
+               .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .copy = &r600_copy_blit,
+               .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+       },
        .get_engine_clock = &radeon_atom_get_engine_clock,
        .set_engine_clock = &radeon_atom_set_engine_clock,
        .get_memory_clock = &radeon_atom_get_memory_clock,
@@ -807,9 +862,14 @@ static struct radeon_asic rs780_asic = {
        .irq_set = &r600_irq_set,
        .irq_process = &r600_irq_process,
        .get_vblank_counter = &rs600_get_vblank_counter,
-       .copy_blit = &r600_copy_blit,
-       .copy_dma = NULL,
-       .copy = &r600_copy_blit,
+       .copy = {
+               .blit = &r600_copy_blit,
+               .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .dma = NULL,
+               .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .copy = &r600_copy_blit,
+               .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+       },
        .get_engine_clock = &radeon_atom_get_engine_clock,
        .set_engine_clock = &radeon_atom_set_engine_clock,
        .get_memory_clock = NULL,
@@ -866,9 +926,14 @@ static struct radeon_asic rv770_asic = {
        .irq_set = &r600_irq_set,
        .irq_process = &r600_irq_process,
        .get_vblank_counter = &rs600_get_vblank_counter,
-       .copy_blit = &r600_copy_blit,
-       .copy_dma = NULL,
-       .copy = &r600_copy_blit,
+       .copy = {
+               .blit = &r600_copy_blit,
+               .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .dma = NULL,
+               .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .copy = &r600_copy_blit,
+               .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+       },
        .get_engine_clock = &radeon_atom_get_engine_clock,
        .set_engine_clock = &radeon_atom_set_engine_clock,
        .get_memory_clock = &radeon_atom_get_memory_clock,
@@ -925,9 +990,14 @@ static struct radeon_asic evergreen_asic = {
        .irq_set = &evergreen_irq_set,
        .irq_process = &evergreen_irq_process,
        .get_vblank_counter = &evergreen_get_vblank_counter,
-       .copy_blit = &r600_copy_blit,
-       .copy_dma = NULL,
-       .copy = &r600_copy_blit,
+       .copy = {
+               .blit = &r600_copy_blit,
+               .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .dma = NULL,
+               .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .copy = &r600_copy_blit,
+               .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+       },
        .get_engine_clock = &radeon_atom_get_engine_clock,
        .set_engine_clock = &radeon_atom_set_engine_clock,
        .get_memory_clock = &radeon_atom_get_memory_clock,
@@ -984,9 +1054,14 @@ static struct radeon_asic sumo_asic = {
        .irq_set = &evergreen_irq_set,
        .irq_process = &evergreen_irq_process,
        .get_vblank_counter = &evergreen_get_vblank_counter,
-       .copy_blit = &r600_copy_blit,
-       .copy_dma = NULL,
-       .copy = &r600_copy_blit,
+       .copy = {
+               .blit = &r600_copy_blit,
+               .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .dma = NULL,
+               .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .copy = &r600_copy_blit,
+               .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+       },
        .get_engine_clock = &radeon_atom_get_engine_clock,
        .set_engine_clock = &radeon_atom_set_engine_clock,
        .get_memory_clock = NULL,
@@ -1043,9 +1118,14 @@ static struct radeon_asic btc_asic = {
        .irq_set = &evergreen_irq_set,
        .irq_process = &evergreen_irq_process,
        .get_vblank_counter = &evergreen_get_vblank_counter,
-       .copy_blit = &r600_copy_blit,
-       .copy_dma = NULL,
-       .copy = &r600_copy_blit,
+       .copy = {
+               .blit = &r600_copy_blit,
+               .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .dma = NULL,
+               .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .copy = &r600_copy_blit,
+               .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+       },
        .get_engine_clock = &radeon_atom_get_engine_clock,
        .set_engine_clock = &radeon_atom_set_engine_clock,
        .get_memory_clock = &radeon_atom_get_memory_clock,
@@ -1127,9 +1207,14 @@ static struct radeon_asic cayman_asic = {
        .irq_set = &evergreen_irq_set,
        .irq_process = &evergreen_irq_process,
        .get_vblank_counter = &evergreen_get_vblank_counter,
-       .copy_blit = &r600_copy_blit,
-       .copy_dma = NULL,
-       .copy = &r600_copy_blit,
+       .copy = {
+               .blit = &r600_copy_blit,
+               .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .dma = NULL,
+               .dma_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+               .copy = &r600_copy_blit,
+               .copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
+       },
        .get_engine_clock = &radeon_atom_get_engine_clock,
        .set_engine_clock = &radeon_atom_set_engine_clock,
        .get_memory_clock = &radeon_atom_get_memory_clock,
@@ -1174,9 +1259,6 @@ int radeon_asic_init(struct radeon_device *rdev)
        else
                rdev->num_crtc = 2;
 
-       /* set the ring used for bo copies */
-       rdev->copy_ring = RADEON_RING_TYPE_GFX_INDEX;
-
        switch (rdev->family) {
        case CHIP_R100:
        case CHIP_RV100:
index 58cee89215c7ee13c2f67e8d4649a07d590dde8c..fef7b722b05dfda1b33bb624d6d4b79291793d5d 100644 (file)
@@ -43,17 +43,19 @@ static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size,
 
        start_jiffies = jiffies;
        for (i = 0; i < n; i++) {
-               r = radeon_fence_create(rdev, &fence, RADEON_RING_TYPE_GFX_INDEX);
-               if (r)
-                       return r;
-
                switch (flag) {
                case RADEON_BENCHMARK_COPY_DMA:
+                       r = radeon_fence_create(rdev, &fence, radeon_copy_dma_ring_index(rdev));
+                       if (r)
+                               return r;
                        r = radeon_copy_dma(rdev, saddr, daddr,
                                            size / RADEON_GPU_PAGE_SIZE,
                                            fence);
                        break;
                case RADEON_BENCHMARK_COPY_BLIT:
+                       r = radeon_fence_create(rdev, &fence, radeon_copy_blit_ring_index(rdev));
+                       if (r)
+                               return r;
                        r = radeon_copy_blit(rdev, saddr, daddr,
                                             size / RADEON_GPU_PAGE_SIZE,
                                             fence);
@@ -129,7 +131,7 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size,
        /* r100 doesn't have dma engine so skip the test */
        /* also, VRAM-to-VRAM test doesn't make much sense for DMA */
        /* skip it as well if domains are the same */
-       if ((rdev->asic->copy_dma) && (sdomain != ddomain)) {
+       if ((rdev->asic->copy.dma) && (sdomain != ddomain)) {
                time = radeon_benchmark_do_move(rdev, size, saddr, daddr,
                                                RADEON_BENCHMARK_COPY_DMA, n);
                if (time < 0)
index c421e77ace71e45cfd9a18e487bd2947e5285313..f493c6403af54169fd497b4572a2748df2cdc0e8 100644 (file)
@@ -226,7 +226,7 @@ static int radeon_move_blit(struct ttm_buffer_object *bo,
        int r, i;
 
        rdev = radeon_get_rdev(bo->bdev);
-       r = radeon_fence_create(rdev, &fence, rdev->copy_ring);
+       r = radeon_fence_create(rdev, &fence, radeon_copy_ring_index(rdev));
        if (unlikely(r)) {
                return r;
        }
@@ -255,7 +255,7 @@ static int radeon_move_blit(struct ttm_buffer_object *bo,
                DRM_ERROR("Unknown placement %d\n", old_mem->mem_type);
                return -EINVAL;
        }
-       if (!rdev->ring[rdev->copy_ring].ready) {
+       if (!rdev->ring[radeon_copy_ring_index(rdev)].ready) {
                DRM_ERROR("Trying to move memory with ring turned off.\n");
                return -EINVAL;
        }
@@ -266,7 +266,7 @@ static int radeon_move_blit(struct ttm_buffer_object *bo,
        if (rdev->family >= CHIP_R600) {
                for (i = 0; i < RADEON_NUM_RINGS; ++i) {
                        /* no need to sync to our own or unused rings */
-                       if (i == rdev->copy_ring || !rdev->ring[i].ready)
+                       if (i == radeon_copy_ring_index(rdev) || !rdev->ring[i].ready)
                                continue;
 
                        if (!fence->semaphore) {
@@ -283,12 +283,12 @@ static int radeon_move_blit(struct ttm_buffer_object *bo,
                        radeon_semaphore_emit_signal(rdev, i, fence->semaphore);
                        radeon_ring_unlock_commit(rdev, &rdev->ring[i]);
 
-                       r = radeon_ring_lock(rdev, &rdev->ring[rdev->copy_ring], 3);
+                       r = radeon_ring_lock(rdev, &rdev->ring[radeon_copy_ring_index(rdev)], 3);
                        /* FIXME: handle ring lock error */
                        if (r)
                                continue;
-                       radeon_semaphore_emit_wait(rdev, rdev->copy_ring, fence->semaphore);
-                       radeon_ring_unlock_commit(rdev, &rdev->ring[rdev->copy_ring]);
+                       radeon_semaphore_emit_wait(rdev, radeon_copy_ring_index(rdev), fence->semaphore);
+                       radeon_ring_unlock_commit(rdev, &rdev->ring[radeon_copy_ring_index(rdev)]);
                }
        }
 
@@ -410,7 +410,8 @@ static int radeon_bo_move(struct ttm_buffer_object *bo,
                radeon_move_null(bo, new_mem);
                return 0;
        }
-       if (!rdev->ring[RADEON_RING_TYPE_GFX_INDEX].ready || rdev->asic->copy == NULL) {
+       if (!rdev->ring[radeon_copy_ring_index(rdev)].ready ||
+           rdev->asic->copy.copy == NULL) {
                /* use memcpy */
                goto memcpy;
        }
index a1668b659ddd3e3f8ee94c97de6474468c71d3dd..a86698137df434bdc658dd7fe75135de5aed6b43 100644 (file)
@@ -1074,7 +1074,7 @@ static int rv770_startup(struct radeon_device *rdev)
        r = r600_blit_init(rdev);
        if (r) {
                r600_blit_fini(rdev);
-               rdev->asic->copy = NULL;
+               rdev->asic->copy.copy = NULL;
                dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r);
        }