diff options
author | Christian König <christian.koenig@amd.com> | 2020-10-24 13:10:28 +0200 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2020-10-29 15:56:45 +0100 |
commit | ee5d2a8e549e90325fcc31825269f89647cd6fac (patch) | |
tree | 9d3faf92bcec71bdc7918acc5667837cae5117e3 /drivers/gpu/drm/ttm | |
parent | d099fc8f540add80f725014fdd4f7f49f3c58911 (diff) | |
download | lwn-ee5d2a8e549e90325fcc31825269f89647cd6fac.tar.gz lwn-ee5d2a8e549e90325fcc31825269f89647cd6fac.zip |
drm/ttm: wire up the new pool as default one v2
Provide the necessary parameters by all drivers and use the new pool alloc
when no driver specific function is provided.
v2: fix the GEM VRAM helpers
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Madhav Chauhan <madhav.chauhan@amd.com>
Tested-by: Huang Rui <ray.huang@amd.com>
Link: https://patchwork.freedesktop.org/patch/397081/?series=83051&rev=1
Diffstat (limited to 'drivers/gpu/drm/ttm')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_memory.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_tt.c | 5 |
3 files changed, 9 insertions, 6 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 40c72a0f9325..e9f91cfce5e9 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -1283,6 +1283,8 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev) pr_debug("Swap list %d was clean\n", i); spin_unlock(&glob->lru_lock); + ttm_pool_fini(&bdev->pool); + if (!ret) ttm_bo_global_release(); @@ -1307,9 +1309,10 @@ static void ttm_bo_init_sysman(struct ttm_bo_device *bdev) int ttm_bo_device_init(struct ttm_bo_device *bdev, struct ttm_bo_driver *driver, + struct device *dev, struct address_space *mapping, struct drm_vma_offset_manager *vma_manager, - bool need_dma32) + bool use_dma_alloc, bool use_dma32) { struct ttm_bo_global *glob = &ttm_bo_glob; int ret; @@ -1324,12 +1327,13 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev, bdev->driver = driver; ttm_bo_init_sysman(bdev); + ttm_pool_init(&bdev->pool, dev, use_dma_alloc, use_dma32); bdev->vma_manager = vma_manager; INIT_DELAYED_WORK(&bdev->wq, ttm_bo_delayed_workqueue); INIT_LIST_HEAD(&bdev->ddestroy); bdev->dev_mapping = mapping; - bdev->need_dma32 = need_dma32; + bdev->need_dma32 = use_dma32; mutex_lock(&ttm_global_mutex); list_add_tail(&bdev->device_list, &glob->device_list); mutex_unlock(&ttm_global_mutex); diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c index 3012d0388c51..b15a91c90271 100644 --- a/drivers/gpu/drm/ttm/ttm_memory.c +++ b/drivers/gpu/drm/ttm/ttm_memory.c @@ -454,7 +454,7 @@ int ttm_mem_global_init(struct ttm_mem_global *glob) } ttm_page_alloc_init(glob, glob->zone_kernel->max_mem/(2*PAGE_SIZE)); ttm_dma_page_alloc_init(glob, glob->zone_kernel->max_mem/(2*PAGE_SIZE)); - ttm_pool_mgr_init(glob->zone_kernel->max_mem/(2*PAGE_SIZE)); + ttm_pool_mgr_init(glob->zone_kernel->max_mem / (2 * PAGE_SIZE)); return 0; out_no_zone: ttm_mem_global_release(glob); diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c index 65c4254eea5c..90054280cd8f 100644 --- a/drivers/gpu/drm/ttm/ttm_tt.c +++ b/drivers/gpu/drm/ttm/ttm_tt.c @@ -37,7 +37,6 @@ #include <linux/file.h> #include <drm/drm_cache.h> #include <drm/ttm/ttm_bo_driver.h> -#include <drm/ttm/ttm_page_alloc.h> /** * Allocates a ttm structure for the given BO. @@ -321,7 +320,7 @@ int ttm_tt_populate(struct ttm_bo_device *bdev, if (bdev->driver->ttm_tt_populate) ret = bdev->driver->ttm_tt_populate(bdev, ttm, ctx); else - ret = ttm_pool_populate(ttm, ctx); + ret = ttm_pool_alloc(&bdev->pool, ttm, ctx); if (ret) return ret; @@ -363,6 +362,6 @@ void ttm_tt_unpopulate(struct ttm_bo_device *bdev, if (bdev->driver->ttm_tt_unpopulate) bdev->driver->ttm_tt_unpopulate(bdev, ttm); else - ttm_pool_unpopulate(ttm); + ttm_pool_free(&bdev->pool, ttm); ttm->page_flags &= ~TTM_PAGE_FLAG_PRIV_POPULATED; } |