[Spice-devel] [PATCH qxl-wddm-dod 18/26] Replacing <#ifdef USE_FRAMEBUFFER> with runtime logic

Sameeh Jubran sameeh at daynix.com
Tue Aug 9 15:31:06 UTC 2016


From: Dmitry Fleytman <dmitry at daynix.com>

Framebuffer should only be used in VGA mode,
however the mode is only known at runtime therefore
framebuffer logic should be active when the driver
is operating in vga mode only.

Signed-off-by: Sameeh Jubran <sameeh at daynix.com>
Signed-off-by: Dmitry Fleytman <dmitry at daynix.com>
---
 qxldod/QxlDod.cpp | 21 +++++++++++----------
 qxldod/QxlDod.h   |  1 +
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index 74cd259..557d796 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -218,9 +218,10 @@ VOID QxlDod::CleanUp(VOID)
     {
         if (m_CurrentModes[Source].FrameBuffer.Ptr)
         {
-#ifdef USE_FRAMEBUFFER
-            UnmapFrameBuffer(m_CurrentModes[Source].FrameBuffer.Ptr, m_CurrentModes[Source].DispInfo.Height * m_CurrentModes[Source].DispInfo.Pitch);
-#endif
+            if (m_pHWDevice->GetType() == VGA_DEVICE)
+            {
+                UnmapFrameBuffer(m_CurrentModes[Source].FrameBuffer.Ptr, m_CurrentModes[Source].DispInfo.Height * m_CurrentModes[Source].DispInfo.Pitch);
+            }
             m_CurrentModes[Source].FrameBuffer.Ptr = NULL;
             m_CurrentModes[Source].Flags.FrameBufferIsActive = FALSE;
         }
@@ -1395,10 +1396,11 @@ NTSTATUS QxlDod::CommitVidPn(_In_ CONST DXGKARG_COMMITVIDPN* CONST pCommitVidPn)
     if (m_CurrentModes[pCommitVidPn->AffectedVidPnSourceId].FrameBuffer.Ptr &&
         !m_CurrentModes[pCommitVidPn->AffectedVidPnSourceId].Flags.DoNotMapOrUnmap)
     {
-#ifdef USE_FRAMEBUFFER
-        Status = UnmapFrameBuffer(m_CurrentModes[pCommitVidPn->AffectedVidPnSourceId].FrameBuffer.Ptr,
-                                  m_CurrentModes[pCommitVidPn->AffectedVidPnSourceId].DispInfo.Pitch * m_CurrentModes[pCommitVidPn->AffectedVidPnSourceId].DispInfo.Height);
-#endif
+        if (m_pHWDevice->GetType() == VGA_DEVICE)
+        {
+            Status = UnmapFrameBuffer(m_CurrentModes[pCommitVidPn->AffectedVidPnSourceId].FrameBuffer.Ptr,
+                m_CurrentModes[pCommitVidPn->AffectedVidPnSourceId].DispInfo.Pitch * m_CurrentModes[pCommitVidPn->AffectedVidPnSourceId].DispInfo.Height);
+        }
         m_CurrentModes[pCommitVidPn->AffectedVidPnSourceId].FrameBuffer.Ptr = NULL;
         m_CurrentModes[pCommitVidPn->AffectedVidPnSourceId].Flags.FrameBufferIsActive = FALSE;
 
@@ -1525,8 +1527,7 @@ NTSTATUS QxlDod::SetSourceModeAndPath(CONST D3DKMDT_VIDPN_SOURCE_MODE* pSourceMo
     pCurrentBddMode->DispInfo.Height = pSourceMode->Format.Graphics.PrimSurfSize.cy;
     pCurrentBddMode->DispInfo.Pitch = pSourceMode->Format.Graphics.PrimSurfSize.cx * BPPFromPixelFormat(pCurrentBddMode->DispInfo.ColorFormat) / BITS_PER_BYTE;
 
-#ifdef USE_FRAMEBUFFER
-    if (!pCurrentBddMode->Flags.DoNotMapOrUnmap)
+    if (m_pHWDevice->GetType() == VGA_DEVICE && !pCurrentBddMode->Flags.DoNotMapOrUnmap)
     {
         // Map the new frame buffer
         QXL_ASSERT(pCurrentBddMode->FrameBuffer.Ptr == NULL);
@@ -1534,7 +1535,7 @@ NTSTATUS QxlDod::SetSourceModeAndPath(CONST D3DKMDT_VIDPN_SOURCE_MODE* pSourceMo
                                 pCurrentBddMode->DispInfo.Pitch * pCurrentBddMode->DispInfo.Height,
                                 &(pCurrentBddMode->FrameBuffer.Ptr));
     }
-#endif
+
     if (NT_SUCCESS(Status))
     {
 
diff --git a/qxldod/QxlDod.h b/qxldod/QxlDod.h
index 19d172f..e5cb410 100755
--- a/qxldod/QxlDod.h
+++ b/qxldod/QxlDod.h
@@ -263,6 +263,7 @@ public:
     virtual NTSTATUS SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pSetPointerPosition) = 0;
     virtual NTSTATUS Escape(_In_ CONST DXGKARG_ESCAPE* pEscap) = 0;
     ULONG GetId(void) { return m_Id; }
+    WIN_QXL_DEVICE_TYPE GetType(void) { return m_type; }
 protected:
     virtual NTSTATUS GetModeList(DXGK_DISPLAY_INFORMATION* pDispInfo) = 0;
 protected:
-- 
2.7.0.windows.1



More information about the Spice-devel mailing list