diff options
author | Frediano Ziglio <fziglio@redhat.com> | 2015-06-19 11:56:05 +0100 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2015-06-26 16:17:42 +0200 |
commit | 6d4e58f70ddf9c178e2cc20dd5a3ade8b95fd142 (patch) | |
tree | 5fe73a982bbfb6943687d3f40ab941917d836ef7 /server/red_dispatcher.c | |
parent | 878d81dae494fab6b67ba34254d389e7f42d7d9d (diff) | |
download | spice-6d4e58f70ddf9c178e2cc20dd5a3ade8b95fd142.tar.gz spice-6d4e58f70ddf9c178e2cc20dd5a3ade8b95fd142.tar.xz spice-6d4e58f70ddf9c178e2cc20dd5a3ade8b95fd142.zip |
server: allows to set maximum monitors
spice-server will attempt to limit number of monitors.
Guest machine can send monitor list it accepts. Limiting the number sent
by guest will limit the number of monitors client will try to enable.
The guest usually see client monitors enabled and start using it so
not seeing client monitor won't try to enable more monitor.
In this case the additional monitor guest can support will always be
seen as heads with no attached monitors.
This allows limiting monitors number without changing guest drivers.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Diffstat (limited to 'server/red_dispatcher.c')
-rw-r--r-- | server/red_dispatcher.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c index 74adaa2d..a2ef2263 100644 --- a/server/red_dispatcher.c +++ b/server/red_dispatcher.c @@ -66,6 +66,7 @@ struct RedDispatcher { Ring async_commands; pthread_mutex_t async_lock; QXLDevSurfaceCreate surface_create; + unsigned int max_monitors; }; extern uint32_t streaming_video; @@ -693,6 +694,7 @@ static void red_dispatcher_monitors_config_async(RedDispatcher *dispatcher, payload.base.cmd = async_command_alloc(dispatcher, message, cookie); payload.monitors_config = monitors_config; payload.group_id = group_id; + payload.max_monitors = dispatcher->max_monitors; dispatcher_send_message(&dispatcher->dispatcher, message, &payload); } @@ -987,6 +989,12 @@ void spice_qxl_monitors_config_async(QXLInstance *instance, QXLPHYSICAL monitors } SPICE_GNUC_VISIBLE +void spice_qxl_set_max_monitors(QXLInstance *instance, unsigned int max_monitors) +{ + instance->st->dispatcher->max_monitors = MAX(1u, max_monitors); +} + +SPICE_GNUC_VISIBLE void spice_qxl_driver_unload(QXLInstance *instance) { red_dispatcher_driver_unload(instance->st->dispatcher); @@ -1110,6 +1118,8 @@ void red_dispatcher_init(QXLInstance *qxl) red_dispatcher->base.destroy_surface_wait = qxl_worker_destroy_surface_wait; red_dispatcher->base.loadvm_commands = qxl_worker_loadvm_commands; + red_dispatcher->max_monitors = UINT_MAX; + qxl->st->qif->get_init_info(qxl, &init_info); init_data.memslot_id_bits = init_info.memslot_id_bits; |