main: don't update display timer for unchanged config

With virgl, set_monitor_ready() may be called each time the scanout is
updated to set the monitor area. This will call
spice_main_update_display(), and keep the timer postponed even if the
monitor configuration didn't change. Treat unchanged configuration as a
no-op and keep configuration timer unchanged. This fixes monitor
autoconfig with virgl (when the display is regularly updated).

It also solves/avoids problems with a guest running on wayland when the
"resize-guest" property is TRUE.

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1266484

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
Marc-André Lureau 2016-03-23 17:11:08 +01:00
parent 962ebf97e7
commit ec6bfc00f8

View File

@ -121,6 +121,14 @@ typedef enum {
DISPLAY_ENABLED,
} SpiceDisplayState;
typedef struct {
int x;
int y;
int width;
int height;
SpiceDisplayState display_state;
} SpiceDisplayConfig;
struct _SpiceMainChannelPrivate {
enum SpiceMouseMode mouse_mode;
bool agent_connected;
@ -140,13 +148,7 @@ struct _SpiceMainChannelPrivate {
guint agent_msg_pos;
uint8_t agent_msg_size;
uint32_t agent_caps[VD_AGENT_CAPS_SIZE];
struct {
int x;
int y;
int width;
int height;
SpiceDisplayState display_state;
} display[MAX_DISPLAY];
SpiceDisplayConfig display[MAX_DISPLAY];
gint timer_id;
GQueue *agent_msg_queue;
GHashTable *file_xfer_tasks;
@ -2688,10 +2690,15 @@ void spice_main_update_display(SpiceMainChannel *channel, int id,
g_return_if_fail(id < SPICE_N_ELEMENTS(c->display));
c->display[id].x = x;
c->display[id].y = y;
c->display[id].width = width;
c->display[id].height = height;
SpiceDisplayConfig display = {
.x = x, .y = y, .width = width, .height = height,
.display_state = c->display[id].display_state
};
if (memcmp(&display, &c->display[id], sizeof(SpiceDisplayConfig)) == 0)
return;
c->display[id] = display;
if (update)
update_display_timer(channel, 1);