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
12/**
13 * struct xe_ttm_vram_mgr - Xe TTM VRAM manager
14 *
15 * Manages placement of TTM resource in VRAM.
16 */
17struct xe_ttm_vram_mgr {
18 /** @manager: Base TTM resource manager */
19 struct ttm_resource_manager manager;
20 /** @mm: DRM buddy allocator which manages the VRAM */
21 struct drm_buddy mm;
22 /** @visible_size: Proped size of the CPU visible portion */
23 u64 visible_size;
24 /** @visible_avail: CPU visible portion still unallocated */
25 u64 visible_avail;
26 /** @default_page_size: default page size */
27 u64 default_page_size;
28 /** @lock: protects allocations of VRAM */
29 struct mutex lock;
30 /** @mem_type: The TTM memory type */
31 u32 mem_type;
32};
33
34/**
35 * struct xe_ttm_vram_mgr_resource - Xe TTM VRAM resource
36 */
37struct xe_ttm_vram_mgr_resource {
38 /** @base: Base TTM resource */
39 struct ttm_resource base;
40 /** @blocks: list of DRM buddy blocks */
41 struct list_head blocks;
42 /** @used_visible_size: How many CPU visible bytes this resource is using */
43 u64 used_visible_size;
44 /** @flags: flags associated with the resource */
45 unsigned long flags;
46};
47
48#endif
49

source code of linux/drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h