Lucas Stach | ea1f572 | 2017-01-16 16:09:51 +0100 | [diff] [blame] | 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 | |
Lucas Stach | ea1f572 | 2017-01-16 16:09:51 +0100 | [diff] [blame] | 20 | #include <linux/types.h> |
| 21 | |
Lucas Stach | e66774d | 2017-01-16 17:29:57 +0100 | [diff] [blame] | 22 | struct etnaviv_gpu; |
| 23 | struct etnaviv_cmdbuf_suballoc; |
| 24 | |
Lucas Stach | ea1f572 | 2017-01-16 16:09:51 +0100 | [diff] [blame] | 25 | struct etnaviv_cmdbuf { |
Lucas Stach | e66774d | 2017-01-16 17:29:57 +0100 | [diff] [blame] | 26 | /* suballocator this cmdbuf is allocated from */ |
| 27 | struct etnaviv_cmdbuf_suballoc *suballoc; |
Lucas Stach | ea1f572 | 2017-01-16 16:09:51 +0100 | [diff] [blame] | 28 | /* user context key, must be unique between all active users */ |
| 29 | struct etnaviv_file_private *ctx; |
| 30 | /* cmdbuf properties */ |
Lucas Stach | e66774d | 2017-01-16 17:29:57 +0100 | [diff] [blame] | 31 | int suballoc_offset; |
Lucas Stach | ea1f572 | 2017-01-16 16:09:51 +0100 | [diff] [blame] | 32 | void *vaddr; |
Lucas Stach | ea1f572 | 2017-01-16 16:09:51 +0100 | [diff] [blame] | 33 | u32 size; |
| 34 | u32 user_size; |
Lucas Stach | ea1f572 | 2017-01-16 16:09:51 +0100 | [diff] [blame] | 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 | |
Lucas Stach | e66774d | 2017-01-16 17:29:57 +0100 | [diff] [blame] | 46 | struct etnaviv_cmdbuf_suballoc * |
| 47 | etnaviv_cmdbuf_suballoc_new(struct etnaviv_gpu * gpu); |
| 48 | void etnaviv_cmdbuf_suballoc_destroy(struct etnaviv_cmdbuf_suballoc *suballoc); |
| 49 | |
| 50 | struct etnaviv_cmdbuf * |
| 51 | etnaviv_cmdbuf_new(struct etnaviv_cmdbuf_suballoc *suballoc, u32 size, |
| 52 | size_t nr_bos); |
| 53 | void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf); |
| 54 | |
Lucas Stach | c3ef4b8 | 2017-01-16 16:52:44 +0100 | [diff] [blame] | 55 | u32 etnaviv_cmdbuf_get_va(struct etnaviv_cmdbuf *buf); |
Lucas Stach | 9912b4d | 2017-01-16 17:00:08 +0100 | [diff] [blame] | 56 | dma_addr_t etnaviv_cmdbuf_get_pa(struct etnaviv_cmdbuf *buf); |
Lucas Stach | c3ef4b8 | 2017-01-16 16:52:44 +0100 | [diff] [blame] | 57 | |
Lucas Stach | ea1f572 | 2017-01-16 16:09:51 +0100 | [diff] [blame] | 58 | #endif /* __ETNAVIV_CMDBUF_H__ */ |