drm/radeon: switch to new allocator v2
It should be able to handle all cases here. v2: fix debugfs as well 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/397088/?series=83051&rev=1
This commit is contained in:
parent
e93b2da979
commit
0fe3cf3a53
@ -47,7 +47,6 @@
|
|||||||
#include <drm/ttm/ttm_bo_api.h>
|
#include <drm/ttm/ttm_bo_api.h>
|
||||||
#include <drm/ttm/ttm_bo_driver.h>
|
#include <drm/ttm/ttm_bo_driver.h>
|
||||||
#include <drm/ttm/ttm_module.h>
|
#include <drm/ttm/ttm_module.h>
|
||||||
#include <drm/ttm/ttm_page_alloc.h>
|
|
||||||
#include <drm/ttm/ttm_placement.h>
|
#include <drm/ttm/ttm_placement.h>
|
||||||
|
|
||||||
#include "radeon_reg.h"
|
#include "radeon_reg.h"
|
||||||
@ -679,19 +678,7 @@ static int radeon_ttm_tt_populate(struct ttm_bo_device *bdev,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_AGP)
|
return ttm_pool_alloc(&rdev->mman.bdev.pool, ttm, ctx);
|
||||||
if (rdev->flags & RADEON_IS_AGP) {
|
|
||||||
return ttm_pool_populate(ttm, ctx);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_SWIOTLB
|
|
||||||
if (rdev->need_swiotlb && swiotlb_nr_tbl()) {
|
|
||||||
return ttm_dma_populate(>t->ttm, rdev->dev, ctx);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ttm_populate_and_map_pages(rdev->dev, >t->ttm, ctx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void radeon_ttm_tt_unpopulate(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
|
static void radeon_ttm_tt_unpopulate(struct ttm_bo_device *bdev, struct ttm_tt *ttm)
|
||||||
@ -709,21 +696,7 @@ static void radeon_ttm_tt_unpopulate(struct ttm_bo_device *bdev, struct ttm_tt *
|
|||||||
if (slave)
|
if (slave)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_AGP)
|
return ttm_pool_free(&rdev->mman.bdev.pool, ttm);
|
||||||
if (rdev->flags & RADEON_IS_AGP) {
|
|
||||||
ttm_pool_unpopulate(ttm);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_SWIOTLB
|
|
||||||
if (rdev->need_swiotlb && swiotlb_nr_tbl()) {
|
|
||||||
ttm_dma_unpopulate(>t->ttm, rdev->dev);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ttm_unmap_and_unpopulate_pages(rdev->dev, >t->ttm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int radeon_ttm_tt_set_userptr(struct radeon_device *rdev,
|
int radeon_ttm_tt_set_userptr(struct radeon_device *rdev,
|
||||||
@ -857,6 +830,9 @@ int radeon_ttm_init(struct radeon_device *rdev)
|
|||||||
}
|
}
|
||||||
rdev->mman.initialized = true;
|
rdev->mman.initialized = true;
|
||||||
|
|
||||||
|
ttm_pool_init(&rdev->mman.bdev.pool, rdev->dev, rdev->need_swiotlb,
|
||||||
|
dma_addressing_limited(&rdev->pdev->dev));
|
||||||
|
|
||||||
r = radeon_ttm_init_vram(rdev);
|
r = radeon_ttm_init_vram(rdev);
|
||||||
if (r) {
|
if (r) {
|
||||||
DRM_ERROR("Failed initializing VRAM heap.\n");
|
DRM_ERROR("Failed initializing VRAM heap.\n");
|
||||||
@ -1004,6 +980,14 @@ static int radeon_mm_dump_table(struct seq_file *m, void *data)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int radeon_ttm_pool_debugfs(struct seq_file *m, void *data)
|
||||||
|
{
|
||||||
|
struct drm_info_node *node = (struct drm_info_node *)m->private;
|
||||||
|
struct drm_device *dev = node->minor->dev;
|
||||||
|
struct radeon_device *rdev = dev->dev_private;
|
||||||
|
|
||||||
|
return ttm_pool_debugfs(&rdev->mman.bdev.pool, m);
|
||||||
|
}
|
||||||
|
|
||||||
static int ttm_pl_vram = TTM_PL_VRAM;
|
static int ttm_pl_vram = TTM_PL_VRAM;
|
||||||
static int ttm_pl_tt = TTM_PL_TT;
|
static int ttm_pl_tt = TTM_PL_TT;
|
||||||
@ -1011,10 +995,7 @@ static int ttm_pl_tt = TTM_PL_TT;
|
|||||||
static struct drm_info_list radeon_ttm_debugfs_list[] = {
|
static struct drm_info_list radeon_ttm_debugfs_list[] = {
|
||||||
{"radeon_vram_mm", radeon_mm_dump_table, 0, &ttm_pl_vram},
|
{"radeon_vram_mm", radeon_mm_dump_table, 0, &ttm_pl_vram},
|
||||||
{"radeon_gtt_mm", radeon_mm_dump_table, 0, &ttm_pl_tt},
|
{"radeon_gtt_mm", radeon_mm_dump_table, 0, &ttm_pl_tt},
|
||||||
{"ttm_page_pool", ttm_page_alloc_debugfs, 0, NULL},
|
{"ttm_page_pool", radeon_ttm_pool_debugfs, 0, NULL}
|
||||||
#ifdef CONFIG_SWIOTLB
|
|
||||||
{"ttm_dma_page_pool", ttm_dma_page_alloc_debugfs, 0, NULL}
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int radeon_ttm_vram_open(struct inode *inode, struct file *filep)
|
static int radeon_ttm_vram_open(struct inode *inode, struct file *filep)
|
||||||
@ -1142,11 +1123,6 @@ static int radeon_ttm_debugfs_init(struct radeon_device *rdev)
|
|||||||
|
|
||||||
count = ARRAY_SIZE(radeon_ttm_debugfs_list);
|
count = ARRAY_SIZE(radeon_ttm_debugfs_list);
|
||||||
|
|
||||||
#ifdef CONFIG_SWIOTLB
|
|
||||||
if (!(rdev->need_swiotlb && swiotlb_nr_tbl()))
|
|
||||||
--count;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return radeon_debugfs_add_files(rdev, radeon_ttm_debugfs_list, count);
|
return radeon_debugfs_add_files(rdev, radeon_ttm_debugfs_list, count);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user