https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e7ccb36b9babef32fb9ed…
commit e7ccb36b9babef32fb9ed050bfe54f45164e642c
Author: Oleg Dubinskiy <oleg.dubinskij30(a)gmail.com>
AuthorDate: Wed Jun 21 18:03:27 2023 +0200
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Jun 21 18:03:27 2023 +0200
[WIN32SS][NTDDRAW] Don't startup DirectX graphics each time on DirectDraw object creation (#5329)
CORE-17561, CORE-17932, CORE-18221
Do it at each system startup instead: Remove old DirectX initialization code.
It's now outdated and not needed anymore.
Previously, the corresponding hackish intEnableReactXDriver() function
did two things: load dxg.sys and enable DirectDraw.
Now loading DirectX graphics is done during WINSRV initialization, and
enabling DirectDraw is called during each (and also first) display mode
switch, as in Windows. As debug analysis proves, there are no any other
calls in NtGdiDdCreateDirectDrawObject, besides the corresponding DXG
function.
---
win32ss/reactx/ntddraw/ddraw.c | 89 ---------------------------------------
win32ss/reactx/ntddraw/intddraw.h | 1 -
2 files changed, 90 deletions(-)
diff --git a/win32ss/reactx/ntddraw/ddraw.c b/win32ss/reactx/ntddraw/ddraw.c
index 4bd290ed986..76e32179182 100644
--- a/win32ss/reactx/ntddraw/ddraw.c
+++ b/win32ss/reactx/ntddraw/ddraw.c
@@ -26,88 +26,6 @@ ULONG gdwDirectDrawContext = 0;
#define DXDBG 1
-/************************************************************************/
-/* DirectX graphic/video driver enable start here */
-/************************************************************************/
-BOOL
-intEnableReactXDriver(HDC hdc)
-{
- NTSTATUS Status;
- PEPROCESS Proc = NULL;
- PDC pDC = NULL;
- PPDEVOBJ pDev = NULL;
- PGD_DXDDENABLEDIRECTDRAW pfnDdEnableDirectDraw = NULL;
- BOOL success = FALSE;
-
- /* FIXME: Get the process data */
-
- /* Do not try load dxg.sys when it have already been load once */
- if (gpfnStartupDxGraphics == NULL)
- {
- Status = DxDdStartupDxGraphics(0,NULL,0,NULL,NULL, Proc);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Warning: Failed to create the directx interface\n");
- return FALSE;
- }
- }
-
- pDC = DC_LockDc(hdc);
- if (pDC == NULL)
- {
- DPRINT1("Warning: Failed to lock hdc\n");
- return FALSE;
- }
-
- pDev = pDC->ppdev;
-
- /* Test and see if drv got a DX interface or not */
- if ( ( pDev->DriverFunctions.DisableDirectDraw == NULL) ||
- ( pDev->DriverFunctions.EnableDirectDraw == NULL))
- {
- DPRINT1("Warning : DisableDirectDraw and EnableDirectDraw are NULL, no dx driver \n");
- }
- else
- {
-
- /* Check and see if DX has been enabled or not */
- if ( pDev->pEDDgpl->pvmList == NULL)
- {
- pDev->pEDDgpl->ddCallbacks.dwSize = sizeof(DD_CALLBACKS);
- pDev->pEDDgpl->ddSurfaceCallbacks.dwSize = sizeof(DD_SURFACECALLBACKS);
- pDev->pEDDgpl->ddPaletteCallbacks.dwSize = sizeof(DD_PALETTECALLBACKS);
-
- pfnDdEnableDirectDraw = (PGD_DXDDENABLEDIRECTDRAW)gpDxFuncs[DXG_INDEX_DxDdEnableDirectDraw].pfn;
- if (pfnDdEnableDirectDraw == NULL)
- {
- DPRINT1("Warning: no pfnDdEnableDirectDraw\n");
- }
- else
- {
- DPRINT1(" call to pfnDdEnableDirectDraw \n ");
-
- /* Note: it is the hdev struct it wants, not the drv hPDev aka pdc->PDev */
- success = pfnDdEnableDirectDraw(pDC->ppdev, TRUE);
- }
- }
- else
- {
- DPRINT1(" The dxg.sys and graphic card driver interface is enabled \n ");
- success = TRUE;
- }
- }
-
-
- DPRINT1("Return value : 0x%08x\n",success);
- DC_UnlockDc(pDC);
- DPRINT1(" end call to pfnDdEnableDirectDraw \n ");
- return success;
-}
-
-/************************************************************************/
-/* DirectX graphic/video driver enable ends here */
-/************************************************************************/
-
/************************************************************************/
/* DirectX graphic/video driver loading and cleanup starts here */
/************************************************************************/
@@ -219,13 +137,6 @@ NtGdiDdCreateDirectDrawObject(HDC hdc)
return 0;
}
- /* FIXME: This should be alloc for each drv and use it from each drv, not global for whole win32k */
- if (intEnableReactXDriver(hdc) == FALSE)
- {
- DPRINT1("Warning: Failed to start the DirectX interface from the graphic driver\n");
- return DDHAL_DRIVER_NOTHANDLED;
- }
-
/* Get the pfnDdCreateDirectDrawObject after we load the drv */
pfnDdCreateDirectDrawObject = (PGD_DDCREATEDIRECTDRAWOBJECT)gpDxFuncs[DXG_INDEX_DxDdCreateDirectDrawObject].pfn;
diff --git a/win32ss/reactx/ntddraw/intddraw.h b/win32ss/reactx/ntddraw/intddraw.h
index 5dcf1d28774..c592ea08a51 100644
--- a/win32ss/reactx/ntddraw/intddraw.h
+++ b/win32ss/reactx/ntddraw/intddraw.h
@@ -8,7 +8,6 @@
#include <reactos/drivers/directx/dxeng.h>
/* From ddraw.c */
-BOOL intEnableReactXDriver(HDC);
NTSTATUS APIENTRY DxDdStartupDxGraphics(ULONG, PDRVENABLEDATA, ULONG, PDRVENABLEDATA, PULONG, PEPROCESS);
extern DRVFN gpDxFuncs[];