videobuf2-msm-mem.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * helper functions for physically contiguous PMEM capture buffers
  13. */
  14. #ifndef _VIDEOBUF2_PMEM_CONTIG_H
  15. #define _VIDEOBUF2_PMEM_CONTIG_H
  16. #include <media/videobuf2-core.h>
  17. #include <mach/iommu_domains.h>
  18. #include <linux/msm_ion.h>
  19. struct videobuf2_mapping {
  20. unsigned int count;
  21. };
  22. enum videobuf2_buffer_type {
  23. VIDEOBUF2_SINGLE_PLANE,
  24. VIDEOBUF2_MULTIPLE_PLANES
  25. };
  26. struct videobuf2_sp_offset {
  27. uint32_t y_off;
  28. uint32_t cbcr_off;
  29. };
  30. struct videobuf2_msm_offset {
  31. union {
  32. struct videobuf2_sp_offset sp_off;
  33. uint32_t data_offset;
  34. };
  35. };
  36. struct videobuf2_contig_pmem {
  37. u32 magic;
  38. void *vaddr;
  39. int phyaddr;
  40. unsigned long size;
  41. int is_userptr;
  42. /* Offset of the plane inside the buffer */
  43. struct videobuf2_msm_offset offset;
  44. enum videobuf2_buffer_type buffer_type;
  45. int path;
  46. struct file *file;
  47. /* Offset of the buffer */
  48. uint32_t addr_offset;
  49. int dirty;
  50. unsigned int count;
  51. void *alloc_ctx;
  52. unsigned long mapped_phyaddr;
  53. struct ion_handle *ion_handle;
  54. struct ion_client *client;
  55. };
  56. void videobuf2_queue_pmem_contig_init(struct vb2_queue *q,
  57. enum v4l2_buf_type type,
  58. const struct vb2_ops *ops,
  59. unsigned int size,
  60. void *priv);
  61. int videobuf2_pmem_contig_mmap_get(struct videobuf2_contig_pmem *mem,
  62. struct videobuf2_msm_offset *offset,
  63. enum videobuf2_buffer_type, int path);
  64. int videobuf2_pmem_contig_user_get(struct videobuf2_contig_pmem *mem,
  65. struct videobuf2_msm_offset *offset,
  66. enum videobuf2_buffer_type,
  67. uint32_t addr_offset, int path,
  68. struct ion_client *client,
  69. int domain_num);
  70. void videobuf2_pmem_contig_user_put(struct videobuf2_contig_pmem *mem,
  71. struct ion_client *client, int domain_num);
  72. unsigned long videobuf2_to_pmem_contig(struct vb2_buffer *buf,
  73. unsigned int plane_no);
  74. #endif /* _VIDEOBUF2_PMEM_CONTIG_H */