* [Qemu-devel] [PATCH 1/9] qxl: fix warnings on 32bit
2012-02-21 10:59 [Qemu-devel] [PULL] spice patch queue Gerd Hoffmann
@ 2012-02-21 10:59 ` Gerd Hoffmann
2012-02-21 10:59 ` [Qemu-devel] [PATCH 2/9] qxl: don't render stuff when the vm is stopped Gerd Hoffmann
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2012-02-21 10:59 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/qxl.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/qxl.c b/hw/qxl.c
index ac69125..f421a45 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -625,7 +625,7 @@ static void interface_release_resource(QXLInstance *sin,
if (ext.group_id == MEMSLOT_GROUP_HOST) {
/* host group -> vga mode update request */
- qemu_spice_destroy_update(&qxl->ssd, (void*)ext.info->id);
+ qemu_spice_destroy_update(&qxl->ssd, (void *)(intptr_t)ext.info->id);
return;
}
@@ -748,7 +748,8 @@ static void interface_async_complete(QXLInstance *sin, uint64_t cookie)
qxl->current_async = QXL_UNDEFINED_IO;
qemu_mutex_unlock(&qxl->async_lock);
- dprint(qxl, 2, "async_complete: %d (%ld) done\n", current_async, cookie);
+ dprint(qxl, 2, "async_complete: %d (%" PRId64 ") done\n",
+ current_async, cookie);
switch (current_async) {
case QXL_IO_CREATE_PRIMARY_ASYNC:
qxl_create_guest_primary_complete(qxl);
@@ -1015,7 +1016,7 @@ void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL pqxl, int group_id)
switch (group_id) {
case MEMSLOT_GROUP_HOST:
- return (void*)offset;
+ return (void *)(intptr_t)offset;
case MEMSLOT_GROUP_GUEST:
PANIC_ON(slot >= NUM_MEMSLOTS);
PANIC_ON(!qxl->guest_slots[slot].active);
--
1.7.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH 2/9] qxl: don't render stuff when the vm is stopped.
2012-02-21 10:59 [Qemu-devel] [PULL] spice patch queue Gerd Hoffmann
2012-02-21 10:59 ` [Qemu-devel] [PATCH 1/9] qxl: fix warnings on 32bit Gerd Hoffmann
@ 2012-02-21 10:59 ` Gerd Hoffmann
2012-02-21 10:59 ` [Qemu-devel] [PATCH 3/9] qxl: set only off-screen surfaces dirty instead of the whole vram Gerd Hoffmann
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2012-02-21 10:59 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
This patch fixes the local qxl renderer to not kick spice-server
in case the vm is stopped. First it is largely pointless because
we ask spice-server to process all not-yet processed commands when
the vm is stopped, so there isn't much do do anyway. Second we
avoid triggering an assert in spice-server.
The patch makes sure we still honor redraw requests, even if we don't
ask spice-server for updates. This is needed to handle displaysurface
changes with a stopped vm correctly.
With this patch applied it is possible to take screen shots (via
screendump monitor command) from a qxl gpu even in case the guest
is stopped.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/qxl-render.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/hw/qxl-render.c b/hw/qxl-render.c
index 133d093..7084143 100644
--- a/hw/qxl-render.c
+++ b/hw/qxl-render.c
@@ -121,19 +121,17 @@ void qxl_render_update(PCIQXLDevice *qxl)
dpy_resize(vga->ds);
}
- if (!qxl->guest_primary.commands) {
- return;
- }
- qxl->guest_primary.commands = 0;
-
update.left = 0;
update.right = qxl->guest_primary.surface.width;
update.top = 0;
update.bottom = qxl->guest_primary.surface.height;
memset(dirty, 0, sizeof(dirty));
- qxl_spice_update_area(qxl, 0, &update,
- dirty, ARRAY_SIZE(dirty), 1, QXL_SYNC);
+ if (runstate_is_running() && qxl->guest_primary.commands) {
+ qxl->guest_primary.commands = 0;
+ qxl_spice_update_area(qxl, 0, &update,
+ dirty, ARRAY_SIZE(dirty), 1, QXL_SYNC);
+ }
if (redraw) {
memset(dirty, 0, sizeof(dirty));
dirty[0] = update;
--
1.7.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH 3/9] qxl: set only off-screen surfaces dirty instead of the whole vram
2012-02-21 10:59 [Qemu-devel] [PULL] spice patch queue Gerd Hoffmann
2012-02-21 10:59 ` [Qemu-devel] [PATCH 1/9] qxl: fix warnings on 32bit Gerd Hoffmann
2012-02-21 10:59 ` [Qemu-devel] [PATCH 2/9] qxl: don't render stuff when the vm is stopped Gerd Hoffmann
@ 2012-02-21 10:59 ` Gerd Hoffmann
2012-02-21 10:59 ` [Qemu-devel] [PATCH 4/9] qxl: make sure primary surface is saved on migration also in compat mode Gerd Hoffmann
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2012-02-21 10:59 UTC (permalink / raw)
To: qemu-devel; +Cc: Yonit Halperin, Gerd Hoffmann
From: Yonit Halperin <yhalperi@redhat.com>
We used to assure the guest surfaces were saved before migration by
setting the whole vram dirty. This patch sets dirty only the areas
that are actually used in the vram.
Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/qxl.c | 53 ++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 44 insertions(+), 9 deletions(-)
diff --git a/hw/qxl.c b/hw/qxl.c
index f421a45..b544f31 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1007,7 +1007,7 @@ static void qxl_reset_surfaces(PCIQXLDevice *d)
qxl_spice_destroy_surfaces(d, QXL_SYNC);
}
-/* called from spice server thread context only */
+/* can be also called from spice server thread context */
void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL pqxl, int group_id)
{
uint64_t phys = le64_to_cpu(pqxl);
@@ -1466,6 +1466,46 @@ static void qxl_hw_text_update(void *opaque, console_ch_t *chardata)
}
}
+static void qxl_dirty_surfaces(PCIQXLDevice *qxl)
+{
+ intptr_t vram_start;
+ int i;
+
+ if (qxl->mode != QXL_MODE_NATIVE) {
+ return;
+ }
+
+ /* dirty the primary surface */
+ qxl_set_dirty(&qxl->vga.vram, qxl->shadow_rom.draw_area_offset,
+ qxl->shadow_rom.surface0_area_size);
+
+ vram_start = (intptr_t)memory_region_get_ram_ptr(&qxl->vram_bar);
+
+ /* dirty the off-screen surfaces */
+ for (i = 0; i < NUM_SURFACES; i++) {
+ QXLSurfaceCmd *cmd;
+ intptr_t surface_offset;
+ int surface_size;
+
+ if (qxl->guest_surfaces.cmds[i] == 0) {
+ continue;
+ }
+
+ cmd = qxl_phys2virt(qxl, qxl->guest_surfaces.cmds[i],
+ MEMSLOT_GROUP_GUEST);
+ assert(cmd->type == QXL_SURFACE_CMD_CREATE);
+ surface_offset = (intptr_t)qxl_phys2virt(qxl,
+ cmd->u.surface_create.data,
+ MEMSLOT_GROUP_GUEST);
+ surface_offset -= vram_start;
+ surface_size = cmd->u.surface_create.height *
+ abs(cmd->u.surface_create.stride);
+ dprint(qxl, 3, "%s: dirty surface %d, offset %d, size %d\n", __func__,
+ i, (int)surface_offset, surface_size);
+ qxl_set_dirty(&qxl->vram_bar, surface_offset, surface_size);
+ }
+}
+
static void qxl_vm_change_state_handler(void *opaque, int running,
RunState state)
{
@@ -1479,14 +1519,9 @@ static void qxl_vm_change_state_handler(void *opaque, int running,
* called
*/
qxl_update_irq(qxl);
- } else if (qxl->mode == QXL_MODE_NATIVE) {
- /* dirty all vram (which holds surfaces) and devram (primary surface)
- * to make sure they are saved */
- /* FIXME #1: should go out during "live" stage */
- /* FIXME #2: we only need to save the areas which are actually used */
- qxl_set_dirty(&qxl->vram_bar, 0, qxl->vram_size);
- qxl_set_dirty(&qxl->vga.vram, qxl->shadow_rom.draw_area_offset,
- qxl->shadow_rom.surface0_area_size);
+ } else {
+ /* make sure surfaces are saved before migration */
+ qxl_dirty_surfaces(qxl);
}
}
--
1.7.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH 4/9] qxl: make sure primary surface is saved on migration also in compat mode
2012-02-21 10:59 [Qemu-devel] [PULL] spice patch queue Gerd Hoffmann
` (2 preceding siblings ...)
2012-02-21 10:59 ` [Qemu-devel] [PATCH 3/9] qxl: set only off-screen surfaces dirty instead of the whole vram Gerd Hoffmann
@ 2012-02-21 10:59 ` Gerd Hoffmann
2012-02-21 10:59 ` [Qemu-devel] [PATCH 5/9] Add SPICE support to add_client monitor command Gerd Hoffmann
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2012-02-21 10:59 UTC (permalink / raw)
To: qemu-devel; +Cc: Yonit Halperin, Gerd Hoffmann
From: Yonit Halperin <yhalperi@redhat.com>
RHBZ #790083
Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/qxl.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/hw/qxl.c b/hw/qxl.c
index b544f31..5c6b556 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1471,7 +1471,7 @@ static void qxl_dirty_surfaces(PCIQXLDevice *qxl)
intptr_t vram_start;
int i;
- if (qxl->mode != QXL_MODE_NATIVE) {
+ if (qxl->mode != QXL_MODE_NATIVE && qxl->mode != QXL_MODE_COMPAT) {
return;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH 5/9] Add SPICE support to add_client monitor command
2012-02-21 10:59 [Qemu-devel] [PULL] spice patch queue Gerd Hoffmann
` (3 preceding siblings ...)
2012-02-21 10:59 ` [Qemu-devel] [PATCH 4/9] qxl: make sure primary surface is saved on migration also in compat mode Gerd Hoffmann
@ 2012-02-21 10:59 ` Gerd Hoffmann
2012-02-21 10:59 ` [Qemu-devel] [PATCH 6/9] spice: support ipv6 channel address in monitor events and in spice info Gerd Hoffmann
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2012-02-21 10:59 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
From: Daniel P. Berrange <berrange@redhat.com>
With the acceptance of some new APIs to libspice-server.so it
is possible to add support for SPICE to the 'add_client'
monitor command, bringing parity with VNC. Since SPICE can
use TLS or plain connections, the command also gains a new
'tls' parameter to specify whether TLS should be attempted
on the injected client sockets.
This new feature is only enabled if building against a
libspice-server >= 0.10.1
* qmp-commands.hx: Add 'tls' parameter & missing doc for
'skipauth' parameter
* monitor.c: Wire up SPICE for 'add_client' command
* ui/qemu-spice.h, ui/spice-core.c: Add qemu_spice_display_add_client
API to wire up from monitor
[1] http://cgit.freedesktop.org/spice/spice/commit/server/spice.h?id=d55b68b6b44f2499278fa860fb47ff22f5011faa
http://cgit.freedesktop.org/spice/spice/commit/server/spice.h?id=bd07dde530d9504e1cfe7ed5837fc00c26f36716
Changes in v3:
- Added 'optional' flag to new parameters documented
- Added no-op impl of qemu_spice_display_add_client when
SPICE is disabled during build
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
monitor.c | 9 +++++++--
qmp-commands.hx | 6 ++++--
ui/qemu-spice.h | 7 +++++++
ui/spice-core.c | 13 +++++++++++++
4 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/monitor.c b/monitor.c
index aadbdcb..0d4daad 100644
--- a/monitor.c
+++ b/monitor.c
@@ -823,13 +823,18 @@ static int add_graphics_client(Monitor *mon, const QDict *qdict, QObject **ret_d
CharDriverState *s;
if (strcmp(protocol, "spice") == 0) {
+ int fd = monitor_get_fd(mon, fdname);
+ int skipauth = qdict_get_try_bool(qdict, "skipauth", 0);
+ int tls = qdict_get_try_bool(qdict, "tls", 0);
if (!using_spice) {
/* correct one? spice isn't a device ,,, */
qerror_report(QERR_DEVICE_NOT_ACTIVE, "spice");
return -1;
}
- qerror_report(QERR_ADD_CLIENT_FAILED);
- return -1;
+ if (qemu_spice_display_add_client(fd, skipauth, tls) < 0) {
+ close(fd);
+ }
+ return 0;
#ifdef CONFIG_VNC
} else if (strcmp(protocol, "vnc") == 0) {
int fd = monitor_get_fd(mon, fdname);
diff --git a/qmp-commands.hx b/qmp-commands.hx
index b5e2ab8..dee95f1 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -910,8 +910,8 @@ EQMP
{
.name = "add_client",
- .args_type = "protocol:s,fdname:s,skipauth:b?",
- .params = "protocol fdname skipauth",
+ .args_type = "protocol:s,fdname:s,skipauth:b?,tls:b?",
+ .params = "protocol fdname skipauth tls",
.help = "add a graphics client",
.user_print = monitor_user_noop,
.mhandler.cmd_new = add_graphics_client,
@@ -927,6 +927,8 @@ Arguments:
- "protocol": protocol name (json-string)
- "fdname": file descriptor name (json-string)
+- "skipauth": whether to skip authentication (json-bool, optional)
+- "tls": whether to perform TLS (json-bool, optional)
Example:
diff --git a/ui/qemu-spice.h b/ui/qemu-spice.h
index c35b29c..680206a 100644
--- a/ui/qemu-spice.h
+++ b/ui/qemu-spice.h
@@ -33,6 +33,7 @@ void qemu_spice_init(void);
void qemu_spice_input_init(void);
void qemu_spice_audio_init(void);
void qemu_spice_display_init(DisplayState *ds);
+int qemu_spice_display_add_client(int csock, int skipauth, int tls);
int qemu_spice_add_interface(SpiceBaseInstance *sin);
int qemu_spice_set_passwd(const char *passwd,
bool fail_if_connected, bool disconnect_if_connected);
@@ -68,6 +69,12 @@ static inline int qemu_spice_migrate_info(const char *h, int p, int t,
return -1;
}
+static inline int qemu_spice_display_add_client(int csock, int skipauth,
+ int tls)
+{
+ return -1;
+}
+
#endif /* CONFIG_SPICE */
#endif /* QEMU_SPICE_H */
diff --git a/ui/spice-core.c b/ui/spice-core.c
index b4629f8..05cb745 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -747,6 +747,19 @@ int qemu_spice_set_pw_expire(time_t expires)
return qemu_spice_set_ticket(false, false);
}
+int qemu_spice_display_add_client(int csock, int skipauth, int tls)
+{
+#if SPICE_SERVER_VERSION >= 0x000a01
+ if (tls) {
+ return spice_server_add_ssl_client(spice_server, csock, skipauth);
+ } else {
+ return spice_server_add_client(spice_server, csock, skipauth);
+ }
+#else
+ return -1;
+#endif
+}
+
static void spice_register_config(void)
{
qemu_add_opts(&qemu_spice_opts);
--
1.7.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH 6/9] spice: support ipv6 channel address in monitor events and in spice info
2012-02-21 10:59 [Qemu-devel] [PULL] spice patch queue Gerd Hoffmann
` (4 preceding siblings ...)
2012-02-21 10:59 ` [Qemu-devel] [PATCH 5/9] Add SPICE support to add_client monitor command Gerd Hoffmann
@ 2012-02-21 10:59 ` Gerd Hoffmann
2012-02-21 10:59 ` [Qemu-devel] [PATCH 7/9] qxl: drop vram bar minimum size Gerd Hoffmann
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2012-02-21 10:59 UTC (permalink / raw)
To: qemu-devel; +Cc: Yonit Halperin, Gerd Hoffmann
From: Yonit Halperin <yhalperi@redhat.com>
RHBZ #788444
CC: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/spice-core.c | 37 ++++++++++++++++++++++++++++++++-----
1 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 05cb745..1308a3d 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -220,10 +220,23 @@ static void channel_event(int event, SpiceChannelEventInfo *info)
}
client = qdict_new();
- add_addr_info(client, &info->paddr, info->plen);
-
server = qdict_new();
- add_addr_info(server, &info->laddr, info->llen);
+
+#ifdef SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT
+ if (info->flags & SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT) {
+ add_addr_info(client, (struct sockaddr *)&info->paddr_ext,
+ info->plen_ext);
+ add_addr_info(server, (struct sockaddr *)&info->laddr_ext,
+ info->llen_ext);
+ } else {
+ fprintf(stderr, "spice: %s, extended address is expected\n",
+ __func__);
+#endif
+ add_addr_info(client, &info->paddr, info->plen);
+ add_addr_info(server, &info->laddr, info->llen);
+#ifdef SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT
+ }
+#endif
if (event == SPICE_CHANNEL_EVENT_INITIALIZED) {
qdict_put(server, "auth", qstring_from_str(auth));
@@ -376,16 +389,30 @@ static SpiceChannelList *qmp_query_spice_channels(void)
QTAILQ_FOREACH(item, &channel_list, link) {
SpiceChannelList *chan;
char host[NI_MAXHOST], port[NI_MAXSERV];
+ struct sockaddr *paddr;
+ socklen_t plen;
chan = g_malloc0(sizeof(*chan));
chan->value = g_malloc0(sizeof(*chan->value));
- getnameinfo(&item->info->paddr, item->info->plen,
+#ifdef SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT
+ if (item->info->flags & SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT) {
+ paddr = (struct sockaddr *)&item->info->paddr_ext;
+ plen = item->info->plen_ext;
+ } else {
+#endif
+ paddr = &item->info->paddr;
+ plen = item->info->plen;
+#ifdef SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT
+ }
+#endif
+
+ getnameinfo(paddr, plen,
host, sizeof(host), port, sizeof(port),
NI_NUMERICHOST | NI_NUMERICSERV);
chan->value->host = g_strdup(host);
chan->value->port = g_strdup(port);
- chan->value->family = g_strdup(inet_strfamily(item->info->paddr.sa_family));
+ chan->value->family = g_strdup(inet_strfamily(paddr->sa_family));
chan->value->connection_id = item->info->connection_id;
chan->value->channel_type = item->info->type;
--
1.7.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH 7/9] qxl: drop vram bar minimum size
2012-02-21 10:59 [Qemu-devel] [PULL] spice patch queue Gerd Hoffmann
` (5 preceding siblings ...)
2012-02-21 10:59 ` [Qemu-devel] [PATCH 6/9] spice: support ipv6 channel address in monitor events and in spice info Gerd Hoffmann
@ 2012-02-21 10:59 ` Gerd Hoffmann
2012-02-21 10:59 ` [Qemu-devel] [PATCH 8/9] qxl: move ram size init to new function Gerd Hoffmann
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2012-02-21 10:59 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
There is no reason to require a minimum size of 16 MB for the vram.
Lower the limit to 4096 (one page). Make it disapper completely would
break guests.
---
hw/qxl.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/qxl.c b/hw/qxl.c
index 5c6b556..4de4b8d 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1592,8 +1592,8 @@ static int qxl_init_common(PCIQXLDevice *qxl)
init_qxl_rom(qxl);
init_qxl_ram(qxl);
- if (qxl->vram_size < 16 * 1024 * 1024) {
- qxl->vram_size = 16 * 1024 * 1024;
+ if (qxl->vram_size < 4096) {
+ qxl->vram_size = 4096;
}
if (qxl->revision == 1) {
qxl->vram_size = 4096;
--
1.7.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH 8/9] qxl: move ram size init to new function
2012-02-21 10:59 [Qemu-devel] [PULL] spice patch queue Gerd Hoffmann
` (6 preceding siblings ...)
2012-02-21 10:59 ` [Qemu-devel] [PATCH 7/9] qxl: drop vram bar minimum size Gerd Hoffmann
@ 2012-02-21 10:59 ` Gerd Hoffmann
2012-02-21 10:59 ` [Qemu-devel] [PATCH 9/9] qxl: add user-friendly bar size properties Gerd Hoffmann
2012-02-22 14:44 ` [Qemu-devel] [PULL] spice patch queue Anthony Liguori
9 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2012-02-21 10:59 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Factor memory bar sizing bits out to a separate function.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/qxl.c | 41 ++++++++++++++++++++++-------------------
1 files changed, 22 insertions(+), 19 deletions(-)
diff --git a/hw/qxl.c b/hw/qxl.c
index 4de4b8d..38bb90e 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1554,6 +1554,25 @@ static DisplayChangeListener display_listener = {
.dpy_refresh = display_refresh,
};
+static void qxl_init_ramsize(PCIQXLDevice *qxl, uint32_t ram_min_mb)
+{
+ /* vga ram (bar 0) */
+ if (qxl->vga.vram_size < ram_min_mb * 1024 * 1024) {
+ qxl->vga.vram_size = ram_min_mb * 1024 * 1024;
+ }
+
+ /* vram (surfaces, bar 1) */
+ if (qxl->vram_size < 4096) {
+ qxl->vram_size = 4096;
+ }
+ if (qxl->revision == 1) {
+ qxl->vram_size = 4096;
+ }
+
+ qxl->vga.vram_size = msb_mask(qxl->vga.vram_size * 2 - 1);
+ qxl->vram_size = msb_mask(qxl->vram_size * 2 - 1);
+}
+
static int qxl_init_common(PCIQXLDevice *qxl)
{
uint8_t* config = qxl->pci.config;
@@ -1592,13 +1611,6 @@ static int qxl_init_common(PCIQXLDevice *qxl)
init_qxl_rom(qxl);
init_qxl_ram(qxl);
- if (qxl->vram_size < 4096) {
- qxl->vram_size = 4096;
- }
- if (qxl->revision == 1) {
- qxl->vram_size = 4096;
- }
- qxl->vram_size = msb_mask(qxl->vram_size * 2 - 1);
memory_region_init_ram(&qxl->vram_bar, "qxl.vram", qxl->vram_size);
vmstate_register_ram(&qxl->vram_bar, &qxl->pci.qdev);
@@ -1641,15 +1653,11 @@ static int qxl_init_primary(PCIDevice *dev)
{
PCIQXLDevice *qxl = DO_UPCAST(PCIQXLDevice, pci, dev);
VGACommonState *vga = &qxl->vga;
- ram_addr_t ram_size = msb_mask(qxl->vga.vram_size * 2 - 1);
PortioList *qxl_vga_port_list = g_new(PortioList, 1);
qxl->id = 0;
-
- if (ram_size < 32 * 1024 * 1024) {
- ram_size = 32 * 1024 * 1024;
- }
- vga_common_init(vga, ram_size);
+ qxl_init_ramsize(qxl, 32);
+ vga_common_init(vga, qxl->vga.vram_size);
vga_init(vga, pci_address_space(dev), pci_address_space_io(dev), false);
portio_list_init(qxl_vga_port_list, qxl_vga_portio_list, vga, "vga");
portio_list_add(qxl_vga_port_list, pci_address_space_io(dev), 0x3b0);
@@ -1668,14 +1676,9 @@ static int qxl_init_secondary(PCIDevice *dev)
{
static int device_id = 1;
PCIQXLDevice *qxl = DO_UPCAST(PCIQXLDevice, pci, dev);
- ram_addr_t ram_size = msb_mask(qxl->vga.vram_size * 2 - 1);
qxl->id = device_id++;
-
- if (ram_size < 16 * 1024 * 1024) {
- ram_size = 16 * 1024 * 1024;
- }
- qxl->vga.vram_size = ram_size;
+ qxl_init_ramsize(qxl, 16);
memory_region_init_ram(&qxl->vga.vram, "qxl.vgavram", qxl->vga.vram_size);
vmstate_register_ram(&qxl->vga.vram, &qxl->pci.qdev);
qxl->vga.vram_ptr = memory_region_get_ram_ptr(&qxl->vga.vram);
--
1.7.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [PATCH 9/9] qxl: add user-friendly bar size properties
2012-02-21 10:59 [Qemu-devel] [PULL] spice patch queue Gerd Hoffmann
` (7 preceding siblings ...)
2012-02-21 10:59 ` [Qemu-devel] [PATCH 8/9] qxl: move ram size init to new function Gerd Hoffmann
@ 2012-02-21 10:59 ` Gerd Hoffmann
2012-02-22 14:44 ` [Qemu-devel] [PULL] spice patch queue Anthony Liguori
9 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2012-02-21 10:59 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Add two properties to specify bar sizes in megabytes instead of bytes,
which is alot more user-friendly.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/qxl.c | 8 ++++++++
hw/qxl.h | 4 ++++
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/hw/qxl.c b/hw/qxl.c
index 38bb90e..87ad49a 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1557,11 +1557,17 @@ static DisplayChangeListener display_listener = {
static void qxl_init_ramsize(PCIQXLDevice *qxl, uint32_t ram_min_mb)
{
/* vga ram (bar 0) */
+ if (qxl->ram_size_mb != -1) {
+ qxl->vga.vram_size = qxl->ram_size_mb * 1024 * 1024;
+ }
if (qxl->vga.vram_size < ram_min_mb * 1024 * 1024) {
qxl->vga.vram_size = ram_min_mb * 1024 * 1024;
}
/* vram (surfaces, bar 1) */
+ if (qxl->vram_size_mb != -1) {
+ qxl->vram_size = qxl->vram_size_mb * 1024 * 1024;
+ }
if (qxl->vram_size < 4096) {
qxl->vram_size = 4096;
}
@@ -1860,6 +1866,8 @@ static Property qxl_properties[] = {
DEFINE_PROP_UINT32("debug", PCIQXLDevice, debug, 0),
DEFINE_PROP_UINT32("guestdebug", PCIQXLDevice, guestdebug, 0),
DEFINE_PROP_UINT32("cmdlog", PCIQXLDevice, cmdlog, 0),
+ DEFINE_PROP_UINT32("ram_size_mb", PCIQXLDevice, ram_size_mb, -1),
+ DEFINE_PROP_UINT32("vram_size_mb", PCIQXLDevice, vram_size_mb, -1),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/hw/qxl.h b/hw/qxl.h
index 766aa6d..d062991 100644
--- a/hw/qxl.h
+++ b/hw/qxl.h
@@ -89,6 +89,10 @@ typedef struct PCIQXLDevice {
/* io bar */
MemoryRegion io_bar;
+
+ /* user-friendly properties (in megabytes) */
+ uint32_t ram_size_mb;
+ uint32_t vram_size_mb;
} PCIQXLDevice;
#define PANIC_ON(x) if ((x)) { \
--
1.7.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [PULL] spice patch queue
2012-02-21 10:59 [Qemu-devel] [PULL] spice patch queue Gerd Hoffmann
` (8 preceding siblings ...)
2012-02-21 10:59 ` [Qemu-devel] [PATCH 9/9] qxl: add user-friendly bar size properties Gerd Hoffmann
@ 2012-02-22 14:44 ` Anthony Liguori
9 siblings, 0 replies; 11+ messages in thread
From: Anthony Liguori @ 2012-02-22 14:44 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On 02/21/2012 04:59 AM, Gerd Hoffmann wrote:
> Hi,
>
> Here is the spice patch queue with a collection of little improvements
> and bugfixes. No major stuff. See individual patches for details.
Pulled. Thanks.
Regards,
Anthony Liguori
> please pull,
> Gerd
>
> The following changes since commit 99c7f87826337fa81f2f0f9baa9ca0a44faf90e9:
>
> input: send kbd+mouse events only to running guests. (2012-02-17 11:02:55 -0600)
>
> are available in the git repository at:
> git://anongit.freedesktop.org/spice/qemu spice.v48
>
> Daniel P. Berrange (1):
> Add SPICE support to add_client monitor command
>
> Gerd Hoffmann (5):
> qxl: fix warnings on 32bit
> qxl: don't render stuff when the vm is stopped.
> qxl: drop vram bar minimum size
> qxl: move ram size init to new function
> qxl: add user-friendly bar size properties
>
> Yonit Halperin (3):
> qxl: set only off-screen surfaces dirty instead of the whole vram
> qxl: make sure primary surface is saved on migration also in compat mode
> spice: support ipv6 channel address in monitor events and in spice info
>
> hw/qxl-render.c | 12 +++----
> hw/qxl.c | 109 +++++++++++++++++++++++++++++++++++++++----------------
> hw/qxl.h | 4 ++
> monitor.c | 9 ++++-
> qmp-commands.hx | 6 ++-
> ui/qemu-spice.h | 7 ++++
> ui/spice-core.c | 50 +++++++++++++++++++++++---
> 7 files changed, 150 insertions(+), 47 deletions(-)
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread