diff options
author | Jerome Glisse <jglisse@redhat.com> | 2011-11-18 11:47:03 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-12-06 05:40:23 -0500 |
commit | dc97b3409a790d2a21aac6e5cdb99558b5944119 (patch) | |
tree | afad2825ec463545dda7477be40ddb437686b58d /drivers/gpu/drm/ttm | |
parent | 57de4ba959b290f0b8cf36ecd5e7f1b29d4b8a12 (diff) |
drm/ttm: callback move_notify any time bo placement change v4
Previously we were calling back move_notify in error path when the
bo is returned to it's original position or when destroy the bo.
When destroying the bo set the new mem placement as NULL when calling
back in the driver.
Updating nouveau to deal with NULL placement properly.
v2: reserve the object before calling move_notify in bo destroy path
at that point ttm should be the only piece of code interacting
with the object so atomic_set is safe here.
v3: callback move notify only once the bo is in its new position
call move notify want swaping out the buffer
v4:- don't call move_notify when swapin out bo, assume driver should
do what is appropriate in swap notify
- move move_notify call back to ttm_bo_cleanup_memtype_use for
destroy path
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Diffstat (limited to 'drivers/gpu/drm/ttm')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index de7ad9991902..119b6e3ff906 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -404,9 +404,6 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, | |||
404 | } | 404 | } |
405 | } | 405 | } |
406 | 406 | ||
407 | if (bdev->driver->move_notify) | ||
408 | bdev->driver->move_notify(bo, mem); | ||
409 | |||
410 | if (!(old_man->flags & TTM_MEMTYPE_FLAG_FIXED) && | 407 | if (!(old_man->flags & TTM_MEMTYPE_FLAG_FIXED) && |
411 | !(new_man->flags & TTM_MEMTYPE_FLAG_FIXED)) | 408 | !(new_man->flags & TTM_MEMTYPE_FLAG_FIXED)) |
412 | ret = ttm_bo_move_ttm(bo, evict, no_wait_reserve, no_wait_gpu, mem); | 409 | ret = ttm_bo_move_ttm(bo, evict, no_wait_reserve, no_wait_gpu, mem); |
@@ -419,6 +416,9 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, | |||
419 | if (ret) | 416 | if (ret) |
420 | goto out_err; | 417 | goto out_err; |
421 | 418 | ||
419 | if (bdev->driver->move_notify) | ||
420 | bdev->driver->move_notify(bo, mem); | ||
421 | |||
422 | moved: | 422 | moved: |
423 | if (bo->evicted) { | 423 | if (bo->evicted) { |
424 | ret = bdev->driver->invalidate_caches(bdev, bo->mem.placement); | 424 | ret = bdev->driver->invalidate_caches(bdev, bo->mem.placement); |
@@ -457,6 +457,9 @@ out_err: | |||
457 | 457 | ||
458 | static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo) | 458 | static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo) |
459 | { | 459 | { |
460 | if (bo->bdev->driver->move_notify) | ||
461 | bo->bdev->driver->move_notify(bo, NULL); | ||
462 | |||
460 | if (bo->ttm) { | 463 | if (bo->ttm) { |
461 | ttm_tt_unbind(bo->ttm); | 464 | ttm_tt_unbind(bo->ttm); |
462 | ttm_tt_destroy(bo->ttm); | 465 | ttm_tt_destroy(bo->ttm); |