msm_vidc_vb2.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef _MSM_VIDC_VB2_H_
  7. #define _MSM_VIDC_VB2_H_
  8. #include <media/videobuf2-core.h>
  9. #include <media/videobuf2-v4l2.h>
  10. #include "msm_vidc_inst.h"
  11. struct vb2_queue *msm_vidc_get_vb2q(struct msm_vidc_inst *inst,
  12. u32 type, const char *func);
  13. /* vb2_mem_ops */
  14. #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
  15. void *msm_vb2_alloc(struct device *dev, unsigned long attrs,
  16. unsigned long size, enum dma_data_direction dma_dir,
  17. gfp_t gfp_flags);
  18. void *msm_vb2_attach_dmabuf(struct device *dev,
  19. struct dma_buf *dbuf,
  20. unsigned long size,
  21. enum dma_data_direction dma_dir);
  22. #else
  23. void *msm_vb2_alloc(struct vb2_buffer *vb, struct device *dev,
  24. unsigned long size);
  25. void *msm_vb2_attach_dmabuf(struct vb2_buffer *vb, struct device *dev,
  26. struct dma_buf *dbuf, unsigned long size);
  27. #endif
  28. void msm_vb2_put(void *buf_priv);
  29. int msm_vb2_mmap(void *buf_priv, struct vm_area_struct *vma);
  30. void msm_vb2_detach_dmabuf(void *buf_priv);
  31. int msm_vb2_map_dmabuf(void *buf_priv);
  32. void msm_vb2_unmap_dmabuf(void *buf_priv);
  33. /* vb2_ops */
  34. int msm_vb2_queue_setup(struct vb2_queue *q,
  35. unsigned int *num_buffers,
  36. unsigned int *num_planes,
  37. unsigned int sizes[],
  38. struct device *alloc_devs[]);
  39. int msm_vidc_start_streaming(struct msm_vidc_inst *inst, struct vb2_queue *q);
  40. int msm_vidc_stop_streaming(struct msm_vidc_inst *inst, struct vb2_queue *q);
  41. int msm_vb2_start_streaming(struct vb2_queue *q, unsigned int count);
  42. void msm_vb2_stop_streaming(struct vb2_queue *q);
  43. void msm_vb2_buf_queue(struct vb2_buffer *vb2);
  44. int msm_vb2_buf_out_validate(struct vb2_buffer *vb);
  45. void msm_vb2_request_complete(struct vb2_buffer *vb);
  46. #endif // _MSM_VIDC_VB2_H_