summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Benditovich <yuri.benditovich@daynix.com>2018-03-09 07:56:29 +0200
committerYuri Benditovich <yuri.benditovich@daynix.com>2018-03-09 07:56:29 +0200
commit554e85328d3ae805b073621b7dcf6552374e8cec (patch)
tree6074fe69edaae6dff70e5bbd9389573a0ed9ee0e
parentef4d85ec2cac14732f6017163ab35871567f0793 (diff)
Use DEV_RAM allocations for cursor commandsbug1540919
BZ#1540919 spice server crashes if live migration happens immediately after login or after driver upgrade/downgrade
-rwxr-xr-xqxldod/QxlDod.cpp9
-rwxr-xr-xqxldod/QxlDod.h2
2 files changed, 6 insertions, 5 deletions
diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index 4f508bd..b5fd4c7 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -4649,10 +4649,11 @@ QXLDrawable *QxlDevice::PrepareBltBits (
// regular chunk allocated from device memory and the data copied to it
BOOLEAN QxlDevice::PutBytesAlign(QXLDataChunk **chunk_ptr, UINT8 **now_ptr,
UINT8 **end_ptr, UINT8 *src, int size,
- size_t alloc_size, PLIST_ENTRY pDelayed)
+ size_t alloc_size, PLIST_ENTRY pDelayed, BOOLEAN bDevRam)
{
PAGED_CODE();
BOOLEAN bResult = TRUE;
+ UINT32 memSpace = bDevRam ? MSPACE_TYPE_DEVRAM : MSPACE_TYPE_VRAM;
BOOLEAN bForced = !g_bSupportVSync || !pDelayed;
QXLDataChunk *chunk = *chunk_ptr;
UINT8 *now = *now_ptr;
@@ -4664,7 +4665,7 @@ BOOLEAN QxlDevice::PutBytesAlign(QXLDataChunk **chunk_ptr, UINT8 **now_ptr,
while (size) {
int cp_size = (int)MIN(end - now, size);
if (!cp_size) {
- void *ptr = (bForced || IsListEmpty(pDelayed)) ? AllocMem(MSPACE_TYPE_VRAM, alloc_size + sizeof(QXLDataChunk), bForced) : NULL;
+ void *ptr = (bForced || IsListEmpty(pDelayed)) ? AllocMem(memSpace, alloc_size + sizeof(QXLDataChunk), bForced) : NULL;
if (ptr) {
chunk->next_chunk = PA(ptr);
((QXLDataChunk *)ptr)->prev_chunk = PA(chunk);
@@ -4775,7 +4776,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_VRAM, CURSOR_ALLOC_SIZE, TRUE);
+ res = (Resource *)AllocMem(MSPACE_TYPE_DEVRAM, CURSOR_ALLOC_SIZE, TRUE);
if (!res) {
DbgPrint(TRACE_LEVEL_ERROR, ("%s: Failed to allocate cursor data\n", __FUNCTION__));
ReleaseOutput(cursor_cmd->release_info.id);
@@ -4818,7 +4819,7 @@ NTSTATUS QxlDevice::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPoi
end = (UINT8 *)res + CURSOR_ALLOC_SIZE;
src_end = src + (pSetPointerShape->Pitch * pSetPointerShape->Height * num_images);
for (; src != src_end; src += pSetPointerShape->Pitch) {
- if (!PutBytesAlign(&chunk, &now, &end, src, line_size, PAGE_SIZE - PAGE_SIZE % line_size, NULL)) {
+ if (!PutBytesAlign(&chunk, &now, &end, src, line_size, PAGE_SIZE - PAGE_SIZE % line_size, NULL, TRUE)) {
// we have a chance to get here only with color cursor bigger than 45*45
// and only if we modify this procedure to use non-forced allocation
DbgPrint(TRACE_LEVEL_ERROR, ("%s: failed to push part of shape\n", __FUNCTION__));
diff --git a/qxldod/QxlDod.h b/qxldod/QxlDod.h
index 695b83a..a18b959 100755
--- a/qxldod/QxlDod.h
+++ b/qxldod/QxlDod.h
@@ -618,7 +618,7 @@ private:
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);
+ size_t alloc_size, PLIST_ENTRY pDelayed, BOOLEAN bDevRam = FALSE);
QXLDataChunk *MakeChunk(DelayedChunk *pdc);
ULONG PrepareDrawable(QXLDrawable*& drawable);
void AsyncIo(UCHAR Port, UCHAR Value);