vsp1.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 (laurent.pinchart@ideasonboard.com)
  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. /**
  17. * struct vsp1_du_lif_config - VSP LIF configuration
  18. * @width: output frame width
  19. * @height: output frame height
  20. * @interlaced: true for interlaced pipelines
  21. * @callback: frame completion callback function (optional). When a callback
  22. * is provided, the VSP driver guarantees that it will be called once
  23. * and only once for each vsp1_du_atomic_flush() call.
  24. * @callback_data: data to be passed to the frame completion callback
  25. */
  26. struct vsp1_du_lif_config {
  27. unsigned int width;
  28. unsigned int height;
  29. bool interlaced;
  30. void (*callback)(void *data, bool completed, u32 crc);
  31. void *callback_data;
  32. };
  33. int vsp1_du_setup_lif(struct device *dev, unsigned int pipe_index,
  34. const struct vsp1_du_lif_config *cfg);
  35. /**
  36. * struct vsp1_du_atomic_config - VSP atomic configuration parameters
  37. * @pixelformat: plane pixel format (V4L2 4CC)
  38. * @pitch: line pitch in bytes for the first plane
  39. * @mem: DMA memory address for each plane of the frame buffer
  40. * @src: source rectangle in the frame buffer (integer coordinates)
  41. * @dst: destination rectangle on the display (integer coordinates)
  42. * @alpha: alpha value (0: fully transparent, 255: fully opaque)
  43. * @zpos: Z position of the plane (from 0 to number of planes minus 1)
  44. */
  45. struct vsp1_du_atomic_config {
  46. u32 pixelformat;
  47. unsigned int pitch;
  48. dma_addr_t mem[3];
  49. struct v4l2_rect src;
  50. struct v4l2_rect dst;
  51. unsigned int alpha;
  52. unsigned int zpos;
  53. };
  54. /**
  55. * enum vsp1_du_crc_source - Source used for CRC calculation
  56. * @VSP1_DU_CRC_NONE: CRC calculation disabled
  57. * @VSP1_DU_CRC_PLANE: Perform CRC calculation on an input plane
  58. * @VSP1_DU_CRC_OUTPUT: Perform CRC calculation on the composed output
  59. */
  60. enum vsp1_du_crc_source {
  61. VSP1_DU_CRC_NONE,
  62. VSP1_DU_CRC_PLANE,
  63. VSP1_DU_CRC_OUTPUT,
  64. };
  65. /**
  66. * struct vsp1_du_crc_config - VSP CRC computation configuration parameters
  67. * @source: source for CRC calculation
  68. * @index: index of the CRC source plane (when source is set to plane)
  69. */
  70. struct vsp1_du_crc_config {
  71. enum vsp1_du_crc_source source;
  72. unsigned int index;
  73. };
  74. /**
  75. * struct vsp1_du_atomic_pipe_config - VSP atomic pipe configuration parameters
  76. * @crc: CRC computation configuration
  77. */
  78. struct vsp1_du_atomic_pipe_config {
  79. struct vsp1_du_crc_config crc;
  80. };
  81. void vsp1_du_atomic_begin(struct device *dev, unsigned int pipe_index);
  82. int vsp1_du_atomic_update(struct device *dev, unsigned int pipe_index,
  83. unsigned int rpf,
  84. const struct vsp1_du_atomic_config *cfg);
  85. void vsp1_du_atomic_flush(struct device *dev, unsigned int pipe_index,
  86. const struct vsp1_du_atomic_pipe_config *cfg);
  87. int vsp1_du_map_sg(struct device *dev, struct sg_table *sgt);
  88. void vsp1_du_unmap_sg(struct device *dev, struct sg_table *sgt);
  89. #endif /* __MEDIA_VSP1_H__ */