fix resolution mismatch when switching between VGA and QXL modes

This commit is contained in:
Vadim Rozenfeld 2015-02-19 21:07:24 +11:00
parent 7693d4153c
commit b2a0aef4a5
3 changed files with 41 additions and 25 deletions

View File

@ -2351,7 +2351,9 @@ NTSTATUS VgaDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo)
VBE_INFO VbeInfo = {0}; VBE_INFO VbeInfo = {0};
ULONG Length; ULONG Length;
VBE_MODEINFO tmpModeInfo; VBE_MODEINFO tmpModeInfo;
UINT Height = pDispInfo->Height;
UINT Width = pDispInfo->Width;
UINT BitsPerPixel = BPPFromPixelFormat(pDispInfo->ColorFormat);
NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status = STATUS_SUCCESS;
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
//Get VBE Mode List //Get VBE Mode List
@ -2398,6 +2400,7 @@ NTSTATUS VgaDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo)
DbgPrint(TRACE_LEVEL_INFORMATION, ("VBE BIOS Present (%d.%d, %8ld Kb)\n", VbeInfo.Version / 0x100, VbeInfo.Version & 0xFF, VbeInfo.TotalMemory * 64)); DbgPrint(TRACE_LEVEL_INFORMATION, ("VBE BIOS Present (%d.%d, %8ld Kb)\n", VbeInfo.Version / 0x100, VbeInfo.Version & 0xFF, VbeInfo.TotalMemory * 64));
DbgPrint(TRACE_LEVEL_INFORMATION, ("Capabilities = 0x%x\n", VbeInfo.Capabilities)); DbgPrint(TRACE_LEVEL_INFORMATION, ("Capabilities = 0x%x\n", VbeInfo.Capabilities));
DbgPrint(TRACE_LEVEL_INFORMATION, ("VideoModePtr = 0x%x (0x%x.0x%x)\n", VbeInfo.VideoModePtr, HIWORD( VbeInfo.VideoModePtr), LOWORD( VbeInfo.VideoModePtr))); DbgPrint(TRACE_LEVEL_INFORMATION, ("VideoModePtr = 0x%x (0x%x.0x%x)\n", VbeInfo.VideoModePtr, HIWORD( VbeInfo.VideoModePtr), LOWORD( VbeInfo.VideoModePtr)));
DbgPrint(TRACE_LEVEL_INFORMATION, ("pDispInfo = %p %dx%d@%d\n", pDispInfo, Width, Height, BitsPerPixel));
for (ModeCount = 0; ; ModeCount++) for (ModeCount = 0; ; ModeCount++)
{ {
@ -2426,6 +2429,12 @@ NTSTATUS VgaDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo)
m_ModeNumbers = reinterpret_cast<PUSHORT> (new (PagedPool) BYTE [sizeof (USHORT) * ModeCount]); m_ModeNumbers = reinterpret_cast<PUSHORT> (new (PagedPool) BYTE [sizeof (USHORT) * ModeCount]);
m_CurrentMode = 0; m_CurrentMode = 0;
DbgPrint(TRACE_LEVEL_INFORMATION, ("m_ModeInfo = 0x%p, m_ModeNumbers = 0x%p\n", m_ModeInfo, m_ModeNumbers)); DbgPrint(TRACE_LEVEL_INFORMATION, ("m_ModeInfo = 0x%p, m_ModeNumbers = 0x%p\n", m_ModeInfo, m_ModeNumbers));
if (Width == 0 || Height == 0 || BitsPerPixel != VGA_BPP)
{
Width = MIN_WIDTH_SIZE;
Height = MIN_HEIGHT_SIZE;
BitsPerPixel = VGA_BPP;
}
for (CurrentMode = 0, SuitableModeCount = 0; for (CurrentMode = 0, SuitableModeCount = 0;
CurrentMode < ModeCount; CurrentMode < ModeCount;
CurrentMode++) CurrentMode++)
@ -2442,7 +2451,6 @@ NTSTATUS VgaDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo)
break; break;
} }
DbgPrint(TRACE_LEVEL_INFORMATION, ("ModeTemp = 0x%X\n", ModeTemp));
RtlZeroMemory(&regs, sizeof(regs)); RtlZeroMemory(&regs, sizeof(regs));
regs.Eax = 0x4F01; regs.Eax = 0x4F01;
regs.Ecx = ModeTemp; regs.Ecx = ModeTemp;
@ -2459,9 +2467,7 @@ NTSTATUS VgaDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo)
&tmpModeInfo, &tmpModeInfo,
sizeof(VBE_MODEINFO)); sizeof(VBE_MODEINFO));
UINT Height = pDispInfo->Height; DbgPrint(TRACE_LEVEL_INFORMATION, ("ModeTemp = 0x%X %dx%d@%d\n", ModeTemp, tmpModeInfo.XResolution, tmpModeInfo.YResolution, tmpModeInfo.BitsPerPixel));
UINT Width = pDispInfo->Width;
UINT BitsPerPixel = BPPFromPixelFormat(pDispInfo->ColorFormat);
if (tmpModeInfo.XResolution >= Width && if (tmpModeInfo.XResolution >= Width &&
tmpModeInfo.YResolution >= Height && tmpModeInfo.YResolution >= Height &&
@ -2992,6 +2998,13 @@ NTSTATUS QxlDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo)
UINT Height = pDispInfo->Height; UINT Height = pDispInfo->Height;
UINT Width = pDispInfo->Width; UINT Width = pDispInfo->Width;
UINT BitsPerPixel = BPPFromPixelFormat(pDispInfo->ColorFormat); UINT BitsPerPixel = BPPFromPixelFormat(pDispInfo->ColorFormat);
if (Width == 0 || Height == 0 || BitsPerPixel != QXL_BPP)
{
Width = MIN_WIDTH_SIZE;
Height = MIN_HEIGHT_SIZE;
BitsPerPixel = QXL_BPP;
}
for (CurrentMode = 0, SuitableModeCount = 0; for (CurrentMode = 0, SuitableModeCount = 0;
CurrentMode < modes->n_modes; CurrentMode < modes->n_modes;
CurrentMode++) CurrentMode++)
@ -3022,7 +3035,6 @@ NTSTATUS QxlDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo)
Status = STATUS_UNSUCCESSFUL; Status = STATUS_UNSUCCESSFUL;
} }
// m_CurrentMode = m_ModeNumbers[0];
m_CustomMode = SuitableModeCount; m_CustomMode = SuitableModeCount;
for (CurrentMode = SuitableModeCount; for (CurrentMode = SuitableModeCount;
CurrentMode < SuitableModeCount + 2; CurrentMode < SuitableModeCount + 2;
@ -4254,16 +4266,19 @@ VOID QxlDevice::BlackOutScreen(CURRENT_BDD_MODE* pCurrentBddMod)
QXLDrawable *drawable; QXLDrawable *drawable;
RECT Rect; RECT Rect;
PAGED_CODE(); PAGED_CODE();
return;
DbgPrint(TRACE_LEVEL_FATAL, ("---> %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_FATAL, ("---> %s\n", __FUNCTION__));
if (pCurrentBddMod->Flags.FrameBufferIsActive)
{
Rect.bottom = pCurrentBddMod->SrcModeHeight; Rect.bottom = pCurrentBddMod->SrcModeHeight;
Rect.top = 0; Rect.top = 0;
Rect.left = 0; Rect.left = 0;
Rect.right = pCurrentBddMod->SrcModeWidth; Rect.right = pCurrentBddMod->SrcModeWidth;
if (!(drawable = Drawable(QXL_DRAW_FILL, &Rect, NULL, 0))) { if (!(drawable = Drawable(QXL_DRAW_FILL, &Rect, NULL, 0)))
{
DbgPrint(TRACE_LEVEL_ERROR, ("Cannot get Drawable.\n")); DbgPrint(TRACE_LEVEL_ERROR, ("Cannot get Drawable.\n"));
return;
} }
drawable->u.fill.brush.type = SPICE_BRUSH_TYPE_SOLID; drawable->u.fill.brush.type = SPICE_BRUSH_TYPE_SOLID;
drawable->u.fill.brush.u.color = 0; drawable->u.fill.brush.u.color = 0;
drawable->u.fill.rop_descriptor = SPICE_ROPD_OP_PUT; drawable->u.fill.rop_descriptor = SPICE_ROPD_OP_PUT;
@ -4272,7 +4287,7 @@ return;
drawable->u.fill.mask.pos.y = 0; drawable->u.fill.mask.pos.y = 0;
drawable->u.fill.mask.bitmap = 0; drawable->u.fill.mask.bitmap = 0;
PushDrawable(drawable); PushDrawable(drawable);
}
DbgPrint(TRACE_LEVEL_FATAL, ("<--- %s\n", __FUNCTION__)); DbgPrint(TRACE_LEVEL_FATAL, ("<--- %s\n", __FUNCTION__));
} }

View File

@ -11,6 +11,7 @@
#define MIN_WIDTH_SIZE 1024 #define MIN_WIDTH_SIZE 1024
#define MIN_HEIGHT_SIZE 768 #define MIN_HEIGHT_SIZE 768
#define QXL_BPP 32 #define QXL_BPP 32
#define VGA_BPP 24
typedef struct _QXL_FLAGS typedef struct _QXL_FLAGS
{ {

View File

@ -9,7 +9,7 @@
// Driver Entry point // Driver Entry point
// //
int nDebugLevel = TRACE_LEVEL_ERROR; int nDebugLevel = TRACE_LEVEL_INFORMATION;
extern "C" extern "C"