Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

183 lines
9.8 KiB

  1. /******************************Module*Header*******************************\
  2. *
  3. * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  4. * !! !!
  5. * !! WARNING: NOT DDK SAMPLE CODE !!
  6. * !! !!
  7. * !! This source code is provided for completeness only and should not be !!
  8. * !! used as sample code for display driver development. Only those sources !!
  9. * !! marked as sample code for a given driver component should be used for !!
  10. * !! development purposes. !!
  11. * !! !!
  12. * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  13. *
  14. * Module Name: ddover.h
  15. *
  16. * Content: DirectDraw Overlays implementation macros and definitions
  17. *
  18. * Copyright (c) 1994-1999 3Dlabs Inc. Ltd. All rights reserved.
  19. * Copyright (c) 1995-2003 Microsoft Corporation
  20. \**************************************************************************/
  21. #ifndef __DDOVER_H
  22. #define __DDOVER_H
  23. // For setting up the VideoPort HAL
  24. #define VIDEOPORT_NUM_CONNECT_INFO 8
  25. #define VIDEOPORT_MAX_FIELD_HEIGHT 0x800
  26. #define VIDEOPORT_MAX_FIELD_WIDTH 0x800
  27. #define VIDEOPORT_MAX_VBI_WIDTH 0x800
  28. #define VIDEOPORT_HREF_ACTIVE_HIGH 1
  29. #define VIDEOPORT_VREF_ACTIVE_HIGH 2
  30. // Defines for VideoOverlay values.
  31. #define VO_ENABLE 1
  32. #define VO_DISABLE 0
  33. #define VO_MIRROR_X 1
  34. #define VO_MIRROR_Y 1
  35. #define VO_COLOR_ORDER_RGB 1
  36. #define VO_COLOR_ORDER_BGR 0
  37. #define VO_YUV_RGB 0
  38. #define VO_YUV_422 1
  39. #define VO_YUV_444 2
  40. #define VO_CF_RGB8888 0
  41. #define VO_CF_RGB4444 1
  42. #define VO_CF_RGB5551 2
  43. #define VO_CF_RGB565 3
  44. #define VO_CF_RGB332 4
  45. #define VO_CF_RGBCI8 5
  46. #define VO_PIXEL_SIZE8 0
  47. #define VO_PIXEL_SIZE16 1
  48. #define VO_PIXEL_SIZE32 2
  49. #define VO_MODE_MAINKEY 0
  50. #define VO_MODE_OVERLAYKEY 1
  51. #define VO_MODE_ALWAYS 2
  52. #define VO_MODE_BLEND 3
  53. #define VO_BLENDSRC_MAIN 0
  54. #define VO_BLENDSRC_REGISTER 1
  55. #define VO_KEY_COLOR 0
  56. #define VO_KEY_ALPHA 1
  57. #define VO_MEMTYPE_FRAMEBUFFER (0 << 30)
  58. #define VO_MEMTYPE_LOCALBUFFER (1 << 30)
  59. typedef struct tagVideoOverlayModeReg
  60. {
  61. DWORD Enable : 1; // lsb
  62. DWORD BufferSync : 3;
  63. DWORD FieldPolarity : 1;
  64. DWORD PixelSize : 2;
  65. DWORD ColorFormat : 3;
  66. DWORD YUV : 2;
  67. DWORD ColorOrder : 1;
  68. DWORD LinearColorExtension : 1;
  69. DWORD Filter : 2;
  70. DWORD DeInterlace : 2;
  71. DWORD PatchMode : 2;
  72. DWORD Flip : 3;
  73. DWORD MirrorX : 1;
  74. DWORD MirrorY : 1;
  75. DWORD Reserved1 : 7;
  76. } VideoOverlayModeReg;
  77. typedef struct tagRDVideoOverlayControlReg
  78. {
  79. BYTE Enable : 1;
  80. BYTE Mode : 2;
  81. BYTE DirectColor : 1;
  82. BYTE BlendSrc : 1;
  83. BYTE Key : 1;
  84. BYTE Reserved : 2;
  85. } RDVideoOverlayControlReg;
  86. #define __GP_VIDEO_ENABLE 0x0001
  87. #if WNT_DDRAW
  88. #define FORCED_IN_ORDER_WRITE(target,value) *((volatile ULONG *)(target)) = (value)
  89. #define UPDATE_OVERLAY(pThisDisplay, bWaitForVSync, bUpdateOverlaySize) \
  90. do \
  91. { \
  92. if (pThisDisplay->pGLInfo->dwFlags & GMVF_VBLANK_ENABLED) \
  93. { \
  94. FORCED_IN_ORDER_WRITE ( pThisDisplay->bVBLANKUpdateOverlay, TRUE ); \
  95. } \
  96. else \
  97. { \
  98. if (bWaitForVSync) \
  99. { \
  100. if (READ_GLINT_CTRL_REG(VideoControl) & __GP_VIDEO_ENABLE) \
  101. \
  102. { \
  103. /* only wait for vblank if the monitor is on */ \
  104. LOAD_GLINT_CTRL_REG(IntFlags, INTR_VBLANK_SET); \
  105. while (((READ_GLINT_CTRL_REG(IntFlags)) & INTR_VBLANK_SET) == 0); \
  106. } \
  107. } \
  108. \
  109. if (bUpdateOverlaySize) \
  110. { \
  111. DWORD dwVideoOverlayMode = READ_GLINT_CTRL_REG(VideoOverlayMode); \
  112. LOAD_GLINT_CTRL_REG(VideoOverlayMode, (dwVideoOverlayMode & 0xfffffffe)); \
  113. LOAD_GLINT_CTRL_REG(VideoOverlayWidth, *pThisDisplay->VBLANKUpdateOverlayWidth); \
  114. LOAD_GLINT_CTRL_REG(VideoOverlayHeight, *pThisDisplay->VBLANKUpdateOverlayHeight); \
  115. LOAD_GLINT_CTRL_REG(VideoOverlayMode, dwVideoOverlayMode); \
  116. } \
  117. \
  118. LOAD_GLINT_CTRL_REG(VideoOverlayUpdate, VO_ENABLE); \
  119. } \
  120. } \
  121. while(0)
  122. #else
  123. static ULONG volatile *vpdwTemp;
  124. // A macro to help me - I always get the volatile syntax wrong.
  125. #define FORCED_IN_ORDER_WRITE(target,value) vpdwTemp = &(target); *vpdwTemp = (value)
  126. #define UPDATE_OVERLAY(pThisDisplay, bWaitForVSync, bUpdateOverlaySize) \
  127. do \
  128. { \
  129. if (pThisDisplay->pGLInfo->dwFlags & GMVF_VBLANK_ENABLED) \
  130. { \
  131. FORCED_IN_ORDER_WRITE ( pThisDisplay->pGLInfo->bVBLANKUpdateOverlay, TRUE ); \
  132. } \
  133. else \
  134. { \
  135. if ((READ_GLINT_CTRL_REG(VideoControl) & __GP_VIDEO_ENABLE) && (bWaitForVSync)) \
  136. { \
  137. /* only wait for vblank if the monitor is on */ \
  138. LOAD_GLINT_CTRL_REG(IntFlags, INTR_VBLANK_SET); \
  139. while (((READ_GLINT_CTRL_REG(IntFlags)) & INTR_VBLANK_SET) == 0); \
  140. } \
  141. \
  142. if (bUpdateOverlaySize) \
  143. { \
  144. DWORD dwVideoOverlayMode = READ_GLINT_CTRL_REG(VideoOverlayMode); \
  145. LOAD_GLINT_CTRL_REG(VideoOverlayMode, (dwVideoOverlayMode & 0xfffffffe)); \
  146. LOAD_GLINT_CTRL_REG(VideoOverlayWidth, pThisDisplay->pGLInfo->VBLANKUpdateOverlayWidth); \
  147. LOAD_GLINT_CTRL_REG(VideoOverlayHeight, pThisDisplay->pGLInfo->VBLANKUpdateOverlayHeight); \
  148. LOAD_GLINT_CTRL_REG(VideoOverlayMode, dwVideoOverlayMode); \
  149. } \
  150. \
  151. LOAD_GLINT_CTRL_REG(VideoOverlayUpdate, VO_ENABLE); \
  152. } \
  153. } \
  154. while(0)
  155. #endif
  156. #endif // __DDOVER_H