aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_device.c
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2009-11-20 08:29:23 -0500
committerDave Airlie <airlied@redhat.com>2009-12-01 23:00:18 -0500
commit4c7886791264f03428d5424befb1b96f08fc90f4 (patch)
tree2c644931001b06969fb3038e7beb68db436c4872 /drivers/gpu/drm/radeon/radeon_device.c
parent1614f8b17b8cc3ad143541d41569623d30dbc9ec (diff)
drm/radeon/kms: Rework radeon object handling
The locking & protection of radeon object was somewhat messy. This patch completely rework it to now use ttm reserve as a protection for the radeon object structure member. It also shrink down the various radeon object structure by removing field which were redondant with the ttm information. Last it converts few simple functions to inline which should with performances. airlied: rebase on top of r600 and other changes. Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_device.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index c962f34c92af..a014ba4cc97c 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -564,6 +564,7 @@ int radeon_device_init(struct radeon_device *rdev,
564 mutex_init(&rdev->cp.mutex); 564 mutex_init(&rdev->cp.mutex);
565 if (rdev->family >= CHIP_R600) 565 if (rdev->family >= CHIP_R600)
566 spin_lock_init(&rdev->ih.lock); 566 spin_lock_init(&rdev->ih.lock);
567 mutex_init(&rdev->gem.mutex);
567 rwlock_init(&rdev->fence_drv.lock); 568 rwlock_init(&rdev->fence_drv.lock);
568 INIT_LIST_HEAD(&rdev->gem.objects); 569 INIT_LIST_HEAD(&rdev->gem.objects);
569 570
@@ -653,6 +654,7 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
653{ 654{
654 struct radeon_device *rdev = dev->dev_private; 655 struct radeon_device *rdev = dev->dev_private;
655 struct drm_crtc *crtc; 656 struct drm_crtc *crtc;
657 int r;
656 658
657 if (dev == NULL || rdev == NULL) { 659 if (dev == NULL || rdev == NULL) {
658 return -ENODEV; 660 return -ENODEV;
@@ -663,18 +665,22 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
663 /* unpin the front buffers */ 665 /* unpin the front buffers */
664 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 666 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
665 struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->fb); 667 struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->fb);
666 struct radeon_object *robj; 668 struct radeon_bo *robj;
667 669
668 if (rfb == NULL || rfb->obj == NULL) { 670 if (rfb == NULL || rfb->obj == NULL) {
669 continue; 671 continue;
670 } 672 }
671 robj = rfb->obj->driver_private; 673 robj = rfb->obj->driver_private;
672 if (robj != rdev->fbdev_robj) { 674 if (robj != rdev->fbdev_rbo) {
673 radeon_object_unpin(robj); 675 r = radeon_bo_reserve(robj, false);
676 if (unlikely(r == 0)) {
677 radeon_bo_unpin(robj);
678 radeon_bo_unreserve(robj);
679 }
674 } 680 }
675 } 681 }
676 /* evict vram memory */ 682 /* evict vram memory */
677 radeon_object_evict_vram(rdev); 683 radeon_bo_evict_vram(rdev);
678 /* wait for gpu to finish processing current batch */ 684 /* wait for gpu to finish processing current batch */
679 radeon_fence_wait_last(rdev); 685 radeon_fence_wait_last(rdev);
680 686
@@ -682,7 +688,7 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
682 688
683 radeon_suspend(rdev); 689 radeon_suspend(rdev);
684 /* evict remaining vram memory */ 690 /* evict remaining vram memory */
685 radeon_object_evict_vram(rdev); 691 radeon_bo_evict_vram(rdev);
686 692
687 pci_save_state(dev->pdev); 693 pci_save_state(dev->pdev);
688 if (state.event == PM_EVENT_SUSPEND) { 694 if (state.event == PM_EVENT_SUSPEND) {