diff options
author | Vadim Rozenfeld <vrozenfe@redhat.com> | 2015-02-19 21:07:24 +1100 |
---|---|---|
committer | Vadim Rozenfeld <vrozenfe@redhat.com> | 2015-02-19 21:07:24 +1100 |
commit | b2a0aef4a553fd2bb1e4db910f86464a2e66660b (patch) | |
tree | 2f22deb6df8d30bd3f81500410a22fd0c0e534b7 | |
parent | 7693d4153cfa5d855998cc6cc49c53d8e8a2b35b (diff) |
fix resolution mismatch when switching between VGA and QXL modes
-rwxr-xr-x | qxldod/QxlDod.cpp | 63 | ||||
-rwxr-xr-x | qxldod/QxlDod.h | 1 | ||||
-rwxr-xr-x | qxldod/driver.cpp | 2 |
3 files changed, 41 insertions, 25 deletions
diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp index 005cfe3..b8fb4b7 100755 --- a/qxldod/QxlDod.cpp +++ b/qxldod/QxlDod.cpp @@ -2351,7 +2351,9 @@ NTSTATUS VgaDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo) VBE_INFO VbeInfo = {0};
ULONG Length;
VBE_MODEINFO tmpModeInfo;
-
+ UINT Height = pDispInfo->Height;
+ UINT Width = pDispInfo->Width;
+ UINT BitsPerPixel = BPPFromPixelFormat(pDispInfo->ColorFormat);
NTSTATUS Status = STATUS_SUCCESS;
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
//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, ("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, ("pDispInfo = %p %dx%d@%d\n", pDispInfo, Width, Height, BitsPerPixel));
for (ModeCount = 0; ; ModeCount++)
{
@@ -2425,7 +2428,13 @@ NTSTATUS VgaDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo) m_ModeInfo = reinterpret_cast<PVIDEO_MODE_INFORMATION> (new (PagedPool) BYTE[sizeof (VIDEO_MODE_INFORMATION) * ModeCount]);
m_ModeNumbers = reinterpret_cast<PUSHORT> (new (PagedPool) BYTE [sizeof (USHORT) * ModeCount]);
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;
CurrentMode < ModeCount;
CurrentMode++)
@@ -2442,7 +2451,6 @@ NTSTATUS VgaDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo) break;
}
- DbgPrint(TRACE_LEVEL_INFORMATION, ("ModeTemp = 0x%X\n", ModeTemp));
RtlZeroMemory(®s, sizeof(regs));
regs.Eax = 0x4F01;
regs.Ecx = ModeTemp;
@@ -2459,9 +2467,7 @@ NTSTATUS VgaDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo) &tmpModeInfo,
sizeof(VBE_MODEINFO));
- UINT Height = pDispInfo->Height;
- UINT Width = pDispInfo->Width;
- UINT BitsPerPixel = BPPFromPixelFormat(pDispInfo->ColorFormat);
+ DbgPrint(TRACE_LEVEL_INFORMATION, ("ModeTemp = 0x%X %dx%d@%d\n", ModeTemp, tmpModeInfo.XResolution, tmpModeInfo.YResolution, tmpModeInfo.BitsPerPixel));
if (tmpModeInfo.XResolution >= Width &&
tmpModeInfo.YResolution >= Height &&
@@ -2992,6 +2998,13 @@ NTSTATUS QxlDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo) UINT Height = pDispInfo->Height;
UINT Width = pDispInfo->Width;
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;
CurrentMode < modes->n_modes;
CurrentMode++)
@@ -3022,7 +3035,6 @@ NTSTATUS QxlDevice::GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo) Status = STATUS_UNSUCCESSFUL;
}
-// m_CurrentMode = m_ModeNumbers[0];
m_CustomMode = SuitableModeCount;
for (CurrentMode = SuitableModeCount;
CurrentMode < SuitableModeCount + 2;
@@ -4254,25 +4266,28 @@ VOID QxlDevice::BlackOutScreen(CURRENT_BDD_MODE* pCurrentBddMod) QXLDrawable *drawable;
RECT Rect;
PAGED_CODE();
-return;
+
DbgPrint(TRACE_LEVEL_FATAL, ("---> %s\n", __FUNCTION__));
- Rect.bottom = pCurrentBddMod->SrcModeHeight;
- Rect.top = 0;
- Rect.left = 0;
- Rect.right = pCurrentBddMod->SrcModeWidth;
- if (!(drawable = Drawable(QXL_DRAW_FILL, &Rect, NULL, 0))) {
- DbgPrint(TRACE_LEVEL_ERROR, ("Cannot get Drawable.\n"));
+ if (pCurrentBddMod->Flags.FrameBufferIsActive)
+ {
+ Rect.bottom = pCurrentBddMod->SrcModeHeight;
+ Rect.top = 0;
+ Rect.left = 0;
+ Rect.right = pCurrentBddMod->SrcModeWidth;
+ if (!(drawable = Drawable(QXL_DRAW_FILL, &Rect, NULL, 0)))
+ {
+ DbgPrint(TRACE_LEVEL_ERROR, ("Cannot get Drawable.\n"));
+ return;
+ }
+ drawable->u.fill.brush.type = SPICE_BRUSH_TYPE_SOLID;
+ drawable->u.fill.brush.u.color = 0;
+ drawable->u.fill.rop_descriptor = SPICE_ROPD_OP_PUT;
+ drawable->u.fill.mask.flags = 0;
+ drawable->u.fill.mask.pos.x = 0;
+ drawable->u.fill.mask.pos.y = 0;
+ drawable->u.fill.mask.bitmap = 0;
+ PushDrawable(drawable);
}
-
- drawable->u.fill.brush.type = SPICE_BRUSH_TYPE_SOLID;
- drawable->u.fill.brush.u.color = 0;
- drawable->u.fill.rop_descriptor = SPICE_ROPD_OP_PUT;
- drawable->u.fill.mask.flags = 0;
- drawable->u.fill.mask.pos.x = 0;
- drawable->u.fill.mask.pos.y = 0;
- drawable->u.fill.mask.bitmap = 0;
- PushDrawable(drawable);
-
DbgPrint(TRACE_LEVEL_FATAL, ("<--- %s\n", __FUNCTION__));
}
diff --git a/qxldod/QxlDod.h b/qxldod/QxlDod.h index 1e7c1a8..6e3af2a 100755 --- a/qxldod/QxlDod.h +++ b/qxldod/QxlDod.h @@ -11,6 +11,7 @@ #define MIN_WIDTH_SIZE 1024
#define MIN_HEIGHT_SIZE 768
#define QXL_BPP 32
+#define VGA_BPP 24
typedef struct _QXL_FLAGS
{
diff --git a/qxldod/driver.cpp b/qxldod/driver.cpp index 48bf346..f7c5fb3 100755 --- a/qxldod/driver.cpp +++ b/qxldod/driver.cpp @@ -9,7 +9,7 @@ // Driver Entry point
//
-int nDebugLevel = TRACE_LEVEL_ERROR;
+int nDebugLevel = TRACE_LEVEL_INFORMATION;
extern "C"
|