Loading...
Note: File does not exist in v3.1.
1/* SPDX-License-Identifier: GPL-2.0 AND MIT */
2/*
3 * Copyright © 2023 Intel Corporation
4 */
5#ifndef TTM_KUNIT_HELPERS_H
6#define TTM_KUNIT_HELPERS_H
7
8#include <drm/drm_drv.h>
9#include <drm/ttm/ttm_device.h>
10#include <drm/ttm/ttm_bo.h>
11
12#include <drm/drm_kunit_helpers.h>
13#include <kunit/test.h>
14
15extern struct ttm_device_funcs ttm_dev_funcs;
16
17struct ttm_test_devices {
18 struct drm_device *drm;
19 struct device *dev;
20 struct ttm_device *ttm_dev;
21};
22
23/* Building blocks for test-specific init functions */
24int ttm_device_kunit_init(struct ttm_test_devices *priv,
25 struct ttm_device *ttm,
26 bool use_dma_alloc,
27 bool use_dma32);
28struct ttm_buffer_object *ttm_bo_kunit_init(struct kunit *test,
29 struct ttm_test_devices *devs,
30 size_t size);
31
32struct ttm_test_devices *ttm_test_devices_basic(struct kunit *test);
33struct ttm_test_devices *ttm_test_devices_all(struct kunit *test);
34
35void ttm_test_devices_put(struct kunit *test, struct ttm_test_devices *devs);
36
37/* Generic init/fini for tests that only need DRM/TTM devices */
38int ttm_test_devices_init(struct kunit *test);
39void ttm_test_devices_fini(struct kunit *test);
40
41#endif // TTM_KUNIT_HELPERS_H