[RFC PATCH qxl-wddm-dod 23/28] Replacing <#ifdef USE_FRAMEBUFFER> with runtime logic

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

 



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@xxxxxxxxxx>
Signed-off-by: Dmitry Fleytman <dmitry@xxxxxxxxxx>
---
 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 f6542c4..a550306 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -219,9 +219,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 c28f97f..41189b3 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:
-- 
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]