[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.
This commit is contained in:
Oleg Dubinskiy 2023-06-21 18:03:27 +02:00 committed by GitHub
parent e034377b51
commit e7ccb36b9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 90 deletions

View file

@ -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;

View file

@ -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[];