[WIN32SS:USER] Fall back to base video (ie VGA) if main display driver failed

This commit is contained in:
Hervé Poussineau 2023-04-17 08:10:02 +02:00
parent 6904b3f5ac
commit 29d80cb14f
3 changed files with 14 additions and 4 deletions

View file

@ -179,7 +179,6 @@ EngpUpdateGraphicsDeviceList(VOID)
WCHAR awcBuffer[256]; WCHAR awcBuffer[256];
NTSTATUS Status; NTSTATUS Status;
PGRAPHICS_DEVICE pGraphicsDevice; PGRAPHICS_DEVICE pGraphicsDevice;
BOOLEAN bFoundNewDevice = FALSE;
ULONG cbValue; ULONG cbValue;
HKEY hkey; HKEY hkey;
@ -248,7 +247,6 @@ EngpUpdateGraphicsDeviceList(VOID)
TRACE("gpVgaGraphicsDevice = %p\n", gpVgaGraphicsDevice); TRACE("gpVgaGraphicsDevice = %p\n", gpVgaGraphicsDevice);
} }
} }
bFoundNewDevice = TRUE;
/* Set the first one as primary device */ /* Set the first one as primary device */
if (!gpPrimaryGraphicsDevice || EngpHasVgaDriver(gpPrimaryGraphicsDevice)) if (!gpPrimaryGraphicsDevice || EngpHasVgaDriver(gpPrimaryGraphicsDevice))
@ -273,7 +271,7 @@ EngpUpdateGraphicsDeviceList(VOID)
gpPrimaryGraphicsDevice->pVgaDevice = gpVgaGraphicsDevice; gpPrimaryGraphicsDevice->pVgaDevice = gpVgaGraphicsDevice;
} }
if (bFoundNewDevice && gbBaseVideo) if (gbBaseVideo)
{ {
PGRAPHICS_DEVICE pToDelete; PGRAPHICS_DEVICE pToDelete;

View file

@ -794,6 +794,10 @@ PDEVOBJ_lChangeDisplaySettings(
RequestedMode ? RequestedMode->dmDisplayFrequency : 0, RequestedMode ? RequestedMode->dmDisplayFrequency : 0,
pmdevOld, ppmdevNew); pmdevOld, ppmdevNew);
/* Update device list (some devices may have been added/removed,
or gbBaseVideo variable may have been changed) */
EngpUpdateGraphicsDeviceList();
if (pustrDeviceName) if (pustrDeviceName)
{ {
pGraphicsDevice = EngpFindGraphicsDevice(pustrDeviceName, 0); pGraphicsDevice = EngpFindGraphicsDevice(pustrDeviceName, 0);

View file

@ -264,8 +264,16 @@ co_IntInitializeDesktopGraphics(VOID)
TEXTMETRICW tmw; TEXTMETRICW tmw;
UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"DISPLAY"); UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"DISPLAY");
PDESKTOP pdesk; PDESKTOP pdesk;
LONG lRet;
if (PDEVOBJ_lChangeDisplaySettings(NULL, NULL, NULL, &gpmdev, TRUE) != DISP_CHANGE_SUCCESSFUL) lRet = PDEVOBJ_lChangeDisplaySettings(NULL, NULL, NULL, &gpmdev, TRUE);
if (lRet != DISP_CHANGE_SUCCESSFUL && !gbBaseVideo)
{
ERR("PDEVOBJ_lChangeDisplaySettings() failed. Trying with base video\n");
gbBaseVideo = TRUE;
lRet = PDEVOBJ_lChangeDisplaySettings(NULL, NULL, NULL, &gpmdev, TRUE);
}
if (lRet != DISP_CHANGE_SUCCESSFUL)
{ {
ERR("PDEVOBJ_lChangeDisplaySettings() failed.\n"); ERR("PDEVOBJ_lChangeDisplaySettings() failed.\n");
return FALSE; return FALSE;