2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * PURPOSE: Native DirectDraw implementation
5 * FILE: subsystems/win32/win32k/ntddraw/eng.c
6 * PROGRAMER: Magnus olsen (magnus@greatlord.com)
8 * 19/1-2006 Magnus Olsen
15 /************************************************************************/
16 /* HeapVidMemAllocAligned */
17 /************************************************************************/
20 HeapVidMemAllocAligned(LPVIDMEM lpVidMem
,
23 LPSURFACEALIGNMENT lpAlignment
,
26 PGD_HEAPVIDMEMALLOCALIGNED pfnHeapVidMemAllocAligned
= (PGD_HEAPVIDMEMALLOCALIGNED
)gpDxFuncs
[DXG_INDEX_DxDdHeapVidMemAllocAligned
].pfn
;
28 if (pfnHeapVidMemAllocAligned
== NULL
)
30 DPRINT1("Warning: no pfnHeapVidMemAllocAligned\n");
34 DPRINT1("Calling dxg.sys pfnHeapVidMemAllocAligned\n");
35 return pfnHeapVidMemAllocAligned(lpVidMem
, dwWidth
, dwHeight
, lpAlignment
, lpNewPitch
);
38 /************************************************************************/
40 /************************************************************************/
43 VidMemFree(LPVMEMHEAP pvmh
,
46 PGD_VIDMEMFREE pfnVidMemFree
= (PGD_VIDMEMFREE
)gpDxFuncs
[DXG_INDEX_DxDdHeapVidMemFree
].pfn
;
48 if (pfnVidMemFree
== NULL
)
50 DPRINT1("Warning: no pfnVidMemFree\n");
54 DPRINT1("Calling dxg.sys pfnVidMemFree\n");
55 pfnVidMemFree(pvmh
, ptr
);
59 /************************************************************************/
60 /* EngAllocPrivateUserMem */
61 /************************************************************************/
64 EngAllocPrivateUserMem(PDD_SURFACE_LOCAL psl
,
68 PGD_ENGALLOCPRIVATEUSERMEM pfnEngAllocPrivateUserMem
= (PGD_ENGALLOCPRIVATEUSERMEM
)gpDxFuncs
[DXG_INDEX_DxDdAllocPrivateUserMem
].pfn
;
70 if (pfnEngAllocPrivateUserMem
== NULL
)
72 DPRINT1("Warning: no pfnEngAllocPrivateUserMem\n");
73 return DDHAL_DRIVER_NOTHANDLED
;
76 DPRINT1("Calling dxg.sys pfnEngAllocPrivateUserMem\n");
77 return pfnEngAllocPrivateUserMem(psl
, cj
, tag
);
80 /************************************************************************/
81 /* EngFreePrivateUserMem */
82 /************************************************************************/
85 EngFreePrivateUserMem(PDD_SURFACE_LOCAL psl
,
88 PGD_ENGFREEPRIVATEUSERMEM pfnEngFreePrivateUserMem
= (PGD_ENGFREEPRIVATEUSERMEM
)gpDxFuncs
[DXG_INDEX_DxDdFreePrivateUserMem
].pfn
;
90 if (pfnEngFreePrivateUserMem
== NULL
)
92 DPRINT1("Warning: no pfnEngFreePrivateUserMem\n");
96 DPRINT1("Calling dxg.sys pfnEngFreePrivateUserMem\n");
97 pfnEngFreePrivateUserMem(psl
, pv
);
105 * The function EngDxIoctl is the ioctl call to different DirectX functions
106 * in the driver dxg.sys
108 * @param ULONG ulIoctl
109 * The ioctl code that we want call to
111 * @param PVOID pBuffer
112 * Our in or out buffer with data to the ioctl code we are using
114 * @param ULONG ulBufferSize
115 * The buffer size in bytes
118 * Always returns DDERR_UNSUPPORTED
121 * dxg.sys EngDxIoctl call is redirected to dxg.sys
122 * This function is no longer used in Windows NT 2000/XP/2003
127 EngDxIoctl(ULONG ulIoctl
,
131 PGD_ENGDXIOCTL pfnEngDxIoctl
= (PGD_ENGDXIOCTL
)gpDxFuncs
[DXG_INDEX_DxDdIoctl
].pfn
;
132 DWORD retVal
= DDERR_UNSUPPORTED
;
134 DPRINT1("Calling dxg.sys pfnEngDxIoctl\n");
136 if (pfnEngDxIoctl
!= NULL
)
138 retVal
= pfnEngDxIoctl(ulIoctl
, pBuffer
, ulBufferSize
);
145 * @name EngLockDirectDrawSurface
148 * The function EngUnlockDirectDrawSurface locks the DirectX surface.
150 * @param HANDLE hSurface
151 * The handle of a surface
154 * This return a vaild or NULL pointer to a PDD_SURFACE_LOCAL object
162 EngLockDirectDrawSurface(HANDLE hSurface
)
164 PGD_ENGLOCKDIRECTDRAWSURFACE pfnEngLockDirectDrawSurface
= (PGD_ENGLOCKDIRECTDRAWSURFACE
)gpDxFuncs
[DXG_INDEX_DxDdLockDirectDrawSurface
].pfn
;
165 PDD_SURFACE_LOCAL retVal
= NULL
;
167 DPRINT1("Calling dxg.sys pfnEngLockDirectDrawSurface\n");
169 if (pfnEngLockDirectDrawSurface
!= NULL
)
171 retVal
= pfnEngLockDirectDrawSurface(hSurface
);
179 * @name EngUnlockDirectDrawSurface
182 * The function EngUnlockDirectDrawSurface unlocks the DirectX surface
184 * @param PDD_SURFACE_LOCAL pSurface
185 * The Surface we want to unlock
188 * This return TRUE for success, FALSE for failure
196 EngUnlockDirectDrawSurface(PDD_SURFACE_LOCAL pSurface
)
198 PGD_ENGUNLOCKDIRECTDRAWSURFACE pfnEngUnlockDirectDrawSurface
= (PGD_ENGUNLOCKDIRECTDRAWSURFACE
)gpDxFuncs
[DXG_INDEX_DxDdUnlockDirectDrawSurface
].pfn
;
201 DPRINT1("Calling dxg.sys pfnEngUnlockDirectDrawSurface\n");
203 if (pfnEngUnlockDirectDrawSurface
!= NULL
)
205 retVal
= pfnEngUnlockDirectDrawSurface(pSurface
);