xref: /linux/drivers/gpu/drm/panthor/panthor_heap.h (revision db5d28c0bfe566908719bec8e25443aabecbb802)
1 /* SPDX-License-Identifier: GPL-2.0 or MIT */
2 /* Copyright 2023 Collabora ltd. */
3 
4 #ifndef __PANTHOR_HEAP_H__
5 #define __PANTHOR_HEAP_H__
6 
7 #include <linux/types.h>
8 
9 struct panthor_device;
10 struct panthor_heap_pool;
11 struct panthor_vm;
12 
13 int panthor_heap_create(struct panthor_heap_pool *pool,
14 			u32 initial_chunk_count,
15 			u32 chunk_size,
16 			u32 max_chunks,
17 			u32 target_in_flight,
18 			u64 *heap_ctx_gpu_va,
19 			u64 *first_chunk_gpu_va);
20 int panthor_heap_destroy(struct panthor_heap_pool *pool, u32 handle);
21 
22 struct panthor_heap_pool *
23 panthor_heap_pool_create(struct panthor_device *ptdev, struct panthor_vm *vm);
24 void panthor_heap_pool_destroy(struct panthor_heap_pool *pool);
25 
26 struct panthor_heap_pool *
27 panthor_heap_pool_get(struct panthor_heap_pool *pool);
28 void panthor_heap_pool_put(struct panthor_heap_pool *pool);
29 
30 int panthor_heap_grow(struct panthor_heap_pool *pool,
31 		      u64 heap_gpu_va,
32 		      u32 renderpasses_in_flight,
33 		      u32 pending_frag_count,
34 		      u64 *new_chunk_gpu_va);
35 int panthor_heap_return_chunk(struct panthor_heap_pool *pool,
36 			      u64 heap_gpu_va,
37 			      u64 chunk_gpu_va);
38 
39 #endif
40