aboutsummaryrefslogtreecommitdiffstats
path: root/ddk/dmemmgr.h
blob: 38e0d94847455326f469aaf9ee99af97a97e473c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#ifndef __DMEMMGR_INCLUDED__
#define __DMEMMGR_INCLUDED__

/*
 * pointer to video meory
 */
typedef unsigned long	FLATPTR;

/*
 * Structure for querying extended heap alignment requirements
 */

typedef struct SURFACEALIGNMENT
{
	union
	{
		struct
		{
			DWORD       dwStartAlignment;
			DWORD       dwPitchAlignment;
			DWORD       dwReserved1;
			DWORD       dwReserved2;
		} Linear;
		struct
		{
			DWORD       dwXAlignment;
			DWORD       dwYAlignment;
			DWORD       dwReserved1;
			DWORD       dwReserved2;
		} Rectangular;
	};
} SURFACEALIGNMENT_t;
typedef struct SURFACEALIGNMENT __far *LPSURFACEALIGNMENT;

typedef struct HEAPALIGNMENT
{
	DWORD                dwSize;
	DDSCAPS_t            ddsCaps;       /* Indicates which alignment fields are valid.*/
	DWORD                dwReserved;
	SURFACEALIGNMENT_t   ExecuteBuffer; /* Surfaces tagged with DDSCAPS_EXECUTEBUFFER */
	SURFACEALIGNMENT_t   Overlay;       /* Surfaces tagged with DDSCAPS_OVERLAY       */
	SURFACEALIGNMENT_t   Texture;       /* Surfaces tagged with DDSCAPS_TEXTURE       */
	SURFACEALIGNMENT_t   ZBuffer;       /* Surfaces tagged with DDSCAPS_ZBUFFER       */
	SURFACEALIGNMENT_t   AlphaBuffer;   /* Surfaces tagged with DDSCAPS_ALPHA         */
	SURFACEALIGNMENT_t   Offscreen;     /* Surfaces tagged with DDSCAPS_OFFSCREENPLAIN*/
	SURFACEALIGNMENT_t   FlipTarget;    /* Surfaces whose bits are potential primaries i.e. back buffers*/
} HEAPALIGNMENT_t;
typedef struct HEAPALIGNMENT __far *LPHEAPALIGNMENT;

/*
 * video memory manager structures
 */
typedef struct VMEML
{
	struct VMEML __far *next;
	FLATPTR		ptr;
	DWORD		  size;
} VMEML_t;

typedef struct VMEML __far* LPVMEML;
typedef struct VMEML __far *__far *LPLPVMEML;

typedef struct VMEMR
{
	struct VMEMR __far *next;
	struct VMEMR __far *prev;
	/*
	 * The pUp, pDown, pLeft and pRight members were removed in DX5
	 */
	struct VMEMR __far *pUp;
	struct VMEMR __far *pDown;
	struct VMEMR __far *pLeft;
	struct VMEMR __far *pRight;
	FLATPTR		ptr;
	DWORD	size;
	DWORD x;
	DWORD y;
	DWORD cx;
	DWORD cy;
	DWORD	flags;
	FLATPTR pBits;
} VMEMR_t;

typedef struct VMEMR __far *LPVMEMR;
typedef struct VMEMR __far *__far *LPLPVMEMR;

typedef struct VMEMHEAP
{
	DWORD             dwFlags;
	DWORD             stride;
	LPVOID		        freeList;
	LPVOID		        allocList;
	DWORD             dwTotalSize;
	FLATPTR           fpGARTLin;      /* AGP: GART linear base of heap (app. visible)   */
	FLATPTR           fpGARTDev;      /* AGP: GART device base of heap (driver visible) */
	DWORD             dwCommitedSize; /* AGP: Number of bytes commited to heap          */
	/*
	 * Extended alignment data:
	 * Filled in by DirectDraw in response to a GetHeapAlignment HAL call.
	 */
	DWORD                       dwCoalesceCount;
	HEAPALIGNMENT_t             Alignment;
} VMEMHEAP_t;

typedef VMEMHEAP_t __far *LPVMEMHEAP;

#define VMEMHEAP_LINEAR			    0x00000001l /* Heap is linear                    */
#define VMEMHEAP_RECTANGULAR		0x00000002l /* Heap is rectangular               */
#define VMEMHEAP_ALIGNMENT  		0x00000004l /* Heap has extended alignment info  */

/*
 * These legacy DLL exports don't handle nonlocal heaps
 */
extern FLATPTR WINAPI VidMemAlloc(LPVMEMHEAP pvmh, DWORD width, DWORD height);
extern void WINAPI VidMemFree(LPVMEMHEAP pvmh, FLATPTR ptr);

/*
 * This DLL export can be used by drivers to allocate aligned surfaces from heaps which
 * they have previously exposed to DDRAW.DLL. This function can allocate from nonlocal heaps.
 */
extern FLATPTR WINAPI HeapVidMemAllocAligned(struct VIDMEM* lpVidMem, DWORD dwWidth, DWORD dwHeight, LPSURFACEALIGNMENT lpAlignment , LPLONG lpNewPitch);


#endif