[Spice-commits] 4 commits - server/display-channel.c server/reds.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Mar 11 08:53:52 UTC 2019
server/display-channel.c | 5 +++--
server/reds.c | 38 +++++++++++++++++++++++---------------
2 files changed, 26 insertions(+), 17 deletions(-)
New commits:
commit 679b63fe6ea153d234c876c8a97393870e8212e7
Author: Victor Toso <me at victortoso.com>
Date: Thu Mar 7 07:24:52 2019 +0000
display-channel: monitors config debug: add head number
The difference is subtle but compared to what client receives, this
could help identify values set to the wrong head, e.g:
First we received:
| display-channel.c:180:monitors_config_debug: monitors config count:2 max:4
| display-channel.c:184:monitors_config_debug: +0+0 1015x805
| display-channel.c:184:monitors_config_debug: +1015+0 1024x740
And then:
| display-channel.c:180:monitors_config_debug: monitors config count:3 max:4
| display-channel.c:184:monitors_config_debug: +0+0 1015x805
| display-channel.c:184:monitors_config_debug: +0+0 0x0
| display-channel.c:184:monitors_config_debug: +1015+0 1024x740
In the first debug it would be helpful to have "head 0" and "head 1",
to point out the temporary error in monitor's config message.
Signed-off-by: Victor Toso <victortoso at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/server/display-channel.c b/server/display-channel.c
index e68ed10f..9bb7fa44 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -179,10 +179,11 @@ static void monitors_config_debug(MonitorsConfig *mc)
int i;
spice_debug("monitors config count:%d max:%d", mc->count, mc->max_allowed);
- for (i = 0; i < mc->count; i++)
- spice_debug("+%d+%d %dx%d",
+ for (i = 0; i < mc->count; i++) {
+ spice_debug("head #%d +%d+%d %dx%d", i,
mc->heads[i].x, mc->heads[i].y,
mc->heads[i].width, mc->heads[i].height);
+ }
}
static MonitorsConfig* monitors_config_new(QXLHead *heads, ssize_t nheads, ssize_t max)
commit 105e63dd8149230b3f164567aecd7421c61e6b92
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date: Mon Mar 4 13:50:45 2019 -0600
Switch some boolean fields to 'bool' type
For coding style consistency, use 'bool' when we want to represent a
boolean value.
Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/server/reds.c b/server/reds.c
index 120df831..429f8142 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -231,9 +231,9 @@ typedef enum {
} VDIPortReadStates;
struct RedCharDeviceVDIPortPrivate {
- gboolean agent_attached;
+ bool agent_attached;
uint32_t plug_generation;
- int client_agent_started;
+ bool client_agent_started;
bool agent_supports_graphics_device_info;
/* write to agent */
@@ -486,7 +486,7 @@ static void reds_reset_vdp(RedsState *reds)
* to be sent from the client. This TODO will require server, protocol, and client changes */
dev->priv->write_filter.result = AGENT_MSG_FILTER_DISCARD;
dev->priv->write_filter.discard_all = TRUE;
- dev->priv->client_agent_started = FALSE;
+ dev->priv->client_agent_started = false;
dev->priv->agent_supports_graphics_device_info = false;
/* The client's tokens are set once when the main channel is initialized
@@ -1151,7 +1151,7 @@ void reds_on_main_agent_start(RedsState *reds, MainChannelClient *mcc, uint32_t
spice_assert(reds->vdagent->st && reds->vdagent->st == dev_state);
rcc = RED_CHANNEL_CLIENT(mcc);
client = red_channel_client_get_client(rcc);
- reds->agent_dev->priv->client_agent_started = TRUE;
+ reds->agent_dev->priv->client_agent_started = true;
/*
* Note that in older releases, send_tokens were set to ~0 on both client
* and server. The server ignored the client given tokens.
@@ -3156,7 +3156,7 @@ static RedCharDevice *attach_to_red_agent(RedsState *reds, SpiceCharDeviceInstan
RedCharDeviceVDIPort *dev = reds->agent_dev;
SpiceCharDeviceInterface *sif;
- dev->priv->agent_attached = TRUE;
+ dev->priv->agent_attached = true;
red_char_device_reset_dev_instance(RED_CHAR_DEVICE(dev), sin);
reds->vdagent = sin;
commit 4c8b485ac4a2e561ca42cf4355b27df4990be0fb
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date: Mon Mar 4 13:50:44 2019 -0600
Only send device display info to supported agents
Only send the graphics device display info to agents that advertise the
VD_AGENT_CAP_GRAPHICS_DEVICE_INFO capability
Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/server/reds.c b/server/reds.c
index d48393d5..120df831 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -234,6 +234,7 @@ struct RedCharDeviceVDIPortPrivate {
gboolean agent_attached;
uint32_t plug_generation;
int client_agent_started;
+ bool agent_supports_graphics_device_info;
/* write to agent */
RedCharDeviceWriteBuffer *recv_from_client_buf;
@@ -486,6 +487,7 @@ static void reds_reset_vdp(RedsState *reds)
dev->priv->write_filter.result = AGENT_MSG_FILTER_DISCARD;
dev->priv->write_filter.discard_all = TRUE;
dev->priv->client_agent_started = FALSE;
+ dev->priv->agent_supports_graphics_device_info = false;
/* The client's tokens are set once when the main channel is initialized
* and once upon agent's connection with SPICE_MSG_MAIN_AGENT_CONNECTED_TOKENS.
@@ -813,6 +815,11 @@ static void reds_adjust_agent_capabilities(RedsState *reds, VDAgentMessage *mess
if (!reds->config->agent_file_xfer) {
VD_AGENT_SET_CAPABILITY(capabilities->caps, VD_AGENT_CAP_FILE_XFER_DISABLED);
}
+
+ size_t caps_size = VD_AGENT_CAPS_SIZE_FROM_MSG_SIZE(message->size);
+ reds->agent_dev->priv->agent_supports_graphics_device_info =
+ VD_AGENT_HAS_CAPABILITY(capabilities->caps, caps_size, VD_AGENT_CAP_GRAPHICS_DEVICE_INFO);
+ reds_send_device_display_info(reds);
}
/* reads from the device till completes reading a message that is addressed to the client,
@@ -965,6 +972,10 @@ void reds_send_device_display_info(RedsState *reds)
if (!reds->agent_dev->priv->agent_attached) {
return;
}
+ if (!reds->agent_dev->priv->agent_supports_graphics_device_info) {
+ return;
+ }
+
g_debug("Sending device display info to the agent:");
SpiceMarshaller *m = spice_marshaller_new();
commit 6cb0c19dafd14d31f81233fd1a35c920653d377d
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date: Mon Mar 4 13:50:43 2019 -0600
Refactor agent_adjust_capabilities() function
Make this a RedsState member function rather than a standalone function.
This means that we simply pass RedsState* as an argument rather than the
internal member variables of RedsState. This enables the following
commit which handles the VD_AGENT_CAP_GRAPHICS_DEVICE_INFO capability to
avoid sending graphics device info to agents that do not support it.
Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
diff --git a/server/reds.c b/server/reds.c
index 03666a53..d48393d5 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -793,8 +793,9 @@ static void vdi_port_read_buf_free(RedPipeItem *base)
g_free(buf);
}
-static void agent_adjust_capabilities(VDAgentMessage *message,
- bool clipboard_enabled, bool xfer_enabled)
+/* certain agent capabilities can be overridden and disabled in the server. In these cases, unset
+ * these capabilities before sending them on to the client */
+static void reds_adjust_agent_capabilities(RedsState *reds, VDAgentMessage *message)
{
VDAgentAnnounceCapabilities *capabilities;
@@ -803,13 +804,13 @@ static void agent_adjust_capabilities(VDAgentMessage *message,
}
capabilities = (VDAgentAnnounceCapabilities *) message->data;
- if (!clipboard_enabled) {
+ if (!reds->config->agent_copypaste) {
VD_AGENT_CLEAR_CAPABILITY(capabilities->caps, VD_AGENT_CAP_CLIPBOARD);
VD_AGENT_CLEAR_CAPABILITY(capabilities->caps, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND);
VD_AGENT_CLEAR_CAPABILITY(capabilities->caps, VD_AGENT_CAP_CLIPBOARD_SELECTION);
}
- if (!xfer_enabled) {
+ if (!reds->config->agent_file_xfer) {
VD_AGENT_SET_CAPABILITY(capabilities->caps, VD_AGENT_CAP_FILE_XFER_DISABLED);
}
}
@@ -879,9 +880,7 @@ static RedPipeItem *vdi_port_read_one_msg_from_device(RedCharDevice *self,
}
switch (vdi_port_read_buf_process(dev, dispatch_buf)) {
case AGENT_MSG_FILTER_OK:
- agent_adjust_capabilities((VDAgentMessage *) dispatch_buf->data,
- reds->config->agent_copypaste,
- reds->config->agent_file_xfer);
+ reds_adjust_agent_capabilities(reds, (VDAgentMessage *) dispatch_buf->data);
return &dispatch_buf->base;
case AGENT_MSG_FILTER_PROTO_ERROR:
reds_agent_remove(reds);
@@ -1380,9 +1379,7 @@ void reds_on_main_channel_migrate(RedsState *reds, MainChannelClient *mcc)
read_buf->len = read_data_len;
switch (vdi_port_read_buf_process(agent_dev, read_buf)) {
case AGENT_MSG_FILTER_OK:
- agent_adjust_capabilities((VDAgentMessage *)read_buf->data,
- reds->config->agent_copypaste,
- reds->config->agent_file_xfer);
+ reds_adjust_agent_capabilities(reds, (VDAgentMessage *)read_buf->data);
main_channel_client_push_agent_data(mcc,
read_buf->data,
read_buf->len,
More information about the Spice-commits
mailing list