xref: /linux/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.h (revision 9912b4db7beae07cfa8d435530cddf375873c6f3)
1 /*
2  * Copyright (C) 2017 Etnaviv Project
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 2 as published by
6  * the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
11  * more details.
12  *
13  * You should have received a copy of the GNU General Public License along with
14  * this program.  If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef __ETNAVIV_CMDBUF_H__
18 #define __ETNAVIV_CMDBUF_H__
19 
20 #include <drm/drm_mm.h>
21 #include <linux/types.h>
22 
23 struct etnaviv_cmdbuf {
24 	/* device this cmdbuf is allocated for */
25 	struct etnaviv_gpu *gpu;
26 	/* user context key, must be unique between all active users */
27 	struct etnaviv_file_private *ctx;
28 	/* cmdbuf properties */
29 	void *vaddr;
30 	dma_addr_t paddr;
31 	u32 size;
32 	u32 user_size;
33 	/* vram node used if the cmdbuf is mapped through the MMUv2 */
34 	struct drm_mm_node vram_node;
35 	/* fence after which this buffer is to be disposed */
36 	struct dma_fence *fence;
37 	/* target exec state */
38 	u32 exec_state;
39 	/* per GPU in-flight list */
40 	struct list_head node;
41 	/* BOs attached to this command buffer */
42 	unsigned int nr_bos;
43 	struct etnaviv_vram_mapping *bo_map[0];
44 };
45 
46 u32 etnaviv_cmdbuf_get_va(struct etnaviv_cmdbuf *buf);
47 dma_addr_t etnaviv_cmdbuf_get_pa(struct etnaviv_cmdbuf *buf);
48 
49 #endif /* __ETNAVIV_CMDBUF_H__ */
50