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>
This commit is contained in:
parent
1614f8b17b
commit
4c78867912
26 changed files with 904 additions and 704 deletions
|
@ -564,6 +564,7 @@ int radeon_device_init(struct radeon_device *rdev,
|
|||
mutex_init(&rdev->cp.mutex);
|
||||
if (rdev->family >= CHIP_R600)
|
||||
spin_lock_init(&rdev->ih.lock);
|
||||
mutex_init(&rdev->gem.mutex);
|
||||
rwlock_init(&rdev->fence_drv.lock);
|
||||
INIT_LIST_HEAD(&rdev->gem.objects);
|
||||
|
||||
|
@ -653,6 +654,7 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
|
|||
{
|
||||
struct radeon_device *rdev = dev->dev_private;
|
||||
struct drm_crtc *crtc;
|
||||
int r;
|
||||
|
||||
if (dev == NULL || rdev == NULL) {
|
||||
return -ENODEV;
|
||||
|
@ -663,18 +665,22 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
|
|||
/* unpin the front buffers */
|
||||
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
|
||||
struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->fb);
|
||||
struct radeon_object *robj;
|
||||
struct radeon_bo *robj;
|
||||
|
||||
if (rfb == NULL || rfb->obj == NULL) {
|
||||
continue;
|
||||
}
|
||||
robj = rfb->obj->driver_private;
|
||||
if (robj != rdev->fbdev_robj) {
|
||||
radeon_object_unpin(robj);
|
||||
if (robj != rdev->fbdev_rbo) {
|
||||
r = radeon_bo_reserve(robj, false);
|
||||
if (unlikely(r == 0)) {
|
||||
radeon_bo_unpin(robj);
|
||||
radeon_bo_unreserve(robj);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* evict vram memory */
|
||||
radeon_object_evict_vram(rdev);
|
||||
radeon_bo_evict_vram(rdev);
|
||||
/* wait for gpu to finish processing current batch */
|
||||
radeon_fence_wait_last(rdev);
|
||||
|
||||
|
@ -682,7 +688,7 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
|
|||
|
||||
radeon_suspend(rdev);
|
||||
/* evict remaining vram memory */
|
||||
radeon_object_evict_vram(rdev);
|
||||
radeon_bo_evict_vram(rdev);
|
||||
|
||||
pci_save_state(dev->pdev);
|
||||
if (state.event == PM_EVENT_SUSPEND) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue