mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:12:58 +00:00
[WIN32K]
- Fix a bug when iterating through the DEVMODE list - Handle VgaCompatible flag differently, by reading this value from the registry for every installed driver. - Priorize non-vga compatible devices over vga compatible, unless /BASEVIDEO is requested - Fall back to vga compatible driver when no other is present svn path=/trunk/; revision=54151
This commit is contained in:
parent
1d1913a81e
commit
de06265192
3 changed files with 45 additions and 20 deletions
|
@ -151,7 +151,7 @@ EngpRegisterGraphicsDevice(
|
||||||
/* Loop all DEVMODEs */
|
/* Loop all DEVMODEs */
|
||||||
pdmEnd = (DEVMODEW*)((PCHAR)pdminfo->adevmode + pdminfo->cbdevmode);
|
pdmEnd = (DEVMODEW*)((PCHAR)pdminfo->adevmode + pdminfo->cbdevmode);
|
||||||
for (pdm = pdminfo->adevmode;
|
for (pdm = pdminfo->adevmode;
|
||||||
pdm + 1 <= pdmEnd;
|
(pdm + 1 <= pdmEnd) && (pdm->dmSize != 0);
|
||||||
pdm = (DEVMODEW*)((PCHAR)pdm + pdm->dmSize + pdm->dmDriverExtra))
|
pdm = (DEVMODEW*)((PCHAR)pdm + pdm->dmSize + pdm->dmDriverExtra))
|
||||||
{
|
{
|
||||||
/* Count this DEVMODE */
|
/* Count this DEVMODE */
|
||||||
|
@ -195,7 +195,7 @@ EngpRegisterGraphicsDevice(
|
||||||
|
|
||||||
/* Loop through the DEVMODEs */
|
/* Loop through the DEVMODEs */
|
||||||
for (pdm = pdminfo->adevmode;
|
for (pdm = pdminfo->adevmode;
|
||||||
pdm + 1 <= pdmEnd;
|
(pdm + 1 <= pdmEnd) && (pdm->dmSize != 0);
|
||||||
pdm = (PDEVMODEW)((PCHAR)pdm + pdm->dmSize + pdm->dmDriverExtra))
|
pdm = (PDEVMODEW)((PCHAR)pdm + pdm->dmSize + pdm->dmDriverExtra))
|
||||||
{
|
{
|
||||||
/* Compare with the default entry */
|
/* Compare with the default entry */
|
||||||
|
|
|
@ -44,7 +44,7 @@ typedef struct _DEVMODEINFO
|
||||||
DEVMODEW adevmode[1];
|
DEVMODEW adevmode[1];
|
||||||
} DEVMODEINFO, *PDEVMODEINFO;
|
} DEVMODEINFO, *PDEVMODEINFO;
|
||||||
|
|
||||||
typedef struct
|
typedef struct _DEVMODEENTRY
|
||||||
{
|
{
|
||||||
DWORD dwFlags;
|
DWORD dwFlags;
|
||||||
PDEVMODEW pdm;
|
PDEVMODEW pdm;
|
||||||
|
|
|
@ -74,6 +74,7 @@ InitDisplayDriver(
|
||||||
ULONG cbSize;
|
ULONG cbSize;
|
||||||
HKEY hkey;
|
HKEY hkey;
|
||||||
DEVMODEW dmDefault;
|
DEVMODEW dmDefault;
|
||||||
|
DWORD dwVga;
|
||||||
|
|
||||||
ERR("InitDisplayDriver(%S, %S);\n",
|
ERR("InitDisplayDriver(%S, %S);\n",
|
||||||
pwszDeviceName, pwszRegKey);
|
pwszDeviceName, pwszRegKey);
|
||||||
|
@ -128,6 +129,11 @@ InitDisplayDriver(
|
||||||
/* Query the default settings */
|
/* Query the default settings */
|
||||||
RegReadDisplaySettings(hkey, &dmDefault);
|
RegReadDisplaySettings(hkey, &dmDefault);
|
||||||
|
|
||||||
|
/* Query if this is a VGA compatible driver */
|
||||||
|
cbSize = sizeof(DWORD);
|
||||||
|
Status = RegQueryValue(hkey, L"VgaCompatible", REG_DWORD, &dwVga, &cbSize);
|
||||||
|
if (!NT_SUCCESS(Status)) dwVga = 0;
|
||||||
|
|
||||||
/* Close the registry key */
|
/* Close the registry key */
|
||||||
ZwClose(hkey);
|
ZwClose(hkey);
|
||||||
|
|
||||||
|
@ -137,6 +143,10 @@ InitDisplayDriver(
|
||||||
&ustrDisplayDrivers,
|
&ustrDisplayDrivers,
|
||||||
&ustrDescription,
|
&ustrDescription,
|
||||||
&dmDefault);
|
&dmDefault);
|
||||||
|
if (pGraphicsDevice && dwVga)
|
||||||
|
{
|
||||||
|
pGraphicsDevice->StateFlags |= DISPLAY_DEVICE_VGA_COMPATIBLE;
|
||||||
|
}
|
||||||
|
|
||||||
return pGraphicsDevice;
|
return pGraphicsDevice;
|
||||||
}
|
}
|
||||||
|
@ -197,7 +207,7 @@ InitVideo()
|
||||||
ERR("Could not read MaxObjectNumber, defaulting to 0.\n");
|
ERR("Could not read MaxObjectNumber, defaulting to 0.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("Found %ld devices\n", ulMaxObjectNumber);
|
TRACE("Found %ld devices\n", ulMaxObjectNumber + 1);
|
||||||
|
|
||||||
/* Loop through all adapters */
|
/* Loop through all adapters */
|
||||||
for (iDevNum = 0; iDevNum <= ulMaxObjectNumber; iDevNum++)
|
for (iDevNum = 0; iDevNum <= ulMaxObjectNumber; iDevNum++)
|
||||||
|
@ -218,31 +228,30 @@ InitVideo()
|
||||||
pGraphicsDevice = InitDisplayDriver(awcDeviceName, awcBuffer);
|
pGraphicsDevice = InitDisplayDriver(awcDeviceName, awcBuffer);
|
||||||
if (!pGraphicsDevice) continue;
|
if (!pGraphicsDevice) continue;
|
||||||
|
|
||||||
/* Check if this is the VGA adapter */
|
/* Check if this is a VGA compatible adapter */
|
||||||
if (iDevNum == iVGACompatible)
|
if (pGraphicsDevice->StateFlags & DISPLAY_DEVICE_VGA_COMPATIBLE)
|
||||||
{
|
{
|
||||||
/* Set the VGA device as primary */
|
/* Save this as the VGA adapter */
|
||||||
gpVgaGraphicsDevice = pGraphicsDevice;
|
if (!gpVgaGraphicsDevice)
|
||||||
ERR("gpVgaGraphicsDevice = %p\n", gpVgaGraphicsDevice);
|
gpVgaGraphicsDevice = pGraphicsDevice;
|
||||||
|
TRACE("gpVgaGraphicsDevice = %p\n", gpVgaGraphicsDevice);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Set the first one as primary device */
|
||||||
|
if (!gpPrimaryGraphicsDevice)
|
||||||
|
gpPrimaryGraphicsDevice = pGraphicsDevice;
|
||||||
|
TRACE("gpPrimaryGraphicsDevice = %p\n", gpPrimaryGraphicsDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the first one as primary device */
|
|
||||||
if (!gpPrimaryGraphicsDevice)
|
|
||||||
gpPrimaryGraphicsDevice = pGraphicsDevice;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close the device map registry key */
|
/* Close the device map registry key */
|
||||||
ZwClose(hkey);
|
ZwClose(hkey);
|
||||||
|
|
||||||
/* Check if we had any success */
|
/* Was VGA mode requested? */
|
||||||
if (!gpPrimaryGraphicsDevice)
|
|
||||||
{
|
|
||||||
ERR("No usable display driver was found.\n");
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gbBaseVideo)
|
if (gbBaseVideo)
|
||||||
{
|
{
|
||||||
|
/* Check if we found a VGA compatible device */
|
||||||
if (gpVgaGraphicsDevice)
|
if (gpVgaGraphicsDevice)
|
||||||
{
|
{
|
||||||
/* Set the VgaAdapter as primary */
|
/* Set the VgaAdapter as primary */
|
||||||
|
@ -255,6 +264,22 @@ InitVideo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if we had any success */
|
||||||
|
if (!gpPrimaryGraphicsDevice)
|
||||||
|
{
|
||||||
|
/* Check if there is a VGA device we skipped */
|
||||||
|
if (gpVgaGraphicsDevice)
|
||||||
|
{
|
||||||
|
/* There is, use the VGA device */
|
||||||
|
gpPrimaryGraphicsDevice = gpVgaGraphicsDevice;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ERR("No usable display driver was found.\n");
|
||||||
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
InitSysParams();
|
InitSysParams();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue