[Spice-devel] [PATCH qxl-wddm-dod v3 1/2] Move code for discarding drawable to separate procedure

Frediano Ziglio fziglio at redhat.com
Fri May 5 10:24:24 UTC 2017


From: "yuri.benditovich at daynix.com" <yuri.benditovich at daynix.com>

Signed-off-by: Yuri Benditovich <yuri.benditovich at daynix.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
---
 qxldod/QxlDod.cpp | 21 ++++++++++++++-------
 qxldod/QxlDod.h   |  1 +
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index 1953688..5ee54f5 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -4500,6 +4500,19 @@ 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);
+    DbgPrint(TRACE_LEVEL_WARNING, ("%s\n", __FUNCTION__));
+}
+
 QXLDrawable *QxlDevice::PrepareBltBits (
     BLT_INFO* pDst,
     CONST BLT_INFO* pSrc,
@@ -4549,13 +4562,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.9.3



More information about the Spice-devel mailing list