mirror of
https://github.com/torvalds/linux.git
synced 2026-04-26 02:22:28 -04:00
drm/ttm/tests: Test simple BO creation and validation
Add tests for ttm_bo_init_reserved() and ttm_bo_validate() that use sys manager. Define a simple move function in ttm_device_funcs. Expose destroy callback of the buffer object to make testing of ttm_bo_init_reserved() behaviour easier. Signed-off-by: Karolina Stolarek <karolina.stolarek@intel.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Reviewed-by: Somalapuram, Amaranath <asomalap@amd.com> Tested-by: Somalapuram, Amaranath <asomalap@amd.com> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/ffba0d62eb98b2cbc61ae7ca90fee7dc0855719c.1718192625.git.karolina.stolarek@intel.com
This commit is contained in:
committed by
Arunpravin Paneer Selvam
parent
f7ed0a7e42
commit
8bd1ff5ddc
@@ -22,13 +22,19 @@ static void ttm_tt_simple_destroy(struct ttm_device *bdev, struct ttm_tt *ttm)
|
||||
kfree(ttm);
|
||||
}
|
||||
|
||||
static void dummy_ttm_bo_destroy(struct ttm_buffer_object *bo)
|
||||
static int mock_move(struct ttm_buffer_object *bo, bool evict,
|
||||
struct ttm_operation_ctx *ctx,
|
||||
struct ttm_resource *new_mem,
|
||||
struct ttm_place *hop)
|
||||
{
|
||||
bo->resource = new_mem;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct ttm_device_funcs ttm_dev_funcs = {
|
||||
.ttm_tt_create = ttm_tt_simple_create,
|
||||
.ttm_tt_destroy = ttm_tt_simple_destroy,
|
||||
.move = mock_move,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(ttm_dev_funcs);
|
||||
|
||||
@@ -93,6 +99,12 @@ struct ttm_place *ttm_place_kunit_init(struct kunit *test,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ttm_place_kunit_init);
|
||||
|
||||
void dummy_ttm_bo_destroy(struct ttm_buffer_object *bo)
|
||||
{
|
||||
drm_gem_object_release(&bo->base);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dummy_ttm_bo_destroy);
|
||||
|
||||
struct ttm_test_devices *ttm_test_devices_basic(struct kunit *test)
|
||||
{
|
||||
struct ttm_test_devices *devs;
|
||||
|
||||
Reference in New Issue
Block a user