mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-08 16:48:06 +00:00
Improve CommonGraphicsChannel encapsulation
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
parent
2bf72a5ce2
commit
f42a20c508
@ -65,14 +65,3 @@ bool CommonGraphicsChannelClient::config_socket()
|
||||
ack_set_client_window(is_low_bandwidth ? WIDE_CLIENT_ACK_WINDOW : NARROW_CLIENT_ACK_WINDOW);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void common_graphics_channel_set_during_target_migrate(CommonGraphicsChannel *self, gboolean value)
|
||||
{
|
||||
self->during_target_migrate = value;
|
||||
}
|
||||
|
||||
gboolean common_graphics_channel_get_during_target_migrate(CommonGraphicsChannel *self)
|
||||
{
|
||||
return self->during_target_migrate;
|
||||
}
|
||||
|
||||
@ -27,18 +27,27 @@
|
||||
|
||||
class CommonGraphicsChannel: public RedChannel
|
||||
{
|
||||
public: // XXX
|
||||
int during_target_migrate = 0; /* TRUE when the client that is associated with the channel
|
||||
public:
|
||||
bool get_during_target_migrate() const
|
||||
{
|
||||
return during_target_migrate;
|
||||
}
|
||||
|
||||
void set_during_target_migrate(bool value)
|
||||
{
|
||||
during_target_migrate = value;
|
||||
}
|
||||
protected:
|
||||
using RedChannel::RedChannel;
|
||||
|
||||
private:
|
||||
bool during_target_migrate = false; /* TRUE when the client that is associated with the channel
|
||||
is during migration. Turned off when the vm is started.
|
||||
The flag is used to avoid sending messages that are artifacts
|
||||
of the transition from stopped vm to loaded vm (e.g., recreation
|
||||
of the primary surface) */
|
||||
using RedChannel::RedChannel;
|
||||
};
|
||||
|
||||
void common_graphics_channel_set_during_target_migrate(CommonGraphicsChannel *self, gboolean value);
|
||||
gboolean common_graphics_channel_get_during_target_migrate(CommonGraphicsChannel *self);
|
||||
|
||||
enum {
|
||||
RED_PIPE_ITEM_TYPE_INVAL_ONE = RED_PIPE_ITEM_TYPE_CHANNEL_BASE,
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor, RedClient
|
||||
rcc->unref();
|
||||
rcc = nullptr;
|
||||
}
|
||||
common_graphics_channel_set_during_target_migrate(cursor, mig_target);
|
||||
cursor->set_during_target_migrate(mig_target);
|
||||
|
||||
return rcc;
|
||||
}
|
||||
|
||||
@ -265,7 +265,7 @@ void cursor_channel_reset(CursorChannel *cursor)
|
||||
|
||||
if (cursor->is_connected()) {
|
||||
cursor->pipes_add_type(RED_PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE);
|
||||
if (!common_graphics_channel_get_during_target_migrate(cursor)) {
|
||||
if (!cursor->get_during_target_migrate()) {
|
||||
cursor->pipes_add_empty_msg(SPICE_MSG_CURSOR_RESET);
|
||||
}
|
||||
cursor->wait_all_sent(COMMON_CLIENT_TIMEOUT);
|
||||
@ -277,7 +277,7 @@ static void cursor_channel_init_client(CursorChannel *cursor, CursorChannelClien
|
||||
spice_return_if_fail(cursor);
|
||||
|
||||
if (!cursor->is_connected()
|
||||
|| common_graphics_channel_get_during_target_migrate(cursor)) {
|
||||
|| cursor->get_during_target_migrate()) {
|
||||
spice_debug("during_target_migrate: skip init");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -184,7 +184,7 @@ void dcc_create_surface(DisplayChannelClient *dcc, int surface_id)
|
||||
flags = is_primary_surface(display, surface_id) ? SPICE_SURFACE_FLAGS_PRIMARY : 0;
|
||||
|
||||
/* don't send redundant create surface commands to client */
|
||||
if (common_graphics_channel_get_during_target_migrate(display) ||
|
||||
if (display->get_during_target_migrate() ||
|
||||
dcc->priv->surface_client_created[surface_id]) {
|
||||
return;
|
||||
}
|
||||
@ -391,7 +391,7 @@ DisplayChannelClient *dcc_new(DisplayChannel *display,
|
||||
dcc = nullptr;
|
||||
}
|
||||
spice_debug("New display (client %p) dcc %p stream %p", client, dcc, stream);
|
||||
common_graphics_channel_set_during_target_migrate(display, mig_target);
|
||||
display->set_during_target_migrate(mig_target);
|
||||
|
||||
return dcc;
|
||||
}
|
||||
@ -612,7 +612,7 @@ void dcc_destroy_surface(DisplayChannelClient *dcc, uint32_t surface_id)
|
||||
|
||||
display = DCC_TO_DC(dcc);
|
||||
|
||||
if (common_graphics_channel_get_during_target_migrate(display) ||
|
||||
if (display->get_during_target_migrate() ||
|
||||
!dcc->priv->surface_client_created[surface_id]) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -438,7 +438,7 @@ static void dev_create_primary_surface(RedWorker *worker, uint32_t surface_id,
|
||||
|
||||
CommonGraphicsChannel *common = display;
|
||||
if (display->is_connected() &&
|
||||
!common_graphics_channel_get_during_target_migrate(common)) {
|
||||
!common->get_during_target_migrate()) {
|
||||
/* guest created primary, so it will (hopefully) send a monitors_config
|
||||
* now, don't send our own temporary one */
|
||||
if (!worker->driver_cap_monitors_config) {
|
||||
@ -539,12 +539,10 @@ static void handle_dev_start(void *opaque, void *payload)
|
||||
|
||||
spice_assert(!red_qxl_is_running(worker->qxl));
|
||||
if (worker->cursor_channel) {
|
||||
CommonGraphicsChannel *common = worker->cursor_channel;
|
||||
common_graphics_channel_set_during_target_migrate(common, FALSE);
|
||||
worker->cursor_channel->set_during_target_migrate(FALSE);
|
||||
}
|
||||
if (worker->display_channel) {
|
||||
CommonGraphicsChannel *common = worker->display_channel;
|
||||
common_graphics_channel_set_during_target_migrate(common, FALSE);
|
||||
worker->display_channel->set_during_target_migrate(FALSE);
|
||||
display_channel_wait_for_migrate_data(worker->display_channel);
|
||||
}
|
||||
red_qxl_set_running(worker->qxl, true);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user