Commit 27cd7769 authored by Alex Deucher's avatar Alex Deucher Committed by Dave Airlie

drm/radeon/kms: reorganize copy callbacks

tidy up the radeon_asic struct, handle multiple
rings better.
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König<christian.koenig@amd.com>
Reviewed-by: default avatarMichel Dänzer <michel.daenzer@amd.com>
Reviewed-by: default avatarJerome Glisse <jglisse@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 293f9fd5
...@@ -3197,7 +3197,7 @@ static int evergreen_startup(struct radeon_device *rdev) ...@@ -3197,7 +3197,7 @@ static int evergreen_startup(struct radeon_device *rdev)
r = evergreen_blit_init(rdev); r = evergreen_blit_init(rdev);
if (r) { if (r) {
r600_blit_fini(rdev); 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); dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r);
} }
......
...@@ -1466,7 +1466,7 @@ static int cayman_startup(struct radeon_device *rdev) ...@@ -1466,7 +1466,7 @@ static int cayman_startup(struct radeon_device *rdev)
r = evergreen_blit_init(rdev); r = evergreen_blit_init(rdev);
if (r) { if (r) {
r600_blit_fini(rdev); 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); dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r);
} }
......
...@@ -2449,7 +2449,7 @@ int r600_startup(struct radeon_device *rdev) ...@@ -2449,7 +2449,7 @@ int r600_startup(struct radeon_device *rdev)
r = r600_blit_init(rdev); r = r600_blit_init(rdev);
if (r) { if (r) {
r600_blit_fini(rdev); 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); dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r);
} }
......
...@@ -1154,21 +1154,30 @@ struct radeon_asic { ...@@ -1154,21 +1154,30 @@ struct radeon_asic {
int (*irq_set)(struct radeon_device *rdev); int (*irq_set)(struct radeon_device *rdev);
int (*irq_process)(struct radeon_device *rdev); int (*irq_process)(struct radeon_device *rdev);
u32 (*get_vblank_counter)(struct radeon_device *rdev, int crtc); u32 (*get_vblank_counter)(struct radeon_device *rdev, int crtc);
int (*copy_blit)(struct radeon_device *rdev,
struct {
int (*blit)(struct radeon_device *rdev,
uint64_t src_offset, uint64_t src_offset,
uint64_t dst_offset, uint64_t dst_offset,
unsigned num_gpu_pages, unsigned num_gpu_pages,
struct radeon_fence *fence); struct radeon_fence *fence);
int (*copy_dma)(struct radeon_device *rdev, u32 blit_ring_index;
int (*dma)(struct radeon_device *rdev,
uint64_t src_offset, uint64_t src_offset,
uint64_t dst_offset, uint64_t dst_offset,
unsigned num_gpu_pages, unsigned num_gpu_pages,
struct radeon_fence *fence); struct radeon_fence *fence);
u32 dma_ring_index;
/* method used for bo copy */
int (*copy)(struct radeon_device *rdev, int (*copy)(struct radeon_device *rdev,
uint64_t src_offset, uint64_t src_offset,
uint64_t dst_offset, uint64_t dst_offset,
unsigned num_gpu_pages, unsigned num_gpu_pages,
struct radeon_fence *fence); struct radeon_fence *fence);
/* ring used for bo copies */
u32 copy_ring_index;
} copy;
uint32_t (*get_engine_clock)(struct radeon_device *rdev); uint32_t (*get_engine_clock)(struct radeon_device *rdev);
void (*set_engine_clock)(struct radeon_device *rdev, uint32_t eng_clock); void (*set_engine_clock)(struct radeon_device *rdev, uint32_t eng_clock);
uint32_t (*get_memory_clock)(struct radeon_device *rdev); uint32_t (*get_memory_clock)(struct radeon_device *rdev);
...@@ -1505,8 +1514,6 @@ struct radeon_device { ...@@ -1505,8 +1514,6 @@ struct radeon_device {
unsigned debugfs_count; unsigned debugfs_count;
/* virtual memory */ /* virtual memory */
struct radeon_vm_manager vm_manager; struct radeon_vm_manager vm_manager;
/* ring used for bo copies */
u32 copy_ring;
}; };
int radeon_device_init(struct radeon_device *rdev, int radeon_device_init(struct radeon_device *rdev,
...@@ -1677,9 +1684,12 @@ void radeon_ring_write(struct radeon_ring *ring, uint32_t v); ...@@ -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_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_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_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_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_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(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_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_set_engine_clock(rdev, e) (rdev)->asic->set_engine_clock((rdev), (e))
#define radeon_get_memory_clock(rdev) (rdev)->asic->get_memory_clock((rdev)) #define radeon_get_memory_clock(rdev) (rdev)->asic->get_memory_clock((rdev))
......
...@@ -151,9 +151,14 @@ static struct radeon_asic r100_asic = { ...@@ -151,9 +151,14 @@ static struct radeon_asic r100_asic = {
.irq_set = &r100_irq_set, .irq_set = &r100_irq_set,
.irq_process = &r100_irq_process, .irq_process = &r100_irq_process,
.get_vblank_counter = &r100_get_vblank_counter, .get_vblank_counter = &r100_get_vblank_counter,
.copy_blit = &r100_copy_blit, .copy = {
.copy_dma = NULL, .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 = &r100_copy_blit,
.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
},
.get_engine_clock = &radeon_legacy_get_engine_clock, .get_engine_clock = &radeon_legacy_get_engine_clock,
.set_engine_clock = &radeon_legacy_set_engine_clock, .set_engine_clock = &radeon_legacy_set_engine_clock,
.get_memory_clock = &radeon_legacy_get_memory_clock, .get_memory_clock = &radeon_legacy_get_memory_clock,
...@@ -211,9 +216,14 @@ static struct radeon_asic r200_asic = { ...@@ -211,9 +216,14 @@ static struct radeon_asic r200_asic = {
.irq_set = &r100_irq_set, .irq_set = &r100_irq_set,
.irq_process = &r100_irq_process, .irq_process = &r100_irq_process,
.get_vblank_counter = &r100_get_vblank_counter, .get_vblank_counter = &r100_get_vblank_counter,
.copy_blit = &r100_copy_blit, .copy = {
.copy_dma = &r200_copy_dma, .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 = &r100_copy_blit,
.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
},
.get_engine_clock = &radeon_legacy_get_engine_clock, .get_engine_clock = &radeon_legacy_get_engine_clock,
.set_engine_clock = &radeon_legacy_set_engine_clock, .set_engine_clock = &radeon_legacy_set_engine_clock,
.get_memory_clock = &radeon_legacy_get_memory_clock, .get_memory_clock = &radeon_legacy_get_memory_clock,
...@@ -270,9 +280,14 @@ static struct radeon_asic r300_asic = { ...@@ -270,9 +280,14 @@ static struct radeon_asic r300_asic = {
.irq_set = &r100_irq_set, .irq_set = &r100_irq_set,
.irq_process = &r100_irq_process, .irq_process = &r100_irq_process,
.get_vblank_counter = &r100_get_vblank_counter, .get_vblank_counter = &r100_get_vblank_counter,
.copy_blit = &r100_copy_blit, .copy = {
.copy_dma = &r200_copy_dma, .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 = &r100_copy_blit,
.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
},
.get_engine_clock = &radeon_legacy_get_engine_clock, .get_engine_clock = &radeon_legacy_get_engine_clock,
.set_engine_clock = &radeon_legacy_set_engine_clock, .set_engine_clock = &radeon_legacy_set_engine_clock,
.get_memory_clock = &radeon_legacy_get_memory_clock, .get_memory_clock = &radeon_legacy_get_memory_clock,
...@@ -330,9 +345,14 @@ static struct radeon_asic r300_asic_pcie = { ...@@ -330,9 +345,14 @@ static struct radeon_asic r300_asic_pcie = {
.irq_set = &r100_irq_set, .irq_set = &r100_irq_set,
.irq_process = &r100_irq_process, .irq_process = &r100_irq_process,
.get_vblank_counter = &r100_get_vblank_counter, .get_vblank_counter = &r100_get_vblank_counter,
.copy_blit = &r100_copy_blit, .copy = {
.copy_dma = &r200_copy_dma, .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 = &r100_copy_blit,
.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
},
.get_engine_clock = &radeon_legacy_get_engine_clock, .get_engine_clock = &radeon_legacy_get_engine_clock,
.set_engine_clock = &radeon_legacy_set_engine_clock, .set_engine_clock = &radeon_legacy_set_engine_clock,
.get_memory_clock = &radeon_legacy_get_memory_clock, .get_memory_clock = &radeon_legacy_get_memory_clock,
...@@ -389,9 +409,14 @@ static struct radeon_asic r420_asic = { ...@@ -389,9 +409,14 @@ static struct radeon_asic r420_asic = {
.irq_set = &r100_irq_set, .irq_set = &r100_irq_set,
.irq_process = &r100_irq_process, .irq_process = &r100_irq_process,
.get_vblank_counter = &r100_get_vblank_counter, .get_vblank_counter = &r100_get_vblank_counter,
.copy_blit = &r100_copy_blit, .copy = {
.copy_dma = &r200_copy_dma, .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 = &r100_copy_blit,
.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
},
.get_engine_clock = &radeon_atom_get_engine_clock, .get_engine_clock = &radeon_atom_get_engine_clock,
.set_engine_clock = &radeon_atom_set_engine_clock, .set_engine_clock = &radeon_atom_set_engine_clock,
.get_memory_clock = &radeon_atom_get_memory_clock, .get_memory_clock = &radeon_atom_get_memory_clock,
...@@ -449,9 +474,14 @@ static struct radeon_asic rs400_asic = { ...@@ -449,9 +474,14 @@ static struct radeon_asic rs400_asic = {
.irq_set = &r100_irq_set, .irq_set = &r100_irq_set,
.irq_process = &r100_irq_process, .irq_process = &r100_irq_process,
.get_vblank_counter = &r100_get_vblank_counter, .get_vblank_counter = &r100_get_vblank_counter,
.copy_blit = &r100_copy_blit, .copy = {
.copy_dma = &r200_copy_dma, .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 = &r100_copy_blit,
.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
},
.get_engine_clock = &radeon_legacy_get_engine_clock, .get_engine_clock = &radeon_legacy_get_engine_clock,
.set_engine_clock = &radeon_legacy_set_engine_clock, .set_engine_clock = &radeon_legacy_set_engine_clock,
.get_memory_clock = &radeon_legacy_get_memory_clock, .get_memory_clock = &radeon_legacy_get_memory_clock,
...@@ -509,9 +539,14 @@ static struct radeon_asic rs600_asic = { ...@@ -509,9 +539,14 @@ static struct radeon_asic rs600_asic = {
.irq_set = &rs600_irq_set, .irq_set = &rs600_irq_set,
.irq_process = &rs600_irq_process, .irq_process = &rs600_irq_process,
.get_vblank_counter = &rs600_get_vblank_counter, .get_vblank_counter = &rs600_get_vblank_counter,
.copy_blit = &r100_copy_blit, .copy = {
.copy_dma = &r200_copy_dma, .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 = &r100_copy_blit,
.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
},
.get_engine_clock = &radeon_atom_get_engine_clock, .get_engine_clock = &radeon_atom_get_engine_clock,
.set_engine_clock = &radeon_atom_set_engine_clock, .set_engine_clock = &radeon_atom_set_engine_clock,
.get_memory_clock = &radeon_atom_get_memory_clock, .get_memory_clock = &radeon_atom_get_memory_clock,
...@@ -569,9 +604,14 @@ static struct radeon_asic rs690_asic = { ...@@ -569,9 +604,14 @@ static struct radeon_asic rs690_asic = {
.irq_set = &rs600_irq_set, .irq_set = &rs600_irq_set,
.irq_process = &rs600_irq_process, .irq_process = &rs600_irq_process,
.get_vblank_counter = &rs600_get_vblank_counter, .get_vblank_counter = &rs600_get_vblank_counter,
.copy_blit = &r100_copy_blit, .copy = {
.copy_dma = &r200_copy_dma, .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 = &r200_copy_dma,
.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
},
.get_engine_clock = &radeon_atom_get_engine_clock, .get_engine_clock = &radeon_atom_get_engine_clock,
.set_engine_clock = &radeon_atom_set_engine_clock, .set_engine_clock = &radeon_atom_set_engine_clock,
.get_memory_clock = &radeon_atom_get_memory_clock, .get_memory_clock = &radeon_atom_get_memory_clock,
...@@ -629,9 +669,14 @@ static struct radeon_asic rv515_asic = { ...@@ -629,9 +669,14 @@ static struct radeon_asic rv515_asic = {
.irq_set = &rs600_irq_set, .irq_set = &rs600_irq_set,
.irq_process = &rs600_irq_process, .irq_process = &rs600_irq_process,
.get_vblank_counter = &rs600_get_vblank_counter, .get_vblank_counter = &rs600_get_vblank_counter,
.copy_blit = &r100_copy_blit, .copy = {
.copy_dma = &r200_copy_dma, .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 = &r100_copy_blit,
.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
},
.get_engine_clock = &radeon_atom_get_engine_clock, .get_engine_clock = &radeon_atom_get_engine_clock,
.set_engine_clock = &radeon_atom_set_engine_clock, .set_engine_clock = &radeon_atom_set_engine_clock,
.get_memory_clock = &radeon_atom_get_memory_clock, .get_memory_clock = &radeon_atom_get_memory_clock,
...@@ -689,9 +734,14 @@ static struct radeon_asic r520_asic = { ...@@ -689,9 +734,14 @@ static struct radeon_asic r520_asic = {
.irq_set = &rs600_irq_set, .irq_set = &rs600_irq_set,
.irq_process = &rs600_irq_process, .irq_process = &rs600_irq_process,
.get_vblank_counter = &rs600_get_vblank_counter, .get_vblank_counter = &rs600_get_vblank_counter,
.copy_blit = &r100_copy_blit, .copy = {
.copy_dma = &r200_copy_dma, .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 = &r100_copy_blit,
.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
},
.get_engine_clock = &radeon_atom_get_engine_clock, .get_engine_clock = &radeon_atom_get_engine_clock,
.set_engine_clock = &radeon_atom_set_engine_clock, .set_engine_clock = &radeon_atom_set_engine_clock,
.get_memory_clock = &radeon_atom_get_memory_clock, .get_memory_clock = &radeon_atom_get_memory_clock,
...@@ -748,9 +798,14 @@ static struct radeon_asic r600_asic = { ...@@ -748,9 +798,14 @@ static struct radeon_asic r600_asic = {
.irq_set = &r600_irq_set, .irq_set = &r600_irq_set,
.irq_process = &r600_irq_process, .irq_process = &r600_irq_process,
.get_vblank_counter = &rs600_get_vblank_counter, .get_vblank_counter = &rs600_get_vblank_counter,
.copy_blit = &r600_copy_blit, .copy = {
.copy_dma = NULL, .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 = &r600_copy_blit,
.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
},
.get_engine_clock = &radeon_atom_get_engine_clock, .get_engine_clock = &radeon_atom_get_engine_clock,
.set_engine_clock = &radeon_atom_set_engine_clock, .set_engine_clock = &radeon_atom_set_engine_clock,
.get_memory_clock = &radeon_atom_get_memory_clock, .get_memory_clock = &radeon_atom_get_memory_clock,
...@@ -807,9 +862,14 @@ static struct radeon_asic rs780_asic = { ...@@ -807,9 +862,14 @@ static struct radeon_asic rs780_asic = {
.irq_set = &r600_irq_set, .irq_set = &r600_irq_set,
.irq_process = &r600_irq_process, .irq_process = &r600_irq_process,
.get_vblank_counter = &rs600_get_vblank_counter, .get_vblank_counter = &rs600_get_vblank_counter,
.copy_blit = &r600_copy_blit, .copy = {
.copy_dma = NULL, .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 = &r600_copy_blit,
.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
},
.get_engine_clock = &radeon_atom_get_engine_clock, .get_engine_clock = &radeon_atom_get_engine_clock,
.set_engine_clock = &radeon_atom_set_engine_clock, .set_engine_clock = &radeon_atom_set_engine_clock,
.get_memory_clock = NULL, .get_memory_clock = NULL,
...@@ -866,9 +926,14 @@ static struct radeon_asic rv770_asic = { ...@@ -866,9 +926,14 @@ static struct radeon_asic rv770_asic = {
.irq_set = &r600_irq_set, .irq_set = &r600_irq_set,
.irq_process = &r600_irq_process, .irq_process = &r600_irq_process,
.get_vblank_counter = &rs600_get_vblank_counter, .get_vblank_counter = &rs600_get_vblank_counter,
.copy_blit = &r600_copy_blit, .copy = {
.copy_dma = NULL, .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 = &r600_copy_blit,
.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
},
.get_engine_clock = &radeon_atom_get_engine_clock, .get_engine_clock = &radeon_atom_get_engine_clock,
.set_engine_clock = &radeon_atom_set_engine_clock, .set_engine_clock = &radeon_atom_set_engine_clock,
.get_memory_clock = &radeon_atom_get_memory_clock, .get_memory_clock = &radeon_atom_get_memory_clock,
...@@ -925,9 +990,14 @@ static struct radeon_asic evergreen_asic = { ...@@ -925,9 +990,14 @@ static struct radeon_asic evergreen_asic = {
.irq_set = &evergreen_irq_set, .irq_set = &evergreen_irq_set,
.irq_process = &evergreen_irq_process, .irq_process = &evergreen_irq_process,
.get_vblank_counter = &evergreen_get_vblank_counter, .get_vblank_counter = &evergreen_get_vblank_counter,
.copy_blit = &r600_copy_blit, .copy = {
.copy_dma = NULL, .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 = &r600_copy_blit,
.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
},
.get_engine_clock = &radeon_atom_get_engine_clock, .get_engine_clock = &radeon_atom_get_engine_clock,
.set_engine_clock = &radeon_atom_set_engine_clock, .set_engine_clock = &radeon_atom_set_engine_clock,
.get_memory_clock = &radeon_atom_get_memory_clock, .get_memory_clock = &radeon_atom_get_memory_clock,
...@@ -984,9 +1054,14 @@ static struct radeon_asic sumo_asic = { ...@@ -984,9 +1054,14 @@ static struct radeon_asic sumo_asic = {
.irq_set = &evergreen_irq_set, .irq_set = &evergreen_irq_set,
.irq_process = &evergreen_irq_process, .irq_process = &evergreen_irq_process,
.get_vblank_counter = &evergreen_get_vblank_counter, .get_vblank_counter = &evergreen_get_vblank_counter,
.copy_blit = &r600_copy_blit, .copy = {
.copy_dma = NULL, .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 = &r600_copy_blit,
.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
},
.get_engine_clock = &radeon_atom_get_engine_clock, .get_engine_clock = &radeon_atom_get_engine_clock,
.set_engine_clock = &radeon_atom_set_engine_clock, .set_engine_clock = &radeon_atom_set_engine_clock,
.get_memory_clock = NULL, .get_memory_clock = NULL,
...@@ -1043,9 +1118,14 @@ static struct radeon_asic btc_asic = { ...@@ -1043,9 +1118,14 @@ static struct radeon_asic btc_asic = {
.irq_set = &evergreen_irq_set, .irq_set = &evergreen_irq_set,
.irq_process = &evergreen_irq_process, .irq_process = &evergreen_irq_process,
.get_vblank_counter = &evergreen_get_vblank_counter, .get_vblank_counter = &evergreen_get_vblank_counter,
.copy_blit = &r600_copy_blit, .copy = {
.copy_dma = NULL, .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 = &r600_copy_blit,
.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
},
.get_engine_clock = &radeon_atom_get_engine_clock, .get_engine_clock = &radeon_atom_get_engine_clock,
.set_engine_clock = &radeon_atom_set_engine_clock, .set_engine_clock = &radeon_atom_set_engine_clock,
.get_memory_clock = &radeon_atom_get_memory_clock, .get_memory_clock = &radeon_atom_get_memory_clock,
...@@ -1127,9 +1207,14 @@ static struct radeon_asic cayman_asic = { ...@@ -1127,9 +1207,14 @@ static struct radeon_asic cayman_asic = {
.irq_set = &evergreen_irq_set, .irq_set = &evergreen_irq_set,
.irq_process = &evergreen_irq_process, .irq_process = &evergreen_irq_process,
.get_vblank_counter = &evergreen_get_vblank_counter, .get_vblank_counter = &evergreen_get_vblank_counter,
.copy_blit = &r600_copy_blit, .copy = {
.copy_dma = NULL, .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 = &r600_copy_blit,
.copy_ring_index = RADEON_RING_TYPE_GFX_INDEX,
},
.get_engine_clock = &radeon_atom_get_engine_clock, .get_engine_clock = &radeon_atom_get_engine_clock,
.set_engine_clock = &radeon_atom_set_engine_clock, .set_engine_clock = &radeon_atom_set_engine_clock,
.get_memory_clock = &radeon_atom_get_memory_clock, .get_memory_clock = &radeon_atom_get_memory_clock,
...@@ -1174,9 +1259,6 @@ int radeon_asic_init(struct radeon_device *rdev) ...@@ -1174,9 +1259,6 @@ int radeon_asic_init(struct radeon_device *rdev)
else else
rdev->num_crtc = 2; rdev->num_crtc = 2;
/* set the ring used for bo copies */
rdev->copy_ring = RADEON_RING_TYPE_GFX_INDEX;
switch (rdev->family) { switch (rdev->family) {
case CHIP_R100: case CHIP_R100:
case CHIP_RV100: case CHIP_RV100:
......
...@@ -43,17 +43,19 @@ static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size, ...@@ -43,17 +43,19 @@ static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size,
start_jiffies = jiffies; start_jiffies = jiffies;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
r = radeon_fence_create(rdev, &fence, RADEON_RING_TYPE_GFX_INDEX);
if (r)
return r;
switch (flag) { switch (flag) {
case RADEON_BENCHMARK_COPY_DMA: 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, r = radeon_copy_dma(rdev, saddr, daddr,
size / RADEON_GPU_PAGE_SIZE, size / RADEON_GPU_PAGE_SIZE,
fence); fence);
break; break;
case RADEON_BENCHMARK_COPY_BLIT: 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, r = radeon_copy_blit(rdev, saddr, daddr,
size / RADEON_GPU_PAGE_SIZE, size / RADEON_GPU_PAGE_SIZE,
fence); fence);
...@@ -129,7 +131,7 @@ static void radeon_benchmark_move(struct radeon_device *rdev, unsigned size, ...@@ -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 */ /* r100 doesn't have dma engine so skip the test */
/* also, VRAM-to-VRAM test doesn't make much sense for DMA */ /* also, VRAM-to-VRAM test doesn't make much sense for DMA */
/* skip it as well if domains are the same */ /* 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, time = radeon_benchmark_do_move(rdev, size, saddr, daddr,
RADEON_BENCHMARK_COPY_DMA, n); RADEON_BENCHMARK_COPY_DMA, n);
if (time < 0) if (time < 0)
......
...@@ -226,7 +226,7 @@ static int radeon_move_blit(struct ttm_buffer_object *bo, ...@@ -226,7 +226,7 @@ static int radeon_move_blit(struct ttm_buffer_object *bo,
int r, i; int r, i;
rdev = radeon_get_rdev(bo->bdev); 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)) { if (unlikely(r)) {
return r; return r;
} }
...@@ -255,7 +255,7 @@ static int radeon_move_blit(struct ttm_buffer_object *bo, ...@@ -255,7 +255,7 @@ static int radeon_move_blit(struct ttm_buffer_object *bo,
DRM_ERROR("Unknown placement %d\n", old_mem->mem_type); DRM_ERROR("Unknown placement %d\n", old_mem->mem_type);
return -EINVAL; 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"); DRM_ERROR("Trying to move memory with ring turned off.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -266,7 +266,7 @@ static int radeon_move_blit(struct ttm_buffer_object *bo, ...@@ -266,7 +266,7 @@ static int radeon_move_blit(struct ttm_buffer_object *bo,
if (rdev->family >= CHIP_R600) { if (rdev->family >= CHIP_R600) {
for (i = 0; i < RADEON_NUM_RINGS; ++i) { for (i = 0; i < RADEON_NUM_RINGS; ++i) {
/* no need to sync to our own or unused rings */ /* 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; continue;
if (!fence->semaphore) { if (!fence->semaphore) {
...@@ -283,12 +283,12 @@ static int radeon_move_blit(struct ttm_buffer_object *bo, ...@@ -283,12 +283,12 @@ static int radeon_move_blit(struct ttm_buffer_object *bo,
radeon_semaphore_emit_signal(rdev, i, fence->semaphore); radeon_semaphore_emit_signal(rdev, i, fence->semaphore);
radeon_ring_unlock_commit(rdev, &rdev->ring[i]); 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 */ /* FIXME: handle ring lock error */
if (r) if (r)
continue; continue;
radeon_semaphore_emit_wait(rdev, rdev->copy_ring, fence->semaphore); radeon_semaphore_emit_wait(rdev, radeon_copy_ring_index(rdev), fence->semaphore);
radeon_ring_unlock_commit(rdev, &rdev->ring[rdev->copy_ring]); 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, ...@@ -410,7 +410,8 @@ static int radeon_bo_move(struct ttm_buffer_object *bo,
radeon_move_null(bo, new_mem); radeon_move_null(bo, new_mem);
return 0; 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 */ /* use memcpy */
goto memcpy; goto memcpy;
} }
......
...@@ -1074,7 +1074,7 @@ static int rv770_startup(struct radeon_device *rdev) ...@@ -1074,7 +1074,7 @@ static int rv770_startup(struct radeon_device *rdev)
r = r600_blit_init(rdev); r = r600_blit_init(rdev);
if (r) { if (r) {
r600_blit_fini(rdev); 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); dev_warn(rdev->dev, "failed blitter (%d) falling back to memcpy\n", r);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment