msm_vidc_memory.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2020-2021,, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _MSM_VIDC_MEMORY_H_
  6. #define _MSM_VIDC_MEMORY_H_
  7. #include "msm_vidc_internal.h"
  8. struct msm_vidc_core;
  9. struct msm_vidc_inst;
  10. enum msm_memory_pool_type {
  11. MSM_MEM_POOL_BUFFER = 0,
  12. MSM_MEM_POOL_MAP,
  13. MSM_MEM_POOL_ALLOC,
  14. MSM_MEM_POOL_TIMESTAMP,
  15. MSM_MEM_POOL_MAX,
  16. };
  17. struct msm_memory_alloc_header {
  18. struct list_head list;
  19. void *buf;
  20. };
  21. struct msm_memory_pool {
  22. u32 type;
  23. u32 size;
  24. char *name;
  25. struct list_head free_pool; /* list of struct msm_memory_alloc_header */
  26. struct list_head busy_pool; /* list of struct msm_memory_alloc_header */
  27. };
  28. int msm_vidc_memory_alloc(struct msm_vidc_core *core,
  29. struct msm_vidc_alloc *alloc);
  30. int msm_vidc_memory_free(struct msm_vidc_core *core,
  31. struct msm_vidc_alloc *alloc);
  32. int msm_vidc_memory_map(struct msm_vidc_core *core,
  33. struct msm_vidc_map *map);
  34. int msm_vidc_memory_unmap(struct msm_vidc_core *core,
  35. struct msm_vidc_map *map);
  36. struct dma_buf *msm_vidc_memory_get_dmabuf(int fd);
  37. void msm_vidc_memory_put_dmabuf(void *dmabuf);
  38. int msm_memory_pools_init(struct msm_vidc_inst *inst);
  39. void msm_memory_pools_deinit(struct msm_vidc_inst *inst);
  40. void *msm_memory_alloc(struct msm_vidc_inst *inst,
  41. enum msm_memory_pool_type type);
  42. void msm_memory_free(struct msm_vidc_inst *inst,
  43. enum msm_memory_pool_type type, void *vidc_buf);
  44. #endif // _MSM_VIDC_MEMORY_H_