blob: 72c90b432e87d34aeb7af3db599e1bad25b04043 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/* SPDX-License-Identifier: MIT */
/*
* Copyright © 2021 Intel Corporation
*/
#ifndef __I915_TTM_BUDDY_MANAGER_H__
#define __I915_TTM_BUDDY_MANAGER_H__
#include <linux/list.h>
#include <linux/types.h>
#include <drm/ttm/ttm_resource.h>
struct ttm_device;
struct ttm_resource_manager;
struct drm_buddy;
/**
* struct i915_ttm_buddy_resource
*
* @base: struct ttm_resource base class we extend
* @blocks: the list of struct i915_buddy_block for this resource/allocation
* @flags: DRM_BUDDY_*_ALLOCATION flags
* @mm: the struct i915_buddy_mm for this resource
*
* Extends the struct ttm_resource to manage an address space allocation with
* one or more struct i915_buddy_block.
*/
struct i915_ttm_buddy_resource {
struct ttm_resource base;
struct list_head blocks;
unsigned long flags;
struct drm_buddy *mm;
};
/**
* to_ttm_buddy_resource
*
* @res: the resource to upcast
*
* Upcast the struct ttm_resource object into a struct i915_ttm_buddy_resource.
*/
static inline struct i915_ttm_buddy_resource *
to_ttm_buddy_resource(struct ttm_resource *res)
{
return container_of(res, struct i915_ttm_buddy_resource, base);
}
int i915_ttm_buddy_man_init(struct ttm_device *bdev,
unsigned type, bool use_tt,
u64 size, u64 default_page_size, u64 chunk_size);
int i915_ttm_buddy_man_fini(struct ttm_device *bdev,
unsigned int type);
int i915_ttm_buddy_man_reserve(struct ttm_resource_manager *man,
u64 start, u64 size);
#endif
|