[Spice-devel] [PATCH qxl-wddm-dod v2 15/25] Enable HW cursor support and fix handling of monochrome cursors.

Frediano Ziglio fziglio at redhat.com
Tue Sep 6 14:12:01 UTC 2016


> 
> From: Sandy Stutsman <sstutsma at redhat.com>
> 
> * Turn on enable pointer
> * Allow for 1bpp bitmap followed by 1bpp XOR map.
> ---
>  qxldod/QxlDod.cpp | 21 ++++++++++++---------
>  qxldod/QxlDod.h   |  2 +-
>  2 files changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
> index 39f85f2..7e2d7c1 100755
> --- a/qxldod/QxlDod.cpp
> +++ b/qxldod/QxlDod.cpp
> @@ -4408,6 +4408,7 @@ NTSTATUS  QxlDevice::SetPointerShape(_In_ CONST
> DXGKARG_SETPOINTERSHAPE* pSetPoi
>      UINT8 *now;
>      UINT8 *end;
>      int line_size;
> +    int num_images = 1;
>  
>      cursor_cmd = CursorCmd();
>      cursor_cmd->type = QXL_CURSOR_SET;
> @@ -4431,14 +4432,16 @@ NTSTATUS  QxlDevice::SetPointerShape(_In_ CONST
> DXGKARG_SETPOINTERSHAPE* pSetPoi
>      cursor->header.height = (UINT16)pSetPointerShape->Height;
>      if (cursor->header.type == SPICE_CURSOR_TYPE_MONO) {
>          line_size = ALIGN(cursor->header.width, 8) >> 3;
> +        cursor->data_size = line_size * pSetPointerShape->Height * 2;
> +        num_images = 2;
>      } else {
>          line_size = cursor->header.width << 2;
> +        cursor->data_size = line_size * pSetPointerShape->Height;
>      }
>  
>      cursor->header.hot_spot_x = (UINT16)pSetPointerShape->XHot;
>      cursor->header.hot_spot_y = (UINT16)pSetPointerShape->YHot;
>  
> -    cursor->data_size = line_size * pSetPointerShape->Height;
>      DbgPrint(TRACE_LEVEL_INFORMATION, ("<--> %s %d::%d::%d::%d::%d\n",
>      __FUNCTION__, cursor->header.width, cursor->header.height,
>      cursor->header.hot_spot_x, cursor->header.hot_spot_y,
>      cursor->data_size));
>  
>      chunk = &cursor->chunk;
> @@ -4448,9 +4451,8 @@ NTSTATUS  QxlDevice::SetPointerShape(_In_ CONST
> DXGKARG_SETPOINTERSHAPE* pSetPoi
>  
>      src = (UINT8*)pSetPointerShape->pPixels;
>      now = chunk->data;
> -    end = (UINT8 *)res + CURSOR_ALLOC_SIZE;
> -
> -    src_end = src + (pSetPointerShape->Pitch * pSetPointerShape->Height *
> (pSetPointerShape->Flags.Monochrome ? 2 : 1));
> +    end = (UINT8 *)res + CURSOR_ALLOC_SIZE;
> +    src_end = src + (pSetPointerShape->Pitch * pSetPointerShape->Height *
> num_images);
>      for (; src != src_end; src += pSetPointerShape->Pitch) {
>          PutBytesAlign(&chunk, &now, &end, src, line_size,
>                   PAGE_SIZE, 1);

Till now the change (I think the patch should be split here) it's just
fixing handling of monochrome cursors.

> @@ -4473,14 +4475,15 @@ NTSTATUS QxlDevice::SetPointerPosition(_In_ CONST
> DXGKARG_SETPOINTERPOSITION* pS
>                                   pSetPointerPosition->VidPnSourceId,
>                                   pSetPointerPosition->X,
>                                   pSetPointerPosition->Y));
> -    if (EnablePointer()) {
> +    if (!EnablePointer()) {

This condition is always false. This is calling QxlDevice::EnablePointer
as there are no inherited classes.
Does this mean that the position is never sent?

>          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;
> +        }
> +        else {
> +            cursor_cmd->type = QXL_CURSOR_MOVE;
> +            cursor_cmd->u.position.x = (INT16) pSetPointerPosition->X;
> +            cursor_cmd->u.position.y = (INT16) pSetPointerPosition->Y;

Just space changes, remove.

>          }
>          PushCursorCmd(cursor_cmd);
>      }
> diff --git a/qxldod/QxlDod.h b/qxldod/QxlDod.h
> index acac36e..1ca9c45 100755
> --- a/qxldod/QxlDod.h
> +++ b/qxldod/QxlDod.h
> @@ -455,7 +455,7 @@ 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; }
> +    BOOLEAN EnablePointer(void) { return TRUE; }
>      NTSTATUS ExecutePresentDisplayOnly(_In_ BYTE*             DstAddr,
>                      _In_ UINT              DstBitPerPixel,
>                      _In_ BYTE*             SrcAddr,

Frediano


More information about the Spice-devel mailing list