diff options
author | Christian König <christian.koenig@amd.com> | 2020-07-23 16:29:59 +0200 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2020-07-31 17:14:09 +0200 |
commit | ccd0dc437f257e42016b20375d52cd1631529e06 (patch) | |
tree | 9b082f25b8c9dc849f92692205fa8bce5daa9cc5 /drivers/gpu/drm/qxl/qxl_ttm.c | |
parent | 009869fde901a4086f3590ec7c9a02de07801276 (diff) | |
download | linux-ccd0dc437f257e42016b20375d52cd1631529e06.tar.bz2 |
drm/qxl: stop implementing init_mem_type
Instead just initialize the memory type parameters
before calling ttm_bo_init_mm.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/382083/
Diffstat (limited to 'drivers/gpu/drm/qxl/qxl_ttm.c')
-rw-r--r-- | drivers/gpu/drm/qxl/qxl_ttm.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c index abb9fa4d80cf..852089d7f783 100644 --- a/drivers/gpu/drm/qxl/qxl_ttm.c +++ b/drivers/gpu/drm/qxl/qxl_ttm.c @@ -51,21 +51,6 @@ static struct qxl_device *qxl_get_qdev(struct ttm_bo_device *bdev) static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, struct ttm_mem_type_manager *man) { - switch (type) { - case TTM_PL_SYSTEM: - /* System memory */ - break; - case TTM_PL_VRAM: - case TTM_PL_PRIV: - /* "On-card" video ram */ - man->func = &ttm_bo_manager_func; - man->available_caching = TTM_PL_MASK_CACHING; - man->default_caching = TTM_PL_FLAG_CACHED; - break; - default: - DRM_ERROR("Unsupported memory type %u\n", (unsigned int)type); - return -EINVAL; - } return 0; } @@ -238,6 +223,19 @@ static struct ttm_bo_driver qxl_bo_driver = { .move_notify = &qxl_bo_move_notify, }; +static int qxl_ttm_init_mem_type(struct qxl_device *qdev, + unsigned int type, + uint64_t size) +{ + struct ttm_mem_type_manager *man = &qdev->mman.bdev.man[type]; + + man->func = &ttm_bo_manager_func; + man->available_caching = TTM_PL_MASK_CACHING; + man->default_caching = TTM_PL_FLAG_CACHED; + + return ttm_bo_init_mm(&qdev->mman.bdev, type, size); +} + int qxl_ttm_init(struct qxl_device *qdev) { int r; @@ -255,14 +253,13 @@ int qxl_ttm_init(struct qxl_device *qdev) } /* NOTE: this includes the framebuffer (aka surface 0) */ num_io_pages = qdev->rom->ram_header_offset / PAGE_SIZE; - r = ttm_bo_init_mm(&qdev->mman.bdev, TTM_PL_VRAM, - num_io_pages); + r = qxl_ttm_init_mem_type(qdev, TTM_PL_VRAM, num_io_pages); if (r) { DRM_ERROR("Failed initializing VRAM heap.\n"); return r; } - r = ttm_bo_init_mm(&qdev->mman.bdev, TTM_PL_PRIV, - qdev->surfaceram_size / PAGE_SIZE); + r = qxl_ttm_init_mem_type(qdev, TTM_PL_PRIV, + qdev->surfaceram_size / PAGE_SIZE); if (r) { DRM_ERROR("Failed initializing Surfaces heap.\n"); return r; |