vsp1.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * vsp1.h -- R-Car VSP1 API
  4. *
  5. * Copyright (C) 2015 Renesas Electronics Corporation
  6. *
  7. * Contact: Laurent Pinchart ([email protected])
  8. */
  9. #ifndef __MEDIA_VSP1_H__
  10. #define __MEDIA_VSP1_H__
  11. #include <linux/scatterlist.h>
  12. #include <linux/types.h>
  13. #include <linux/videodev2.h>
  14. struct device;
  15. int vsp1_du_init(struct device *dev);
  16. #define VSP1_DU_STATUS_COMPLETE BIT(0)
  17. #define VSP1_DU_STATUS_WRITEBACK BIT(1)
  18. /**
  19. * struct vsp1_du_lif_config - VSP LIF configuration
  20. * @width: output frame width
  21. * @height: output frame height
  22. * @interlaced: true for interlaced pipelines
  23. * @callback: frame completion callback function (optional). When a callback
  24. * is provided, the VSP driver guarantees that it will be called once
  25. * and only once for each vsp1_du_atomic_flush() call.
  26. * @callback_data: data to be passed to the frame completion callback
  27. */
  28. struct vsp1_du_lif_config {
  29. unsigned int width;
  30. unsigned int height;
  31. bool interlaced;
  32. void (*callback)(void *data, unsigned int status, u32 crc);
  33. void *callback_data;
  34. };
  35. int vsp1_du_setup_lif(struct device *dev, unsigned int pipe_index,
  36. const struct vsp1_du_lif_config *cfg);
  37. /**
  38. * struct vsp1_du_atomic_config - VSP atomic configuration parameters
  39. * @pixelformat: plane pixel format (V4L2 4CC)
  40. * @pitch: line pitch in bytes for the first plane
  41. * @mem: DMA memory address for each plane of the frame buffer
  42. * @src: source rectangle in the frame buffer (integer coordinates)
  43. * @dst: destination rectangle on the display (integer coordinates)
  44. * @alpha: alpha value (0: fully transparent, 255: fully opaque)
  45. * @zpos: Z position of the plane (from 0 to number of planes minus 1)
  46. * @premult: true for premultiplied alpha
  47. */
  48. struct vsp1_du_atomic_config {
  49. u32 pixelformat;
  50. unsigned int pitch;
  51. dma_addr_t mem[3];
  52. struct v4l2_rect src;
  53. struct v4l2_rect dst;
  54. unsigned int alpha;
  55. unsigned int zpos;
  56. bool premult;
  57. };
  58. /**
  59. * enum vsp1_du_crc_source - Source used for CRC calculation
  60. * @VSP1_DU_CRC_NONE: CRC calculation disabled
  61. * @VSP1_DU_CRC_PLANE: Perform CRC calculation on an input plane
  62. * @VSP1_DU_CRC_OUTPUT: Perform CRC calculation on the composed output
  63. */
  64. enum vsp1_du_crc_source {
  65. VSP1_DU_CRC_NONE,
  66. VSP1_DU_CRC_PLANE,
  67. VSP1_DU_CRC_OUTPUT,
  68. };
  69. /**
  70. * struct vsp1_du_crc_config - VSP CRC computation configuration parameters
  71. * @source: source for CRC calculation
  72. * @index: index of the CRC source plane (when source is set to plane)
  73. */
  74. struct vsp1_du_crc_config {
  75. enum vsp1_du_crc_source source;
  76. unsigned int index;
  77. };
  78. /**
  79. * struct vsp1_du_writeback_config - VSP writeback configuration parameters
  80. * @pixelformat: plane pixel format (V4L2 4CC)
  81. * @pitch: line pitch in bytes for the first plane
  82. * @mem: DMA memory address for each plane of the frame buffer
  83. */
  84. struct vsp1_du_writeback_config {
  85. u32 pixelformat;
  86. unsigned int pitch;
  87. dma_addr_t mem[3];
  88. };
  89. /**
  90. * struct vsp1_du_atomic_pipe_config - VSP atomic pipe configuration parameters
  91. * @crc: CRC computation configuration
  92. * @writeback: writeback configuration
  93. */
  94. struct vsp1_du_atomic_pipe_config {
  95. struct vsp1_du_crc_config crc;
  96. struct vsp1_du_writeback_config writeback;
  97. };
  98. void vsp1_du_atomic_begin(struct device *dev, unsigned int pipe_index);
  99. int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index,
  100. unsigned int rpf,
  101. const struct vsp1_du_atomic_config *cfg);
  102. void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index,
  103. const struct vsp1_du_atomic_pipe_config *cfg);
  104. int vsp1_du_map_sg(struct device *dev, struct sg_table *sgt);
  105. void vsp1_du_unmap_sg(struct device *dev, struct sg_table *sgt);
  106. #endif /* __MEDIA_VSP1_H__ */