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.

317 lines
11 KiB

  1. /**************************************************************************
  2. ***************************************************************************
  3. *
  4. * Copyright (c) 1997, Cirrus Logic, Inc.
  5. * All Rights Reserved
  6. *
  7. * FILE: overlay.h
  8. *
  9. * DESCRIPTION:
  10. *
  11. * REVISION HISTORY:
  12. *
  13. * $Log: X:/log/laguna/ddraw/inc/overlay.h $
  14. *
  15. * Rev 1.13 Mar 26 1998 09:52:50 frido
  16. * Fixed a hangup in overlays when switching from DOS and Overfly.
  17. *
  18. * Rev 1.12 06 Jan 1998 13:26:50 xcong
  19. * Access pDriverData locally for multi-monitor support.
  20. *
  21. * Rev 1.11 18 Sep 1997 16:10:42 bennyn
  22. *
  23. * Fixed NT 3.51 compile/link problem
  24. *
  25. * Rev 1.10 12 Sep 1997 12:12:48 bennyn
  26. *
  27. * Modified for NT DD overlay support
  28. *
  29. * Rev 1.9 29 Aug 1997 16:11:52 RUSSL
  30. * Added support for NT
  31. *
  32. * Rev 1.8 28 Jul 1997 09:13:06 RUSSL
  33. * Added arg passed to pfnGetFlipStatus
  34. * Added GetVideoWidowIndex inline function
  35. * Added dwNumVideoWindows global var
  36. *
  37. * Rev 1.7 20 Jun 1997 11:24:54 RUSSL
  38. * Added CLPL fourcc code, added a linear bit flag in surface flags, and
  39. * changed OVERLAYTABLE pfnCreateSurface function to return an HRESULT
  40. *
  41. * Rev 1.6 15 May 1997 10:50:58 RUSSL
  42. * Changed OVERLAYTABLE pfnCanCreateSurface function to return an HRESULT
  43. *
  44. * Rev 1.5 14 May 1997 14:51:30 KENTL
  45. * Added #define for FLG_PANNING
  46. *
  47. * Rev 1.4 13 May 1997 10:33:54 RUSSL
  48. * Added gsOverlayFlip to global vars
  49. *
  50. * Rev 1.3 21 Feb 1997 11:30:46 RUSSL
  51. * Added FLG_YUY2 define
  52. *
  53. * Rev 1.2 27 Jan 1997 18:33:54 RUSSL
  54. * Removed SetCaps from OVERLAYTABLE structure
  55. * Added Set5465FlipDuration function prototype
  56. * Moved GetFormatInfo function prototype to surface.h
  57. *
  58. * Rev 1.1 21 Jan 1997 14:35:42 RUSSL
  59. * Added FLG_VWx defines, etc.
  60. * Added 5465 function prototypes
  61. *
  62. * Rev 1.0 15 Jan 1997 11:01:50 RUSSL
  63. * Initial revision.
  64. *
  65. ***************************************************************************
  66. ***************************************************************************/
  67. // If WinNT 3.5 skip all the source code
  68. #if defined WINNT_VER35 // WINNT_VER35
  69. #else
  70. #ifndef _OVERLAY_H_
  71. #define _OVERLAY_H_
  72. /***************************************************************************
  73. * D E F I N E S
  74. ****************************************************************************/
  75. /* surface flags -----------------------------------------*/
  76. #define FLG_BEGIN_ACCESS (DWORD)0x00000001
  77. #define FLG_ENABLED (DWORD)0x00000002
  78. //#define FLG_CONVERT_PACKJR (DWORD)0x00000004
  79. #define FLG_MUST_RASTER (DWORD)0x00000008
  80. #define FLG_TWO_MEG (DWORD)0x00000010
  81. #define FLG_CHECK (DWORD)0x00000020
  82. #define FLG_COLOR_KEY (DWORD)0x00000040
  83. #define FLG_INTERPOLATE (DWORD)0x00000080
  84. #define FLG_OVERLAY (DWORD)0x00000100
  85. #define FLG_YUV422 (DWORD)0x00000200
  86. //#define FLG_PACKJR (DWORD)0x00000400
  87. #define FLG_USE_OFFSET (DWORD)0x00000800
  88. #define FLG_YUVPLANAR (DWORD)0x00001000
  89. #define FLG_SRC_COLOR_KEY (DWORD)0x00002000
  90. #define FLG_DECIMATE (DWORD)0x00004000
  91. #define FLG_CAPTURE (DWORD)0x00008000
  92. #define FLG_VW0 (DWORD)0x00010000
  93. #define FLG_VW1 (DWORD)0x00020000
  94. #define FLG_VW2 (DWORD)0x00040000
  95. #define FLG_VW3 (DWORD)0x00080000
  96. #define FLG_VW4 (DWORD)0x00100000
  97. #define FLG_VW5 (DWORD)0x00200000
  98. #define FLG_VW6 (DWORD)0x00400000
  99. #define FLG_VW7 (DWORD)0x00800000
  100. #define FLG_PANNING (DWORD)0x01000000
  101. #define FLG_VW_MASK (DWORD)0x00FF0000
  102. #define FLG_VW_SHIFT 16
  103. #define FLG_UYVY FLG_YUV422
  104. #define FLG_YUY2 (DWORD)0x40000000
  105. #define FLG_DECIMATE4 (DWORD)0x80000000
  106. #define FLG_LINEAR (DWORD)0x10000000
  107. #define MIN_OLAY_WIDTH 4
  108. #define FOURCC_YUVPLANAR mmioFOURCC('C','L','P','L')
  109. /***************************************************************************
  110. * T Y P E D E F S
  111. ****************************************************************************/
  112. #ifdef WINNT_VER40
  113. #include <memmgr.h>
  114. typedef struct _PDEV PDEV;
  115. // Be sure to synchronize the following structures with the one
  116. // in i386\Laguna.inc!
  117. //
  118. typedef struct tagOVERLAYTABLE
  119. {
  120. HRESULT (*pfnCanCreateSurface)(PDEV*, DWORD, DWORD);
  121. HRESULT (*pfnCreateSurface)(PDEV*, PDD_SURFACE_LOCAL, DWORD);
  122. VOID (*pfnDestroySurface)(PDEV*, PDD_DESTROYSURFACEDATA);
  123. DWORD (*pfnLock)(PDEV*, PDD_LOCKDATA);
  124. VOID (*pfnUnlock)(PDEV*, PDD_UNLOCKDATA);
  125. VOID (*pfnSetColorKey)(PDEV*, PDD_SETCOLORKEYDATA);
  126. DWORD (*pfnFlip)(PDEV*, PDD_FLIPDATA);
  127. DWORD (*pfnUpdateOverlay)(PDEV*, PDD_UPDATEOVERLAYDATA);
  128. DWORD (*pfnSetOverlayPos)(PDEV*, PDD_SETOVERLAYPOSITIONDATA);
  129. DWORD (*pfnGetFlipStatus)(PDEV*, FLATPTR,DWORD);
  130. } OVERLAYTABLE, *LPOVERLAYTABLE;
  131. // Be sure to synchronize the following structures with the one
  132. // in i386\Laguna.inc!
  133. //
  134. typedef struct
  135. {
  136. FLATPTR fpFlipFrom;
  137. LONGLONG liFlipTime;
  138. DWORD dwFlipDuration;
  139. DWORD dwFlipScanline;
  140. BOOL bFlipFlag;
  141. BOOL bHaveEverCrossedVBlank;
  142. BOOL bWasEverInDisplay;
  143. } OVERLAYFLIPRECORD;
  144. #else
  145. typedef struct tagOVERLAYTABLE
  146. {
  147. HRESULT (*pfnCanCreateSurface)(GLOBALDATA *,DWORD, DWORD);
  148. HRESULT (*pfnCreateSurface)(LPDDRAWI_DIRECTDRAWSURFACE, DWORD, LPGLOBALDATA);
  149. VOID (*pfnDestroySurface)(LPDDHAL_DESTROYSURFACEDATA);
  150. DWORD (*pfnLock)(LPDDHAL_LOCKDATA);
  151. VOID (*pfnUnlock)(LPDDHAL_UNLOCKDATA);
  152. VOID (*pfnSetColorKey)(LPDDHAL_SETCOLORKEYDATA);
  153. DWORD (*pfnFlip)(LPDDHAL_FLIPDATA);
  154. DWORD (*pfnUpdateOverlay)(LPDDHAL_UPDATEOVERLAYDATA);
  155. DWORD (*pfnSetOverlayPos)(LPDDHAL_SETOVERLAYPOSITIONDATA);
  156. DWORD (*pfnGetFlipStatus)(LPGLOBALDATA,FLATPTR,DWORD);
  157. } OVERLAYTABLE, *LPOVERLAYTABLE;
  158. typedef struct
  159. {
  160. FLATPTR fpFlipFrom;
  161. __int64 liFlipTime;
  162. DWORD dwFlipDuration;
  163. DWORD dwFlipScanline;
  164. BOOL bFlipFlag;
  165. BOOL bHaveEverCrossedVBlank;
  166. BOOL bWasEverInDisplay;
  167. } OVERLAYFLIPRECORD;
  168. #endif
  169. #ifdef WINNT_VER40
  170. #if DRIVER_5465 && defined(OVERLAY)
  171. #define DDOFM SURFACE_DATA
  172. #define PDDOFM LP_SURFACE_DATA
  173. #endif
  174. //this structure is used to store information per surface
  175. typedef struct surface_data
  176. {
  177. // This is the inclusion of DDOFM structure.
  178. // When OVERLAY is defined, DDOFM structure will be map to this structure
  179. struct surface_data *prevhdl;
  180. struct surface_data *nexthdl;
  181. POFMHDL phdl;
  182. //
  183. // Note: Not all fields will get used/set for all types of surfaces!
  184. //
  185. // PMEMBLK pMemblk;
  186. // VOID* pLinearAddr; // Linear address of memory block if linear
  187. // // memory allocated via dmAllocLinear.
  188. // LPVOID lpTextureData;
  189. LPVOID lpCLPLData;
  190. // DWORD dwFlags;
  191. DWORD dwOverlayFlags;
  192. // WORD wMemtype; // Memory type (if we allocated surface).
  193. // DWORD dwBitsPerPixel;
  194. // DWORD dwBytesPerPixel; // Rounded to nearest byte!
  195. // DWORD dwBaseLinearAddr; // Linear address of memory heap.
  196. // DWORD dwBasePhysAddr; // Physical address of memory heap.
  197. // DWORD dwBaseOffset; // Offset of surface from base of memory heap.
  198. DWORD dwOverlayOffset; // Offset of overlay surface by clipping
  199. #if DDRAW_COMPAT >= 50
  200. DWORD dwAutoBaseAddr1; //Auto flip Vport surface 1 address
  201. DWORD dwAutoBaseAddr2; //Auto flip Vport surface 2 address
  202. DDPIXELFORMAT ddpfAltPixelFormat; // if pixel fmt is different than
  203. // we lead DDraw to believe it is
  204. #endif
  205. }SURFACE_DATA, *LP_SURFACE_DATA;
  206. #endif
  207. /***************************************************************************
  208. * G L O B A L V A R I A B L E S
  209. ****************************************************************************/
  210. #ifndef WINNT_VER40
  211. extern OVERLAYTABLE OverlayTable;
  212. extern OVERLAYFLIPRECORD gsOverlayFlip;
  213. extern DWORD dwNumVideoWindows;
  214. #endif
  215. /***************************************************************************
  216. * I N L I N E F U N C T I O N S
  217. ****************************************************************************/
  218. /***************************************************************************
  219. *
  220. * FUNCTION: GetVideoWindowIndex
  221. *
  222. * DESCRIPTION:
  223. *
  224. ****************************************************************************/
  225. static __inline DWORD
  226. GetVideoWindowIndex ( DWORD dwOverlayFlags )
  227. {
  228. DWORD dwVWIndex;
  229. DWORD dwTemp;
  230. // Isn't there a better way to count the number of zeros to the right of
  231. // the FLG_VWx bit?
  232. dwTemp = (dwOverlayFlags & FLG_VW_MASK) >> FLG_VW_SHIFT;
  233. dwVWIndex = 0;
  234. if (dwTemp != 0) // Only do the next loop if there is any bit set.
  235. while (0 == (dwTemp & 0x00000001))
  236. {
  237. dwTemp >>= 1;
  238. dwVWIndex++;
  239. }
  240. // if the video window index is larger than or equal to the number of video
  241. // windows implemented in the hardware, then this surface was assigned an
  242. // invalid video window!
  243. // ASSERT(dwNumVideoWindows > dwVWIndex);
  244. return dwVWIndex;
  245. }
  246. /***************************************************************************
  247. * F U N C T I O N P R O T O T Y P E S
  248. ****************************************************************************/
  249. #ifdef WINNT_VER40
  250. DWORD __stdcall UpdateOverlay32 ( PDD_UPDATEOVERLAYDATA );
  251. DWORD __stdcall SetOverlayPosition32 ( PDD_SETOVERLAYPOSITIONDATA );
  252. DWORD __stdcall SetColorKey32 ( PDD_SETCOLORKEYDATA );
  253. BOOL QueryOverlaySupport ( PDEV*, DWORD );
  254. VOID OverlayInit ( PDEV*, DWORD, PDD_SURFACECALLBACKS, PDD_HALINFO );
  255. VOID OverlayReInit ( PDEV*, DWORD, PDD_HALINFO );
  256. // 5465 function prototypes
  257. VOID Init5465Overlay ( PDEV*, DWORD, PDD_HALINFO, LPOVERLAYTABLE );
  258. VOID Init5465Info ( PDEV*, PDD_HALINFO );
  259. VOID Set5465FlipDuration ( PDEV*, DWORD );
  260. #else
  261. DWORD __stdcall UpdateOverlay32 ( LPDDHAL_UPDATEOVERLAYDATA );
  262. DWORD __stdcall SetOverlayPosition32 ( LPDDHAL_SETOVERLAYPOSITIONDATA );
  263. DWORD __stdcall SetColorKey32 ( LPDDHAL_SETCOLORKEYDATA );
  264. BOOL QueryOverlaySupport ( LPGLOBALDATA, DWORD);
  265. VOID OverlayInit ( DWORD, LPDDHAL_DDSURFACECALLBACKS, LPDDHALINFO, GLOBALDATA * );
  266. VOID OverlayReInit ( DWORD, LPDDHALINFO ,GLOBALDATA * );
  267. // 5465 function prototypes
  268. VOID Init5465Overlay ( DWORD, LPDDHALINFO, LPOVERLAYTABLE, GLOBALDATA * );
  269. VOID Init5465Info ( LPDDHALINFO, GLOBALDATA * );
  270. VOID Set5465FlipDuration ( DWORD );
  271. #endif
  272. #endif /* _OVERLAY_H_ */
  273. #endif // WINNT_VER35
  274. /* Don't write below this endif */
  275.