*/
#include <win32k.h>
-
-#define NDEBUG
-#include <debug.h>
+DBG_DEFAULT_CHANNEL(EngDev)
PGRAPHICS_DEVICE gpPrimaryGraphicsDevice;
PGRAPHICS_DEVICE gpVgaGraphicsDevice;
PDEVMODEINFO pdminfo;
PDEVMODEW pdm, pdmEnd;
PLDEVOBJ pldev;
+ BOOLEAN bModeMatch = FALSE;
- DPRINT("EngpRegisterGraphicsDevice(%wZ)\n", pustrDeviceName);
+ TRACE("EngpRegisterGraphicsDevice(%wZ)\n", pustrDeviceName);
/* Allocate a GRAPHICS_DEVICE structure */
pGraphicsDevice = ExAllocatePoolWithTag(PagedPool,
GDITAG_GDEVICE);
if (!pGraphicsDevice)
{
- DPRINT1("ExAllocatePoolWithTag failed\n");
+ ERR("ExAllocatePoolWithTag failed\n");
return NULL;
}
&pDeviceObject);
if (!NT_SUCCESS(Status))
{
- DPRINT1("Could not open driver %wZ, 0x%lx\n", pustrDeviceName, Status);
+ ERR("Could not open driver %wZ, 0x%lx\n", pustrDeviceName, Status);
ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
return NULL;
}
pwsz = ExAllocatePoolWithTag(PagedPool, cj, GDITAG_DRVSUP);
if (!pwsz)
{
- DPRINT1("Could not allocate string buffer\n");
+ ERR("Could not allocate string buffer\n");
ASSERT(FALSE); // FIXME
ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
return NULL;
* This is a REG_MULTI_SZ string */
for (; *pwsz; pwsz += wcslen(pwsz) + 1)
{
- DPRINT("trying driver: %ls\n", pwsz);
+ TRACE("trying driver: %ls\n", pwsz);
/* Try to load the display driver */
pldev = EngLoadImageEx(pwsz, LDEV_DEVICE_DISPLAY);
if (!pldev)
{
- DPRINT1("Could not load driver: '%ls'\n", pwsz);
+ ERR("Could not load driver: '%ls'\n", pwsz);
continue;
}
pdminfo = LDEVOBJ_pdmiGetModes(pldev, pDeviceObject);
if (!pdminfo)
{
- DPRINT1("Could not get mode list for '%ls'\n", pwsz);
+ ERR("Could not get mode list for '%ls'\n", pwsz);
continue;
}
if (!pGraphicsDevice->pdevmodeInfo || cModes == 0)
{
- DPRINT1("No devmodes\n");
+ ERR("No devmodes\n");
ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
return NULL;
}
GDITAG_GDEVICE);
if (!pGraphicsDevice->pDevModeList)
{
- DPRINT1("No devmode list\n");
+ ERR("No devmode list\n");
ExFreePoolWithTag(pGraphicsDevice, GDITAG_GDEVICE);
return NULL;
}
+ TRACE("Looking for mode %lux%lux%lu(%lu Hz)\n",
+ pdmDefault->dmPelsWidth,
+ pdmDefault->dmPelsHeight,
+ pdmDefault->dmBitsPerPel,
+ pdmDefault->dmDisplayFrequency);
+
/* Loop through all DEVMODEINFOs */
for (pdminfo = pGraphicsDevice->pdevmodeInfo, i = 0;
pdminfo;
(pdm + 1 <= pdmEnd) && (pdm->dmSize != 0);
pdm = (PDEVMODEW)((PCHAR)pdm + pdm->dmSize + pdm->dmDriverExtra))
{
+ TRACE(" %S has mode %lux%lux%lu(%lu Hz)\n",
+ pdm->dmDeviceName,
+ pdm->dmPelsWidth,
+ pdm->dmPelsHeight,
+ pdm->dmBitsPerPel,
+ pdm->dmDisplayFrequency);
/* Compare with the default entry */
- if (pdm->dmBitsPerPel == pdmDefault->dmBitsPerPel &&
+ if (!bModeMatch &&
+ pdm->dmBitsPerPel == pdmDefault->dmBitsPerPel &&
pdm->dmPelsWidth == pdmDefault->dmPelsWidth &&
- pdm->dmPelsHeight == pdmDefault->dmPelsHeight &&
- pdm->dmDisplayFrequency == pdmDefault->dmDisplayFrequency)
+ pdm->dmPelsHeight == pdmDefault->dmPelsHeight)
{
pGraphicsDevice->iDefaultMode = i;
pGraphicsDevice->iCurrentMode = i;
- DPRINT("Found default entry: %lu '%ls'\n", i, pdm->dmDeviceName);
+ TRACE("Found default entry: %lu '%ls'\n", i, pdm->dmDeviceName);
+ if (pdm->dmDisplayFrequency == pdmDefault->dmDisplayFrequency)
+ {
+ /* Uh oh, even the display frequency matches. */
+ bModeMatch = TRUE;
+ }
}
/* Initialize the entry */
/* Unlock loader */
EngReleaseSemaphore(ghsemGraphicsDeviceList);
- DPRINT("Prepared %lu modes for %ls\n", cModes, pGraphicsDevice->pwszDescription);
+ TRACE("Prepared %lu modes for %ls\n", cModes, pGraphicsDevice->pwszDescription);
return pGraphicsDevice;
}
UNICODE_STRING ustrCurrent;
PGRAPHICS_DEVICE pGraphicsDevice;
ULONG i;
- DPRINT("EngpFindGraphicsDevice('%wZ', %lu, 0x%lx)\n",
+ TRACE("EngpFindGraphicsDevice('%wZ', %lu, 0x%lx)\n",
pustrDevice, iDevNum, dwFlags);
/* Lock list */
IO_STATUS_BLOCK Iosb;
PDEVICE_OBJECT DeviceObject;
- DPRINT("EngDeviceIoControl() called\n");
+ TRACE("EngDeviceIoControl() called\n");
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
Status = Iosb.Status;
}
- DPRINT("EngDeviceIoControl(): Returning %X/%X\n", Iosb.Status,
+ TRACE("EngDeviceIoControl(): Returning %X/%X\n", Iosb.Status,
Iosb.Information);
/* Return information to the caller about the operation. */