From c1d37cd353be3ea4c5773fc227ba8459c1f20470 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Tue, 14 Apr 2015 08:56:21 +0200 Subject: spice: fix simple display on bigendian hosts Denis Kirjanov is busy getting spice run on ppc64 and trapped into this one. Spice wire format is little endian, so we have to explicitly say we want little endian when letting pixman convert the data for us. Reported-by: Denis Kirjanov Signed-off-by: Gerd Hoffmann --- ui/spice-display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/spice-display.c') diff --git a/ui/spice-display.c b/ui/spice-display.c index 16441852e4..1a64e07cc1 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -178,7 +178,7 @@ static void qemu_spice_create_one_update(SimpleSpiceDisplay *ssd, image->bitmap.palette = 0; image->bitmap.format = SPICE_BITMAP_FMT_32BIT; - dest = pixman_image_create_bits(PIXMAN_x8r8g8b8, bw, bh, + dest = pixman_image_create_bits(PIXMAN_LE_x8r8g8b8, bw, bh, (void *)update->bitmap, bw * 4); pixman_image_composite(PIXMAN_OP_SRC, ssd->surface, NULL, ssd->mirror, rect->left, rect->top, 0, 0, -- cgit 1.4.1 From d0df04a1569c75f6442123fdda0b2e9aadc3fcc7 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Tue, 24 Mar 2015 17:50:11 +0100 Subject: spice: fix mouse cursor position Signed-off-by: Gerd Hoffmann --- ui/spice-display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ui/spice-display.c') diff --git a/ui/spice-display.c b/ui/spice-display.c index 1a64e07cc1..bf66cc92f9 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -734,7 +734,7 @@ static void display_mouse_set(DisplayChangeListener *dcl, qemu_mutex_lock(&ssd->lock); ssd->ptr_x = x; - ssd->ptr_y = x; + ssd->ptr_y = y; if (ssd->ptr_move) { g_free(ssd->ptr_move); } -- cgit 1.4.1 From dc8dceee64f45820c20f3ffa3c3fecd7b6539990 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Tue, 24 Mar 2015 17:50:12 +0100 Subject: spice: set pointer position on hotspot The Spice protocol uses cursor position on hotspot: the client is applying hotspot offset when drawing the cursor. Signed-off-by: Gerd Hoffmann --- include/ui/spice-display.h | 3 ++- ui/spice-display.c | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'ui/spice-display.c') diff --git a/include/ui/spice-display.h b/include/ui/spice-display.h index 53883a17fc..b25328a6ba 100644 --- a/include/ui/spice-display.h +++ b/include/ui/spice-display.h @@ -97,7 +97,8 @@ struct SimpleSpiceDisplay { /* cursor (without qxl): displaychangelistener -> spice server */ SimpleSpiceCursor *ptr_define; SimpleSpiceCursor *ptr_move; - uint16_t ptr_x, ptr_y; + int16_t ptr_x, ptr_y; + int16_t hot_x, hot_y; /* cursor (with qxl): qxl local renderer -> displaychangelistener */ QEMUCursor *cursor; diff --git a/ui/spice-display.c b/ui/spice-display.c index bf66cc92f9..a09f6f8483 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -275,8 +275,8 @@ qemu_spice_create_cursor_update(SimpleSpiceDisplay *ssd, if (c) { ccmd->type = QXL_CURSOR_SET; - ccmd->u.set.position.x = ssd->ptr_x; - ccmd->u.set.position.y = ssd->ptr_y; + ccmd->u.set.position.x = ssd->ptr_x + ssd->hot_x; + ccmd->u.set.position.y = ssd->ptr_y + ssd->hot_y; ccmd->u.set.visible = true; ccmd->u.set.shape = (uintptr_t)cursor; cursor->header.unique = ssd->unique++; @@ -290,8 +290,8 @@ qemu_spice_create_cursor_update(SimpleSpiceDisplay *ssd, memcpy(cursor->chunk.data, c->data, size); } else { ccmd->type = QXL_CURSOR_MOVE; - ccmd->u.position.x = ssd->ptr_x; - ccmd->u.position.y = ssd->ptr_y; + ccmd->u.position.x = ssd->ptr_x + ssd->hot_x; + ccmd->u.position.y = ssd->ptr_y + ssd->hot_y; } ccmd->release_info.id = (uintptr_t)(&update->ext); @@ -748,6 +748,8 @@ static void display_mouse_define(DisplayChangeListener *dcl, SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl); qemu_mutex_lock(&ssd->lock); + ssd->hot_x = c->hot_x; + ssd->hot_y = c->hot_y; if (ssd->ptr_move) { g_free(ssd->ptr_move); ssd->ptr_move = NULL; -- cgit 1.4.1 From 700cd855def54c2a9f2b6a016dcebf75fe19c238 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Tue, 24 Mar 2015 17:50:13 +0100 Subject: spice: learn to hide cursor Signed-off-by: Gerd Hoffmann --- ui/spice-display.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ui/spice-display.c') diff --git a/ui/spice-display.c b/ui/spice-display.c index a09f6f8483..c71a059e35 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -260,7 +260,8 @@ static void qemu_spice_create_update(SimpleSpiceDisplay *ssd) static SimpleSpiceCursor* qemu_spice_create_cursor_update(SimpleSpiceDisplay *ssd, - QEMUCursor *c) + QEMUCursor *c, + int on) { size_t size = c ? c->width * c->height * 4 : 0; SimpleSpiceCursor *update; @@ -288,6 +289,8 @@ qemu_spice_create_cursor_update(SimpleSpiceDisplay *ssd, cursor->data_size = size; cursor->chunk.data_size = size; memcpy(cursor->chunk.data, c->data, size); + } else if (!on) { + ccmd->type = QXL_CURSOR_HIDE; } else { ccmd->type = QXL_CURSOR_MOVE; ccmd->u.position.x = ssd->ptr_x + ssd->hot_x; @@ -738,7 +741,7 @@ static void display_mouse_set(DisplayChangeListener *dcl, if (ssd->ptr_move) { g_free(ssd->ptr_move); } - ssd->ptr_move = qemu_spice_create_cursor_update(ssd, NULL); + ssd->ptr_move = qemu_spice_create_cursor_update(ssd, NULL, on); qemu_mutex_unlock(&ssd->lock); } @@ -757,7 +760,7 @@ static void display_mouse_define(DisplayChangeListener *dcl, if (ssd->ptr_define) { g_free(ssd->ptr_define); } - ssd->ptr_define = qemu_spice_create_cursor_update(ssd, c); + ssd->ptr_define = qemu_spice_create_cursor_update(ssd, c, 0); qemu_mutex_unlock(&ssd->lock); } -- cgit 1.4.1