fb_decoder.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /*
  2. * Copyright(c) 2011-2016 Intel Corporation. All rights reserved.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice (including the next
  12. * paragraph) shall be included in all copies or substantial portions of the
  13. * Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. * SOFTWARE.
  22. *
  23. * Authors:
  24. * Kevin Tian <kevin.tian@intel.com>
  25. *
  26. * Contributors:
  27. * Bing Niu <bing.niu@intel.com>
  28. * Xu Han <xu.han@intel.com>
  29. * Ping Gao <ping.a.gao@intel.com>
  30. * Xiaoguang Chen <xiaoguang.chen@intel.com>
  31. * Yang Liu <yang2.liu@intel.com>
  32. * Tina Zhang <tina.zhang@intel.com>
  33. *
  34. */
  35. #ifndef _GVT_FB_DECODER_H_
  36. #define _GVT_FB_DECODER_H_
  37. #define _PLANE_CTL_FORMAT_SHIFT 24
  38. #define _PLANE_CTL_TILED_SHIFT 10
  39. #define _PIPE_V_SRCSZ_SHIFT 0
  40. #define _PIPE_V_SRCSZ_MASK (0xfff << _PIPE_V_SRCSZ_SHIFT)
  41. #define _PIPE_H_SRCSZ_SHIFT 16
  42. #define _PIPE_H_SRCSZ_MASK (0x1fff << _PIPE_H_SRCSZ_SHIFT)
  43. #define _PRI_PLANE_FMT_SHIFT 26
  44. #define _PRI_PLANE_STRIDE_MASK (0x3ff << 6)
  45. #define _PRI_PLANE_X_OFF_SHIFT 0
  46. #define _PRI_PLANE_X_OFF_MASK (0x1fff << _PRI_PLANE_X_OFF_SHIFT)
  47. #define _PRI_PLANE_Y_OFF_SHIFT 16
  48. #define _PRI_PLANE_Y_OFF_MASK (0xfff << _PRI_PLANE_Y_OFF_SHIFT)
  49. #define _CURSOR_MODE 0x3f
  50. #define _CURSOR_ALPHA_FORCE_SHIFT 8
  51. #define _CURSOR_ALPHA_FORCE_MASK (0x3 << _CURSOR_ALPHA_FORCE_SHIFT)
  52. #define _CURSOR_ALPHA_PLANE_SHIFT 10
  53. #define _CURSOR_ALPHA_PLANE_MASK (0x3 << _CURSOR_ALPHA_PLANE_SHIFT)
  54. #define _CURSOR_POS_X_SHIFT 0
  55. #define _CURSOR_POS_X_MASK (0x1fff << _CURSOR_POS_X_SHIFT)
  56. #define _CURSOR_SIGN_X_SHIFT 15
  57. #define _CURSOR_SIGN_X_MASK (1 << _CURSOR_SIGN_X_SHIFT)
  58. #define _CURSOR_POS_Y_SHIFT 16
  59. #define _CURSOR_POS_Y_MASK (0xfff << _CURSOR_POS_Y_SHIFT)
  60. #define _CURSOR_SIGN_Y_SHIFT 31
  61. #define _CURSOR_SIGN_Y_MASK (1 << _CURSOR_SIGN_Y_SHIFT)
  62. #define _SPRITE_FMT_SHIFT 25
  63. #define _SPRITE_COLOR_ORDER_SHIFT 20
  64. #define _SPRITE_YUV_ORDER_SHIFT 16
  65. #define _SPRITE_STRIDE_SHIFT 6
  66. #define _SPRITE_STRIDE_MASK (0x1ff << _SPRITE_STRIDE_SHIFT)
  67. #define _SPRITE_SIZE_WIDTH_SHIFT 0
  68. #define _SPRITE_SIZE_HEIGHT_SHIFT 16
  69. #define _SPRITE_SIZE_WIDTH_MASK (0x1fff << _SPRITE_SIZE_WIDTH_SHIFT)
  70. #define _SPRITE_SIZE_HEIGHT_MASK (0xfff << _SPRITE_SIZE_HEIGHT_SHIFT)
  71. #define _SPRITE_POS_X_SHIFT 0
  72. #define _SPRITE_POS_Y_SHIFT 16
  73. #define _SPRITE_POS_X_MASK (0x1fff << _SPRITE_POS_X_SHIFT)
  74. #define _SPRITE_POS_Y_MASK (0xfff << _SPRITE_POS_Y_SHIFT)
  75. #define _SPRITE_OFFSET_START_X_SHIFT 0
  76. #define _SPRITE_OFFSET_START_Y_SHIFT 16
  77. #define _SPRITE_OFFSET_START_X_MASK (0x1fff << _SPRITE_OFFSET_START_X_SHIFT)
  78. #define _SPRITE_OFFSET_START_Y_MASK (0xfff << _SPRITE_OFFSET_START_Y_SHIFT)
  79. enum GVT_FB_EVENT {
  80. FB_MODE_SET_START = 1,
  81. FB_MODE_SET_END,
  82. FB_DISPLAY_FLIP,
  83. };
  84. enum DDI_PORT {
  85. DDI_PORT_NONE = 0,
  86. DDI_PORT_B = 1,
  87. DDI_PORT_C = 2,
  88. DDI_PORT_D = 3,
  89. DDI_PORT_E = 4
  90. };
  91. struct intel_gvt;
  92. /* color space conversion and gamma correction are not included */
  93. struct intel_vgpu_primary_plane_format {
  94. u8 enabled; /* plane is enabled */
  95. u8 tiled; /* X-tiled */
  96. u8 bpp; /* bits per pixel */
  97. u32 hw_format; /* format field in the PRI_CTL register */
  98. u32 drm_format; /* format in DRM definition */
  99. u32 base; /* framebuffer base in graphics memory */
  100. u64 base_gpa;
  101. u32 x_offset; /* in pixels */
  102. u32 y_offset; /* in lines */
  103. u32 width; /* in pixels */
  104. u32 height; /* in lines */
  105. u32 stride; /* in bytes */
  106. };
  107. struct intel_vgpu_sprite_plane_format {
  108. u8 enabled; /* plane is enabled */
  109. u8 tiled; /* X-tiled */
  110. u8 bpp; /* bits per pixel */
  111. u32 hw_format; /* format field in the SPR_CTL register */
  112. u32 drm_format; /* format in DRM definition */
  113. u32 base; /* sprite base in graphics memory */
  114. u64 base_gpa;
  115. u32 x_pos; /* in pixels */
  116. u32 y_pos; /* in lines */
  117. u32 x_offset; /* in pixels */
  118. u32 y_offset; /* in lines */
  119. u32 width; /* in pixels */
  120. u32 height; /* in lines */
  121. u32 stride; /* in bytes */
  122. };
  123. struct intel_vgpu_cursor_plane_format {
  124. u8 enabled;
  125. u8 mode; /* cursor mode select */
  126. u8 bpp; /* bits per pixel */
  127. u32 drm_format; /* format in DRM definition */
  128. u32 base; /* cursor base in graphics memory */
  129. u64 base_gpa;
  130. u32 x_pos; /* in pixels */
  131. u32 y_pos; /* in lines */
  132. u8 x_sign; /* X Position Sign */
  133. u8 y_sign; /* Y Position Sign */
  134. u32 width; /* in pixels */
  135. u32 height; /* in lines */
  136. u32 x_hot; /* in pixels */
  137. u32 y_hot; /* in pixels */
  138. };
  139. struct intel_vgpu_pipe_format {
  140. struct intel_vgpu_primary_plane_format primary;
  141. struct intel_vgpu_sprite_plane_format sprite;
  142. struct intel_vgpu_cursor_plane_format cursor;
  143. enum DDI_PORT ddi_port; /* the DDI port that pipe is connected to */
  144. };
  145. struct intel_vgpu_fb_format {
  146. struct intel_vgpu_pipe_format pipes[I915_MAX_PIPES];
  147. };
  148. int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu,
  149. struct intel_vgpu_primary_plane_format *plane);
  150. int intel_vgpu_decode_cursor_plane(struct intel_vgpu *vgpu,
  151. struct intel_vgpu_cursor_plane_format *plane);
  152. int intel_vgpu_decode_sprite_plane(struct intel_vgpu *vgpu,
  153. struct intel_vgpu_sprite_plane_format *plane);
  154. #endif