Commit | Line | Data |
---|---|---|
dd08ebf6 MB |
1 | /* SPDX-License-Identifier: MIT */ |
2 | /* | |
3 | * Copyright © 2022 Intel Corporation | |
4 | */ | |
5 | ||
6 | #ifndef _XE_TTM_VRAM_MGR_TYPES_H_ | |
7 | #define _XE_TTM_VRAM_MGR_TYPES_H_ | |
8 | ||
9 | #include <drm/drm_buddy.h> | |
10 | #include <drm/ttm/ttm_device.h> | |
11 | ||
4e002016 | 12 | struct xe_mem_region; |
dd08ebf6 MB |
13 | |
14 | /** | |
15 | * struct xe_ttm_vram_mgr - XE TTM VRAM manager | |
16 | * | |
17 | * Manages placement of TTM resource in VRAM. | |
18 | */ | |
19 | struct xe_ttm_vram_mgr { | |
dd08ebf6 MB |
20 | /** @manager: Base TTM resource manager */ |
21 | struct ttm_resource_manager manager; | |
22 | /** @mm: DRM buddy allocator which manages the VRAM */ | |
23 | struct drm_buddy mm; | |
4e002016 BW |
24 | /** @vram: ptr to details of associated VRAM region */ |
25 | struct xe_mem_region *vram; | |
793e6612 MA |
26 | /** @visible_size: Proped size of the CPU visible portion */ |
27 | u64 visible_size; | |
28 | /** @visible_avail: CPU visible portion still unallocated */ | |
29 | u64 visible_avail; | |
dd08ebf6 MB |
30 | /** @default_page_size: default page size */ |
31 | u64 default_page_size; | |
32 | /** @lock: protects allocations of VRAM */ | |
33 | struct mutex lock; | |
1ef151d7 | 34 | /** @mem_type: The TTM memory type */ |
d8b52a02 | 35 | u32 mem_type; |
dd08ebf6 MB |
36 | }; |
37 | ||
38 | /** | |
39 | * struct xe_ttm_vram_mgr_resource - XE TTM VRAM resource | |
40 | */ | |
41 | struct xe_ttm_vram_mgr_resource { | |
42 | /** @base: Base TTM resource */ | |
43 | struct ttm_resource base; | |
44 | /** @blocks: list of DRM buddy blocks */ | |
45 | struct list_head blocks; | |
793e6612 MA |
46 | /** @used_visible_size: How many CPU visible bytes this resource is using */ |
47 | u64 used_visible_size; | |
dd08ebf6 MB |
48 | /** @flags: flags associated with the resource */ |
49 | unsigned long flags; | |
50 | }; | |
51 | ||
52 | #endif |