diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/r600_blit_kms.c')
-rw-r--r-- | drivers/gpu/drm/radeon/r600_blit_kms.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c index 9aecafb51b66..446b765ac72a 100644 --- a/drivers/gpu/drm/radeon/r600_blit_kms.c +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c | |||
@@ -449,6 +449,7 @@ int r600_blit_init(struct radeon_device *rdev) | |||
449 | u32 packet2s[16]; | 449 | u32 packet2s[16]; |
450 | int num_packet2s = 0; | 450 | int num_packet2s = 0; |
451 | 451 | ||
452 | mutex_init(&rdev->r600_blit.mutex); | ||
452 | rdev->r600_blit.state_offset = 0; | 453 | rdev->r600_blit.state_offset = 0; |
453 | 454 | ||
454 | if (rdev->family >= CHIP_RV770) | 455 | if (rdev->family >= CHIP_RV770) |
@@ -512,14 +513,16 @@ void r600_blit_fini(struct radeon_device *rdev) | |||
512 | { | 513 | { |
513 | int r; | 514 | int r; |
514 | 515 | ||
516 | if (rdev->r600_blit.shader_obj == NULL) | ||
517 | return; | ||
518 | /* If we can't reserve the bo, unref should be enough to destroy | ||
519 | * it when it becomes idle. | ||
520 | */ | ||
515 | r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); | 521 | r = radeon_bo_reserve(rdev->r600_blit.shader_obj, false); |
516 | if (unlikely(r != 0)) { | 522 | if (!r) { |
517 | dev_err(rdev->dev, "(%d) can't finish r600 blit\n", r); | 523 | radeon_bo_unpin(rdev->r600_blit.shader_obj); |
518 | goto out_unref; | 524 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); |
519 | } | 525 | } |
520 | radeon_bo_unpin(rdev->r600_blit.shader_obj); | ||
521 | radeon_bo_unreserve(rdev->r600_blit.shader_obj); | ||
522 | out_unref: | ||
523 | radeon_bo_unref(&rdev->r600_blit.shader_obj); | 526 | radeon_bo_unref(&rdev->r600_blit.shader_obj); |
524 | } | 527 | } |
525 | 528 | ||
@@ -540,9 +543,6 @@ int r600_vb_ib_get(struct radeon_device *rdev) | |||
540 | void r600_vb_ib_put(struct radeon_device *rdev) | 543 | void r600_vb_ib_put(struct radeon_device *rdev) |
541 | { | 544 | { |
542 | radeon_fence_emit(rdev, rdev->r600_blit.vb_ib->fence); | 545 | radeon_fence_emit(rdev, rdev->r600_blit.vb_ib->fence); |
543 | mutex_lock(&rdev->ib_pool.mutex); | ||
544 | list_add_tail(&rdev->r600_blit.vb_ib->list, &rdev->ib_pool.scheduled_ibs); | ||
545 | mutex_unlock(&rdev->ib_pool.mutex); | ||
546 | radeon_ib_free(rdev, &rdev->r600_blit.vb_ib); | 546 | radeon_ib_free(rdev, &rdev->r600_blit.vb_ib); |
547 | } | 547 | } |
548 | 548 | ||
@@ -555,7 +555,8 @@ int r600_blit_prepare_copy(struct radeon_device *rdev, int size_bytes) | |||
555 | int dwords_per_loop = 76, num_loops; | 555 | int dwords_per_loop = 76, num_loops; |
556 | 556 | ||
557 | r = r600_vb_ib_get(rdev); | 557 | r = r600_vb_ib_get(rdev); |
558 | WARN_ON(r); | 558 | if (r) |
559 | return r; | ||
559 | 560 | ||
560 | /* set_render_target emits 2 extra dwords on rv6xx */ | 561 | /* set_render_target emits 2 extra dwords on rv6xx */ |
561 | if (rdev->family > CHIP_R600 && rdev->family < CHIP_RV770) | 562 | if (rdev->family > CHIP_R600 && rdev->family < CHIP_RV770) |
@@ -577,11 +578,12 @@ int r600_blit_prepare_copy(struct radeon_device *rdev, int size_bytes) | |||
577 | ring_size = num_loops * dwords_per_loop; | 578 | ring_size = num_loops * dwords_per_loop; |
578 | /* set default + shaders */ | 579 | /* set default + shaders */ |
579 | ring_size += 40; /* shaders + def state */ | 580 | ring_size += 40; /* shaders + def state */ |
580 | ring_size += 5; /* fence emit for VB IB */ | 581 | ring_size += 7; /* fence emit for VB IB */ |
581 | ring_size += 5; /* done copy */ | 582 | ring_size += 5; /* done copy */ |
582 | ring_size += 5; /* fence emit for done copy */ | 583 | ring_size += 7; /* fence emit for done copy */ |
583 | r = radeon_ring_lock(rdev, ring_size); | 584 | r = radeon_ring_lock(rdev, ring_size); |
584 | WARN_ON(r); | 585 | if (r) |
586 | return r; | ||
585 | 587 | ||
586 | set_default_state(rdev); /* 14 */ | 588 | set_default_state(rdev); /* 14 */ |
587 | set_shaders(rdev); /* 26 */ | 589 | set_shaders(rdev); /* 26 */ |