xref: /linux/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.h (revision db82a0435b8be32d544bbed91c43c2f21b5f4ea7)
1f6ffbd4fSLucas Stach /* SPDX-License-Identifier: GPL-2.0 */
2ea1f5729SLucas Stach /*
3ea1f5729SLucas Stach  * Copyright (C) 2017 Etnaviv Project
4ea1f5729SLucas Stach  */
5ea1f5729SLucas Stach 
6ea1f5729SLucas Stach #ifndef __ETNAVIV_CMDBUF_H__
7ea1f5729SLucas Stach #define __ETNAVIV_CMDBUF_H__
8ea1f5729SLucas Stach 
9ea1f5729SLucas Stach #include <linux/types.h>
10ea1f5729SLucas Stach 
11e66774ddSLucas Stach struct etnaviv_gpu;
12*db82a043SLucas Stach struct etnaviv_iommu;
13*db82a043SLucas Stach struct etnaviv_vram_mapping;
14e66774ddSLucas Stach struct etnaviv_cmdbuf_suballoc;
158d3d56ceSChristian Gmeiner struct etnaviv_perfmon_request;
16e66774ddSLucas Stach 
17ea1f5729SLucas Stach struct etnaviv_cmdbuf {
18e66774ddSLucas Stach 	/* suballocator this cmdbuf is allocated from */
19e66774ddSLucas Stach 	struct etnaviv_cmdbuf_suballoc *suballoc;
20ea1f5729SLucas Stach 	/* cmdbuf properties */
21e66774ddSLucas Stach 	int suballoc_offset;
22ea1f5729SLucas Stach 	void *vaddr;
23ea1f5729SLucas Stach 	u32 size;
24ea1f5729SLucas Stach 	u32 user_size;
25ea1f5729SLucas Stach };
26ea1f5729SLucas Stach 
27e66774ddSLucas Stach struct etnaviv_cmdbuf_suballoc *
28e66774ddSLucas Stach etnaviv_cmdbuf_suballoc_new(struct etnaviv_gpu * gpu);
29e66774ddSLucas Stach void etnaviv_cmdbuf_suballoc_destroy(struct etnaviv_cmdbuf_suballoc *suballoc);
30*db82a043SLucas Stach int etnaviv_cmdbuf_suballoc_map(struct etnaviv_cmdbuf_suballoc *suballoc,
31*db82a043SLucas Stach 				struct etnaviv_iommu *mmu,
32*db82a043SLucas Stach 				struct etnaviv_vram_mapping *mapping,
33*db82a043SLucas Stach 				u32 memory_base);
34*db82a043SLucas Stach void etnaviv_cmdbuf_suballoc_unmap(struct etnaviv_iommu *mmu,
35*db82a043SLucas Stach 				   struct etnaviv_vram_mapping *mapping);
36e66774ddSLucas Stach 
372f9225dbSLucas Stach 
382f9225dbSLucas Stach int etnaviv_cmdbuf_init(struct etnaviv_cmdbuf_suballoc *suballoc,
392f9225dbSLucas Stach 		struct etnaviv_cmdbuf *cmdbuf, u32 size);
40e66774ddSLucas Stach void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf);
41e66774ddSLucas Stach 
42*db82a043SLucas Stach u32 etnaviv_cmdbuf_get_va(struct etnaviv_cmdbuf *buf,
43*db82a043SLucas Stach 			  struct etnaviv_vram_mapping *mapping);
449912b4dbSLucas Stach dma_addr_t etnaviv_cmdbuf_get_pa(struct etnaviv_cmdbuf *buf);
45c3ef4b8cSLucas Stach 
46ea1f5729SLucas Stach #endif /* __ETNAVIV_CMDBUF_H__ */
47