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

Sameeh Jubran sameeh at daynix.com
Mon Sep 5 08:34:12 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);
@@ -4473,14 +4475,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 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,
-- 
2.7.0.windows.1



More information about the Spice-devel mailing list