Lines Matching +full:additional +full:- +full:devs
1 // SPDX-License-Identifier: GPL-2.0 AND MIT
65 struct ttm_resource *old_mem = bo->resource; in mock_move()
67 if (!old_mem || (old_mem->mem_type == TTM_PL_SYSTEM && !bo->ttm)) { in mock_move()
72 if (bo->resource->mem_type == TTM_PL_VRAM && in mock_move()
73 new_mem->mem_type == TTM_PL_SYSTEM) { in mock_move()
74 hop->mem_type = TTM_PL_TT; in mock_move()
75 hop->flags = TTM_PL_FLAG_TEMPORARY; in mock_move()
76 hop->fpfn = 0; in mock_move()
77 hop->lpfn = 0; in mock_move()
78 return -EMULTIHOP; in mock_move()
81 if ((old_mem->mem_type == TTM_PL_SYSTEM && in mock_move()
82 new_mem->mem_type == TTM_PL_TT) || in mock_move()
83 (old_mem->mem_type == TTM_PL_TT && in mock_move()
84 new_mem->mem_type == TTM_PL_SYSTEM)) { in mock_move()
95 switch (bo->resource->mem_type) { in mock_evict_flags()
121 struct drm_device *drm = priv->drm; in ttm_device_kunit_init_with_funcs()
124 err = ttm_device_init(ttm, funcs, drm->dev, in ttm_device_kunit_init_with_funcs()
125 drm->anon_inode->i_mapping, in ttm_device_kunit_init_with_funcs()
126 drm->vma_offset_manager, in ttm_device_kunit_init_with_funcs()
171 struct ttm_test_devices *devs, in ttm_bo_kunit_init() argument
182 bo->base = gem_obj; in ttm_bo_kunit_init()
185 bo->base.resv = obj; in ttm_bo_kunit_init()
187 err = drm_gem_object_init(devs->drm, &bo->base, size); in ttm_bo_kunit_init()
190 bo->bdev = devs->ttm_dev; in ttm_bo_kunit_init()
191 bo->destroy = dummy_ttm_bo_destroy; in ttm_bo_kunit_init()
193 kref_init(&bo->kref); in ttm_bo_kunit_init()
206 place->mem_type = mem_type; in ttm_place_kunit_init()
207 place->flags = flags; in ttm_place_kunit_init()
215 drm_gem_object_release(&bo->base); in dummy_ttm_bo_destroy()
221 struct ttm_test_devices *devs; in ttm_test_devices_basic() local
223 devs = kunit_kzalloc(test, sizeof(*devs), GFP_KERNEL); in ttm_test_devices_basic()
224 KUNIT_ASSERT_NOT_NULL(test, devs); in ttm_test_devices_basic()
226 devs->dev = drm_kunit_helper_alloc_device(test); in ttm_test_devices_basic()
227 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, devs->dev); in ttm_test_devices_basic()
230 devs->dev->coherent_dma_mask = -1; in ttm_test_devices_basic()
232 devs->drm = __drm_kunit_helper_alloc_drm_device(test, devs->dev, in ttm_test_devices_basic()
233 sizeof(*devs->drm), 0, in ttm_test_devices_basic()
235 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, devs->drm); in ttm_test_devices_basic()
237 return devs; in ttm_test_devices_basic()
243 struct ttm_test_devices *devs; in ttm_test_devices_all() local
247 devs = ttm_test_devices_basic(test); in ttm_test_devices_all()
252 err = ttm_device_kunit_init(devs, ttm_dev, false, false); in ttm_test_devices_all()
255 devs->ttm_dev = ttm_dev; in ttm_test_devices_all()
257 return devs; in ttm_test_devices_all()
261 void ttm_test_devices_put(struct kunit *test, struct ttm_test_devices *devs) in ttm_test_devices_put() argument
263 if (devs->ttm_dev) in ttm_test_devices_put()
264 ttm_device_fini(devs->ttm_dev); in ttm_test_devices_put()
266 drm_kunit_helper_free_device(test, devs->dev); in ttm_test_devices_put()
278 test->priv = priv; in ttm_test_devices_init()
292 test->priv = priv; in ttm_test_devices_all_init()
300 ttm_test_devices_put(test, test->priv); in ttm_test_devices_fini()
305 MODULE_LICENSE("GPL and additional rights");