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