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 22e66774ddSLucas Stach struct etnaviv_gpu; 23e66774ddSLucas Stach struct etnaviv_cmdbuf_suballoc; 24*8d3d56ceSChristian Gmeiner struct etnaviv_perfmon_request; 25e66774ddSLucas Stach 26ea1f5729SLucas Stach struct etnaviv_cmdbuf { 27e66774ddSLucas Stach /* suballocator this cmdbuf is allocated from */ 28e66774ddSLucas Stach struct etnaviv_cmdbuf_suballoc *suballoc; 29ea1f5729SLucas Stach /* user context key, must be unique between all active users */ 30ea1f5729SLucas Stach struct etnaviv_file_private *ctx; 31ea1f5729SLucas Stach /* cmdbuf properties */ 32e66774ddSLucas Stach int suballoc_offset; 33ea1f5729SLucas Stach void *vaddr; 34ea1f5729SLucas Stach u32 size; 35ea1f5729SLucas Stach u32 user_size; 36ea1f5729SLucas Stach /* fence after which this buffer is to be disposed */ 37ea1f5729SLucas Stach struct dma_fence *fence; 38ea1f5729SLucas Stach /* target exec state */ 39ea1f5729SLucas Stach u32 exec_state; 40ea1f5729SLucas Stach /* per GPU in-flight list */ 41ea1f5729SLucas Stach struct list_head node; 42*8d3d56ceSChristian Gmeiner /* perfmon requests */ 43*8d3d56ceSChristian Gmeiner unsigned int nr_pmrs; 44*8d3d56ceSChristian Gmeiner struct etnaviv_perfmon_request *pmrs; 45ea1f5729SLucas Stach /* BOs attached to this command buffer */ 46ea1f5729SLucas Stach unsigned int nr_bos; 47ea1f5729SLucas Stach struct etnaviv_vram_mapping *bo_map[0]; 48ea1f5729SLucas Stach }; 49ea1f5729SLucas Stach 50e66774ddSLucas Stach struct etnaviv_cmdbuf_suballoc * 51e66774ddSLucas Stach etnaviv_cmdbuf_suballoc_new(struct etnaviv_gpu * gpu); 52e66774ddSLucas Stach void etnaviv_cmdbuf_suballoc_destroy(struct etnaviv_cmdbuf_suballoc *suballoc); 53e66774ddSLucas Stach 54e66774ddSLucas Stach struct etnaviv_cmdbuf * 55e66774ddSLucas Stach etnaviv_cmdbuf_new(struct etnaviv_cmdbuf_suballoc *suballoc, u32 size, 56e66774ddSLucas Stach size_t nr_bos); 57e66774ddSLucas Stach void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf); 58e66774ddSLucas Stach 59c3ef4b8cSLucas Stach u32 etnaviv_cmdbuf_get_va(struct etnaviv_cmdbuf *buf); 609912b4dbSLucas Stach dma_addr_t etnaviv_cmdbuf_get_pa(struct etnaviv_cmdbuf *buf); 61c3ef4b8cSLucas Stach 62ea1f5729SLucas Stach #endif /* __ETNAVIV_CMDBUF_H__ */ 63