[Spice-devel] [RFC PATCH qxl-wddm-dod 12/28] Use the second bar (VRAM) for qxl command buffer.

Dmitry Fleytman dmitry at daynix.com
Mon Jul 18 06:33:53 UTC 2016


From: Sandy Stutsman <sstutsma at redhat.com>

---
 qxldod/QxlDod.cpp | 52 ++++++++++++++++++++++++++--------------------------
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index a328d2d..e6c4ada 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -3429,7 +3429,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);
 }
 
@@ -3437,7 +3437,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;
@@ -3859,7 +3859,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;
 }
@@ -3939,7 +3939,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;
@@ -3954,7 +3954,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;
@@ -3975,7 +3975,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;
@@ -3989,7 +3989,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;
 }
 
@@ -4034,11 +4034,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__));
 }
 
@@ -4061,12 +4061,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__));
 }
 
@@ -4086,12 +4086,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__));
 }
 
@@ -4134,7 +4134,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__));
@@ -4152,7 +4152,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__));
@@ -4225,7 +4225,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;
@@ -4239,7 +4239,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;
@@ -4262,7 +4262,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);
@@ -4295,9 +4295,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;
@@ -4387,7 +4387,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;
@@ -4429,7 +4429,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__));
 
-- 
1.8.3.1



More information about the Spice-devel mailing list