sde_rotator_inline.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __SDE_ROTATOR_INLINE_H__
  6. #define __SDE_ROTATOR_INLINE_H__
  7. #include <linux/types.h>
  8. #include <linux/dma-buf.h>
  9. #include <linux/platform_device.h>
  10. #include "sde_rotator_formats.h"
  11. #define SDE_ROTATOR_INLINE_PLANE_MAX 4
  12. /*
  13. * enum sde_rotator_inline_cmd_type - inline rotator command stages
  14. * @SDE_ROTATOR_INLINE_CMD_VALIDATE: validate command only
  15. * @SDE_ROTATOR_INLINE_CMD_COMMIT: commit command to hardware
  16. * @SDE_ROTATOR_INLINE_CMD_START: ready to start inline rotation
  17. * @SDE_ROTATOR_INLINE_CMD_CLEANUP: cleanup after commit is done
  18. * @SDE_ROTATOR_INLINE_CMD_ABORT: abort current commit and reset
  19. */
  20. enum sde_rotator_inline_cmd_type {
  21. SDE_ROTATOR_INLINE_CMD_VALIDATE,
  22. SDE_ROTATOR_INLINE_CMD_COMMIT,
  23. SDE_ROTATOR_INLINE_CMD_START,
  24. SDE_ROTATOR_INLINE_CMD_CLEANUP,
  25. SDE_ROTATOR_INLINE_CMD_ABORT,
  26. };
  27. /**
  28. * sde_rotator_inline_cmd - inline rotation command
  29. * @sequence_id: unique command sequence identifier
  30. * @video_mode: true if video interface is connected
  31. * @fps: frame rate in frame-per-second
  32. * @rot90: rotate 90 counterclockwise
  33. * @hflip: horizontal flip prior to rotation
  34. * @vflip: vertical flip prior to rotation
  35. * @secure: true if buffer is in secure domain
  36. * @prefill_bw: prefill bandwidth in Bps
  37. * @clkrate: clock rate in Hz
  38. * @data_bw: data bus bandwidth in Bps
  39. * @src_addr: source i/o buffer virtual address
  40. * @src_len: source i/o buffer length
  41. * @src_planes: source plane number
  42. * @src_pixfmt: v4l2 fourcc pixel format of source buffer
  43. * @src_width: width of source buffer
  44. * @src_height: height of source buffer
  45. * @src_rect_x: roi x coordinate of source buffer
  46. * @src_rect_y: roi y coordinate of source buffer
  47. * @src_rect_w: roi width of source buffer
  48. * @src_rect_h: roi height of source buffer
  49. * @dst_addr: destination i/o virtual buffer address
  50. * @dst_len: destination i/o buffer length
  51. * @dst_planes: destination plane number
  52. * @dst_pixfmt: v4l2 fourcc pixel format of destination buffer
  53. * @dst_rect_x: roi x coordinate of destination buffer
  54. * @dst_rect_y: roi y coordinate of destination buffer
  55. * @dst_rect_w: roi width of destination buffer
  56. * @dst_rect_h: roi height of destination buffer
  57. * @dst_writeback: true if cache writeback is required
  58. * @priv_handle: private handle of rotator session
  59. */
  60. struct sde_rotator_inline_cmd {
  61. u32 sequence_id;
  62. bool video_mode;
  63. u32 fps;
  64. bool rot90;
  65. bool hflip;
  66. bool vflip;
  67. bool secure;
  68. u64 prefill_bw;
  69. u64 clkrate;
  70. u64 data_bw;
  71. dma_addr_t src_addr[SDE_ROTATOR_INLINE_PLANE_MAX];
  72. u32 src_len[SDE_ROTATOR_INLINE_PLANE_MAX];
  73. u32 src_planes;
  74. u32 src_pixfmt;
  75. u32 src_width;
  76. u32 src_height;
  77. u32 src_rect_x;
  78. u32 src_rect_y;
  79. u32 src_rect_w;
  80. u32 src_rect_h;
  81. dma_addr_t dst_addr[SDE_ROTATOR_INLINE_PLANE_MAX];
  82. u32 dst_len[SDE_ROTATOR_INLINE_PLANE_MAX];
  83. u32 dst_planes;
  84. u32 dst_pixfmt;
  85. u32 dst_rect_x;
  86. u32 dst_rect_y;
  87. u32 dst_rect_w;
  88. u32 dst_rect_h;
  89. bool dst_writeback;
  90. void *priv_handle;
  91. };
  92. #if defined(CONFIG_MSM_SDE_ROTATOR)
  93. void *sde_rotator_inline_open(struct platform_device *pdev);
  94. int sde_rotator_inline_get_dst_pixfmt(struct platform_device *pdev,
  95. u32 src_pixfmt, u32 *dst_pixfmt);
  96. int sde_rotator_inline_get_downscale_caps(struct platform_device *pdev,
  97. char *downscale_caps, int len);
  98. int sde_rotator_inline_get_maxlinewidth(struct platform_device *pdev);
  99. int sde_rotator_inline_get_pixfmt_caps(struct platform_device *pdev,
  100. bool input, u32 *pixfmt, int len);
  101. int sde_rotator_inline_commit(void *handle, struct sde_rotator_inline_cmd *cmd,
  102. enum sde_rotator_inline_cmd_type cmd_type);
  103. int sde_rotator_inline_release(void *handle);
  104. void sde_rotator_inline_reg_dump(struct platform_device *pdev);
  105. #else
  106. void *sde_rotator_inline_open(struct platform_device *pdev)
  107. {
  108. return NULL;
  109. }
  110. int sde_rotator_inline_get_dst_pixfmt(struct platform_device *pdev,
  111. u32 src_pixfmt, u32 *dst_pixfmt)
  112. {
  113. return 0;
  114. }
  115. int sde_rotator_inline_get_downscale_caps(struct platform_device *pdev,
  116. char *downscale_caps, int len)
  117. {
  118. return 0;
  119. }
  120. int sde_rotator_inline_get_maxlinewidth(struct platform_device *pdev)
  121. {
  122. return 0;
  123. }
  124. int sde_rotator_inline_get_pixfmt_caps(struct platform_device *pdev,
  125. bool input, u32 *pixfmt, int len)
  126. {
  127. return 0;
  128. }
  129. int sde_rotator_inline_commit(void *handle, struct sde_rotator_inline_cmd *cmd,
  130. enum sde_rotator_inline_cmd_type cmd_type)
  131. {
  132. return 0;
  133. }
  134. int sde_rotator_inline_release(void *handle)
  135. {
  136. return 0;
  137. }
  138. void sde_rotator_inline_reg_dump(struct platform_device *pdev)
  139. {
  140. }
  141. #endif
  142. #endif /* __SDE_ROTATOR_INLINE_H__ */