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.

194 lines
6.1 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1994-1998 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: dmemmgr.h
  6. * Content: Direct Memory Manager include file
  7. *
  8. ***************************************************************************/
  9. #ifndef __DMEMMGR_INCLUDED__
  10. #define __DMEMMGR_INCLUDED__
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. #ifndef __NTDDKCOMP__
  15. /*
  16. * pointer to video memory
  17. */
  18. typedef ULONG_PTR FLATPTR;
  19. typedef struct _VIDMEM *LPVIDMEM;
  20. #else
  21. /*
  22. * pointer to video memory, potentially 64-bit
  23. */
  24. typedef ULONG_PTR FLATPTR;
  25. typedef struct _VIDEOMEMORY *LPVIDMEM;
  26. #endif
  27. /*
  28. * Structure for querying extended heap alignment requirements
  29. */
  30. typedef struct _SURFACEALIGNMENT
  31. {
  32. union
  33. {
  34. struct
  35. {
  36. DWORD dwStartAlignment;
  37. DWORD dwPitchAlignment;
  38. DWORD dwFlags;
  39. DWORD dwReserved2;
  40. } Linear;
  41. struct
  42. {
  43. DWORD dwXAlignment;
  44. DWORD dwYAlignment;
  45. DWORD dwFlags;
  46. DWORD dwReserved2;
  47. } Rectangular;
  48. };
  49. } SURFACEALIGNMENT;
  50. typedef struct _SURFACEALIGNMENT FAR *LPSURFACEALIGNMENT;
  51. #define SURFACEALIGN_DISCARDABLE 0x00000001l /* Surface can be discarded to */
  52. /* make room for another surface */
  53. typedef struct _HEAPALIGNMENT
  54. {
  55. DWORD dwSize;
  56. DDSCAPS ddsCaps; /* Indicates which alignment fields are valid.*/
  57. DWORD dwReserved;
  58. SURFACEALIGNMENT ExecuteBuffer; /* Surfaces tagged with DDSCAPS_EXECUTEBUFFER */
  59. SURFACEALIGNMENT Overlay; /* Surfaces tagged with DDSCAPS_OVERLAY */
  60. SURFACEALIGNMENT Texture; /* Surfaces tagged with DDSCAPS_TEXTURE */
  61. SURFACEALIGNMENT ZBuffer; /* Surfaces tagged with DDSCAPS_ZBUFFER */
  62. SURFACEALIGNMENT AlphaBuffer; /* Surfaces tagged with DDSCAPS_ALPHA */
  63. SURFACEALIGNMENT Offscreen; /* Surfaces tagged with DDSCAPS_OFFSCREENPLAIN*/
  64. SURFACEALIGNMENT FlipTarget; /* Surfaces whose bits are potential primaries i.e. back buffers*/
  65. } HEAPALIGNMENT;
  66. typedef struct _HEAPALIGNMENT FAR *LPHEAPALIGNMENT;
  67. typedef struct _DD_GETHEAPALIGNMENTDATA
  68. {
  69. ULONG_PTR dwInstance; // driver context
  70. DWORD dwHeap; // heap index passed by DirectDraw
  71. HRESULT ddRVal; // return value
  72. VOID* GetHeapAlignment; // Unused: Win95 compatibility
  73. HEAPALIGNMENT Alignment; // Filled in by driver.
  74. } DD_GETHEAPALIGNMENTDATA;
  75. typedef struct _DD_GETHEAPALIGNMENTDATA *PDD_GETHEAPALIGNMENTDATA;
  76. /*
  77. * video memory manager structures
  78. */
  79. typedef struct _VMEML
  80. {
  81. struct _VMEML FAR *next;
  82. FLATPTR ptr;
  83. DWORD size;
  84. BOOL bDiscardable;
  85. } VMEML, FAR *LPVMEML, FAR * FAR *LPLPVMEML;
  86. typedef struct _VMEMR
  87. {
  88. struct _VMEMR FAR *next;
  89. struct _VMEMR FAR *prev;
  90. /*
  91. * The pUp, pDown, pLeft and pRight members were removed in DX5
  92. */
  93. struct _VMEMR FAR *pUp;
  94. struct _VMEMR FAR *pDown;
  95. struct _VMEMR FAR *pLeft;
  96. struct _VMEMR FAR *pRight;
  97. FLATPTR ptr;
  98. DWORD size;
  99. DWORD x;
  100. DWORD y;
  101. DWORD cx;
  102. DWORD cy;
  103. DWORD flags;
  104. FLATPTR pBits;
  105. BOOL bDiscardable;
  106. } VMEMR, FAR *LPVMEMR, FAR * FAR *LPLPVMEMR;
  107. typedef struct _VMEMHEAP
  108. {
  109. DWORD dwFlags;
  110. DWORD stride;
  111. LPVOID freeList;
  112. LPVOID allocList;
  113. DWORD dwTotalSize;
  114. FLATPTR fpGARTLin; /* AGP: GART linear base of heap (app. visible) */
  115. FLATPTR fpGARTDev; /* AGP: GART device base of heap (driver visible) */
  116. DWORD dwCommitedSize; /* AGP: Number of bytes commited to heap */
  117. /*
  118. * Extended alignment data:
  119. * Filled in by DirectDraw in response to a GetHeapAlignment HAL call.
  120. */
  121. DWORD dwCoalesceCount;
  122. HEAPALIGNMENT Alignment;
  123. /*
  124. * These are analogous to VIDMEM.ddsCaps and VIDMEM.ddsCapsAlt. These values are queried from the
  125. * driver by a GetDriverInfo call. See the documentation for GUID_DDMoreSurfaceCaps
  126. */
  127. DDSCAPSEX ddsCapsEx;
  128. DDSCAPSEX ddsCapsExAlt;
  129. #ifndef IS_16
  130. // Full physical address of heap base for NT AGP heaps.
  131. LARGE_INTEGER liPhysAGPBase;
  132. #endif
  133. // hdev for use with VidMemAllocAligned on NT. Set by the system at
  134. // initialization time.
  135. HANDLE hdevAGP;
  136. // Physical reservation handle for NT heaps.
  137. LPVOID pvPhysRsrv;
  138. BYTE* pAgpCommitMask;
  139. DWORD dwAgpCommitMaskSize;
  140. } VMEMHEAP;
  141. typedef VMEMHEAP FAR *LPVMEMHEAP;
  142. #define VMEMHEAP_LINEAR 0x00000001l /* Heap is linear */
  143. #define VMEMHEAP_RECTANGULAR 0x00000002l /* Heap is rectangular */
  144. #define VMEMHEAP_ALIGNMENT 0x00000004l /* Heap has extended alignment info */
  145. /*
  146. * This legacy export doesn't handle nonlocal heaps
  147. * This function is not available on Windows NT
  148. */
  149. #ifndef __NTDDKCOMP__
  150. extern FLATPTR WINAPI VidMemAlloc( LPVMEMHEAP pvmh, DWORD width, DWORD height );
  151. #endif
  152. /*
  153. * This export can be used by drivers to allocate aligned surfaces from heaps which
  154. * they have previously exposed to DirectDraw. This function can allocate from nonlocal heaps.
  155. */
  156. extern FLATPTR WINAPI HeapVidMemAllocAligned(
  157. LPVIDMEM lpVidMem,
  158. DWORD dwWidth,
  159. DWORD dwHeight,
  160. LPSURFACEALIGNMENT lpAlignment ,
  161. LPLONG lpNewPitch );
  162. /*
  163. * This export can free memory allocated via either allocation function
  164. */
  165. extern void WINAPI VidMemFree( LPVMEMHEAP pvmh, FLATPTR ptr );
  166. #ifdef __cplusplus
  167. };
  168. #endif
  169. #endif