]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
drm/ttm: Add a swap_notify callback.
authorThomas Hellstrom <thellstrom@vmware.com>
Wed, 13 Jan 2010 21:28:40 +0000 (22:28 +0100)
committerDave Airlie <airlied@redhat.com>
Thu, 14 Jan 2010 02:18:54 +0000 (12:18 +1000)
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>
drivers/gpu/drm/ttm/ttm_bo.c
include/drm/ttm/ttm_bo_driver.h

index 2920f9a279e141aa9fd1ccc38cc0bfcb586c5f59..e10a04e7c4e950a96ffd2c8a8e0463e679d77071 100644 (file)
@@ -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:
 
index ff7664e0c3cdbe78a856ff1b6448baf98eaf77a2..4c4e0f8375b397ff521455c2e92d9383cade07d3 100644 (file)
@@ -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);
 };
 
 /**