Re: [Spice-devel] [PATCH spice-gtk 0/3] Avoid sending extra resize requests
Hi, On Tue, 2016-07-26 at 17:04 -0400, Marc-André Lureau wrote: > Hi > > - Original Message - > > > > Hi, > > > > Intention of these patches is to avoid sending unnecessary resize requests > > which causes strange behavior ("flickering") of GNOME on Wayland guests [0]. > > The main channel now compares new resize requests with the information about > > the monitor configuration stored in the display channels. > > > > I noticed that linux guests (Fedora on GNOME) doesn't always resize to > > requested > > size (eg request 650x480, guest resizes to 648x480) and guest keeps > > flickering > > when this happens. Windows guests behave correctly. > > > > Feel free to ignore the first patch, it just helped me with testing. > > > > > > > [0] https://bugs.freedesktop.org/show_bug.cgi?id=94950 > > Does this series actually fix the bug? No. The guest keeps flickering if it is resized to different size. ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH spice-gtk] vmcstream: set the right result for the task
This bogus code was introduced when switching to GTask API. Seems that while writing those patches I just overlooked this part and set the wrong result for the task. As part of the problems introduced (and now fixed) you can notice that no output stream was being sent to the guest. Signed-off-by: Fabiano Fidêncio --- src/vmcstream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vmcstream.c b/src/vmcstream.c index c536f71..7c7af44 100644 --- a/src/vmcstream.c +++ b/src/vmcstream.c @@ -411,7 +411,7 @@ write_cb(GObject *source_object, { GTask *task = user_data; -g_task_return_pointer(task, g_object_ref(task), g_object_unref); +g_task_return_pointer(task, res, NULL); g_object_unref(task); } -- 2.7.4 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH spice-gtk 0/3] Avoid sending extra resize requests
Hi - Original Message - > Hi, > > Intention of these patches is to avoid sending unnecessary resize requests > which causes strange behavior ("flickering") of GNOME on Wayland guests [0]. > The main channel now compares new resize requests with the information about > the monitor configuration stored in the display channels. > > I noticed that linux guests (Fedora on GNOME) doesn't always resize to > requested > size (eg request 650x480, guest resizes to 648x480) and guest keeps > flickering > when this happens. Windows guests behave correctly. > > Feel free to ignore the first patch, it just helped me with testing. > > [0] https://bugs.freedesktop.org/show_bug.cgi?id=94950 Does this series actually fix the bug? ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [PATCH] usbredirparser: prevent endless recursion if interface_count == 0
Hey Alon, On Tue, Jul 26, 2016 at 01:47:16PM +0300, Alon Levy wrote: > On fedora 24 this function is tail optimized, resulting in a busy wait. > > This happens to me with virt-manager running a win7 vm Ah ok, probably goes with the call with interface_count == 0 in usbredirhost.c if libusb_get_active_config_descriptor() returns NULL. In this case, if usbredirfilter_check1() does not match the device, then we'll indeed keep calling usbredirfilter_check() as num_skipped will always be 0 when interface_count is 0. The tail optimization of the call means that instead of crashing because of the infinite recursion, we just busy wait. Patch looks good to me, though a bit more details in the commit log would have avoided some head scratching :p Christophe > > usbredir-0.7.1-2.fc24.x86_64 > --- > Hi Guys! > > One liner to fix an issue I had with virt-manager - symptom is 100% cpu > taken in it, stack traced to the problem fixed by this patch. > > Alon > > usbredirparser/usbredirfilter.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/usbredirparser/usbredirfilter.c > b/usbredirparser/usbredirfilter.c > index 02184ef..bdfbfc2 100644 > --- a/usbredirparser/usbredirfilter.c > +++ b/usbredirparser/usbredirfilter.c > @@ -205,7 +205,7 @@ int usbredirfilter_check( > * by recursively calling this function with a flag that forbids > * skipping (usbredirfilter_fl_dont_skip_non_boot_hid) > */ > -if (num_skipped == interface_count) { > +if (interface_count > 0 && num_skipped == interface_count) { > rc = usbredirfilter_check(rules, rules_count, >device_class, device_subclass, >device_protocol, >interface_class, interface_subclass, > -- > 2.7.4 > ___ > Spice-devel mailing list > Spice-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/spice-devel signature.asc Description: PGP signature ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH spice-gtk 2/3] move SpiceDisplayConfig from main channel to session
It helps to get the real display configuration from display channels instead of relying on the last requested monitor config. Related: https://bugs.freedesktop.org/show_bug.cgi?id=94950 --- src/channel-main.c | 32 +- src/spice-session-priv.h | 17 ++ src/spice-session.c | 58 3 files changed, 86 insertions(+), 21 deletions(-) diff --git a/src/channel-main.c b/src/channel-main.c index 26192ed..cf43649 100644 --- a/src/channel-main.c +++ b/src/channel-main.c @@ -54,20 +54,6 @@ typedef struct spice_migrate spice_migrate; -typedef enum { -DISPLAY_UNDEFINED, -DISPLAY_DISABLED, -DISPLAY_ENABLED, -} SpiceDisplayState; - -typedef struct { -int x; -int y; -int width; -int height; -SpiceDisplayState display_state; -} SpiceDisplayConfig; - typedef struct { GHashTable *xfer_task; SpiceMainChannel *channel; @@ -2552,6 +2538,8 @@ void spice_main_update_display(SpiceMainChannel *channel, int id, gboolean update) { SpiceMainChannelPrivate *c; +SpiceSession *session; +SpiceDisplayConfig display; g_return_if_fail(channel != NULL); g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel)); @@ -2564,15 +2552,17 @@ void spice_main_update_display(SpiceMainChannel *channel, int id, g_return_if_fail(id < SPICE_N_ELEMENTS(c->display)); -SpiceDisplayConfig display = { -.x = x, .y = y, .width = width, .height = height, -.display_state = c->display[id].display_state -}; +c->display[id].x = x; +c->display[id].y = y; +c->display[id].width = width; +c->display[id].height = height; -if (memcmp(&display, &c->display[id], sizeof(SpiceDisplayConfig)) == 0) +session = spice_channel_get_session(SPICE_CHANNEL(channel)); +if (spice_session_get_display_config(session, id, &display) && +memcmp(&display, &c->display[id], sizeof(SpiceDisplayConfig)) == 0) { +SPICE_DEBUG("new monitor config matches current config"); return; - -c->display[id] = display; +} if (update) update_display_timer(channel, 1); diff --git a/src/spice-session-priv.h b/src/spice-session-priv.h index 049973a..4e6bec4 100644 --- a/src/spice-session-priv.h +++ b/src/spice-session-priv.h @@ -37,6 +37,20 @@ typedef struct _PhodavServer PhodavServer; G_BEGIN_DECLS +typedef enum { +DISPLAY_UNDEFINED, +DISPLAY_DISABLED, +DISPLAY_ENABLED, +} SpiceDisplayState; + +typedef struct { +int x; +int y; +int width; +int height; +SpiceDisplayState display_state; +} SpiceDisplayConfig; + #define WEBDAV_MAGIC_SIZE 16 SpiceSession *spice_session_new_from_session(SpiceSession *session); @@ -99,6 +113,9 @@ guint spice_session_get_n_display_channels(SpiceSession *session); void spice_session_set_main_channel(SpiceSession *session, SpiceChannel *channel); gboolean spice_session_set_migration_session(SpiceSession *session, SpiceSession *mig_session); SpiceAudio *spice_audio_get(SpiceSession *session, GMainContext *context); +gboolean spice_session_get_display_config(const SpiceSession *session, + const guint id, + SpiceDisplayConfig *config); G_END_DECLS #endif /* __SPICE_CLIENT_SESSION_PRIV_H__ */ diff --git a/src/spice-session.c b/src/spice-session.c index db283d4..c276227 100644 --- a/src/spice-session.c +++ b/src/spice-session.c @@ -2785,3 +2785,61 @@ gboolean spice_session_set_migration_session(SpiceSession *session, SpiceSession return TRUE; } + + +static void display_monitor_config_to_display_config(const SpiceDisplayMonitorConfig *monitor, + SpiceDisplayConfig *config) +{ +config->x = monitor->x; +config->y = monitor->y; +config->width = monitor->width; +config->height = monitor->height; +if (monitor->width > 0 && monitor->height > 0) +config->display_state = DISPLAY_ENABLED; +else +config->display_state = DISPLAY_DISABLED; +} + +/* + * spice_session_get_display_config: + * @session: a Spice session + * @id: a display id (zero based) + * @config: a #SpiceDisplayConfig to store result + * + * Goes through all display channels until it finds a display configuration + * for display by given id + * + * Returns: %FALSE if display with the specified id does not exists + **/ +G_GNUC_INTERNAL +gboolean spice_session_get_display_config(const SpiceSession *session, + const guint id, + SpiceDisplayConfig *config) +{ +RingItem *item; +struct channel *c; +guint checked_displays = 0; + +
[Spice-devel] [PATCH spice-gtk 3/3] main: Do not request to resize when have desired size
Check for current size of monitors stored in display channels and avoid sending request to resize if it matches new requested size. Related: https://bugs.freedesktop.org/show_bug.cgi?id=94950 --- src/channel-main.c | 21 + 1 file changed, 21 insertions(+) diff --git a/src/channel-main.c b/src/channel-main.c index cf43649..ede3d87 100644 --- a/src/channel-main.c +++ b/src/channel-main.c @@ -1074,7 +1074,28 @@ gboolean spice_main_send_monitor_config(SpiceMainChannel *channel) if (spice_main_agent_test_capability(channel, VD_AGENT_CAP_SPARSE_MONITORS_CONFIG)) { +gboolean config_changed = FALSE; +const SpiceSession *session = spice_channel_get_session(SPICE_CHANNEL(channel)); monitors = SPICE_N_ELEMENTS(c->display); +for (i = 0; i < monitors; i++) { /* check whether the configuration has changed */ +SpiceDisplayConfig config; +if (spice_session_get_display_config(session, i, &config)) { +if (memcmp(&config, &c->display[i], sizeof(SpiceDisplayConfig)) != 0) { +config_changed = TRUE; +break; +} +} else { +if (c->display[i].display_state == DISPLAY_ENABLED) { +/* request to enable display i */ +config_changed = TRUE; +break; +} +} +} +if (!config_changed) { +SPICE_DEBUG("monitor configuration has not changed"); +return TRUE; +} } else { monitors = 0; for (i = 0; i < SPICE_N_ELEMENTS(c->display); i++) { -- 2.9.2 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH spice-gtk 1/3] spicy: Add dialog for precise resizing
--- src/spicy.c | 72 + 1 file changed, 72 insertions(+) diff --git a/src/spicy.c b/src/spicy.c index ea4d4e0..2013e68 100644 --- a/src/spicy.c +++ b/src/spicy.c @@ -566,6 +566,70 @@ static void keyboard_grab_cb(GtkWidget *widget, gint grabbed, gpointer data) } } +static void menu_cb_resize_to(GtkAction *action G_GNUC_UNUSED, + gpointer data) +{ +SpiceWindow *win = data; +GtkWidget *dialog, *enable_display; +GtkWidget *spin_width, *spin_height, *spin_x, *spin_y, *spin_id; +GtkGrid *grid; +gint width, height; +dialog = gtk_dialog_new_with_buttons("Resize guest to", + GTK_WINDOW(win->toplevel), + GTK_DIALOG_DESTROY_WITH_PARENT, + "_Apply", + GTK_RESPONSE_APPLY, + "_Cancel", + GTK_RESPONSE_CANCEL, + NULL); + +enable_display = gtk_switch_new(); +gtk_switch_set_state(GTK_SWITCH(enable_display), TRUE); + +spin_width = gtk_spin_button_new_with_range(0, G_MAXINT, 10); +spin_height = gtk_spin_button_new_with_range(0, G_MAXINT, 10); +spin_x = gtk_spin_button_new_with_range(0, G_MAXINT, 10); +spin_y = gtk_spin_button_new_with_range(0, G_MAXINT, 10); +spin_id = gtk_spin_button_new_with_range(0, CHANNELID_MAX * MONITORID_MAX - 1, 1); + +gtk_widget_get_preferred_width(win->spice, NULL, &width); +gtk_widget_get_preferred_height(win->spice, NULL, &height); + +gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_width), width); +gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_height), height); +gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin_id), win->id + win->monitor_id); + +grid = GTK_GRID(gtk_grid_new()); + gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), GTK_WIDGET(grid)); +gtk_grid_attach(grid, gtk_label_new("Resize the guest display:"), 0, 0, 2, 1); +gtk_grid_attach(grid, enable_display, 0, 1, 1, 1); +gtk_grid_attach(grid, spin_id, 1, 1, 1, 1); +gtk_grid_attach(grid, gtk_label_new("width:"), 0, 2, 1, 1); +gtk_grid_attach(grid, spin_width, 1, 2, 1, 1); +gtk_grid_attach(grid, gtk_label_new("height:"), 0, 3, 1, 1); +gtk_grid_attach(grid, spin_height, 1, 3, 1, 1); +gtk_grid_attach(grid, gtk_label_new("x:"), 0, 4, 1, 1); +gtk_grid_attach(grid, spin_x, 1, 4, 1, 1); +gtk_grid_attach(grid, gtk_label_new("y:"), 0, 5, 1, 1); +gtk_grid_attach(grid, spin_y, 1, 5, 1, 1); + +gtk_widget_show_all(dialog); +if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_APPLY) { +spice_main_update_display_enabled(win->conn->main, + gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin_id)), + gtk_switch_get_state(GTK_SWITCH(enable_display)), + FALSE); +spice_main_set_display(win->conn->main, + gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin_id)), + gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin_x)), + gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin_y)), + gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin_width)), + gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin_height))); +spice_main_send_monitor_config(win->conn->main); +} +gtk_widget_destroy (dialog); +} + static void restore_configuration(SpiceWindow *win) { gboolean state; @@ -689,6 +753,11 @@ static const GtkActionEntry entries[] = { .callback= G_CALLBACK(menu_cb_fullscreen), .accelerator = "F11", },{ +.name= "ResizeTo", +.label = "_Resize to", +.callback= G_CALLBACK(menu_cb_resize_to), +.accelerator = "", +},{ #ifdef USE_SMARTCARD .name= "InsertSmartcard", .label = "_Insert Smartcard", @@ -876,6 +945,9 @@ static char ui_xml[] = "\n" "\n" "\n" +"\n" +"\n" +"\n" " \n" "\n"; -- 2.9.2 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH spice-gtk 0/3] Avoid sending extra resize requests
Hi, Intention of these patches is to avoid sending unnecessary resize requests which causes strange behavior ("flickering") of GNOME on Wayland guests [0]. The main channel now compares new resize requests with the information about the monitor configuration stored in the display channels. I noticed that linux guests (Fedora on GNOME) doesn't always resize to requested size (eg request 650x480, guest resizes to 648x480) and guest keeps flickering when this happens. Windows guests behave correctly. Feel free to ignore the first patch, it just helped me with testing. [0] https://bugs.freedesktop.org/show_bug.cgi?id=94950 Pavel Grunt (3): spicy: Add dialog for precise resizing move SpiceDisplayConfig from main channel to session main: Do not request to resize when have desired size src/channel-main.c | 53 +-- src/spice-session-priv.h | 17 src/spice-session.c | 58 ++ src/spicy.c | 72 4 files changed, 179 insertions(+), 21 deletions(-) -- 2.9.2 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [spice-gtk v2] Handle pause key correctly
Windows does not like Pause key sent with same scancodes as Break. Although is the same physical key the two functions send two completely different set of codes. Tested with Linux and Windows clients. Tested with Linux, Windows and DOS guests. On Windows guest VK_PAUSE was not arriving correctly. Signed-off-by: Frediano Ziglio --- src/spice-widget.c | 27 +++ 1 file changed, 27 insertions(+) Changes from v1: - fixed typo in commit message; - separate press from release, seems that some HW keyboard send them separately. diff --git a/src/spice-widget.c b/src/spice-widget.c index c7dd553..6c00563 100644 --- a/src/spice-widget.c +++ b/src/spice-widget.c @@ -1286,6 +1286,25 @@ static gboolean key_press_delayed(gpointer data) return FALSE; } +static bool send_pause(SpiceDisplay *display, GdkEventType type) +{ +SpiceInputsChannel *inputs = display->priv->inputs; + +/* Send proper scancodes. This will send same scancodes + * as hardware. + * The 0x21d is a sort of Third-Ctrl while + * 0x45 is the NumLock. + */ +if (type == GDK_KEY_PRESS) { +spice_inputs_key_press(inputs, 0x21d); +spice_inputs_key_press(inputs, 0x45); +} else { +spice_inputs_key_release(inputs, 0x21d); +spice_inputs_key_release(inputs, 0x45); +} +return true; +} + static void send_key(SpiceDisplay *display, int scancode, SendKeyType type, gboolean press_delayed) { SpiceDisplayPrivate *d = display->priv; @@ -1479,6 +1498,14 @@ static gboolean key_event(GtkWidget *widget, GdkEventKey *key) if (!d->inputs) return true; +if (key->keyval == GDK_KEY_Pause +#ifdef G_OS_WIN32 +/* for some reason GDK does not fill keyval for VK_PAUSE */ +|| key->hardware_keycode == VK_PAUSE +#endif +) { +return send_pause(display, key->type); +} if (!scancode) scancode = vnc_display_keymap_gdk2xtkbd(d->keycode_map, d->keycode_maplen, key->hardware_keycode); -- 2.7.4 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk 2/2] Handle pause key correctly
> > Hi Frediano, > > On Tue, 2016-07-26 at 10:04 +0100, Frediano Ziglio wrote: > > Windows does not like Pause key sent with same scancodes as Break. > > Although is the same physical key the two functions send two complitely > typo - completely Got it, fixed. > > different set of codes. > > Tested with Linux and Windows clients. > > Tested with Linux, Windows and DOS guests. > > On Windows guest VK_PAUSE was not arriving correctly. > > > > Signed-off-by: Frediano Ziglio > > --- > > src/spice-widget.c | 27 +++ > > 1 file changed, 27 insertions(+) > > > > diff --git a/src/spice-widget.c b/src/spice-widget.c > > index c7dd553..7890f70 100644 > > --- a/src/spice-widget.c > > +++ b/src/spice-widget.c > > @@ -1286,6 +1286,25 @@ static gboolean key_press_delayed(gpointer data) > > return FALSE; > > } > > > > +static bool send_pause(SpiceDisplay *display, GdkEventType type) > > +{ > > +SpiceInputsChannel *inputs = display->priv->inputs; > > + > > +/* Send proper scancodes. > > + * Note that this key send all scancode when pressed > > + * but nothing when released. > > What is the reason for that ? > > So (in client): > Press "Pause" > Press something else > Release something else > Release "Pause" > will produce (in guest): > Press "Pause" > Release "Pause" > Press something else > Release something else > > It is a different behavior than in the client > This will send the same hardware sequence as hardware Pause produce. The guest will get a pause sequence, there is no "something else". Actually the software fake a press+release and you can think the events are separate but if you physically press pause you will get press and release at the same time while release will be silent. When Windows receives the E1 1D 45 sequence it just sent a single WM_KEYDOWN with virtual code VK_PAUSE and scancode 0x45. > > + * The 0x21d is a sort of Third-Ctrl while > > + * 0x45 is the NumLock. > > + */ > > +if (type == GDK_KEY_PRESS) { > > +spice_inputs_key_press(inputs, 0x21d); > > +spice_inputs_key_press(inputs, 0x45); > > +spice_inputs_key_release(inputs, 0x21d); > > +spice_inputs_key_release(inputs, 0x45); > > Do you know why it is needed to enter these "manually" ? Is the keymap > wrongly > generated? > There are some problems: - send_key does not support scancodes > 512 and adding support for 0x21d (extending key_state) just for this does not make much sense to me; - the key (as you can see) send multiple scancodes and the keymap table just store one, still I don't see much value supporting multiple scancodes in keymap table just for this; - strangely looks like 0xff13 (Pause) was send as Break (scancode 326) and the row in keymaps.csv is KEY_PAUSE,119198,98,,326,72,VK_PAUSE,0x013,0x66,0x66,XK_Pause,0xff13 while the Break key is empty KEY_BREAK,0x19b if you fill KEY_BREAK nothing happens, if you change KEY_PAUSE you break both functions (Break and Pause) > > +} > > +return true; > > +} > > + > > static void send_key(SpiceDisplay *display, int scancode, SendKeyType > > type, > > gboolean press_delayed) > > { > > SpiceDisplayPrivate *d = display->priv; > > @@ -1479,6 +1498,14 @@ static gboolean key_event(GtkWidget *widget, > > GdkEventKey *key) > > if (!d->inputs) > > return true; > > > > +if (key->keyval == GDK_KEY_Pause > > +#ifdef G_OS_WIN32 > > +/* for some reason GDK does not fill keyval for VK_PAUSE */ > > rather bug for gtk ? > I think so. The keyval is filled with 0xff. > > +|| key->hardware_keycode == VK_PAUSE > > +#endif > > +) { > > +return send_pause(display, key->type); > > +} > > if (!scancode) > > scancode = vnc_display_keymap_gdk2xtkbd(d->keycode_map, d- > > >keycode_maplen, > > key->hardware_keycode); > > > Thanks, > Pavel > > Frediano ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk 2/2] Handle pause key correctly
Hi Frediano, On Tue, 2016-07-26 at 10:04 +0100, Frediano Ziglio wrote: > Windows does not like Pause key sent with same scancodes as Break. > Although is the same physical key the two functions send two complitely typo - completely > different set of codes. > Tested with Linux and Windows clients. > Tested with Linux, Windows and DOS guests. > On Windows guest VK_PAUSE was not arriving correctly. > > Signed-off-by: Frediano Ziglio > --- > src/spice-widget.c | 27 +++ > 1 file changed, 27 insertions(+) > > diff --git a/src/spice-widget.c b/src/spice-widget.c > index c7dd553..7890f70 100644 > --- a/src/spice-widget.c > +++ b/src/spice-widget.c > @@ -1286,6 +1286,25 @@ static gboolean key_press_delayed(gpointer data) > return FALSE; > } > > +static bool send_pause(SpiceDisplay *display, GdkEventType type) > +{ > +SpiceInputsChannel *inputs = display->priv->inputs; > + > +/* Send proper scancodes. > + * Note that this key send all scancode when pressed > + * but nothing when released. What is the reason for that ? So (in client): Press "Pause" Press something else Release something else Release "Pause" will produce (in guest): Press "Pause" Release "Pause" Press something else Release something else It is a different behavior than in the client > + * The 0x21d is a sort of Third-Ctrl while > + * 0x45 is the NumLock. > + */ > +if (type == GDK_KEY_PRESS) { > +spice_inputs_key_press(inputs, 0x21d); > +spice_inputs_key_press(inputs, 0x45); > +spice_inputs_key_release(inputs, 0x21d); > +spice_inputs_key_release(inputs, 0x45); Do you know why it is needed to enter these "manually" ? Is the keymap wrongly generated? > +} > +return true; > +} > + > static void send_key(SpiceDisplay *display, int scancode, SendKeyType type, > gboolean press_delayed) > { > SpiceDisplayPrivate *d = display->priv; > @@ -1479,6 +1498,14 @@ static gboolean key_event(GtkWidget *widget, > GdkEventKey *key) > if (!d->inputs) > return true; > > +if (key->keyval == GDK_KEY_Pause > +#ifdef G_OS_WIN32 > +/* for some reason GDK does not fill keyval for VK_PAUSE */ rather bug for gtk ? > +|| key->hardware_keycode == VK_PAUSE > +#endif > +) { > +return send_pause(display, key->type); > +} > if (!scancode) > scancode = vnc_display_keymap_gdk2xtkbd(d->keycode_map, d- > >keycode_maplen, > key->hardware_keycode); Thanks, Pavel ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice] server: Make sure g_object_new receive the correct data
On 07/25/2016 07:51 PM, Francois Gouget wrote: On Mon, 25 Jul 2016, Frediano Ziglio wrote: [...] -"client-tokens-interval", REDS_TOKENS_TO_SEND, -"self-tokens", REDS_NUM_INTERNAL_AGENT_MESSAGES, +"client-tokens-interval", (guint64)REDS_TOKENS_TO_SEND, +"self-tokens", (guint64)REDS_NUM_INTERNAL_AGENT_MESSAGES, [...] The patch is ok, but I think it would be better to do the cast in the define itself, or replace the define with a const (g)uint64_t variable Uri. This would bound the constant to the property which does not make much sense as the constant can be used for different purposes. What if the same constant is used for two properties with different types? I do not see it as a problem. Constants have meaning. What if the constant is used in 10 places (as uint64), you will need to cast all places. (Theoretically, not in this case as Francois mentions below) To be fair REDS_TOKENS_TO_SEND is only used in this one place. But REDS_NUM_INTERNAL_AGENT_MESSAGES is defined in main-channel.h and is used to define MAIN_CHANNEL_RECEIVE_BUF_SIZE so defining it as a guint64 may not make sense. Also I think having a visible cast here more explicitly indicates that the property is 64 bit than a cast hidden in a far away macro. (One could also argue for an explicit comment but I think that would be overkill. Why add a comment here and not for every other cast?) I do not see the value of being explicit about this property being a 64 bit. I agree that a comment would be an overkill. Having said that, I accept the patch as is. Uri. ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] [spice-gtk 1/2] Support more extension codes
On Tue, 2016-07-26 at 10:03 +0100, Frediano Ziglio wrote: > Not only E0 prefix but also E1 and E2. > They are used in some special cases, one is the pause key. > > Signed-off-by: Frediano Ziglio Acked-by: Pavel Grunt > --- > src/spice-util.c | 20 +++- > 1 file changed, 7 insertions(+), 13 deletions(-) > > diff --git a/src/spice-util.c b/src/spice-util.c > index bca3abc..81a66fd 100644 > --- a/src/spice-util.c > +++ b/src/spice-util.c > @@ -23,6 +23,7 @@ > #include > #include > #include > +#include > #include "spice-util-priv.h" > #include "spice-util.h" > #include "spice-util-priv.h" > @@ -269,19 +270,12 @@ guint16 spice_make_scancode(guint scancode, gboolean > release) > SPICE_DEBUG("%s: %s scancode %u", > __FUNCTION__, release ? "release" : "", scancode); > > -if (release) { > -if (scancode < 0x100) > -return scancode | 0x80; > -else > -return 0x80e0 | ((scancode - 0x100) << 8); > -} else { > -if (scancode < 0x100) > -return scancode; > -else > -return 0xe0 | ((scancode - 0x100) << 8); > -} > - > -g_return_val_if_reached(0); > +scancode &= 0x37f; > +if (release) > +scancode |= 0x80; > +if (scancode < 0x100) > +return scancode; > +return SPICE_BYTESWAP16(0xe000 | (scancode - 0x100)); > } > > typedef enum { ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [PATCH] usbredirparser: prevent endless recursion if interface_count == 0
On fedora 24 this function is tail optimized, resulting in a busy wait. This happens to me with virt-manager running a win7 vm usbredir-0.7.1-2.fc24.x86_64 --- Hi Guys! One liner to fix an issue I had with virt-manager - symptom is 100% cpu taken in it, stack traced to the problem fixed by this patch. Alon usbredirparser/usbredirfilter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usbredirparser/usbredirfilter.c b/usbredirparser/usbredirfilter.c index 02184ef..bdfbfc2 100644 --- a/usbredirparser/usbredirfilter.c +++ b/usbredirparser/usbredirfilter.c @@ -205,7 +205,7 @@ int usbredirfilter_check( * by recursively calling this function with a flag that forbids * skipping (usbredirfilter_fl_dont_skip_non_boot_hid) */ -if (num_skipped == interface_count) { +if (interface_count > 0 && num_skipped == interface_count) { rc = usbredirfilter_check(rules, rules_count, device_class, device_subclass, device_protocol, interface_class, interface_subclass, -- 2.7.4 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] Fwd: where do usbredir patches go nowadays?
Forwarded Message Subject: where do usbredir patches go nowadays? Date: Mon, 18 Jul 2016 17:23:44 +0300 From: Alon Levy To: Hans de Goede Well, ok, so I'm taking this time to say hi - you seem to be having good GPU fun these days. >From 132286d0972914cd36c586be6b9b6fa3d0ee982c Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Mon, 18 Jul 2016 17:13:27 +0300 Subject: [PATCH] usbredirparser: prevent endless recursion if interface_count == 0 On fedora 24 this function is tail optimized, resulting in a busy wait. usbredir-0.7.1-2.fc24.x86_64 --- usbredirparser/usbredirfilter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usbredirparser/usbredirfilter.c b/usbredirparser/usbredirfilter.c index 02184ef..bdfbfc2 100644 --- a/usbredirparser/usbredirfilter.c +++ b/usbredirparser/usbredirfilter.c @@ -205,7 +205,7 @@ int usbredirfilter_check( * by recursively calling this function with a flag that forbids * skipping (usbredirfilter_fl_dont_skip_non_boot_hid) */ -if (num_skipped == interface_count) { +if (interface_count > 0 && num_skipped == interface_count) { rc = usbredirfilter_check(rules, rules_count, device_class, device_subclass, device_protocol, interface_class, interface_subclass, -- 2.7.4 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [spice-gtk 1/2] Support more extension codes
Not only E0 prefix but also E1 and E2. They are used in some special cases, one is the pause key. Signed-off-by: Frediano Ziglio --- src/spice-util.c | 20 +++- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/spice-util.c b/src/spice-util.c index bca3abc..81a66fd 100644 --- a/src/spice-util.c +++ b/src/spice-util.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "spice-util-priv.h" #include "spice-util.h" #include "spice-util-priv.h" @@ -269,19 +270,12 @@ guint16 spice_make_scancode(guint scancode, gboolean release) SPICE_DEBUG("%s: %s scancode %u", __FUNCTION__, release ? "release" : "", scancode); -if (release) { -if (scancode < 0x100) -return scancode | 0x80; -else -return 0x80e0 | ((scancode - 0x100) << 8); -} else { -if (scancode < 0x100) -return scancode; -else -return 0xe0 | ((scancode - 0x100) << 8); -} - -g_return_val_if_reached(0); +scancode &= 0x37f; +if (release) +scancode |= 0x80; +if (scancode < 0x100) +return scancode; +return SPICE_BYTESWAP16(0xe000 | (scancode - 0x100)); } typedef enum { -- 2.7.4 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] [spice-gtk 2/2] Handle pause key correctly
Windows does not like Pause key sent with same scancodes as Break. Although is the same physical key the two functions send two complitely different set of codes. Tested with Linux and Windows clients. Tested with Linux, Windows and DOS guests. On Windows guest VK_PAUSE was not arriving correctly. Signed-off-by: Frediano Ziglio --- src/spice-widget.c | 27 +++ 1 file changed, 27 insertions(+) diff --git a/src/spice-widget.c b/src/spice-widget.c index c7dd553..7890f70 100644 --- a/src/spice-widget.c +++ b/src/spice-widget.c @@ -1286,6 +1286,25 @@ static gboolean key_press_delayed(gpointer data) return FALSE; } +static bool send_pause(SpiceDisplay *display, GdkEventType type) +{ +SpiceInputsChannel *inputs = display->priv->inputs; + +/* Send proper scancodes. + * Note that this key send all scancode when pressed + * but nothing when released. + * The 0x21d is a sort of Third-Ctrl while + * 0x45 is the NumLock. + */ +if (type == GDK_KEY_PRESS) { +spice_inputs_key_press(inputs, 0x21d); +spice_inputs_key_press(inputs, 0x45); +spice_inputs_key_release(inputs, 0x21d); +spice_inputs_key_release(inputs, 0x45); +} +return true; +} + static void send_key(SpiceDisplay *display, int scancode, SendKeyType type, gboolean press_delayed) { SpiceDisplayPrivate *d = display->priv; @@ -1479,6 +1498,14 @@ static gboolean key_event(GtkWidget *widget, GdkEventKey *key) if (!d->inputs) return true; +if (key->keyval == GDK_KEY_Pause +#ifdef G_OS_WIN32 +/* for some reason GDK does not fill keyval for VK_PAUSE */ +|| key->hardware_keycode == VK_PAUSE +#endif +) { +return send_pause(display, key->type); +} if (!scancode) scancode = vnc_display_keymap_gdk2xtkbd(d->keycode_map, d->keycode_maplen, key->hardware_keycode); -- 2.7.4 ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
Re: [Spice-devel] Multiple monitors for a windows virtual machine where each is to be displayed on a different client (for a windows 10 virtual machine)
Hi, On Tue, 2016-07-26 at 00:19 -0400, pt...@jgh.mcgill.ca wrote: > Hi! > > I have a server (in my basement) running windows 10 as a virtual machine. I > would like the windows virtual machine to have 3 virtual displays (or at least > 2) That is not a problem, you just need to add more '-vga qxl -device qxl' http://www.spice-space.org/spice-user-manual.html#_multiple_monitor_support > , and I would like to display the frist virtual display on the monitor on the > first machine in my office, the second virtual display on the monitor of the > second machine in my office, and the third virtual display on the monitor of > the third machine in my office. So 1 virtual machine & 3 clients - for that you would need to enable "Simultaneous clients connection" which is an EXPERIMENTAL feature: http://www.spice-space.org/multiple-clients.html All the clients will receive the same stuff (all will get 3 displays, but you can "hide" some windows). > All three machines in my office are running Lubuntu and have spice-client-gtk > on them (I am running Lubuntu 16.04 so spice-client-gtk contains spicy). You would need remote-viewer (it has multi-monitor support) for that. You can find it in the virt-viewer package - the latest version is remote-viewer 4.0 > I am using qemu-system-x86_64 to run the windows virtual machine, and I have > two virtual displays working, but they are both displaying on the monitor of > one of the machines in my office. > > Is there a way for me to tell (possibly by using different port numbers and > spice options in the parameter list for qemu-system-x86_64) so that each > virtual display is directed to a different physical machine? > > I have listed my command line below (with an attempt to use two references to > spice, which didn't work). use just one > > THANKS . . . > > Phil > > P.S. I am also curious whether I am using image compression and video > compression in a sensible manner. Looks good, but you can experiment with it :) Recent versions of spice-gtk and spice-server have support for changing image compression from the client using '--spice-preferred-compression' Regards, Pavel > > # Start qemu-system asynchronously > qemu-system-x86_64 \ > -enable-kvm \ > -machine pc,accel=kvm \ > -drive file=/mnt/Windows10Image/Windows10Guest.img,if=virtio \ > -drive > file=/home/troyware1/InstallFiles/Windows10H64/Windows10H64Install.iso,media=c > drom \ > -drive file=/home/troyware1/InstallFiles/Windows10H64/virtio-win- > 0.1.118.iso,media=cdrom \ > -net nic,model=virtio,macaddr=56:44:45:30:31:35 \ > -net user \ > -cpu host \ > -vga qxl \ > -spice port=5900,disable-ticketing,image-compression=glz,zlib-glz-wan- > compression=always \ > -device qxl \ > -spice port=5951,disable-ticketing,jpeg-wan-compression=always,zlib-glz-wan- > compression=always \ > -uuid 8373c3d6-1e6c-f022-38e2-b94e6e14e170 \ > -smp cpus=3,maxcpus=6 \ > -m 8192 \ > -name TroyWare1Win7VM \ > -localtime \ > -k en-us \ > -usb -usbdevice tablet & > > > Philip M. Troy, Ph.D. > > Analytics Conseiller principal > Centre intégré universitaire de santé et de services sociaux du Centre-Ouest- > de-l’Île-de-Montréal > phil.troy.cco...@.gouv.qc.ca > > professeur adjoint de chirurgie > Université McGill > philip.t...@mcgill.ca > ___ > Spice-devel mailing list > Spice-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/spice-devel ___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel
[Spice-devel] Multiple monitors for a windows virtual machine where each is to be displayed on a different client (for a windows 10 virtual machine)
Hi! I have a server (in my basement) running windows 10 as a virtual machine. I would like the windows virtual machine to have 3 virtual displays (or at least 2), and I would like to display the frist virtual display on the monitor on the first machine in my office, the second virtual display on the monitor of the second machine in my office, and the third virtual display on the monitor of the third machine in my office. All three machines in my office are running Lubuntu and have spice-client-gtk on them (I am running Lubuntu 16.04 so spice-client-gtk contains spicy). I am using qemu-system-x86_64 to run the windows virtual machine, and I have two virtual displays working, but they are both displaying on the monitor of one of the machines in my office. Is there a way for me to tell (possibly by using different port numbers and spice options in the parameter list for qemu-system-x86_64) so that each virtual display is directed to a different physical machine? I have listed my command line below (with an attempt to use two references to spice, which didn't work). THANKS . . . Phil P.S. I am also curious whether I am using image compression and video compression in a sensible manner. # Start qemu-system asynchronously qemu-system-x86_64 \ -enable-kvm \ -machine pc,accel=kvm \ -drive file=/mnt/Windows10Image/Windows10Guest.img,if=virtio \ -drive file=/home/troyware1/InstallFiles/Windows10H64/Windows10H64Install.iso,media=cdrom \ -drive file=/home/troyware1/InstallFiles/Windows10H64/virtio-win-0.1.118.iso,media=cdrom \ -net nic,model=virtio,macaddr=56:44:45:30:31:35 \ -net user \ -cpu host \ -vga qxl \ -spice port=5900,disable-ticketing,image-compression=glz,zlib-glz-wan-compression=always \ -device qxl \ -spice port=5951,disable-ticketing,jpeg-wan-compression=always,zlib-glz-wan-compression=always \ -uuid 8373c3d6-1e6c-f022-38e2-b94e6e14e170 \ -smp cpus=3,maxcpus=6 \ -m 8192 \ -name TroyWare1Win7VM \ -localtime \ -k en-us \ -usb -usbdevice tablet & Philip M. Troy, Ph.D. Analytics Conseiller principal Centre intégré universitaire de santé et de services sociaux du Centre-Ouest-de-l’Île-de-Montréal phil.troy.cco...@.gouv.qc.ca professeur adjoint de chirurgie Université McGill philip.t...@mcgill.ca___ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel