[Spice-devel] [PATCH v2 1/2] qxl-wddm-dod: Enable hardware pointer acceleration

Frediano Ziglio fziglio at redhat.com
Mon Nov 21 14:12:50 UTC 2016


> 
> Windows disables hw pointer acceleration and draws the cursor
> in frame buffer if the driver does not report pointer capabilities
> in QueryAdapterInfo. In this mode OS usually does not send pointer
> commands to the driver or does it with pointer set to invisible
> state. This mode of operation consumes CPU time and device-to-host
> traffic. Now we enable pointer hardware acceleration.
> 
> Signed-off-by: Yuri Benditovich <yuri.benditovich at daynix.com>
> ---
>  qxldod/QxlDod.cpp | 30 +++++++++++++-----------------
>  qxldod/QxlDod.h   |  3 ---
>  2 files changed, 13 insertions(+), 20 deletions(-)
> 
> diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
> index 85343e4..724e89f 100755
> --- a/qxldod/QxlDod.cpp
> +++ b/qxldod/QxlDod.cpp
> @@ -406,12 +406,10 @@ NTSTATUS QxlDod::QueryAdapterInfo(_In_ CONST
> DXGKARG_QUERYADAPTERINFO* pQueryAda
>              pDriverCaps->WDDMVersion = DXGKDDI_WDDMv1_2;
>              pDriverCaps->HighestAcceptableAddress.QuadPart = -1;
>  
> -            if (m_pHWDevice->EnablePointer()) {
> -                pDriverCaps->MaxPointerWidth  = POINTER_SIZE;
> -                pDriverCaps->MaxPointerHeight = POINTER_SIZE;
> -                pDriverCaps->PointerCaps.Monochrome = 1;
> -                pDriverCaps->PointerCaps.Color = 1;
> -            }
> +            pDriverCaps->MaxPointerWidth  = POINTER_SIZE;
> +            pDriverCaps->MaxPointerHeight = POINTER_SIZE;
> +            pDriverCaps->PointerCaps.Monochrome = 1;
> +            pDriverCaps->PointerCaps.Color = 1;
>  
>              pDriverCaps->SupportNonVGA = TRUE;
>  
> @@ -4428,7 +4426,7 @@ NTSTATUS  QxlDevice::SetPointerShape(_In_ CONST
> DXGKARG_SETPOINTERSHAPE* pSetPoi
>                                   pSetPointerShape->Height,
>                                   pSetPointerShape->XHot,
>                                   pSetPointerShape->YHot));
> -    if (!EnablePointer() || (!pSetPointerShape->Flags.Monochrome &&
> !pSetPointerShape->Flags.Color))
> +    if (!pSetPointerShape->Flags.Monochrome &&
> !pSetPointerShape->Flags.Color)
>          return STATUS_UNSUCCESSFUL;
>  
>      QXLCursorCmd *cursor_cmd;
> @@ -4508,17 +4506,15 @@ NTSTATUS QxlDevice::SetPointerPosition(_In_ CONST
> DXGKARG_SETPOINTERPOSITION* pS
>                                   pSetPointerPosition->VidPnSourceId,
>                                   pSetPointerPosition->X,
>                                   pSetPointerPosition->Y));
> -    if (EnablePointer()) {
> -        QXLCursorCmd *cursor_cmd = CursorCmd();
> -        if (pSetPointerPosition->X < 0) {
> -           cursor_cmd->type = QXL_CURSOR_HIDE;
> -        } else {
> -           cursor_cmd->type = QXL_CURSOR_MOVE;
> -           cursor_cmd->u.position.x = (INT16)pSetPointerPosition->X;
> -           cursor_cmd->u.position.y = (INT16)pSetPointerPosition->Y;
> -        }
> -        PushCursorCmd(cursor_cmd);
> +    QXLCursorCmd *cursor_cmd = CursorCmd();
> +    if (pSetPointerPosition->X < 0) {
> +        cursor_cmd->type = QXL_CURSOR_HIDE;
> +    } else {
> +        cursor_cmd->type = QXL_CURSOR_MOVE;
> +        cursor_cmd->u.position.x = (INT16)pSetPointerPosition->X;
> +        cursor_cmd->u.position.y = (INT16)pSetPointerPosition->Y;
>      }
> +    PushCursorCmd(cursor_cmd);
>      DbgPrint(TRACE_LEVEL_VERBOSE, ("<--- %s\n", __FUNCTION__));
>      return STATUS_SUCCESS;
>  }
> diff --git a/qxldod/QxlDod.h b/qxldod/QxlDod.h
> index 1d5cf53..8503f29 100755
> --- a/qxldod/QxlDod.h
> +++ b/qxldod/QxlDod.h
> @@ -245,7 +245,6 @@ public:
>      USHORT GetModeNumber(USHORT idx) {return m_ModeNumbers[idx];}
>      USHORT GetCurrentModeIndex(void) {return m_CurrentMode;}
>      VOID SetCurrentModeIndex(USHORT idx) {m_CurrentMode = idx;}
> -    virtual BOOLEAN EnablePointer(void) = 0;
>      virtual NTSTATUS ExecutePresentDisplayOnly(_In_ BYTE*
>      DstAddr,
>                                   _In_ UINT              DstBitPerPixel,
>                                   _In_ BYTE*             SrcAddr,
> @@ -289,7 +288,6 @@ public:
>      NTSTATUS SetPowerState(DEVICE_POWER_STATE DevicePowerState,
>      DXGK_DISPLAY_INFORMATION* pDispInfo);
>      NTSTATUS HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION*
>      pDispInfo);
>      NTSTATUS HWClose(void);
> -    BOOLEAN EnablePointer(void) { return TRUE; }
>      NTSTATUS ExecutePresentDisplayOnly(_In_ BYTE*             DstAddr,
>                                   _In_ UINT              DstBitPerPixel,
>                                   _In_ BYTE*             SrcAddr,
> @@ -464,7 +462,6 @@ public:
>      NTSTATUS SetPowerState(DEVICE_POWER_STATE DevicePowerState,
>      DXGK_DISPLAY_INFORMATION* pDispInfo);
>      NTSTATUS HWInit(PCM_RESOURCE_LIST pResList, DXGK_DISPLAY_INFORMATION*
>      pDispInfo);
>      NTSTATUS HWClose(void);
> -    BOOLEAN EnablePointer(void) { return FALSE; }
>      NTSTATUS ExecutePresentDisplayOnly(_In_ BYTE*             DstAddr,
>                      _In_ UINT              DstBitPerPixel,
>                      _In_ BYTE*             SrcAddr,

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

Frediano


More information about the Spice-devel mailing list