Comments
Patch
From 503679f3e1bab80e1bbb465d5b3532fe2aae3c4e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?=
<Fabiano.Fidencio@fit-tecnologia.org.br>
Date: Wed, 22 Feb 2012 01:56:03 -0200
Subject: [PATCH] Revert "spice: don't call displaystate callbacks from spice
server context."
This reverts commit 075360945860ad9bdd491921954b383bf762b0e5, that
introduce a bug in SDL/VNC, where cursor is not being rendered.
This bug occurs because cursor_define() and mouse_set() callbacks are
being called only locally, in spice-display.c
So, until we find out a good solution for all displaystates, let's
revert it.
---
hw/qxl-render.c | 25 +++++++++++++------------
ui/spice-display.c | 12 ------------
ui/spice-display.h | 3 ---
3 files changed, 13 insertions(+), 27 deletions(-)
@@ -197,6 +197,7 @@ void qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext)
QXLCursorCmd *cmd = qxl_phys2virt(qxl, ext->cmd.data, ext->group_id);
QXLCursor *cursor;
QEMUCursor *c;
+ int x = -1, y = -1;
if (!qxl->ssd.ds->mouse_set || !qxl->ssd.ds->cursor_define) {
return;
@@ -209,6 +210,8 @@ void qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext)
}
switch (cmd->type) {
case QXL_CURSOR_SET:
+ x = cmd->u.set.position.x;
+ y = cmd->u.set.position.y;
cursor = qxl_phys2virt(qxl, cmd->u.set.shape, ext->group_id);
if (cursor->chunk.data_size != cursor->data_size) {
fprintf(stderr, "%s: multiple chunks\n", __FUNCTION__);
@@ -218,20 +221,18 @@ void qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext)
if (c == NULL) {
c = cursor_builtin_left_ptr();
}
- qemu_mutex_lock(&qxl->ssd.lock);
- if (qxl->ssd.cursor) {
- cursor_put(qxl->ssd.cursor);
- }
- qxl->ssd.cursor = c;
- qxl->ssd.mouse_x = cmd->u.set.position.x;
- qxl->ssd.mouse_y = cmd->u.set.position.y;
- qemu_mutex_unlock(&qxl->ssd.lock);
+ qemu_mutex_lock_iothread();
+ qxl->ssd.ds->cursor_define(c);
+ qxl->ssd.ds->mouse_set(x, y, 1);
+ qemu_mutex_unlock_iothread();
+ cursor_put(c);
break;
case QXL_CURSOR_MOVE:
- qemu_mutex_lock(&qxl->ssd.lock);
- qxl->ssd.mouse_x = cmd->u.position.x;
- qxl->ssd.mouse_y = cmd->u.position.y;
- qemu_mutex_unlock(&qxl->ssd.lock);
+ x = cmd->u.position.x;
+ y = cmd->u.position.y;
+ qemu_mutex_lock_iothread();
+ qxl->ssd.ds->mouse_set(x, y, 1);
+ qemu_mutex_unlock_iothread();
break;
}
}
@@ -271,8 +271,6 @@ void qemu_spice_display_init_common(SimpleSpiceDisplay *ssd, DisplayState *ds)
{
ssd->ds = ds;
qemu_mutex_init(&ssd->lock);
- ssd->mouse_x = -1;
- ssd->mouse_y = -1;
ssd->bufsize = (16 * 1024 * 1024);
ssd->buf = g_malloc(ssd->bufsize);
}
@@ -327,16 +325,6 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd)
ssd->update = qemu_spice_create_update(ssd);
ssd->notify++;
}
- if (ssd->cursor) {
- ssd->ds->cursor_define(ssd->cursor);
- cursor_put(ssd->cursor);
- ssd->cursor = NULL;
- }
- if (ssd->mouse_x != -1 && ssd->mouse_y != -1) {
- ssd->ds->mouse_set(ssd->mouse_x, ssd->mouse_y, 1);
- ssd->mouse_x = -1;
- ssd->mouse_y = -1;
- }
qemu_mutex_unlock(&ssd->lock);
if (ssd->notify) {
@@ -20,7 +20,6 @@
#include <spice/qxl_dev.h>
#include "qemu-thread.h"
-#include "console.h"
#include "pflib.h"
#include "sysemu.h"
@@ -71,8 +70,6 @@ struct SimpleSpiceDisplay {
*/
QemuMutex lock;
SimpleSpiceUpdate *update;
- QEMUCursor *cursor;
- int mouse_x, mouse_y;
};
struct SimpleSpiceUpdate {
--
1.7.7.6