Merge branch 'for-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
[sfrench/cifs-2.6.git] / drivers / gpu / drm / etnaviv / etnaviv_cmdbuf.h
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__ */