Author: sgasiorek
Date: Tue Mar 14 19:45:23 2017
New Revision: 74170
URL:
http://svn.reactos.org/svn/reactos?rev=74170&view=rev
Log:
[DXG] Implement DxDdEnableDirectDraw CORE-4490
[NTDDRAW] Enable DxEGShDevData_hSpooler and DxEGShDevData_ldev in DxEngGetHdevData
CORE-7733
Modified:
trunk/reactos/win32ss/reactx/dxg/CMakeLists.txt
trunk/reactos/win32ss/reactx/dxg/dxg_int.h
trunk/reactos/win32ss/reactx/dxg/eng.c
trunk/reactos/win32ss/reactx/dxg/main.c
trunk/reactos/win32ss/reactx/dxg/tags.h
trunk/reactos/win32ss/reactx/ntddraw/dxeng.c
Modified: trunk/reactos/win32ss/reactx/dxg/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/CMakeLi…
==============================================================================
--- trunk/reactos/win32ss/reactx/dxg/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/win32ss/reactx/dxg/CMakeLists.txt [iso-8859-1] Tue Mar 14 19:45:23 2017
@@ -8,6 +8,9 @@
historic.c
dxg_int.h)
+include_directories(
+ ${REACTOS_SOURCE_DIR}/win32ss/include)
+
add_library(dxg SHARED
${SOURCE}
dxg.rc
Modified: trunk/reactos/win32ss/reactx/dxg/dxg_int.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/dxg_int…
==============================================================================
--- trunk/reactos/win32ss/reactx/dxg/dxg_int.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/reactx/dxg/dxg_int.h [iso-8859-1] Tue Mar 14 19:45:23 2017
@@ -19,7 +19,13 @@
#include <wingdi.h>
#include <winddi.h>
#include <ddkernel.h>
+#include <initguid.h>
#include <ddrawi.h>
+#include <ntgdityp.h>
+
+DEFINE_GUID(GUID_NTCallbacks, 0x6fe9ecde, 0xdf89, 0x11d1, 0x9d, 0xb0, 0x00,
0x60, 0x08, 0x27, 0x71, 0xba);
+DEFINE_GUID(GUID_DDMoreCaps, 0x880baf30, 0xb030, 0x11d0, 0x8e, 0xa7, 0x00,
0x60, 0x97, 0x97, 0xea, 0x5b);
+DEFINE_GUID(GUID_NTPrivateDriverCaps, 0xfad16a23, 0x7b66, 0x11d2, 0x83, 0xd7, 0x00,
0xc0, 0x4f, 0x7c, 0xe5, 0x8c);
/* DXG treats this as opaque */
typedef PVOID PDC;
@@ -40,11 +46,18 @@
#include "tags.h"
+#define CapOver_DisableAccel 0x1
+#define CapOver_DisableD3DDDAccel 0x2
+#define CapOver_DisableD3DAccel 0x4
+#define CapOver_DisableOGL 0x8
+#define CapOver_DisableEscapes 0x10
+
+
#define ObjType_DDSURFACE_TYPE 2
#define ObjType_DDVIDEOPORT_TYPE 4
#define ObjType_DDMOTIONCOMP_TYPE 5
- typedef struct _DD_ENTRY
+typedef struct _DD_ENTRY
{
union
{
@@ -61,6 +74,98 @@
DD_BASEOBJECT Object;
DD_SURFACE_LOCAL Surfacelcl;
} EDD_SURFACE_LOCAL, *PEDD_SURFACE_LOCAL;
+
+
+typedef BOOLEAN (APIENTRY* PFN_DxEngNUIsTermSrv)(VOID);
+typedef DWORD (APIENTRY* PFN_DxEngScreenAccessCheck)(VOID);
+typedef BOOLEAN (APIENTRY* PFN_DxEngRedrawDesktop)(VOID);
+typedef ULONG (APIENTRY* PFN_DxEngDispUniq)(VOID);
+typedef BOOLEAN (APIENTRY* PFN_DxEngIncDispUniq)(VOID);
+typedef ULONG (APIENTRY* PFN_DxEngVisRgnUniq)(VOID);
+typedef BOOLEAN (APIENTRY* PFN_DxEngLockShareSem)(VOID);
+typedef BOOLEAN (APIENTRY* PFN_DxEngUnlockShareSem)(VOID);
+typedef HDEV* (APIENTRY* PFN_DxEngEnumerateHdev)(HDEV*);
+typedef BOOLEAN (APIENTRY* PFN_DxEngLockHdev)(HDEV);
+typedef BOOLEAN (APIENTRY* PFN_DxEngUnlockHdev)(HDEV);
+typedef BOOLEAN (APIENTRY* PFN_DxEngIsHdevLockedByCurrentThread)(HDEV);
+typedef BOOLEAN (APIENTRY* PFN_DxEngReferenceHdev)(HDEV);
+typedef BOOLEAN (APIENTRY* PFN_DxEngUnreferenceHdev)(HDEV);
+typedef BOOL (APIENTRY* PFN_DxEngGetDeviceGammaRamp)(HDEV, PGAMMARAMP);
+typedef BOOLEAN (APIENTRY* PFN_DxEngSetDeviceGammaRamp)(HDEV, PGAMMARAMP, BOOL);
+typedef DWORD (APIENTRY* PFN_DxEngSpTearDownSprites)(DWORD, DWORD, DWORD);
+typedef DWORD (APIENTRY* PFN_DxEngSpUnTearDownSprites)(DWORD, DWORD, DWORD);
+typedef DWORD (APIENTRY* PFN_DxEngSpSpritesVisible)(DWORD);
+typedef DWORD_PTR (APIENTRY* PFN_DxEngGetHdevData)(HDEV, DXEGSHDEVDATA);
+typedef BOOLEAN (APIENTRY* PFN_DxEngSetHdevData)(HDEV, DXEGSHDEVDATA, DWORD_PTR);
+typedef HDC (APIENTRY* PFN_DxEngCreateMemoryDC)(HDEV);
+typedef HDC (APIENTRY* PFN_DxEngGetDesktopDC)(ULONG, BOOL, BOOL);
+typedef BOOLEAN (APIENTRY* PFN_DxEngDeleteDC)(HDC, BOOL);
+typedef BOOLEAN (APIENTRY* PFN_DxEngCleanDC)(HDC hdc);
+typedef BOOL (APIENTRY* PFN_DxEngSetDCOwner)(HGDIOBJ, DWORD);
+typedef PDC (APIENTRY* PFN_DxEngLockDC)(HDC);
+typedef BOOLEAN (APIENTRY* PFN_DxEngUnlockDC)(PDC);
+typedef BOOLEAN (APIENTRY* PFN_DxEngSetDCState)(HDC, DWORD, DWORD);
+typedef DWORD_PTR (APIENTRY* PFN_DxEngGetDCState)(HDC, DWORD);
+typedef DWORD (APIENTRY* PFN_DxEngSelectBitmap)(DWORD, DWORD);
+typedef DWORD (APIENTRY* PFN_DxEngSetBitmapOwner)(DWORD, DWORD);
+typedef DWORD (APIENTRY* PFN_DxEngDeleteSurface)(DWORD);
+typedef DWORD (APIENTRY* PFN_DxEngGetSurfaceData)(DWORD, DWORD);
+typedef DWORD (APIENTRY* PFN_DxEngAltLockSurface)(DWORD);
+typedef DWORD (APIENTRY* PFN_DxEngUploadPaletteEntryToSurface)(DWORD, DWORD, DWORD,
DWORD);
+typedef DWORD (APIENTRY* PFN_DxEngMarkSurfaceAsDirectDraw)(DWORD, DWORD);
+typedef DWORD (APIENTRY* PFN_DxEngSelectPaletteToSurface)(DWORD, DWORD);
+typedef DWORD (APIENTRY* PFN_DxEngSyncPaletteTableWithDevice)(DWORD, DWORD);
+typedef DWORD (APIENTRY* PFN_DxEngSetPaletteState)(DWORD, DWORD, DWORD);
+typedef DWORD (APIENTRY* PFN_DxEngGetRedirectionBitmap)(DWORD);
+typedef DWORD (APIENTRY* PFN_DxEngLoadImage)(DWORD, DWORD);
+
+
+typedef struct _DXENG_FUNCTIONS
+{
+ PVOID Reserved;
+ PFN_DxEngNUIsTermSrv DxEngNUIsTermSrv;
+ PFN_DxEngScreenAccessCheck DxEngScreenAccessCheck;
+ PFN_DxEngRedrawDesktop DxEngRedrawDesktop;
+ PFN_DxEngDispUniq DxEngDispUniq;
+ PFN_DxEngIncDispUniq DxEngIncDispUniq;
+ PFN_DxEngVisRgnUniq DxEngVisRgnUniq;
+ PFN_DxEngLockShareSem DxEngLockShareSem;
+ PFN_DxEngUnlockShareSem DxEngUnlockShareSem;
+ PFN_DxEngEnumerateHdev DxEngEnumerateHdev;
+ PFN_DxEngLockHdev DxEngLockHdev;
+ PFN_DxEngUnlockHdev DxEngUnlockHdev;
+ PFN_DxEngIsHdevLockedByCurrentThread DxEngIsHdevLockedByCurrentThread;
+ PFN_DxEngReferenceHdev DxEngReferenceHdev;
+ PFN_DxEngUnreferenceHdev DxEngUnreferenceHdev;
+ PFN_DxEngGetDeviceGammaRamp DxEngGetDeviceGammaRamp;
+ PFN_DxEngSetDeviceGammaRamp DxEngSetDeviceGammaRamp;
+ PFN_DxEngSpTearDownSprites DxEngSpTearDownSprites;
+ PFN_DxEngSpUnTearDownSprites DxEngSpUnTearDownSprites;
+ PFN_DxEngSpSpritesVisible DxEngSpSpritesVisible;
+ PFN_DxEngGetHdevData DxEngGetHdevData;
+ PFN_DxEngSetHdevData DxEngSetHdevData;
+ PFN_DxEngCreateMemoryDC DxEngCreateMemoryDC;
+ PFN_DxEngGetDesktopDC DxEngGetDesktopDC;
+ PFN_DxEngDeleteDC DxEngDeleteDC;
+ PFN_DxEngCleanDC DxEngCleanDC;
+ PFN_DxEngSetDCOwner DxEngSetDCOwner;
+ PFN_DxEngLockDC DxEngLockDC;
+ PFN_DxEngUnlockDC DxEngUnlockDC;
+ PFN_DxEngSetDCState DxEngSetDCState;
+ PFN_DxEngGetDCState DxEngGetDCState;
+ PFN_DxEngSelectBitmap DxEngSelectBitmap;
+ PFN_DxEngSetBitmapOwner DxEngSetBitmapOwner;
+ PFN_DxEngDeleteSurface DxEngDeleteSurface;
+ PFN_DxEngGetSurfaceData DxEngGetSurfaceData;
+ PFN_DxEngAltLockSurface DxEngAltLockSurface;
+ PFN_DxEngUploadPaletteEntryToSurface DxEngUploadPaletteEntryToSurface;
+ PFN_DxEngMarkSurfaceAsDirectDraw DxEngMarkSurfaceAsDirectDraw;
+ PFN_DxEngSelectPaletteToSurface DxEngSelectPaletteToSurface;
+ PFN_DxEngSyncPaletteTableWithDevice DxEngSyncPaletteTableWithDevice;
+ PFN_DxEngSetPaletteState DxEngSetPaletteState;
+ PFN_DxEngGetRedirectionBitmap DxEngGetRedirectionBitmap;
+ PFN_DxEngLoadImage DxEngLoadImage;
+} DXENG_FUNCTIONS, *PDXENG_FUNCTIONS;
/* exported functions */
NTSTATUS NTAPI DriverEntry(IN PVOID Context1, IN PVOID Context2);
@@ -80,6 +185,7 @@
extern VOID *gpDummyPage;
extern PEPROCESS gpepSession;
extern PLARGE_INTEGER gpLockShortDelay;
+extern DXENG_FUNCTIONS gpEngFuncs;
/* Driver list export functions */
DWORD NTAPI DxDxgGenericThunk(ULONG_PTR ulIndex, ULONG_PTR ulHandle, SIZE_T
*pdwSizeOfPtr1, PVOID pvPtr1, SIZE_T *pdwSizeOfPtr2, PVOID pvPtr2);
@@ -93,12 +199,5 @@
BOOL FASTCALL DdHmgDestroy(VOID);
PVOID FASTCALL DdHmgLock(HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned);
-/* define stuff */
-#define drvDxEngLockDC gpEngFuncs[DXENG_INDEX_DxEngLockDC]
-#define drvDxEngGetDCState gpEngFuncs[DXENG_INDEX_DxEngGetDCState]
-#define drvDxEngGetHdevData gpEngFuncs[DXENG_INDEX_DxEngGetHdevData]
-#define drvDxEngUnlockDC gpEngFuncs[DXENG_INDEX_DxEngUnlockDC]
-#define drvDxEngUnlockHdev gpEngFuncs[DXENG_INDEX_DxEngUnlockHdev]
-#define drvDxEngLockHdev gpEngFuncs[DXENG_INDEX_DxEngLockHdev]
#endif /* _DXG_PCH_ */
Modified: trunk/reactos/win32ss/reactx/dxg/eng.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/eng.c?r…
==============================================================================
--- trunk/reactos/win32ss/reactx/dxg/eng.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/reactx/dxg/eng.c [iso-8859-1] Tue Mar 14 19:45:23 2017
@@ -10,6 +10,64 @@
#include <dxg_int.h>
+/*++
+* @name intDdGetDriverInfo
+* @implemented
+*
+* The function intDdGetDriverInfo is used internally in dxg.sys
+* It retrieves driver information structures
+*
+* @param PEDD_DIRECTDRAW_GLOBAL peDdGl
+* DirectDraw global structure
+*
+* @param GUID guid
+* GUID of InfoData to read
+*
+* @param PVOID callbackStruct
+* Callback structure pointer
+*
+* @param ULONG callbackSize
+* Size of allocated callback structure
+*
+* @param ULONG *returnSize
+* Desired structure size returned by driver
+*
+* @return
+* Returns true on successful execution, false when error.
+*
+* @remarks.
+* Only used internally in dxg.sys
+*--*/
+BOOL intDdGetDriverInfo(PEDD_DIRECTDRAW_GLOBAL peDdGl, GUID guid, PVOID callbackStruct,
ULONG callbackSize, ULONG *returnSize)
+{
+ DD_GETDRIVERINFODATA ddGetDriverInfoData;
+
+ if (peDdGl->ddHalInfo.dwFlags & DDHALINFO_GETDRIVERINFOSET &&
peDdGl->ddHalInfo.GetDriverInfo)
+ {
+ memset(&ddGetDriverInfoData, 0, sizeof(DD_GETDRIVERINFODATA));
+ ddGetDriverInfoData.dwSize = sizeof(DD_GETDRIVERINFODATA);
+ ddGetDriverInfoData.dhpdev = peDdGl->dhpdev;
+ memcpy(&ddGetDriverInfoData.guidInfo, &guid, sizeof(GUID));
+ ddGetDriverInfoData.dwExpectedSize = callbackSize;
+ ddGetDriverInfoData.lpvData = callbackStruct;
+ ddGetDriverInfoData.ddRVal = DDERR_CURRENTLYNOTAVAIL;
+ if (peDdGl->ddHalInfo.GetDriverInfo(&ddGetDriverInfoData) &&
!ddGetDriverInfoData.ddRVal)
+ {
+ if (returnSize)
+ *returnSize = ddGetDriverInfoData.dwActualSize;
+ return TRUE;
+ }
+
+ }
+
+ /* cleanup on error */
+ memset(callbackStruct, 0, callbackSize);
+ if (returnSize)
+ *returnSize = 0;
+ return FALSE;
+}
+
+
PDD_SURFACE_LOCAL
NTAPI
DxDdLockDirectDrawSurface(HANDLE hDdSurface)
@@ -43,17 +101,168 @@
return retVal;
}
+/*++
+* @name intDdGetAllDriverInfo
+* @implemented
+*
+* The function intDdGetAllDriverInfo is used internally in dxg.sys
+* It retrieves all possible driver information structures
+*
+* @param PEDD_DIRECTDRAW_GLOBAL peDdGl
+* Pointer to destination DirectDrawGlobal structure
+*
+* @remarks.
+* Only used internally in dxg.sys
+* Missing some callbacks (VideoPort, DxApi, AGP)
+*--*/
+VOID intDdGetAllDriverInfo(PEDD_DIRECTDRAW_GLOBAL peDdGl)
+{
+ if (peDdGl->ddHalInfo.GetDriverInfo && peDdGl->ddHalInfo.dwFlags &
DDHALINFO_GETDRIVERINFOSET)
+ {
+ intDdGetDriverInfo(peDdGl, GUID_KernelCaps, &peDdGl->ddKernelCaps,
sizeof(peDdGl->ddKernelCaps), 0);
+ intDdGetDriverInfo(peDdGl, GUID_KernelCallbacks,
&peDdGl->ddKernelCallbacks, sizeof(peDdGl->ddKernelCallbacks), 0);
+
+ if (intDdGetDriverInfo(peDdGl, GUID_D3DCallbacks3,
&peDdGl->d3dNtHalCallbacks3, sizeof(peDdGl->d3dNtHalCallbacks3), 0))
+ peDdGl->dwCallbackFlags |= EDDDGBL_D3DCALLBACKS3;
+
+ if (intDdGetDriverInfo(peDdGl, GUID_ColorControlCallbacks,
&peDdGl->ddColorControlCallbacks, sizeof(peDdGl->ddColorControlCallbacks), 0))
+ peDdGl->dwCallbackFlags |= EDDDGBL_COLORCONTROLCALLBACKS;
+
+ if (intDdGetDriverInfo(peDdGl, GUID_MiscellaneousCallbacks,
&peDdGl->ddMiscellanousCallbacks, sizeof(peDdGl->ddMiscellanousCallbacks), 0))
+ peDdGl->dwCallbackFlags |= EDDDGBL_MISCCALLBACKS;
+
+ if (intDdGetDriverInfo(peDdGl, GUID_Miscellaneous2Callbacks,
&peDdGl->ddMiscellanous2Callbacks, sizeof(peDdGl->ddMiscellanous2Callbacks),
0))
+ peDdGl->dwCallbackFlags |= EDDDGBL_MISC2CALLBACKS;
+
+ if (intDdGetDriverInfo(peDdGl, GUID_NTCallbacks, &peDdGl->ddNtCallbacks,
sizeof(peDdGl->ddNtCallbacks), 0) )
+ peDdGl->dwCallbackFlags |= EDDDGBL_NTCALLBACKS;
+
+ if (intDdGetDriverInfo(peDdGl, GUID_DDMoreCaps, &peDdGl->ddMoreCaps,
sizeof(peDdGl->ddMoreCaps), 0) )
+ peDdGl->dwCallbackFlags |= EDDDGBL_DDMORECAPS;
+
+ if (intDdGetDriverInfo(peDdGl, GUID_NTPrivateDriverCaps,
&peDdGl->ddNtPrivateDriverCaps, sizeof(peDdGl->ddNtPrivateDriverCaps), 0) )
+ peDdGl->dwCallbackFlags |= EDDDGBL_PRIVATEDRIVERCAPS;
+
+ if (intDdGetDriverInfo(peDdGl, GUID_MotionCompCallbacks,
&peDdGl->ddMotionCompCallbacks, sizeof(peDdGl->ddMotionCompCallbacks), 0) )
+ peDdGl->dwCallbackFlags |= EDDDGBL_MOTIONCOMPCALLBACKS;
+ }
+}
+
+
+/*++
+* @name intDdEnableDriver
+* @implemented
+*
+* The function intDdEnableDriver is used internally in dxg.sys
+* Fills in all EDD_DIRECTDRAW_GLOBAL structures and enables DirectDraw acceleration when
possible
+*
+* @param PEDD_DIRECTDRAW_GLOBAL peDdGl
+* Pointer to destination DirectDrawGlobal structure
+*
+* @remarks.
+* Only used internally in dxg.sys
+*--*/
+VOID intDdEnableDriver(PEDD_DIRECTDRAW_GLOBAL peDdGl)
+{
+ PDRIVER_FUNCTIONS DriverFunctions;
+ LPD3DNTHAL_GLOBALDRIVERDATA GlobalDriverData;
+ LPD3DNTHAL_CALLBACKS HalCallbacks;
+ PDD_D3DBUFCALLBACKS D3DBufCallbacks;
+
+
+ gpEngFuncs.DxEngLockHdev(peDdGl->hDev);
+ DriverFunctions = (PDRIVER_FUNCTIONS)gpEngFuncs.DxEngGetHdevData(peDdGl->hDev,
DxEGShDevData_DrvFuncs);
+
+ // check if driver has DirectDraw functions
+ if
((!DriverFunctions->GetDirectDrawInfo)||(!DriverFunctions->EnableDirectDraw)||(!DriverFunctions->DisableDirectDraw))
+ peDdGl->dhpdev = 0;
+
+
+ // reset acceleration flag
+ peDdGl->fl = peDdGl->fl & 0xFFFFFFFE;
+
+ // ask for structure sizes
+ if
((peDdGl->dhpdev)&&(DriverFunctions->GetDirectDrawInfo(peDdGl->dhpdev,
&peDdGl->ddHalInfo, &peDdGl->dwNumHeaps, NULL, &peDdGl->dwNumFourCC,
NULL)))
+ {
+ // allocate memory for DX data
+ if (peDdGl->dwNumHeaps)
+ peDdGl->pvmList = EngAllocMem(FL_ZERO_MEMORY,
peDdGl->dwNumHeaps*sizeof(VIDEOMEMORY), TAG_GDDV);
+ if (peDdGl->dwNumFourCC)
+ peDdGl->pdwFourCC = EngAllocMem(FL_ZERO_MEMORY, peDdGl->dwNumFourCC *
4, TAG_GDDF);
+
+ // get data from driver
+ if (!DriverFunctions->GetDirectDrawInfo(peDdGl->dhpdev,
&peDdGl->ddHalInfo, &peDdGl->dwNumHeaps, peDdGl->pvmList,
&peDdGl->dwNumFourCC, peDdGl->pdwFourCC))
+ {
+ // failed - cleanup and exit
+ if (peDdGl->pvmList)
+ EngFreeMem(peDdGl->pvmList);
+ if (peDdGl->pdwFourCC)
+ EngFreeMem(peDdGl->pdwFourCC);
+ gpEngFuncs.DxEngUnlockHdev(peDdGl->hDev);
+ return;
+ }
+
+ // check if we can enable DirectDraw acceleration
+ if ((peDdGl->ddHalInfo.vmiData.pvPrimary) &&
+ (DriverFunctions->EnableDirectDraw(peDdGl->dhpdev,
&peDdGl->ddCallbacks, &peDdGl->ddSurfaceCallbacks,
&peDdGl->ddPaletteCallbacks))&&
+ !(gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_dd_flags) &
CapOver_DisableD3DAccel)&&
+ (peDdGl->ddHalInfo.dwSize == sizeof(DD_HALINFO)))
+ {
+ GlobalDriverData = peDdGl->ddHalInfo.lpD3DGlobalDriverData;
+ HalCallbacks = peDdGl->ddHalInfo.lpD3DHALCallbacks;
+ D3DBufCallbacks = peDdGl->ddHalInfo.lpD3DHALCallbacks;
+
+ if (GlobalDriverData && GlobalDriverData->dwSize ==
sizeof(D3DNTHAL_GLOBALDRIVERDATA))
+ memcpy(&peDdGl->d3dNtGlobalDriverData, GlobalDriverData,
sizeof(D3DNTHAL_GLOBALDRIVERDATA));
+
+ if (HalCallbacks && HalCallbacks->dwSize ==
sizeof(D3DNTHAL_CALLBACKS))
+ memcpy(&peDdGl->d3dNtHalCallbacks, HalCallbacks,
sizeof(D3DNTHAL_CALLBACKS));
+
+ if (D3DBufCallbacks && D3DBufCallbacks->dwSize ==
sizeof(DD_D3DBUFCALLBACKS))
+ memcpy(&peDdGl->d3dBufCallbacks, D3DBufCallbacks,
sizeof(DD_D3DBUFCALLBACKS));
+
+ intDdGetAllDriverInfo(peDdGl);
+
+ // enable DirectDraw acceleration
+ peDdGl->fl |= 1;
+ }
+ else
+ {
+ // failed - cleanup and exit
+ if (peDdGl->pvmList)
+ EngFreeMem(peDdGl->pvmList);
+ if (peDdGl->pdwFourCC)
+ EngFreeMem(peDdGl->pdwFourCC);
+ }
+ }
+
+ gpEngFuncs.DxEngUnlockHdev(peDdGl->hDev);
+}
+
+/*++
+* @name DxDdEnableDirectDraw
+* @implemented
+*
+* Function enables DirectDraw
+*
+* @param PEDD_DIRECTDRAW_GLOBAL peDdGl
+* Pointer to destination DirectDrawGlobal structure
+*--*/
BOOL
NTAPI
-DxDdEnableDirectDraw(PVOID arg1, BOOL arg2/*What for?*/)
-{
- // taken from CORE-4490
- //PDEV_WIN32K pdev = (PDEV_WIN32K) arg1 ;
- //return pdev->DriverFunctions.EnableDirectDraw(pdev->dhpdev,
- // &pdev->EDDgpl.ddCallbacks,
- // &pdev->EDDgpl.ddSurfaceCallbacks,
- // &pdev->EDDgpl.ddPaletteCallbacks) ;
-
- return TRUE;
-}
-
+DxDdEnableDirectDraw(HANDLE hDev, BOOL arg2/*What for?*/)
+{
+ PEDD_DIRECTDRAW_GLOBAL peDdGl = NULL;
+
+ if (gpEngFuncs.DxEngGetHdevData(hDev, DxEGShDevData_display))
+ {
+ peDdGl = (PEDD_DIRECTDRAW_GLOBAL)gpEngFuncs.DxEngGetHdevData(hDev,
DxEGShDevData_eddg);
+ peDdGl->hDev = hDev;
+ peDdGl->bSuspended = FALSE;
+ peDdGl->dhpdev = (PVOID)gpEngFuncs.DxEngGetHdevData(hDev,
DxEGShDevData_dhpdev);
+ intDdEnableDriver(peDdGl);
+ return TRUE;
+ }
+
+ return FALSE;
+}
Modified: trunk/reactos/win32ss/reactx/dxg/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/main.c?…
==============================================================================
--- trunk/reactos/win32ss/reactx/dxg/main.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/reactx/dxg/main.c [iso-8859-1] Tue Mar 14 19:45:23 2017
@@ -17,7 +17,8 @@
PEPROCESS gpepSession = NULL;
PLARGE_INTEGER gpLockShortDelay = NULL;
-PDRVFN gpEngFuncs;
+DXENG_FUNCTIONS gpEngFuncs;
+
const ULONG gcDxgFuncs = DXG_INDEX_DxDdIoctl + 1;
@@ -39,6 +40,9 @@
{
PDRVFN drv_func;
+ ULONG peng_funcs;
+ PULONG peng_func;
+
UINT i;
/* Test see if the data is vaild we got from win32k.sys */
@@ -71,6 +75,8 @@
* and if it really are exported
*/
+ peng_funcs = (ULONG)&gpEngFuncs;
+
for (i=1 ; i < DXENG_INDEX_DxEngLoadImage + 1; i++)
{
drv_func = &pDxEngDrv->pdrvfn[i];
@@ -80,9 +86,9 @@
{
return STATUS_INTERNAL_ERROR;
}
+ peng_func = (PULONG)(peng_funcs+(i * sizeof(ULONG)));
+ *peng_func = (ULONG)drv_func->pfn;
}
-
- gpEngFuncs = pDxEngDrv->pdrvfn;
/* Note 12/1-2004 : Why is this set to 0x618 */
*DirectDrawContext = 0x618;
Modified: trunk/reactos/win32ss/reactx/dxg/tags.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/dxg/tags.h?…
==============================================================================
--- trunk/reactos/win32ss/reactx/dxg/tags.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/reactx/dxg/tags.h [iso-8859-1] Tue Mar 14 19:45:23 2017
@@ -1,3 +1,5 @@
#define TAG_THDD 'ddht'
#define TAG_GINI 'iniG'
+#define TAG_GDDV 'vddG'
+#define TAG_GDDF 'fddG'
#define TAG_DH_0 '0 hD'
Modified: trunk/reactos/win32ss/reactx/ntddraw/dxeng.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/reactx/ntddraw/dxe…
==============================================================================
--- trunk/reactos/win32ss/reactx/ntddraw/dxeng.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/reactx/ntddraw/dxeng.c [iso-8859-1] Tue Mar 14 19:45:23 2017
@@ -249,7 +249,7 @@
* The following typs are supported
* Type Purpose
* DxEGShDevData_Surface Retrieve pointer to Surface handle.
-* DxEGShDevData_hSpooler See if the device is a spooler driver.
+* DxEGShDevData_hSpooler Device object of graphics driver.
* DxEGShDevData_DitherFmt Retrieve the device iDitherFormat
* DxEGShDevData_FxCaps Retrieve the device flGraphicsCaps
* DxEGShDevData_FxCaps2 Retrieve the device flGraphicsCaps2
@@ -297,7 +297,7 @@
break;
case DxEGShDevData_hSpooler:
DPRINT1("requested DXEGSHDEVDATA DxEGShDevData_hSpooler\n");
- retVal = 0; // (DWORD_PTR) PDev->hSpooler; // If the device is a spooler
driver.
+ retVal = (DWORD_PTR) PDev->hSpooler;
break;
case DxEGShDevData_DitherFmt:
DPRINT1("requested DXEGSHDEVDATA DxEGShDevData_DitherFmt\n");
@@ -356,9 +356,8 @@
retVal = (DWORD_PTR) PDev->gdiinfo.flRaster & RC_PALETTE;
break;
case DxEGShDevData_ldev:
- DPRINT1("DxEGShDevData_ldev not supported yet\n");
- // ATM we do not support the Loader Device driver structure.
-// retVal = (DWORD) PDev->pldev;
+ DPRINT1("requested DXEGSHDEVDATA DxEGShDevData_ldev\n");
+ retVal = (DWORD) PDev->pldev;
break;
case DxEGShDevData_GDev:
DPRINT1("requested DXEGSHDEVDATA DxEGShDevData_GDev\n");