[RFC PATCH qxl-wddm-dod 07/28] On power wake call the init functions before setting the vidpn to black. Otherwise, BSOD.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Sandy Stutsman <sstutsma@xxxxxxxxxx>

---
 qxldod/QxlDod.cpp | 66 ++++++++++++++++++++++++++++---------------------------
 1 file changed, 34 insertions(+), 32 deletions(-)

diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index ec960e5..9d13934 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -284,12 +284,16 @@ NTSTATUS QxlDod::SetPowerState(_In_  ULONG HardwareUid,
                                _In_  DEVICE_POWER_STATE DevicePowerState,
                                _In_  POWER_ACTION       ActionType)
 {
+    NTSTATUS Status(STATUS_SUCCESS);
     PAGED_CODE();
     DbgPrint(TRACE_LEVEL_INFORMATION, ("---> %s HardwareUid = 0x%x ActionType = %s DevicePowerState = %s AdapterPowerState = %s\n", __FUNCTION__, HardwareUid, DbgPowerActionString(ActionType), DbgDevicePowerString(DevicePowerState), DbgDevicePowerString(m_AdapterPowerState)));
 
     if (HardwareUid == DISPLAY_ADAPTER_HW_ID)
     {
-        if (DevicePowerState == PowerDeviceD0)
+        // There is nothing to do to specifically power up/down the display adapter
+        Status = m_pHWDevice->SetPowerState(DevicePowerState, &(m_CurrentModes[0].DispInfo));
+
+        if (NT_SUCCESS(Status) && DevicePowerState == PowerDeviceD0)
         {
 
             // When returning from D3 the device visibility defined to be off for all targets
@@ -305,12 +309,10 @@ NTSTATUS QxlDod::SetPowerState(_In_  ULONG HardwareUid,
         // Store new adapter power state
         m_AdapterPowerState = DevicePowerState;
 
-        // There is nothing to do to specifically power up/down the display adapter
-        return m_pHWDevice->SetPowerState(DevicePowerState, &(m_CurrentModes[0].DispInfo));
     }
     // TODO: This is where the specified monitor should be powered up/down
     
-    return STATUS_SUCCESS;
+    return Status;
 }
 
 NTSTATUS QxlDod::QueryChildRelations(_Out_writes_bytes_(ChildRelationsSize) DXGK_CHILD_DESCRIPTOR* pChildRelations,
@@ -2977,10 +2979,10 @@ BOOL QxlDevice::SetVideoModeInfo(UINT Idx, QXLMode* pModeInfo)
 void QxlDevice::UpdateVideoModeInfo(UINT Idx, UINT xres, UINT yres, UINT bpp)
 {
     PVIDEO_MODE_INFORMATION pMode = NULL;
-    UINT bytes_pp = (bpp + 7) / 8;
+    UINT bytes_pp = (bpp + 7) / 8;
     ULONG color_bits;
     PAGED_CODE();
-
+
     pMode = &m_ModeInfo[Idx];
     pMode->VisScreenWidth = xres;
     pMode->VisScreenHeight = yres;
@@ -4400,39 +4402,39 @@ NTSTATUS QxlDevice::Escape(_In_ CONST DXGKARG_ESCAPE* pEscap)
 {
     DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
     QXLEscapeSetCustomDisplay *custom_display;
-    UINT xres;
-    UINT yres;
-    UINT bpp;
+    UINT xres;
+    UINT yres;
+    UINT bpp;
 
     if (pEscap->PrivateDriverDataSize != sizeof(QXLEscapeSetCustomDisplay)) {
         DbgPrint(TRACE_LEVEL_ERROR, ("<--> %s Incorrect buffer size %d instead of %d\n", __FUNCTION__, pEscap->PrivateDriverDataSize, sizeof(QXLEscapeSetCustomDisplay)));
         return STATUS_INVALID_BUFFER_SIZE;
     }
     custom_display = (QXLEscapeSetCustomDisplay*)pEscap->pPrivateDriverData;
-    xres = custom_display->xres & ~0x3;
-    yres = custom_display->yres & ~0x3;
-    bpp = custom_display->bpp;
-    if (bpp != QXL_BPP)
-    {
-        bpp = QXL_BPP;
-    }
-    if (xres < MIN_WIDTH_SIZE || yres < MIN_HEIGHT_SIZE)
-    {
+    xres = custom_display->xres & ~0x3;
+    yres = custom_display->yres & ~0x3;
+    bpp = custom_display->bpp;
+    if (bpp != QXL_BPP)
+    {
+        bpp = QXL_BPP;
+    }
+    if (xres < MIN_WIDTH_SIZE || yres < MIN_HEIGHT_SIZE)
+    {
         DbgPrint(TRACE_LEVEL_ERROR, ("%s: xres = %d, yres = %d\n", __FUNCTION__, xres, yres));
-        return ERROR_INVALID_DATA;
-    }
-
-    if (m_CustomMode == (m_ModeCount - 1))
-        m_CustomMode = (USHORT)(m_ModeCount - 2);
-    else
-        m_CustomMode = (USHORT)(m_ModeCount - 1);
-
-    if ((xres * yres * bpp / 8) > m_RomHdr->surface0_area_size) {
-        DbgPrint(TRACE_LEVEL_ERROR, ("%s: Mode (%dx%d#%d) doesn't fit in memory (%d)\n",
-                    __FUNCTION__, xres, yres, bpp, m_RomHdr->surface0_area_size));
-        return STATUS_INVALID_PARAMETER;
-    }
-    UpdateVideoModeInfo(m_CustomMode, xres, yres, bpp);
+        return ERROR_INVALID_DATA;
+    }
+
+    if (m_CustomMode == (m_ModeCount - 1))
+        m_CustomMode = (USHORT)(m_ModeCount - 2);
+    else
+        m_CustomMode = (USHORT)(m_ModeCount - 1);
+
+    if ((xres * yres * bpp / 8) > m_RomHdr->surface0_area_size) {
+        DbgPrint(TRACE_LEVEL_ERROR, ("%s: Mode (%dx%d#%d) doesn't fit in memory (%d)\n",
+                    __FUNCTION__, xres, yres, bpp, m_RomHdr->surface0_area_size));
+        return STATUS_INVALID_PARAMETER;
+    }
+    UpdateVideoModeInfo(m_CustomMode, xres, yres, bpp);
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
     return STATUS_SUCCESS;
 }
-- 
1.8.3.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]