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.

168 lines
5.7 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1994-1997 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: dmemmgr.h
  6. * Content: Direct Memory Manager include file
  7. *@@BEGIN_MSINTERNAL
  8. * History:
  9. * Date By Reason
  10. * ==== == ======
  11. * 10-jun-95 craige initial implementation
  12. * 18-jun-95 craige pitch in VidMemInit
  13. * 17-jul-95 craige added VidMemLargestFree
  14. * 29-nov-95 colinmc added VidMemAmountAllocated
  15. * 05-jul-96 colinmc Work Item: Removing the restriction on taking Win16
  16. * lock on VRAM surfaces (not including the primary)
  17. * 18-jan-97 colinmc Work Item: AGP support
  18. * 03-mar-97 jeffno Work item: Extended surface memory alignment
  19. *@@END_MSINTERNAL
  20. ***************************************************************************/
  21. #ifndef __DMEMMGR_INCLUDED__
  22. #define __DMEMMGR_INCLUDED__
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /*
  27. * pointer to video meory
  28. */
  29. typedef unsigned long FLATPTR;
  30. /*
  31. * Structure for querying extended heap alignment requirements
  32. */
  33. typedef struct _SURFACEALIGNMENT
  34. {
  35. union
  36. {
  37. struct
  38. {
  39. DWORD dwStartAlignment;
  40. DWORD dwPitchAlignment;
  41. DWORD dwReserved1;
  42. DWORD dwReserved2;
  43. } Linear;
  44. struct
  45. {
  46. DWORD dwXAlignment;
  47. DWORD dwYAlignment;
  48. DWORD dwReserved1;
  49. DWORD dwReserved2;
  50. } Rectangular;
  51. };
  52. } SURFACEALIGNMENT;
  53. typedef struct _SURFACEALIGNMENT FAR *LPSURFACEALIGNMENT;
  54. typedef struct _HEAPALIGNMENT
  55. {
  56. DWORD dwSize;
  57. DDSCAPS ddsCaps; /* Indicates which alignment fields are valid.*/
  58. DWORD dwReserved;
  59. SURFACEALIGNMENT ExecuteBuffer; /* Surfaces tagged with DDSCAPS_EXECUTEBUFFER */
  60. SURFACEALIGNMENT Overlay; /* Surfaces tagged with DDSCAPS_OVERLAY */
  61. SURFACEALIGNMENT Texture; /* Surfaces tagged with DDSCAPS_TEXTURE */
  62. SURFACEALIGNMENT ZBuffer; /* Surfaces tagged with DDSCAPS_ZBUFFER */
  63. SURFACEALIGNMENT AlphaBuffer; /* Surfaces tagged with DDSCAPS_ALPHA */
  64. SURFACEALIGNMENT Offscreen; /* Surfaces tagged with DDSCAPS_OFFSCREENPLAIN*/
  65. SURFACEALIGNMENT FlipTarget; /* Surfaces whose bits are potential primaries i.e. back buffers*/
  66. } HEAPALIGNMENT;
  67. typedef struct _HEAPALIGNMENT FAR *LPHEAPALIGNMENT;
  68. /*
  69. * video memory manager structures
  70. */
  71. typedef struct _VMEML
  72. {
  73. struct _VMEML FAR *next;
  74. FLATPTR ptr;
  75. DWORD size;
  76. } VMEML, FAR *LPVMEML, FAR * FAR *LPLPVMEML;
  77. typedef struct _VMEMR
  78. {
  79. struct _VMEMR FAR *next;
  80. struct _VMEMR FAR *prev;
  81. /*
  82. * The pUp, pDown, pLeft and pRight members were removed in DX5
  83. */
  84. struct _VMEMR FAR *pUp;
  85. struct _VMEMR FAR *pDown;
  86. struct _VMEMR FAR *pLeft;
  87. struct _VMEMR FAR *pRight;
  88. FLATPTR ptr;
  89. DWORD size;
  90. DWORD x;
  91. DWORD y;
  92. DWORD cx;
  93. DWORD cy;
  94. DWORD flags;
  95. FLATPTR pBits;
  96. } VMEMR, FAR *LPVMEMR, FAR * FAR *LPLPVMEMR;
  97. #ifdef NT_KERNEL_HEAPS
  98. typedef void VMEMHEAP;
  99. #else
  100. typedef struct _VMEMHEAP
  101. {
  102. DWORD dwFlags;
  103. DWORD stride;
  104. LPVOID freeList;
  105. LPVOID allocList;
  106. DWORD dwTotalSize;
  107. FLATPTR fpGARTLin; /* AGP: GART linear base of heap (app. visible) */
  108. FLATPTR fpGARTDev; /* AGP: GART device base of heap (driver visible) */
  109. DWORD dwCommitedSize; /* AGP: Number of bytes commited to heap */
  110. /*
  111. * Extended alignment data:
  112. * Filled in by DirectDraw in response to a GetHeapAlignment HAL call.
  113. */
  114. DWORD dwCoalesceCount;
  115. HEAPALIGNMENT Alignment;
  116. } VMEMHEAP;
  117. #endif
  118. typedef VMEMHEAP FAR *LPVMEMHEAP;
  119. #define VMEMHEAP_LINEAR 0x00000001l /* Heap is linear */
  120. #define VMEMHEAP_RECTANGULAR 0x00000002l /* Heap is rectangular */
  121. #define VMEMHEAP_ALIGNMENT 0x00000004l /* Heap has extended alignment info */
  122. /*
  123. * These legacy DLL exports don't handle nonlocal heaps
  124. */
  125. extern FLATPTR WINAPI VidMemAlloc( LPVMEMHEAP pvmh, DWORD width, DWORD height );
  126. extern void WINAPI VidMemFree( LPVMEMHEAP pvmh, FLATPTR ptr );
  127. /*
  128. * This DLL export can be used by drivers to allocate aligned surfaces from heaps which
  129. * they have previously exposed to DDRAW.DLL. This function can allocate from nonlocal heaps.
  130. */
  131. extern FLATPTR WINAPI HeapVidMemAllocAligned(
  132. struct _VIDMEM* lpVidMem,
  133. DWORD dwWidth,
  134. DWORD dwHeight,
  135. LPSURFACEALIGNMENT lpAlignment ,
  136. LPLONG lpNewPitch );
  137. //@@BEGIN_MSINTERNAL
  138. extern FLATPTR WINAPI HeapVidMemAlloc( struct _VIDMEM* lpVidMem, DWORD x, DWORD y, HANDLE hdev , LPSURFACEALIGNMENT lpAlignment , LPLONG lpNewPitch );
  139. extern LPVMEMHEAP WINAPI VidMemInit( DWORD flags, FLATPTR start, FLATPTR end_or_width, DWORD height, DWORD pitch );
  140. extern void WINAPI VidMemFini( LPVMEMHEAP pvmh );
  141. extern DWORD WINAPI VidMemAmountFree( LPVMEMHEAP pvmh );
  142. extern DWORD WINAPI VidMemAmountAllocated( LPVMEMHEAP pvmh );
  143. extern DWORD WINAPI VidMemLargestFree( LPVMEMHEAP pvmh );
  144. extern LPVMEMHEAP WINAPI HeapVidMemInit( struct _VIDMEM* lpVidMem, DWORD pitch, HANDLE hdev, LPHEAPALIGNMENT phad);
  145. extern void WINAPI HeapVidMemFini( struct _VIDMEM* lpVidMem, HANDLE hdev );
  146. //@@END_MSINTERNAL
  147. #ifdef __cplusplus
  148. };
  149. #endif
  150. #endif