[Spice-devel] [PATCH qxl-wddm-dod v4 05/10] Use the second bar (VRAM) for qxl command buffer.

Sameeh Jubran sameeh at daynix.com
Sun Sep 11 13:05:24 UTC 2016


Based on a patch by Sandy Stutsman <sstutsma at redhat.com>

Acked-by: Frediano Ziglio <fziglio at redhat.com>

Signed-off-by: Sameeh Jubran <sameeh at daynix.com>
---
 qxldod/QxlDod.cpp | 52 ++++++++++++++++++++++++++--------------------------
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index 5659e87..b8a13a9 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -3483,7 +3483,7 @@ _inline QXLPHYSICAL QxlDevice::PA(PVOID virt, UINT8 slot_id)
 {
     PAGED_CODE();
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--> %s\n", __FUNCTION__));
-    MemSlot *pSlot = &m_MemSlots[slot_id];;
+    MemSlot *pSlot = &m_MemSlots[slot_id];
     return pSlot->high_bits | ((UINT64)virt - pSlot->start_virt_addr);
 }
 
@@ -3491,7 +3491,7 @@ _inline UINT64 QxlDevice::VA(QXLPHYSICAL paddr, UINT8 slot_id)
 {
     PAGED_CODE();
     UINT64 virt;
-    MemSlot *pSlot = &m_MemSlots[slot_id];;
+    MemSlot *pSlot = &m_MemSlots[slot_id];
 
     DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
     virt = paddr & m_VaSlotMask;
@@ -3927,7 +3927,7 @@ UINT64 QxlDevice::ReleaseOutput(UINT64 output_id)
         RELEASE_RES(*now);
     }
     next = *(UINT64*)output->data;
-    FreeMem(MSPACE_TYPE_DEVRAM, output);
+    FreeMem(MSPACE_TYPE_VRAM, output);
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<---%s\n", __FUNCTION__));
     return next;
 }
@@ -4007,7 +4007,7 @@ QXLDrawable *QxlDevice::GetDrawable()
     PAGED_CODE();
     QXLOutput *output;
 
-    output = (QXLOutput *)AllocMem(MSPACE_TYPE_DEVRAM, sizeof(QXLOutput) + sizeof(QXLDrawable), TRUE);
+    output = (QXLOutput *)AllocMem(MSPACE_TYPE_VRAM, sizeof(QXLOutput) + sizeof(QXLDrawable), TRUE);
     output->num_res = 0;
     RESOURCE_TYPE(output, RESOURCE_TYPE_DRAWABLE);
     ((QXLDrawable *)output->data)->release_info.id = (UINT64)output;
@@ -4022,7 +4022,7 @@ QXLCursorCmd *QxlDevice::CursorCmd()
     QXLOutput *output;
 
     DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
-    output = (QXLOutput *)AllocMem(MSPACE_TYPE_DEVRAM, sizeof(QXLOutput) + sizeof(QXLCursorCmd), TRUE);
+    output = (QXLOutput *)AllocMem(MSPACE_TYPE_VRAM, sizeof(QXLOutput) + sizeof(QXLCursorCmd), TRUE);
     output->num_res = 0;
     RESOURCE_TYPE(output, RESOURCE_TYPE_CURSOR);
     cursor_cmd = (QXLCursorCmd *)output->data;
@@ -4043,7 +4043,7 @@ BOOL QxlDevice::SetClip(const RECT *clip, QXLDrawable *drawable)
     }
 
     QXLClipRects *rects;
-    rects_res = (Resource *)AllocMem(MSPACE_TYPE_DEVRAM, sizeof(Resource) + sizeof(QXLClipRects) +
+    rects_res = (Resource *)AllocMem(MSPACE_TYPE_VRAM, sizeof(Resource) + sizeof(QXLClipRects) +
                                         sizeof(QXLRect), TRUE);
     rects_res->refs = 1;
     rects_res->free = FreeClipRectsEx;
@@ -4057,7 +4057,7 @@ BOOL QxlDevice::SetClip(const RECT *clip, QXLDrawable *drawable)
 
     DrawableAddRes(drawable, rects_res);
     drawable->clip.type = SPICE_CLIP_TYPE_RECTS;
-    drawable->clip.data = PA(rects_res->res, m_MainMemSlot);
+    drawable->clip.data = PA(rects_res->res, m_SurfaceMemSlot);
     return TRUE;
 }
 
@@ -4102,11 +4102,11 @@ void QxlDevice::FreeClipRects(Resource *res)
 
     chunk_phys = ((QXLClipRects *)res->res)->chunk.next_chunk;
     while (chunk_phys) {
-        QXLDataChunk *chunk = (QXLDataChunk *)VA(chunk_phys, m_MainMemSlot);
+        QXLDataChunk *chunk = (QXLDataChunk *)VA(chunk_phys, m_SurfaceMemSlot);
         chunk_phys = chunk->next_chunk;
-        FreeMem(MSPACE_TYPE_DEVRAM, chunk);
+        FreeMem(MSPACE_TYPE_VRAM, chunk);
     }
-    FreeMem(MSPACE_TYPE_DEVRAM, res);
+    FreeMem(MSPACE_TYPE_VRAM, res);
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 }
 
@@ -4129,12 +4129,12 @@ void QxlDevice::FreeBitmapImage(Resource *res)
 
     chunk_phys = ((QXLDataChunk *)(&internal->image.bitmap + 1))->next_chunk;
     while (chunk_phys) {
-        QXLDataChunk *chunk = (QXLDataChunk *)VA(chunk_phys, m_MainMemSlot);
+        QXLDataChunk *chunk = (QXLDataChunk *)VA(chunk_phys, m_SurfaceMemSlot);
         chunk_phys = chunk->next_chunk;
-        FreeMem(MSPACE_TYPE_DEVRAM, chunk);
+        FreeMem(MSPACE_TYPE_VRAM, chunk);
     }
 
-    FreeMem(MSPACE_TYPE_DEVRAM, res);
+    FreeMem(MSPACE_TYPE_VRAM, res);
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 }
 
@@ -4154,12 +4154,12 @@ void QxlDevice::FreeCursor(Resource *res)
     DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));
     chunk_phys = ((InternalCursor *)res->res)->cursor.chunk.next_chunk;
     while (chunk_phys) {
-        QXLDataChunk *chunk = (QXLDataChunk *)VA(chunk_phys, m_MainMemSlot);
+        QXLDataChunk *chunk = (QXLDataChunk *)VA(chunk_phys, m_SurfaceMemSlot);
         chunk_phys = chunk->next_chunk;
-        FreeMem(MSPACE_TYPE_DEVRAM, chunk);
+        FreeMem(MSPACE_TYPE_VRAM, chunk);
     }
 
-    FreeMem(MSPACE_TYPE_DEVRAM, res);
+    FreeMem(MSPACE_TYPE_VRAM, res);
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 }
 
@@ -4202,7 +4202,7 @@ void QxlDevice::PushDrawable(QXLDrawable *drawable)
     WaitForCmdRing();
     cmd = SPICE_RING_PROD_ITEM(m_CommandRing);
     cmd->type = QXL_CMD_DRAW;
-    cmd->data = PA(drawable, m_MainMemSlot);
+    cmd->data = PA(drawable, m_SurfaceMemSlot);
     PushCmd();
     ReleaseMutex(&m_CmdLock, locked);
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
@@ -4220,7 +4220,7 @@ void QxlDevice::PushCursorCmd(QXLCursorCmd *cursor_cmd)
     WaitForCursorRing();
     cmd = SPICE_RING_PROD_ITEM(m_CursorRing);
     cmd->type = QXL_CMD_CURSOR;
-    cmd->data = PA(cursor_cmd, m_MainMemSlot);
+    cmd->data = PA(cursor_cmd, m_SurfaceMemSlot);
     PushCursor();
     ReleaseMutex(&m_CrsLock, locked);
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
@@ -4294,7 +4294,7 @@ VOID QxlDevice::BltBits (
 
     alloc_size = BITMAP_ALLOC_BASE + BITS_BUF_MAX - BITS_BUF_MAX % line_size;
     alloc_size = MIN(BITMAP_ALLOC_BASE + height * line_size, alloc_size);
-    image_res = (Resource*)AllocMem(MSPACE_TYPE_DEVRAM, alloc_size, TRUE);
+    image_res = (Resource*)AllocMem(MSPACE_TYPE_VRAM, alloc_size, TRUE);
 
     image_res->refs = 1;
     image_res->free = FreeBitmapImageEx;
@@ -4308,7 +4308,7 @@ VOID QxlDevice::BltBits (
     chunk->data_size = 0;
     chunk->prev_chunk = 0;
     chunk->next_chunk = 0;
-    internal->image.bitmap.data = PA(chunk, m_MainMemSlot);
+    internal->image.bitmap.data = PA(chunk, m_SurfaceMemSlot);
     internal->image.bitmap.flags = 0;
     internal->image.descriptor.width = internal->image.bitmap.x = width;
     internal->image.descriptor.height = internal->image.bitmap.y = height;
@@ -4331,7 +4331,7 @@ VOID QxlDevice::BltBits (
 
     internal->image.bitmap.palette = 0;
 
-    drawable->u.copy.src_bitmap = PA(&internal->image, m_MainMemSlot);
+    drawable->u.copy.src_bitmap = PA(&internal->image, m_SurfaceMemSlot);
 
     CopyRect(&drawable->surfaces_rects[1], pRect);
     DrawableAddRes(drawable, image_res);
@@ -4364,9 +4364,9 @@ VOID QxlDevice::PutBytesAlign(QXLDataChunk **chunk_ptr, UINT8 **now_ptr,
             aligned_size = (int)MIN(alloc_size + alignment - 1, BITS_BUF_MAX);
             aligned_size -=  aligned_size % alignment;
 
-            void *ptr = AllocMem(MSPACE_TYPE_DEVRAM, size + sizeof(QXLDataChunk), TRUE);
-            chunk->next_chunk = PA(ptr, m_MainMemSlot);
-            ((QXLDataChunk *)ptr)->prev_chunk = PA(chunk, m_MainMemSlot);
+            void *ptr = AllocMem(MSPACE_TYPE_VRAM, size + sizeof(QXLDataChunk), TRUE);
+            chunk->next_chunk = PA(ptr, m_SurfaceMemSlot);
+            ((QXLDataChunk *)ptr)->prev_chunk = PA(chunk, m_SurfaceMemSlot);
             chunk = (QXLDataChunk *)ptr;
             chunk->data_size = 0;
             chunk->next_chunk = 0;
@@ -4457,7 +4457,7 @@ NTSTATUS  QxlDevice::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPoi
     cursor_cmd->u.set.position.x = 0;
     cursor_cmd->u.set.position.y = 0;
 
-    res = (Resource *)AllocMem(MSPACE_TYPE_DEVRAM, CURSOR_ALLOC_SIZE, TRUE);
+    res = (Resource *)AllocMem(MSPACE_TYPE_VRAM, CURSOR_ALLOC_SIZE, TRUE);
     res->refs = 1;
     res->free = FreeCursorEx;
     res->ptr = this;
@@ -4499,7 +4499,7 @@ NTSTATUS  QxlDevice::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPoi
     }
     CursorCmdAddRes(cursor_cmd, res);
     RELEASE_RES(res);
-    cursor_cmd->u.set.shape = PA(&internal->cursor, m_MainMemSlot);
+    cursor_cmd->u.set.shape = PA(&internal->cursor, m_SurfaceMemSlot);
     PushCursorCmd(cursor_cmd);
     DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
 
-- 
2.7.4



More information about the Spice-devel mailing list