etnaviv_cmdbuf.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #ifndef __ETNAVIV_CMDBUF_H__
  17. #define __ETNAVIV_CMDBUF_H__
  18. #include <linux/types.h>
  19. struct etnaviv_gpu;
  20. struct etnaviv_cmdbuf_suballoc;
  21. struct etnaviv_cmdbuf {
  22. /* suballocator this cmdbuf is allocated from */
  23. struct etnaviv_cmdbuf_suballoc *suballoc;
  24. /* user context key, must be unique between all active users */
  25. struct etnaviv_file_private *ctx;
  26. /* cmdbuf properties */
  27. int suballoc_offset;
  28. void *vaddr;
  29. u32 size;
  30. u32 user_size;
  31. /* fence after which this buffer is to be disposed */
  32. struct dma_fence *fence;
  33. /* target exec state */
  34. u32 exec_state;
  35. /* per GPU in-flight list */
  36. struct list_head node;
  37. /* BOs attached to this command buffer */
  38. unsigned int nr_bos;
  39. struct etnaviv_vram_mapping *bo_map[0];
  40. };
  41. struct etnaviv_cmdbuf_suballoc *
  42. etnaviv_cmdbuf_suballoc_new(struct etnaviv_gpu * gpu);
  43. void etnaviv_cmdbuf_suballoc_destroy(struct etnaviv_cmdbuf_suballoc *suballoc);
  44. struct etnaviv_cmdbuf *
  45. etnaviv_cmdbuf_new(struct etnaviv_cmdbuf_suballoc *suballoc, u32 size,
  46. size_t nr_bos);
  47. void etnaviv_cmdbuf_free(struct etnaviv_cmdbuf *cmdbuf);
  48. u32 etnaviv_cmdbuf_get_va(struct etnaviv_cmdbuf *buf);
  49. dma_addr_t etnaviv_cmdbuf_get_pa(struct etnaviv_cmdbuf *buf);
  50. #endif /* __ETNAVIV_CMDBUF_H__ */