xref: /linux/drivers/gpu/drm/etnaviv/etnaviv_cmdbuf.h (revision 27b67278e007b5475bc14918794bf73cf297a026)
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 
11bffe5db8SLucas Stach struct device;
12*27b67278SLucas Stach struct etnaviv_iommu_context;
13db82a043SLucas 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 *
28bffe5db8SLucas Stach etnaviv_cmdbuf_suballoc_new(struct device *dev);
29e66774ddSLucas Stach void etnaviv_cmdbuf_suballoc_destroy(struct etnaviv_cmdbuf_suballoc *suballoc);
30db82a043SLucas Stach int etnaviv_cmdbuf_suballoc_map(struct etnaviv_cmdbuf_suballoc *suballoc,
31*27b67278SLucas Stach 				struct etnaviv_iommu_context *context,
32db82a043SLucas Stach 				struct etnaviv_vram_mapping *mapping,
33db82a043SLucas Stach 				u32 memory_base);
34*27b67278SLucas Stach void etnaviv_cmdbuf_suballoc_unmap(struct etnaviv_iommu_context *context,
35db82a043SLucas 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 
42db82a043SLucas Stach u32 etnaviv_cmdbuf_get_va(struct etnaviv_cmdbuf *buf,
43db82a043SLucas 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