[Spice-devel] [RFC qxl-wddm-dod 1/3] Move code for discarding drawable to separate procedure

Yuri Benditovich yuri.benditovich at daynix.com
Sun Apr 16 19:43:01 UTC 2017


Signed-off-by: Yuri Benditovich <yuri.benditovich at daynix.com>
---
 qxldod/QxlDod.cpp | 20 +++++++++++++-------
 qxldod/QxlDod.h   |  1 +
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index 1953688..c60cf31 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -4500,6 +4500,18 @@ BOOLEAN QxlDevice::AttachNewBitmap(QXLDrawable *drawable, UINT8 *src, UINT8 *src
     return TRUE;
 }
 
+void QxlDevice::DiscardDrawable(QXLDrawable *drawable)
+{
+    PAGED_CODE();
+    PLIST_ENTRY pDelayedList = DelayedList(drawable);
+    // if some delayed chunks were allocated, free them
+    while (!IsListEmpty(pDelayedList)) {
+        DelayedChunk *pdc = (DelayedChunk *)RemoveHeadList(pDelayedList);
+        delete[] reinterpret_cast<BYTE*>(pdc);
+    }
+    ReleaseOutput(drawable->release_info.id);
+}
+
 QXLDrawable *QxlDevice::PrepareBltBits (
     BLT_INFO* pDst,
     CONST BLT_INFO* pSrc,
@@ -4549,13 +4561,7 @@ QXLDrawable *QxlDevice::PrepareBltBits (
     src += pSrc->Pitch * (height - 1);
 
     if (!AttachNewBitmap(drawable, src, src_end, (INT)pSrc->Pitch, !g_bSupportVSync)) {
-        PLIST_ENTRY pDelayedList = DelayedList(drawable);
-        // if some delayed chunks were allocated, free them
-        while (!IsListEmpty(pDelayedList)) {
-            DelayedChunk *pdc = (DelayedChunk *)RemoveHeadList(pDelayedList);
-            delete[] reinterpret_cast<BYTE*>(pdc);
-        }
-        ReleaseOutput(drawable->release_info.id);
+        DiscardDrawable(drawable);
         drawable = NULL;
     } else {
         DbgPrint(TRACE_LEVEL_INFORMATION, ("%s drawable= %p type = %d, effect = %d Dest right(%d) left(%d) top(%d) bottom(%d) src_bitmap= %p.\n", __FUNCTION__,
diff --git a/qxldod/QxlDod.h b/qxldod/QxlDod.h
index e865032..b524577 100755
--- a/qxldod/QxlDod.h
+++ b/qxldod/QxlDod.h
@@ -603,6 +603,7 @@ private:
     void WaitForCursorRing(void);
     void PushCursor(void);
     BOOLEAN AttachNewBitmap(QXLDrawable *drawable, UINT8 *src, UINT8 *src_end, INT pitch, BOOLEAN bForce);
+    void DiscardDrawable(QXLDrawable *drawable);
     BOOLEAN PutBytesAlign(QXLDataChunk **chunk_ptr, UINT8 **now_ptr,
                             UINT8 **end_ptr, UINT8 *src, int size,
                             size_t alloc_size, PLIST_ENTRY pDelayed);
-- 
2.7.0.windows.1



More information about the Spice-devel mailing list