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 <linux/types.h> 21ea1f5729SLucas Stach 22*e66774ddSLucas Stach struct etnaviv_gpu; 23*e66774ddSLucas Stach struct etnaviv_cmdbuf_suballoc; 24*e66774ddSLucas Stach 25ea1f5729SLucas Stach struct etnaviv_cmdbuf { 26*e66774ddSLucas Stach /* suballocator this cmdbuf is allocated from */ 27*e66774ddSLucas Stach struct etnaviv_cmdbuf_suballoc *suballoc; 28ea1f5729SLucas Stach /* user context key, must be unique between all active users */ 29ea1f5729SLucas Stach struct etnaviv_file_private *ctx; 30ea1f5729SLucas Stach /* cmdbuf properties */ 31*e66774ddSLucas Stach int suballoc_offset; 32ea1f5729SLucas Stach void *vaddr; 33ea1f5729SLucas Stach u32 size; 34ea1f5729SLucas Stach u32 user_size; 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 46*e66774ddSLucas Stach struct etnaviv_cmdbuf_suballoc * 47*e66774ddSLucas Stach etnaviv_cmdbuf_suballoc_new(struct etnaviv_gpu * gpu); 48*e66774ddSLucas Stach void etnaviv_cmdbuf_suballoc_destroy(struct etnaviv_cmdbuf_suballoc *suballoc); 49*e66774ddSLucas Stach 50*e66774ddSLucas Stach struct etnaviv_cmdbuf * 51*e66774ddSLucas Stach etnaviv_cmdbuf_new(struct etnaviv_cmdbuf_suballoc *suballoc, u32 size, 52*e66774ddSLucas Stach size_t nr_bos); 53*e66774ddSLucas Stach void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf); 54*e66774ddSLucas Stach 55c3ef4b8cSLucas Stach u32 etnaviv_cmdbuf_get_va(struct etnaviv_cmdbuf *buf); 569912b4dbSLucas Stach dma_addr_t etnaviv_cmdbuf_get_pa(struct etnaviv_cmdbuf *buf); 57c3ef4b8cSLucas Stach 58ea1f5729SLucas Stach #endif /* __ETNAVIV_CMDBUF_H__ */ 59