aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/cik_sdma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon/cik_sdma.c')
-rw-r--r--drivers/gpu/drm/radeon/cik_sdma.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c
index 192278bc993c..c01a6100c318 100644
--- a/drivers/gpu/drm/radeon/cik_sdma.c
+++ b/drivers/gpu/drm/radeon/cik_sdma.c
@@ -537,18 +537,19 @@ void cik_sdma_fini(struct radeon_device *rdev)
537 * @src_offset: src GPU address 537 * @src_offset: src GPU address
538 * @dst_offset: dst GPU address 538 * @dst_offset: dst GPU address
539 * @num_gpu_pages: number of GPU pages to xfer 539 * @num_gpu_pages: number of GPU pages to xfer
540 * @fence: radeon fence object 540 * @resv: reservation object to sync to
541 * 541 *
542 * Copy GPU paging using the DMA engine (CIK). 542 * Copy GPU paging using the DMA engine (CIK).
543 * Used by the radeon ttm implementation to move pages if 543 * Used by the radeon ttm implementation to move pages if
544 * registered as the asic copy callback. 544 * registered as the asic copy callback.
545 */ 545 */
546int cik_copy_dma(struct radeon_device *rdev, 546struct radeon_fence *cik_copy_dma(struct radeon_device *rdev,
547 uint64_t src_offset, uint64_t dst_offset, 547 uint64_t src_offset, uint64_t dst_offset,
548 unsigned num_gpu_pages, 548 unsigned num_gpu_pages,
549 struct radeon_fence **fence) 549 struct reservation_object *resv)
550{ 550{
551 struct radeon_semaphore *sem = NULL; 551 struct radeon_semaphore *sem = NULL;
552 struct radeon_fence *fence;
552 int ring_index = rdev->asic->copy.dma_ring_index; 553 int ring_index = rdev->asic->copy.dma_ring_index;
553 struct radeon_ring *ring = &rdev->ring[ring_index]; 554 struct radeon_ring *ring = &rdev->ring[ring_index];
554 u32 size_in_bytes, cur_size_in_bytes; 555 u32 size_in_bytes, cur_size_in_bytes;
@@ -558,7 +559,7 @@ int cik_copy_dma(struct radeon_device *rdev,
558 r = radeon_semaphore_create(rdev, &sem); 559 r = radeon_semaphore_create(rdev, &sem);
559 if (r) { 560 if (r) {
560 DRM_ERROR("radeon: moving bo (%d).\n", r); 561 DRM_ERROR("radeon: moving bo (%d).\n", r);
561 return r; 562 return ERR_PTR(r);
562 } 563 }
563 564
564 size_in_bytes = (num_gpu_pages << RADEON_GPU_PAGE_SHIFT); 565 size_in_bytes = (num_gpu_pages << RADEON_GPU_PAGE_SHIFT);
@@ -567,10 +568,10 @@ int cik_copy_dma(struct radeon_device *rdev,
567 if (r) { 568 if (r) {
568 DRM_ERROR("radeon: moving bo (%d).\n", r); 569 DRM_ERROR("radeon: moving bo (%d).\n", r);
569 radeon_semaphore_free(rdev, &sem, NULL); 570 radeon_semaphore_free(rdev, &sem, NULL);
570 return r; 571 return ERR_PTR(r);
571 } 572 }
572 573
573 radeon_semaphore_sync_to(sem, *fence); 574 radeon_semaphore_sync_resv(sem, resv, false);
574 radeon_semaphore_sync_rings(rdev, sem, ring->idx); 575 radeon_semaphore_sync_rings(rdev, sem, ring->idx);
575 576
576 for (i = 0; i < num_loops; i++) { 577 for (i = 0; i < num_loops; i++) {
@@ -589,17 +590,17 @@ int cik_copy_dma(struct radeon_device *rdev,
589 dst_offset += cur_size_in_bytes; 590 dst_offset += cur_size_in_bytes;
590 } 591 }
591 592
592 r = radeon_fence_emit(rdev, fence, ring->idx); 593 r = radeon_fence_emit(rdev, &fence, ring->idx);
593 if (r) { 594 if (r) {
594 radeon_ring_unlock_undo(rdev, ring); 595 radeon_ring_unlock_undo(rdev, ring);
595 radeon_semaphore_free(rdev, &sem, NULL); 596 radeon_semaphore_free(rdev, &sem, NULL);
596 return r; 597 return ERR_PTR(r);
597 } 598 }
598 599
599 radeon_ring_unlock_commit(rdev, ring, false); 600 radeon_ring_unlock_commit(rdev, ring, false);
600 radeon_semaphore_free(rdev, &sem, *fence); 601 radeon_semaphore_free(rdev, &sem, fence);
601 602
602 return r; 603 return fence;
603} 604}
604 605
605/** 606/**