xref: /linux/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.h (revision 6b16f5d12202a23d875915349cc031c07fe1b3ec)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2017 Etnaviv Project
4  */
5 
6 #ifndef __ETNAVIV_CMDBUF_H__
7 #define __ETNAVIV_CMDBUF_H__
8 
9 #include <linux/types.h>
10 
11 struct etnaviv_gpu;
12 struct etnaviv_cmdbuf_suballoc;
13 struct etnaviv_perfmon_request;
14 
15 struct etnaviv_cmdbuf {
16 	/* suballocator this cmdbuf is allocated from */
17 	struct etnaviv_cmdbuf_suballoc *suballoc;
18 	/* user context key, must be unique between all active users */
19 	struct etnaviv_file_private *ctx;
20 	/* cmdbuf properties */
21 	int suballoc_offset;
22 	void *vaddr;
23 	u32 size;
24 	u32 user_size;
25 };
26 
27 struct etnaviv_cmdbuf_suballoc *
28 etnaviv_cmdbuf_suballoc_new(struct etnaviv_gpu * gpu);
29 void etnaviv_cmdbuf_suballoc_destroy(struct etnaviv_cmdbuf_suballoc *suballoc);
30 
31 
32 int etnaviv_cmdbuf_init(struct etnaviv_cmdbuf_suballoc *suballoc,
33 		struct etnaviv_cmdbuf *cmdbuf, u32 size);
34 void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf);
35 
36 u32 etnaviv_cmdbuf_get_va(struct etnaviv_cmdbuf *buf);
37 dma_addr_t etnaviv_cmdbuf_get_pa(struct etnaviv_cmdbuf *buf);
38 
39 #endif /* __ETNAVIV_CMDBUF_H__ */
40