Source code of Windows XP (NT5)
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.

348 lines
13 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1997 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: dxmini.h
  6. * Content: Miniport support for DirectDraw DXAPI. This file is
  7. * analagous to Win95's ddkmmini.h.
  8. *
  9. ***************************************************************************/
  10. #ifndef __DXMINI_INCLUDED__
  11. #define __DXMINI_INCLUDED__
  12. DEFINE_GUID(GUID_DxApi, 0x8a79bef0, 0xb915, 0x11d0, 0x91, 0x44, 0x08, 0x00, 0x36, 0xd2, 0xef, 0x02);
  13. #ifndef GUID_DEFS_ONLY
  14. /*============================================================================
  15. *
  16. * MDL structure for handling pagelocked memory. This is copied from WDM.H
  17. *
  18. *==========================================================================*/
  19. #ifndef MDL_MAPPING_FLAGS
  20. typedef struct _MDL {
  21. struct _MDL *MdlNext;
  22. short MdlSize;
  23. short MdlFlags;
  24. struct _EPROCESS *Process;
  25. ULONG *lpMappedSystemVa;
  26. ULONG *lpStartVa;
  27. ULONG ByteCount;
  28. ULONG ByteOffset;
  29. } MDL;
  30. typedef MDL *PMDL;
  31. #define MDL_MAPPED_TO_SYSTEM_VA 0x0001
  32. #define MDL_PAGES_LOCKED 0x0002
  33. #define MDL_SOURCE_IS_NONPAGED_POOL 0x0004
  34. #define MDL_ALLOCATED_FIXED_SIZE 0x0008
  35. #define MDL_PARTIAL 0x0010
  36. #define MDL_PARTIAL_HAS_BEEN_MAPPED 0x0020
  37. #define MDL_IO_PAGE_READ 0x0040
  38. #define MDL_WRITE_OPERATION 0x0080
  39. #define MDL_PARENT_MAPPED_SYSTEM_VA 0x0100
  40. #define MDL_LOCK_HELD 0x0200
  41. #define MDL_SCATTER_GATHER_VA 0x0400
  42. #define MDL_IO_SPACE 0x0800
  43. #define MDL_NETWORK_HEADER 0x1000
  44. #define MDL_MAPPING_CAN_FAIL 0x2000
  45. #define MDL_ALLOCATED_MUST_SUCCEED 0x4000
  46. #define MDL_64_BIT_VA 0x8000
  47. #define MDL_MAPPING_FLAGS (MDL_MAPPED_TO_SYSTEM_VA | \
  48. MDL_PAGES_LOCKED | \
  49. MDL_SOURCE_IS_NONPAGED_POOL | \
  50. MDL_PARTIAL_HAS_BEEN_MAPPED | \
  51. MDL_PARENT_MAPPED_SYSTEM_VA | \
  52. MDL_LOCK_HELD | \
  53. MDL_SYSTEM_VA | \
  54. MDL_IO_SPACE )
  55. #endif
  56. /*============================================================================
  57. *
  58. * Error values that may be returned by the miniport
  59. *
  60. *==========================================================================*/
  61. #define DX_OK 0x0
  62. #define DXERR_UNSUPPORTED 0x80004001
  63. #define DXERR_GENERIC 0x80004005
  64. #define DXERR_OUTOFCAPS 0x88760168
  65. /*============================================================================
  66. *
  67. * Structures maintained by DirectDraw
  68. *
  69. *==========================================================================*/
  70. #define DDOVER_AUTOFLIP 0x00100000l
  71. #define DDOVER_BOB 0x00200000l
  72. #define DDOVER_OVERRIDEBOBWEAVE 0x00400000l
  73. #define DDOVER_INTERLEAVED 0x00800000l
  74. //
  75. // Data for every DXAPI surface
  76. //
  77. typedef struct _DDSURFACEDATA {
  78. DWORD ddsCaps; // Ring 3 creation caps
  79. DWORD dwSurfaceOffset; // Offset in frame buffer of surface
  80. ULONG_PTR fpLockPtr; // Surface lock ptr
  81. DWORD dwWidth; // Surface width
  82. DWORD dwHeight; // Surface height
  83. LONG lPitch; // Surface pitch
  84. DWORD dwOverlayFlags; // DDOVER_XX flags
  85. DWORD dwOverlayOffset; // Offset in frame buffer of overlay
  86. DWORD dwOverlaySrcWidth; // Src width of overlay
  87. DWORD dwOverlaySrcHeight; // Src height of overlay
  88. DWORD dwOverlayDestWidth; // Dest width of overlay
  89. DWORD dwOverlayDestHeight; // Dest height of overlay
  90. DWORD dwVideoPortId; // ID of video port (-1 if not connected to a video port)
  91. DWORD dwFormatFlags;
  92. DWORD dwFormatFourCC;
  93. DWORD dwFormatBitCount;
  94. DWORD dwRBitMask;
  95. DWORD dwGBitMask;
  96. DWORD dwBBitMask;
  97. ULONG dwDriverReserved1; // Reserved for the HAL/Miniport
  98. ULONG dwDriverReserved2; // Reserved for the HAL/Miniport
  99. ULONG dwDriverReserved3; // Reserved for the HAL/Miniport
  100. ULONG dwDriverReserved4; // Reserved for the HAL/Miniport
  101. } DDSURFACEDATA, *LPDDSURFACEDATA;
  102. //
  103. // Data for every DXAPI video port
  104. //
  105. typedef struct DDVIDEOPORTDATA {
  106. DWORD dwVideoPortId; // ID of video port (0 - MaxVideoPorts-1)
  107. DWORD dwVPFlags; // Video port DDVP_ option flags
  108. DWORD dwOriginOffset; // Start address relative to surface
  109. DWORD dwHeight; // Height of total video region (per field)
  110. DWORD dwVBIHeight; // Height of VBI region (per field)
  111. ULONG dwDriverReserved1; // Reserved for the HAL/Miniport
  112. ULONG dwDriverReserved2; // Reserved for the HAL/Miniport
  113. ULONG dwDriverReserved3; // Reserved for the HAL/Miniport
  114. } DDVIDEOPORTDATA, *LPDDVIDEOPORTDATA;
  115. /*============================================================================
  116. *
  117. * Structures used to communicate with the Miniport
  118. *
  119. *==========================================================================*/
  120. typedef struct _DX_IRQDATA {
  121. DWORD dwIrqFlags; // DDIRQ_ flags ORed in by miniport
  122. } DX_IRQDATA, *PDX_IRQDATA;
  123. typedef VOID (*PDX_IRQCALLBACK)(PDX_IRQDATA pIrqData);
  124. #define DDIRQ_DISPLAY_VSYNC 0x00000001l
  125. #define DDIRQ_BUSMASTER 0x00000002l
  126. #define DDIRQ_VPORT0_VSYNC 0x00000004l
  127. #define DDIRQ_VPORT0_LINE 0x00000008l
  128. #define DDIRQ_VPORT1_VSYNC 0x00000010l
  129. #define DDIRQ_VPORT1_LINE 0x00000020l
  130. #define DDIRQ_VPORT2_VSYNC 0x00000040l
  131. #define DDIRQ_VPORT2_LINE 0x00000080l
  132. #define DDIRQ_VPORT3_VSYNC 0x00000100l
  133. #define DDIRQ_VPORT3_LINE 0x00000200l
  134. #define DDIRQ_VPORT4_VSYNC 0x00000400l
  135. #define DDIRQ_VPORT4_LINE 0x00000800l
  136. #define DDIRQ_VPORT5_VSYNC 0x00001000l
  137. #define DDIRQ_VPORT5_LINE 0x00002000l
  138. #define DDIRQ_VPORT6_VSYNC 0x00004000l
  139. #define DDIRQ_VPORT6_LINE 0x00008000l
  140. #define DDIRQ_VPORT7_VSYNC 0x00010000l
  141. #define DDIRQ_VPORT7_LINE 0x00020000l
  142. #define DDIRQ_VPORT8_VSYNC 0x00040000l
  143. #define DDIRQ_VPORT8_LINE 0x00080000l
  144. #define DDIRQ_VPORT9_VSYNC 0x00010000l
  145. #define DDIRQ_VPORT9_LINE 0x00020000l
  146. // output from DxGetIrqInfo
  147. typedef struct _DDGETIRQINFO {
  148. DWORD dwFlags;
  149. } DDGETIRQINFO, *PDDGETIRQINFO;
  150. #define IRQINFO_HANDLED 0x01 // Miniport is managing IRQ
  151. #define IRQINFO_NOTHANDLED 0x02 // Not supported on NT
  152. // input to DxEnableIrq
  153. typedef struct _DDENABLEIRQINFO {
  154. DWORD dwIRQSources;
  155. DWORD dwLine; // Line for DDIRQ_VPORTx_LINE interrupt
  156. PDX_IRQCALLBACK IRQCallback; // Miniport calls this when IRQ happens
  157. PDX_IRQDATA lpIRQData; // Parameter to be passed to IRQCallback
  158. } DDENABLEIRQINFO, *PDDENABLEIRQINFO;
  159. // input to DxSkipNextField
  160. typedef struct _DDSKIPNEXTFIELDINFO {
  161. LPDDVIDEOPORTDATA lpVideoPortData;
  162. DWORD dwSkipFlags;
  163. } DDSKIPNEXTFIELDINFO, *PDDSKIPNEXTFIELDINFO;
  164. #define DDSKIP_SKIPNEXT 1
  165. #define DDSKIP_ENABLENEXT 2
  166. // intput to DxBobNextField
  167. typedef struct _DDBOBNEXTFIELDINFO {
  168. LPDDSURFACEDATA lpSurface;
  169. } DDBOBNEXTFIELDINFO, *PDDBOBNEXTFIELDINFO;
  170. // intput to DxSetState
  171. typedef struct _DDSETSTATEININFO {
  172. LPDDSURFACEDATA lpSurfaceData;
  173. LPDDVIDEOPORTDATA lpVideoPortData;
  174. } DDSETSTATEININFO, *PDDSETSTATEININFO;
  175. // output from DxSetState
  176. typedef struct _DDSETSTATEOUTINFO {
  177. BOOL bSoftwareAutoflip;
  178. DWORD dwSurfaceIndex;
  179. DWORD dwVBISurfaceIndex;
  180. } DDSETSTATEOUTINFO, *PDDSETSTATEOUTINFO;
  181. // input to DxLock
  182. typedef struct _DDLOCKININFO {
  183. LPDDSURFACEDATA lpSurfaceData;
  184. } DDLOCKININFO, *PDDLOCKININFO;
  185. // output from DxLock
  186. typedef struct _DDLOCKOUTINFO {
  187. ULONG_PTR dwSurfacePtr;
  188. } DDLOCKOUTINFO, *PDDLOCKOUTINFO;
  189. // input to DxFlipOverlay
  190. typedef struct _DDFLIPOVERLAYINFO {
  191. LPDDSURFACEDATA lpCurrentSurface;
  192. LPDDSURFACEDATA lpTargetSurface;
  193. DWORD dwFlags;
  194. } DDFLIPOVERLAYINFO, *PDDFLIPOVERLAYINFO;
  195. // intput to DxFlipVideoPort
  196. typedef struct _DDFLIPVIDEOPORTINFO {
  197. LPDDVIDEOPORTDATA lpVideoPortData;
  198. LPDDSURFACEDATA lpCurrentSurface;
  199. LPDDSURFACEDATA lpTargetSurface;
  200. DWORD dwFlipVPFlags;
  201. } DDFLIPVIDEOPORTINFO, *PDDFLIPVIDEOPORTINFO;
  202. #define DDVPFLIP_VIDEO 0x00000001l
  203. #define DDVPFLIP_VBI 0x00000002l
  204. // input to DxGetPolarity
  205. typedef struct _DDGETPOLARITYININFO {
  206. LPDDVIDEOPORTDATA lpVideoPortData;
  207. } DDGETPOLARITYININFO, *PDDGETPOLARITYININFO;
  208. // output from DxGetPolarity
  209. typedef struct _DDGETPOLARITYOUTINFO {
  210. DWORD bPolarity;
  211. } DDGETPOLARITYOUTINFO, *PDDGETPOLARITYOUTINFO;
  212. // input to DxGetCurrentAutoflipSurface
  213. typedef struct _DDGETCURRENTAUTOFLIPININFO {
  214. LPDDVIDEOPORTDATA lpVideoPortData;
  215. } DDGETCURRENTAUTOFLIPININFO, *PDDGETCURRENTAUTOFLIPININFO;
  216. // output from DxGetCurrentAutoflipSurface
  217. typedef struct _DDGETCURRENTAUTOFLIPOUTINFO {
  218. DWORD dwSurfaceIndex;
  219. DWORD dwVBISurfaceIndex;
  220. } DDGETCURRENTAUTOFLIPOUTINFO, *PDDGETCURRENTAUTOFLIPOUTINFO;
  221. // input to DxGetPreviousAutoflipSurface
  222. typedef struct _DDGETPREVIOUSAUTOFLIPININFO {
  223. LPDDVIDEOPORTDATA lpVideoPortData;
  224. } DDGETPREVIOUSAUTOFLIPININFO, *PDDGETPREVIOUSAUTOFLIPININFO;
  225. // output from DxGetPreviousAutoflipSurface
  226. typedef struct _DDGETPREVIOUSAUTOFLIPOUTINFO {
  227. DWORD dwSurfaceIndex;
  228. DWORD dwVBISurfaceIndex;
  229. } DDGETPREVIOUSAUTOFLIPOUTINFO, *PDDGETPREVIOUSAUTOFLIPOUTINFO;
  230. // intput to DxTransfer
  231. typedef struct _DDTRANSFERININFO {
  232. LPDDSURFACEDATA lpSurfaceData;
  233. DWORD dwStartLine;
  234. DWORD dwEndLine;
  235. ULONG_PTR dwTransferID;
  236. DWORD dwTransferFlags;
  237. PMDL lpDestMDL;
  238. } DDTRANSFERININFO, *PDDTRANSFERININFO;
  239. #define DDTRANSFER_SYSTEMMEMORY 0x00000001
  240. #define DDTRANSFER_NONLOCALVIDMEM 0x00000002
  241. #define DDTRANSFER_INVERT 0x00000004
  242. #define DDTRANSFER_CANCEL 0x00000080
  243. #define DDTRANSFER_HALFLINES 0x00000100
  244. // output from DxTransfer
  245. typedef struct _DDTRANSFEROUTINFO {
  246. DWORD dwBufferPolarity;
  247. } DDTRANSFEROUTINFO, *PDDTRANSFEROUTINFO;
  248. // output from DxGetTransferStatus
  249. typedef struct _DDGETTRANSFERSTATUSOUTINFO {
  250. DWORD_PTR dwTransferID;
  251. } DDGETTRANSFERSTATUSOUTINFO, *PDDGETTRANSFEROUTINFO;
  252. /*============================================================================
  253. *
  254. * DXAPI function prototypes
  255. *
  256. *==========================================================================*/
  257. typedef DWORD (*PDX_GETIRQINFO)(PVOID,PVOID,PDDGETIRQINFO);
  258. typedef DWORD (*PDX_ENABLEIRQ)(PVOID,PDDENABLEIRQINFO,PVOID);
  259. typedef DWORD (*PDX_SKIPNEXTFIELD)(PVOID,PDDSKIPNEXTFIELDINFO,PVOID);
  260. typedef DWORD (*PDX_BOBNEXTFIELD)(PVOID,PDDBOBNEXTFIELDINFO,PVOID);
  261. typedef DWORD (*PDX_SETSTATE)(PVOID,PDDSETSTATEININFO,PDDSETSTATEOUTINFO);
  262. typedef DWORD (*PDX_LOCK)(PVOID,PDDLOCKININFO,PDDLOCKOUTINFO);
  263. typedef DWORD (*PDX_FLIPOVERLAY)(PVOID,PDDFLIPOVERLAYINFO,PVOID);
  264. typedef DWORD (*PDX_FLIPVIDEOPORT)(PVOID,PDDFLIPVIDEOPORTINFO,PVOID);
  265. typedef DWORD (*PDX_GETPOLARITY)(PVOID,PDDGETPOLARITYININFO,PDDGETPOLARITYOUTINFO);
  266. typedef DWORD (*PDX_GETCURRENTAUTOFLIP)(PVOID,PDDGETCURRENTAUTOFLIPININFO,PDDGETCURRENTAUTOFLIPOUTINFO);
  267. typedef DWORD (*PDX_GETPREVIOUSAUTOFLIP)(PVOID,PDDGETPREVIOUSAUTOFLIPININFO,PDDGETPREVIOUSAUTOFLIPOUTINFO);
  268. typedef DWORD (*PDX_TRANSFER)(PVOID,PDDTRANSFERININFO,PDDTRANSFEROUTINFO);
  269. typedef DWORD (*PDX_GETTRANSFERSTATUS)(PVOID,PVOID,PDDGETTRANSFEROUTINFO);
  270. /*============================================================================
  271. *
  272. * HAL table filled in by the miniport and called by DirectDraw
  273. *
  274. *==========================================================================*/
  275. #define DXAPI_HALVERSION 0x0001
  276. typedef struct _DXAPI_INTERFACE {
  277. USHORT Size;
  278. USHORT Version;
  279. PVOID Context;
  280. PVOID InterfaceReference;
  281. PVOID InterfaceDereference;
  282. PDX_GETIRQINFO DxGetIrqInfo;
  283. PDX_ENABLEIRQ DxEnableIrq;
  284. PDX_SKIPNEXTFIELD DxSkipNextField;
  285. PDX_BOBNEXTFIELD DxBobNextField;
  286. PDX_SETSTATE DxSetState;
  287. PDX_LOCK DxLock;
  288. PDX_FLIPOVERLAY DxFlipOverlay;
  289. PDX_FLIPVIDEOPORT DxFlipVideoPort;
  290. PDX_GETPOLARITY DxGetPolarity;
  291. PDX_GETCURRENTAUTOFLIP DxGetCurrentAutoflip;
  292. PDX_GETPREVIOUSAUTOFLIP DxGetPreviousAutoflip;
  293. PDX_TRANSFER DxTransfer;
  294. PDX_GETTRANSFERSTATUS DxGetTransferStatus;
  295. } DXAPI_INTERFACE, *PDXAPI_INTERFACE;
  296. #endif // GUID_DEFS_ONLY
  297. #endif