server/red_dispatcher: client_monitors_config support

Adds two functions:
 - red_dispatcher_use_client_monitors_config:
   check that QXLInterface supports client_monitors_config and that it's
   functional.
 - red_dispatcher_client_monitors_config:
   send the client monitors configuration to the guest.
This commit is contained in:
Alon Levy 2012-09-10 18:30:17 +03:00
parent ce42c76aed
commit dc69ef49d0
2 changed files with 53 additions and 0 deletions

View File

@ -83,6 +83,22 @@ extern spice_wan_compression_t zlib_glz_state;
static RedDispatcher *dispatchers = NULL;
static int red_dispatcher_version_check(int major, int minor)
{
if (num_active_workers > 0) {
RedDispatcher *now = dispatchers;
while (now) {
if (now->base.major_version != major ||
now->base.minor_version < minor) {
return FALSE;
}
now = now->next;
}
return TRUE;
}
return FALSE;
}
static void red_dispatcher_set_display_peer(RedChannel *channel, RedClient *client,
RedsStream *stream, int migration,
int num_common_caps, uint32_t *common_caps, int num_caps,
@ -295,6 +311,39 @@ static void red_dispatcher_update_area(RedDispatcher *dispatcher, uint32_t surfa
&payload);
}
int red_dispatcher_use_client_monitors_config(void)
{
RedDispatcher *now = dispatchers;
if (num_active_workers == 0) {
return FALSE;
}
for (; now ; now = now->next) {
if (!red_dispatcher_version_check(3, 3) ||
!now->qxl->st->qif->client_monitors_config ||
!now->qxl->st->qif->client_monitors_config(now->qxl, NULL)) {
return FALSE;
}
}
return TRUE;
}
void red_dispatcher_client_monitors_config(VDAgentMonitorsConfig *monitors_config)
{
RedDispatcher *now = dispatchers;
while (now) {
if (!now->qxl->st->qif->client_monitors_config ||
!now->qxl->st->qif->client_monitors_config(now->qxl,
monitors_config)) {
spice_warning("spice bug: QXLInterface::client_monitors_config"
" failed/missing unexpectedly\n");
}
now = now->next;
}
}
static AsyncCommand *async_command_alloc(RedDispatcher *dispatcher,
RedWorkerMessage message,
uint64_t cookie)

View File

@ -18,6 +18,8 @@
#ifndef _H_RED_DISPATCHER
#define _H_RED_DISPATCHER
#include "red_channel.h"
struct RedChannelClient;
typedef struct AsyncCommand AsyncCommand;
@ -35,6 +37,8 @@ uint32_t red_dispatcher_qxl_ram_size(void);
int red_dispatcher_qxl_count(void);
void red_dispatcher_async_complete(struct RedDispatcher *, AsyncCommand *);
struct Dispatcher *red_dispatcher_get_dispatcher(struct RedDispatcher *);
int red_dispatcher_use_client_monitors_config(void);
void red_dispatcher_client_monitors_config(VDAgentMonitorsConfig *monitors_config);
typedef struct RedWorkerMessageDisplayConnect {
RedClient * client;