Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cursor freezing when there is no one presented on the screen #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 14 additions & 28 deletions viogpudo/viogpudo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,6 @@ NTSTATUS VioGpuDod::SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pS
VIOGPU_ASSERT(pSetPointerPosition != NULL);
VIOGPU_ASSERT(pSetPointerPosition->VidPnSourceId < MAX_VIEWS);

if (!(pSetPointerPosition->Flags.Visible))
{
DbgPrint(TRACE_LEVEL_INFORMATION, ("<--- %s Cursor is not visible\n", __FUNCTION__));
return STATUS_SUCCESS;
}
return m_pHWDevice->SetPointerPosition(pSetPointerPosition, &m_CurrentModes[pSetPointerPosition->VidPnSourceId]);
}

Expand Down Expand Up @@ -2969,8 +2964,8 @@ NTSTATUS VioGpuAdapter::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSet

crsr->hdr.type = VIRTIO_GPU_CMD_UPDATE_CURSOR;
crsr->resource_id = m_pCursorBuf->GetId();
crsr->pos.x = 0;
crsr->pos.y = 0;
crsr->pos.x = pSetPointerShape->Width;
crsr->pos.y = pSetPointerShape->Height;
crsr->hot_x = pSetPointerShape->XHot;
crsr->hot_y = pSetPointerShape->YHot;
ret = m_CursorQueue.QueueCursor(vbuf);
Expand All @@ -2983,6 +2978,7 @@ NTSTATUS VioGpuAdapter::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSet

NTSTATUS VioGpuAdapter::SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pSetPointerPosition, _In_ CONST CURRENT_BDD_MODE* pModeCur)
{
if (m_pCursorBuf == NULL) return STATUS_UNSUCCESSFUL;
PAGED_CODE();
PGPU_UPDATE_CURSOR crsr;
PGPU_VBUFFER vbuf;
Expand All @@ -2993,28 +2989,18 @@ NTSTATUS VioGpuAdapter::SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION
crsr->hdr.type = VIRTIO_GPU_CMD_MOVE_CURSOR;
crsr->resource_id = m_pCursorBuf->GetId();

if (!pSetPointerPosition->Flags.Visible ||
(UINT)pSetPointerPosition->X > pModeCur->SrcModeWidth ||
(UINT)pSetPointerPosition->Y > pModeCur->SrcModeHeight ||
pSetPointerPosition->X < 0 ||
pSetPointerPosition->Y < 0) {
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s (%d - %d) Visiable = %d Value = %x VidPnSourceId = %d\n",
__FUNCTION__,
pSetPointerPosition->X,
pSetPointerPosition->Y,
pSetPointerPosition->Flags.Visible,
pSetPointerPosition->Flags.Value,
pSetPointerPosition->VidPnSourceId));
crsr->pos.x = 0;
crsr->pos.y = 0;
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s (%d - %d) Visiable = %d Value = %x VidPnSourceId = %d\n",
__FUNCTION__,
pSetPointerPosition->X,
pSetPointerPosition->Y,
pSetPointerPosition->Flags.Visible,
pSetPointerPosition->Flags.Value,
pSetPointerPosition->VidPnSourceId));

if (!pSetPointerPosition->Flags.Visible) {
crsr->pos.x = pModeCur->SrcModeWidth;
crsr->pos.y = pModeCur->SrcModeHeight;
} else {
DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s (%d - %d) Visiable = %d Value = %x VidPnSourceId = %d\n",
__FUNCTION__,
pSetPointerPosition->X,
pSetPointerPosition->Y,
pSetPointerPosition->Flags.Visible,
pSetPointerPosition->Flags.Value,
pSetPointerPosition->VidPnSourceId));
crsr->pos.x = pSetPointerPosition->X;
crsr->pos.y = pSetPointerPosition->Y;
}
Expand Down