[Spice-devel] [RFC PATCH qxl-wddm-dod 16/28] Enable HW cursor support and fix handling of monochrome cursors.

Dmitry Fleytman dmitry at daynix.com
Mon Jul 18 06:33:57 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 | 19 +++++++++++--------
 qxldod/QxlDod.h   |  2 +-
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index ff987c4..3139092 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -4383,6 +4383,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;
@@ -4405,16 +4406,17 @@ NTSTATUS  QxlDevice::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPoi
     cursor->header.width = (UINT16)pSetPointerShape->Width;
     cursor->header.height = (UINT16)pSetPointerShape->Height;
     if (cursor->header.type == SPICE_CURSOR_TYPE_MONO) {
-        cursor->header.height >>= 1;
         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;
@@ -4426,7 +4428,7 @@ NTSTATUS  QxlDevice::SetPointerShape(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPoi
     now = chunk->data;
     end = (UINT8 *)res + CURSOR_ALLOC_SIZE;
 
-    src_end = src + (pSetPointerShape->Pitch * pSetPointerShape->Height);
+    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);
@@ -4449,14 +4451,15 @@ NTSTATUS QxlDevice::SetPointerPosition(_In_ CONST DXGKARG_SETPOINTERPOSITION* pS
                                  pSetPointerPosition->VidPnSourceId,
                                  pSetPointerPosition->X,
                                  pSetPointerPosition->Y));
-    if (EnablePointer()) {
+    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;
+        }
+        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);
     }
diff --git a/qxldod/QxlDod.h b/qxldod/QxlDod.h
index 8ecae19..9bc0bdb 100755
--- a/qxldod/QxlDod.h
+++ b/qxldod/QxlDod.h
@@ -462,7 +462,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,
-- 
1.8.3.1



More information about the Spice-devel mailing list