diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2010-01-13 22:28:40 +0100 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-01-14 12:18:54 +1000 |
commit | 3f09ea4ecdcbcea05541f83e557d6ce2e56626d8 (patch) | |
tree | 445e4519b2e8a39136f611f07db670d1e10ace6e | |
parent | effe1105bef07f42366c20eac41b80ff9fcf675e (diff) | |
download | op-kernel-dev-3f09ea4ecdcbcea05541f83e557d6ce2e56626d8.zip op-kernel-dev-3f09ea4ecdcbcea05541f83e557d6ce2e56626d8.tar.gz |
drm/ttm: Add a swap_notify callback.
This is needed for a bugfix in the vmwgfx driver.
Drivers may have GPU bindings on buffers that core TTM is not aware of,
and TTM may view those buffers as ordinary system memory buffers.
Add a notifier to such drivers when TTM is about to move the buffer
contents out to swappable memory. The driver must then release any
private GPU bindings on those buffers.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 3 | ||||
-rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 2920f9a..e10a04e 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -1844,6 +1844,9 @@ static int ttm_bo_swapout(struct ttm_mem_shrink *shrink) * anyone tries to access a ttm page. */ + if (bo->bdev->driver->swap_notify) + bo->bdev->driver->swap_notify(bo); + ret = ttm_tt_swapout(bo->ttm, bo->persistant_swap_storage); out: diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index ff7664e..4c4e0f8 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h @@ -353,6 +353,11 @@ struct ttm_bo_driver { /* notify the driver we are taking a fault on this BO * and have reserved it */ void (*fault_reserve_notify)(struct ttm_buffer_object *bo); + + /** + * notify the driver that we're about to swap out this bo + */ + void (*swap_notify) (struct ttm_buffer_object *bo); }; /** |