Linux Audio

Check our new training course

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#include <drm/ttm/ttm_placement.h>
12
13#include <drm/drm_kunit_helpers.h>
14#include <kunit/test.h>
15
16#define TTM_PL_MOCK1 (TTM_PL_PRIV + 1)
17#define TTM_PL_MOCK2 (TTM_PL_PRIV + 2)
18
19extern struct ttm_device_funcs ttm_dev_funcs;
20extern struct ttm_device_funcs ttm_dev_funcs_bad_evict;
21
22struct ttm_test_devices {
23	struct drm_device *drm;
24	struct device *dev;
25	struct ttm_device *ttm_dev;
26};
27
28/* Building blocks for test-specific init functions */
29int ttm_device_kunit_init(struct ttm_test_devices *priv,
30			  struct ttm_device *ttm,
31			  bool use_dma_alloc,
32			  bool use_dma32);
33int ttm_device_kunit_init_bad_evict(struct ttm_test_devices *priv,
34				    struct ttm_device *ttm,
35				    bool use_dma_alloc,
36				    bool use_dma32);
37struct ttm_buffer_object *ttm_bo_kunit_init(struct kunit *test,
38					    struct ttm_test_devices *devs,
39					    size_t size,
40					    struct dma_resv *obj);
41struct ttm_place *ttm_place_kunit_init(struct kunit *test, u32 mem_type,
42				       u32 flags);
43void dummy_ttm_bo_destroy(struct ttm_buffer_object *bo);
44
45struct ttm_test_devices *ttm_test_devices_basic(struct kunit *test);
46struct ttm_test_devices *ttm_test_devices_all(struct kunit *test);
47
48void ttm_test_devices_put(struct kunit *test, struct ttm_test_devices *devs);
49
50/* Generic init/fini for tests that only need DRM/TTM devices */
51int ttm_test_devices_init(struct kunit *test);
52int ttm_test_devices_all_init(struct kunit *test);
53void ttm_test_devices_fini(struct kunit *test);
54
55#endif // TTM_KUNIT_HELPERS_H