Use DEV_RAM allocations for cursor commands
BZ#1540919 spice server crashes if live migration happens immediately after login or after driver upgrade/downgrade
This commit is contained in:
parent
ef4d85ec2c
commit
554e85328d
@ -4649,10 +4649,11 @@ QXLDrawable *QxlDevice::PrepareBltBits (
|
|||||||
// regular chunk allocated from device memory and the data copied to it
|
// regular chunk allocated from device memory and the data copied to it
|
||||||
BOOLEAN QxlDevice::PutBytesAlign(QXLDataChunk **chunk_ptr, UINT8 **now_ptr,
|
BOOLEAN QxlDevice::PutBytesAlign(QXLDataChunk **chunk_ptr, UINT8 **now_ptr,
|
||||||
UINT8 **end_ptr, UINT8 *src, int size,
|
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();
|
PAGED_CODE();
|
||||||
BOOLEAN bResult = TRUE;
|
BOOLEAN bResult = TRUE;
|
||||||
|
UINT32 memSpace = bDevRam ? MSPACE_TYPE_DEVRAM : MSPACE_TYPE_VRAM;
|
||||||
BOOLEAN bForced = !g_bSupportVSync || !pDelayed;
|
BOOLEAN bForced = !g_bSupportVSync || !pDelayed;
|
||||||
QXLDataChunk *chunk = *chunk_ptr;
|
QXLDataChunk *chunk = *chunk_ptr;
|
||||||
UINT8 *now = *now_ptr;
|
UINT8 *now = *now_ptr;
|
||||||
@ -4664,7 +4665,7 @@ BOOLEAN QxlDevice::PutBytesAlign(QXLDataChunk **chunk_ptr, UINT8 **now_ptr,
|
|||||||
while (size) {
|
while (size) {
|
||||||
int cp_size = (int)MIN(end - now, size);
|
int cp_size = (int)MIN(end - now, size);
|
||||||
if (!cp_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) {
|
if (ptr) {
|
||||||
chunk->next_chunk = PA(ptr);
|
chunk->next_chunk = PA(ptr);
|
||||||
((QXLDataChunk *)ptr)->prev_chunk = PA(chunk);
|
((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.x = 0;
|
||||||
cursor_cmd->u.set.position.y = 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) {
|
if (!res) {
|
||||||
DbgPrint(TRACE_LEVEL_ERROR, ("%s: Failed to allocate cursor data\n", __FUNCTION__));
|
DbgPrint(TRACE_LEVEL_ERROR, ("%s: Failed to allocate cursor data\n", __FUNCTION__));
|
||||||
ReleaseOutput(cursor_cmd->release_info.id);
|
ReleaseOutput(cursor_cmd->release_info.id);
|
||||||
@ -4818,7 +4819,7 @@ NTSTATUS QxlDevice::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPoi
|
|||||||
end = (UINT8 *)res + CURSOR_ALLOC_SIZE;
|
end = (UINT8 *)res + CURSOR_ALLOC_SIZE;
|
||||||
src_end = src + (pSetPointerShape->Pitch * pSetPointerShape->Height * num_images);
|
src_end = src + (pSetPointerShape->Pitch * pSetPointerShape->Height * num_images);
|
||||||
for (; src != src_end; src += pSetPointerShape->Pitch) {
|
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
|
// 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
|
// 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__));
|
DbgPrint(TRACE_LEVEL_ERROR, ("%s: failed to push part of shape\n", __FUNCTION__));
|
||||||
|
@ -618,7 +618,7 @@ private:
|
|||||||
void DiscardDrawable(QXLDrawable *drawable);
|
void DiscardDrawable(QXLDrawable *drawable);
|
||||||
BOOLEAN PutBytesAlign(QXLDataChunk **chunk_ptr, UINT8 **now_ptr,
|
BOOLEAN PutBytesAlign(QXLDataChunk **chunk_ptr, UINT8 **now_ptr,
|
||||||
UINT8 **end_ptr, UINT8 *src, int size,
|
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);
|
QXLDataChunk *MakeChunk(DelayedChunk *pdc);
|
||||||
ULONG PrepareDrawable(QXLDrawable*& drawable);
|
ULONG PrepareDrawable(QXLDrawable*& drawable);
|
||||||
void AsyncIo(UCHAR Port, UCHAR Value);
|
void AsyncIo(UCHAR Port, UCHAR Value);
|
||||||
|
Loading…
Reference in New Issue
Block a user