Re: [Spice-devel] [PATCH spice-gtk] Ensure that file transfers get cancelled

2016-04-08 Thread Pavel Grunt
On Thu, 2016-04-07 at 15:51 -0500, Jonathon Jongsma wrote:
> When canceling a file transfer task in spicy, the client would often
> stop sending additional data, but it would not send a "CANCELLED"
> message to the guest. Because of this, the partial file would remain
> in
> the guest's downloads folder until the spice client disconnected, at
> which point the vdagent would remove the unfinshed file.
> 
> This CANCELLED status message was only being sent if the task was
> canceled during the async file read operation. If you cancel a task,
> it's quite likely that it will happen during other operations
> (e.g. file_xfer_flush_async(), etc). In order to handle these
> scenarios
> (and make sure that the file gets canceled properly), send the
> FILE_XFER_STATUS message in spice_file_transfer_task_completed().

Acked-by: Pavel Grunt <pgr...@redhat.com>
> ---
>  src/channel-main.c | 17 ++---
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/src/channel-main.c b/src/channel-main.c
> index 4a1f58a..85353d4 100644
> --- a/src/channel-main.c
> +++ b/src/channel-main.c
> @@ -1912,13 +1912,6 @@ static void file_xfer_read_cb(GObject
> *source_object,
>    file_xfer_data_flushed_cb, self);
>  self->priv->pending = TRUE;
>  } else if (error) {
> -VDAgentFileXferStatusMessage msg = {
> -.id = self->priv->id,
> -.result = error->code == G_IO_ERROR_CANCELLED ?
> -VD_AGENT_FILE_XFER_STATUS_CANCELLED :
> VD_AGENT_FILE_XFER_STATUS_ERROR,
> -};
> -agent_msg_queue_many(self->priv->channel,
> VD_AGENT_FILE_XFER_STATUS,
> - , sizeof(msg), NULL);
>  spice_channel_wakeup(SPICE_CHANNEL(self->priv->channel),
> FALSE);
>  spice_file_transfer_task_completed(self, error);
>  }
> @@ -2944,6 +2937,16 @@ static void
> spice_file_transfer_task_completed(SpiceFileTransferTask *self,
>  self->priv->error = error;
>  }
>  
> +if (self->priv->error) {
> +VDAgentFileXferStatusMessage msg = {
> +.id = self->priv->id,
> +.result = error->code == G_IO_ERROR_CANCELLED ?
> +VD_AGENT_FILE_XFER_STATUS_CANCELLED :
> VD_AGENT_FILE_XFER_STATUS_ERROR,
> +};
> +agent_msg_queue_many(self->priv->channel,
> VD_AGENT_FILE_XFER_STATUS,
> + , sizeof(msg), NULL);
> +}
> +
>  if (self->priv->pending)
>  return;
>  
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH 06/14] FIXME/HACK: RedPipeItem/VDIPortBuf refcounting hack

2016-04-08 Thread Pavel Grunt
Hi,

On Thu, 2016-04-07 at 17:11 -0500, Jonathon Jongsma wrote:
> From: Christophe Fergeau
> 
> related to 7d375e0
> workaround a runtime check in red_pipe_item_ref()

Should the refcount be initialized by red_pipe_item_init?

Pavel

> ---
>  server/reds.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/server/reds.c b/server/reds.c
> index 64f7df8..bf39cf7 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -752,7 +752,8 @@ static VDIReadBuf
> *vdi_port_get_read_buf(RedCharDeviceVDIPort *dev)
>  buf = SPICE_CONTAINEROF(item, VDIReadBuf, link.parent.link);
>  
>  g_warn_if_fail(buf->link.refcount == 0);
> -red_pipe_item_ref(buf);
> +buf->link.refcount = 1;
> +//red_pipe_item_ref(buf);
>  
>  return buf;
>  }
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [vdagent-linux v2] remove trailing spaces

2016-04-11 Thread Pavel Grunt
Hi,

git grep "[[:space:]]$" shows one more in the ChangeLog

Pavel

On Mon, 2016-04-11 at 11:33 +0200, Victor Toso wrote:
> ---
>  src/console-kit.c| 10 +-
>  src/dummy-session-info.c |  6 +++---
>  src/session-info.h   |  6 +++---
>  src/systemd-login.c  |  6 +++---
>  src/udscs.c  |  8 
>  src/udscs.h  |  8 
>  src/vdagent-file-xfers.c |  6 +++---
>  src/vdagent-file-xfers.h |  6 +++---
>  src/vdagent-virtio-port.c|  8 
>  src/vdagent-virtio-port.h|  8 
>  src/vdagent-x11-randr.c  |  6 +++---
>  src/vdagent-x11.c|  8 
>  src/vdagent-x11.h|  6 +++---
>  src/vdagent.c|  6 +++---
>  src/vdagentd-proto-strings.h |  6 +++---
>  src/vdagentd-proto.h |  6 +++---
>  src/vdagentd-uinput.c|  6 +++---
>  src/vdagentd-uinput.h|  6 +++---
>  src/vdagentd-xorg-conf.h |  6 +++---
>  src/vdagentd.c   |  8 
>  20 files changed, 68 insertions(+), 68 deletions(-)
> 
> diff --git a/src/console-kit.c b/src/console-kit.c
> index 759a81e..6e83bf2 100644
> --- a/src/console-kit.c
> +++ b/src/console-kit.c
> @@ -7,12 +7,12 @@
>  
>  This program is free software: you can redistribute it and/or
> modify
>  it under the terms of the GNU General Public License as
> published by
> -the Free Software Foundation, either version 3 of the License,
> or   
> +the Free Software Foundation, either version 3 of the License,
> or
>  (at your option) any later version.
>  
>  This program is distributed in the hope that it will be useful,
> -but WITHOUT ANY WARRANTY; without even the implied warranty of 
> -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>  GNU General Public License for more details.
>  
>  You should have received a copy of the GNU General Public
> License
> @@ -59,7 +59,7 @@ struct session_info *session_info_create(int
> verbose)
>  free(ck);
>  return NULL;
>  }
> -
> +
>  if (!dbus_connection_get_unix_fd(ck->connection, >fd)) {
>  syslog(LOG_ERR, "Unable to get connection fd");
>  session_info_destroy(ck);
> @@ -77,7 +77,7 @@ struct session_info *session_info_create(int
> verbose)
>   "path='%s',member='ActiveSessionChanged'", ck->seat);
>  dbus_error_init();
>  dbus_bus_add_match(ck->connection, match, );
> -if (dbus_error_is_set()) { 
> +if (dbus_error_is_set()) {
>  syslog(LOG_ERR, "Match Error (%s)", error.message);
>  session_info_destroy(ck);
>  return NULL;
> diff --git a/src/dummy-session-info.c b/src/dummy-session-info.c
> index e188ddc..2f0ae65 100644
> --- a/src/dummy-session-info.c
> +++ b/src/dummy-session-info.c
> @@ -7,12 +7,12 @@
>  
>  This program is free software: you can redistribute it and/or
> modify
>  it under the terms of the GNU General Public License as
> published by
> -the Free Software Foundation, either version 3 of the License,
> or   
> +the Free Software Foundation, either version 3 of the License,
> or
>  (at your option) any later version.
>  
>  This program is distributed in the hope that it will be useful,
> -but WITHOUT ANY WARRANTY; without even the implied warranty of 
> -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>  GNU General Public License for more details.
>  
>  You should have received a copy of the GNU General Public
> License
> diff --git a/src/session-info.h b/src/session-info.h
> index 67099de..c4f8187 100644
> --- a/src/session-info.h
> +++ b/src/session-info.h
> @@ -7,12 +7,12 @@
>  
>  This program is free software: you can redistribute it and/or
> modify
>  it under the terms of the GNU General Public License as
> published by
> -the Free Software Foundation, either version 3 of the License,
> or   
> +the Free Software Foundation, either version 3 of the License,
> or
>  (at your option) any later version.
>  
>  This program is distributed in the hope that it will be useful,
> -but WITHOUT ANY WARRANTY; without even the implied warranty of 
> -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>  GNU General Public License for more details.
>  
>  You should have received a copy of the GNU General Public
> License
> diff --git a/src/systemd-login.c b/src/systemd-login.c
> index 73db37f..9ba300a 100644
> --- a/src/systemd-login.c
> +++ b/src/systemd-login.c
> @@ -7,12 +7,12 @@

Re: [Spice-devel] [vdagent-linux v3] remove trailing spaces

2016-04-11 Thread Pavel Grunt
On Mon, 2016-04-11 at 11:54 +0200, Victor Toso wrote:

Acked-by: Pavel Grunt <pgr...@redhat.com>
> ---
>  ChangeLog|  2 +-
>  src/console-kit.c| 10 +-
>  src/dummy-session-info.c |  6 +++---
>  src/session-info.h   |  6 +++---
>  src/systemd-login.c  |  6 +++---
>  src/udscs.c  |  8 
>  src/udscs.h  |  8 
>  src/vdagent-file-xfers.c |  6 +++---
>  src/vdagent-file-xfers.h |  6 +++---
>  src/vdagent-virtio-port.c|  8 
>  src/vdagent-virtio-port.h|  8 
>  src/vdagent-x11-randr.c  |  6 +++---
>  src/vdagent-x11.c|  8 
>  src/vdagent-x11.h|  6 +++---
>  src/vdagent.c|  6 +++---
>  src/vdagentd-proto-strings.h |  6 +++---
>  src/vdagentd-proto.h |  6 +++---
>  src/vdagentd-uinput.c|  6 +++---
>  src/vdagentd-uinput.h|  6 +++---
>  src/vdagentd-xorg-conf.h |  6 +++---
>  src/vdagentd.c   |  8 
>  21 files changed, 69 insertions(+), 69 deletions(-)
> 
> diff --git a/ChangeLog b/ChangeLog
> index 4138359..da24341 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -26,7 +26,7 @@ spice-vdagent-0.12.1
>  
>  spice-vdagent-0.12.0
>  
> -* Full multi-monitor and arbritary resolution support, this requires
> a new   
> +* Full multi-monitor and arbritary resolution support, this requires
> a new
>    enough xorg-x11-drv-qxl driver, as well as a new enough host
>  * systemd service support, using systemd hardware acivation
>  * Use syslog for logging, rather then logging to private log files
> diff --git a/src/console-kit.c b/src/console-kit.c
> index 759a81e..6e83bf2 100644
> --- a/src/console-kit.c
> +++ b/src/console-kit.c
> @@ -7,12 +7,12 @@
>  
>  This program is free software: you can redistribute it and/or
> modify
>  it under the terms of the GNU General Public License as
> published by
> -the Free Software Foundation, either version 3 of the License,
> or   
> +the Free Software Foundation, either version 3 of the License,
> or
>  (at your option) any later version.
>  
>  This program is distributed in the hope that it will be useful,
> -but WITHOUT ANY WARRANTY; without even the implied warranty of 
> -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>  GNU General Public License for more details.
>  
>  You should have received a copy of the GNU General Public
> License
> @@ -59,7 +59,7 @@ struct session_info *session_info_create(int
> verbose)
>  free(ck);
>  return NULL;
>  }
> -
> +
>  if (!dbus_connection_get_unix_fd(ck->connection, >fd)) {
>  syslog(LOG_ERR, "Unable to get connection fd");
>  session_info_destroy(ck);
> @@ -77,7 +77,7 @@ struct session_info *session_info_create(int
> verbose)
>   "path='%s',member='ActiveSessionChanged'", ck->seat);
>  dbus_error_init();
>  dbus_bus_add_match(ck->connection, match, );
> -if (dbus_error_is_set()) { 
> +if (dbus_error_is_set()) {
>  syslog(LOG_ERR, "Match Error (%s)", error.message);
>  session_info_destroy(ck);
>  return NULL;
> diff --git a/src/dummy-session-info.c b/src/dummy-session-info.c
> index e188ddc..2f0ae65 100644
> --- a/src/dummy-session-info.c
> +++ b/src/dummy-session-info.c
> @@ -7,12 +7,12 @@
>  
>  This program is free software: you can redistribute it and/or
> modify
>  it under the terms of the GNU General Public License as
> published by
> -the Free Software Foundation, either version 3 of the License,
> or   
> +the Free Software Foundation, either version 3 of the License,
> or
>  (at your option) any later version.
>  
>  This program is distributed in the hope that it will be useful,
> -but WITHOUT ANY WARRANTY; without even the implied warranty of 
> -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
> +but WITHOUT ANY WARRANTY; without even the implied warranty of
> +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>  GNU General Public License for more details.
>  
>  You should have received a copy of the GNU General Public
> License
> diff --git a/src/session-info.h b/src/session-info.h
> index 67099de..c4f8187 100644
> --- a/src/session-info.h
> +++ b/src/session-info.h
> @@ -7,12 +7,12 @@
>  
>  This program is free s

[Spice-devel] [PATCH spice-gtk v2 3/6] Use GMutex instead of GStaticMutex

2016-04-06 Thread Pavel Grunt
Since GLib 2.32 GMutex can be statically allocated, so GStaticMutex has
been deprecated.

Acked-by: Christophe Fergeau 
---
 src/desktop-integration.c |  6 +++---
 src/spice-gtk-session.c   |  6 +++---
 src/spice-session.c   | 12 ++--
 src/usbutil.c |  6 +++---
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/desktop-integration.c b/src/desktop-integration.c
index 01300e8..529fb05 100644
--- a/src/desktop-integration.c
+++ b/src/desktop-integration.c
@@ -196,17 +196,17 @@ static void 
spice_desktop_integration_class_init(SpiceDesktopIntegrationClass *k
 SpiceDesktopIntegration *spice_desktop_integration_get(SpiceSession *session)
 {
 SpiceDesktopIntegration *self;
-static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+static GMutex mutex;
 
 g_return_val_if_fail(session != NULL, NULL);
 
-g_static_mutex_lock();
+g_mutex_lock();
 self = g_object_get_data(G_OBJECT(session), "spice-desktop");
 if (self == NULL) {
 self = g_object_new(SPICE_TYPE_DESKTOP_INTEGRATION, NULL);
 g_object_set_data_full(G_OBJECT(session), "spice-desktop", self, 
g_object_unref);
 }
-g_static_mutex_unlock();
+g_mutex_unlock();
 
 return self;
 }
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 380b0bb..7370599 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -1133,15 +1133,15 @@ SpiceGtkSession *spice_gtk_session_get(SpiceSession 
*session)
 g_return_val_if_fail(SPICE_IS_SESSION(session), NULL);
 
 SpiceGtkSession *self;
-static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+static GMutex mutex;
 
-g_static_mutex_lock();
+g_mutex_lock();
 self = g_object_get_data(G_OBJECT(session), "spice-gtk-session");
 if (self == NULL) {
 self = g_object_new(SPICE_TYPE_GTK_SESSION, "session", session, NULL);
 g_object_set_data_full(G_OBJECT(session), "spice-gtk-session", self, 
g_object_unref);
 }
-g_static_mutex_unlock();
+g_mutex_unlock();
 
 return SPICE_GTK_SESSION(self);
 }
diff --git a/src/spice-session.c b/src/spice-session.c
index 6a0edae..9bf3f40 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -2641,18 +2641,18 @@ SpiceURI *spice_session_get_proxy_uri(SpiceSession 
*session)
  **/
 SpiceAudio *spice_audio_get(SpiceSession *session, GMainContext *context)
 {
-static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+static GMutex mutex;
 SpiceAudio *self;
 
 g_return_val_if_fail(SPICE_IS_SESSION(session), NULL);
 
-g_static_mutex_lock();
+g_mutex_lock();
 self = session->priv->audio_manager;
 if (self == NULL) {
 self = spice_audio_new(session, context, NULL);
 session->priv->audio_manager = self;
 }
-g_static_mutex_unlock();
+g_mutex_unlock();
 
 return self;
 }
@@ -2675,19 +2675,19 @@ SpiceUsbDeviceManager 
*spice_usb_device_manager_get(SpiceSession *session,
 GError **err)
 {
 SpiceUsbDeviceManager *self;
-static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
+static GMutex mutex;
 
 g_return_val_if_fail(SPICE_IS_SESSION(session), NULL);
 g_return_val_if_fail(err == NULL || *err == NULL, NULL);
 
-g_static_mutex_lock();
+g_mutex_lock();
 self = session->priv->usb_manager;
 if (self == NULL) {
 self = g_initable_new(SPICE_TYPE_USB_DEVICE_MANAGER, NULL, err,
   "session", session, NULL);
 session->priv->usb_manager = self;
 }
-g_static_mutex_unlock();
+g_mutex_unlock();
 
 return self;
 }
diff --git a/src/usbutil.c b/src/usbutil.c
index 24330b2..6cd8148 100644
--- a/src/usbutil.c
+++ b/src/usbutil.c
@@ -51,7 +51,7 @@ typedef struct _usb_vendor_info {
 char name[VENDOR_NAME_LEN];
 } usb_vendor_info;
 
-static GStaticMutex usbids_load_mutex = G_STATIC_MUTEX_INIT;
+static GMutex usbids_load_mutex;
 static int usbids_vendor_count = 0; /* < 0: failed, 0: empty, > 0: loaded */
 static usb_vendor_info *usbids_vendor_info = NULL;
 
@@ -215,7 +215,7 @@ static gboolean spice_usbutil_load_usbids(void)
 {
 gboolean success = FALSE;
 
-g_static_mutex_lock(_load_mutex);
+g_mutex_lock(_load_mutex);
 if (usbids_vendor_count) {
 success = usbids_vendor_count > 0;
 goto leave;
@@ -242,7 +242,7 @@ static gboolean spice_usbutil_load_usbids(void)
 #endif
 
 leave:
-g_static_mutex_unlock(_load_mutex);
+g_mutex_unlock(_load_mutex);
 return success;
 }
 
-- 
2.8.0

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk v2 4/6] Use g_object_unref instead of gdk_cursor_unref

2016-04-06 Thread Pavel Grunt
GdkCursor is GObject and gdk_cursor_unref has been deprecated since 3.0

Acked-by: Eduardo Lima (Etrunko) 
---
v2: fix commit message g_object_unref -> gdk_cursor_unref
---
 src/spice-widget.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/spice-widget.c b/src/spice-widget.c
index f605439..8ca8631 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -440,12 +440,12 @@ static void spice_display_finalize(GObject *obj)
 d->activeseq = NULL;
 
 if (d->show_cursor) {
-gdk_cursor_unref(d->show_cursor);
+g_object_unref(d->show_cursor);
 d->show_cursor = NULL;
 }
 
 if (d->mouse_cursor) {
-gdk_cursor_unref(d->mouse_cursor);
+g_object_unref(d->mouse_cursor);
 d->mouse_cursor = NULL;
 }
 
@@ -987,7 +987,7 @@ static GdkGrabStatus do_pointer_grab(SpiceDisplay *display)
 }
 
 end:
-gdk_cursor_unref(blank);
+g_object_unref(blank);
 return status;
 }
 
@@ -2368,7 +2368,7 @@ static void cursor_set(SpiceCursorChannel *channel,
 #endif
 if (d->show_cursor) {
 /* unhide */
-gdk_cursor_unref(d->show_cursor);
+g_object_unref(d->show_cursor);
 d->show_cursor = NULL;
 if (d->mouse_mode == SPICE_MOUSE_MODE_SERVER) {
 /* keep a hidden cursor, will be shown in cursor_move() */
@@ -2377,7 +2377,7 @@ static void cursor_set(SpiceCursorChannel *channel,
 }
 }
 
-gdk_cursor_unref(d->mouse_cursor);
+g_object_unref(d->mouse_cursor);
 d->mouse_cursor = cursor;
 
 update_mouse_pointer(display);
@@ -2493,7 +2493,7 @@ static void cursor_move(SpiceCursorChannel *channel, gint 
x, gint y, gpointer da
 
 /* apparently we have to restore cursor when "cursor_move" */
 if (d->show_cursor != NULL) {
-gdk_cursor_unref(d->mouse_cursor);
+g_object_unref(d->mouse_cursor);
 d->mouse_cursor = d->show_cursor;
 d->show_cursor = NULL;
 update_mouse_pointer(display);
-- 
2.8.0

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk v2 6/6] Use g_clear_pointer if possible

2016-04-06 Thread Pavel Grunt
---
v2: removed extra curly braces
fix wrong calls
diff to v1 - http://paste.fedoraproject.org/350384/14599492/
---
 src/bio-gio.c   |  3 +--
 src/channel-display-mjpeg.c |  3 +--
 src/channel-display.c   | 10 +++---
 src/channel-main.c  |  6 ++
 src/channel-playback.c  |  3 +--
 src/channel-record.c|  9 +++--
 src/channel-smartcard.c | 28 ++-
 src/channel-usbredir.c  |  9 +++--
 src/decode-glz.c|  3 +--
 src/smartcard-manager.c | 13 +++--
 src/spice-audio.c   |  5 +
 src/spice-channel.c | 26 ++---
 src/spice-gstaudio.c| 32 +--
 src/spice-gtk-session.c |  6 ++
 src/spice-option.c  |  3 +--
 src/spice-pulse.c   | 46 +
 src/spice-session.c | 12 
 src/spice-widget-cairo.c| 11 +++
 src/spice-widget.c  | 16 
 src/usb-acl-helper.c| 11 ++-
 src/wocky-http-proxy.c  |  3 +--
 21 files changed, 70 insertions(+), 188 deletions(-)

diff --git a/src/bio-gio.c b/src/bio-gio.c
index 108ac1a..b310c97 100644
--- a/src/bio-gio.c
+++ b/src/bio-gio.c
@@ -76,8 +76,7 @@ static int bio_gio_destroy(BIO *bio)
 return 0;
 
 SPICE_DEBUG("bio gsocket destroy");
-g_free(bio->method);
-bio->method = NULL;;
+g_clear_pointer(>method, g_free);
 
 return 1;
 }
diff --git a/src/channel-display-mjpeg.c b/src/channel-display-mjpeg.c
index 95d5b33..5ea3371 100644
--- a/src/channel-display-mjpeg.c
+++ b/src/channel-display-mjpeg.c
@@ -151,6 +151,5 @@ G_GNUC_INTERNAL
 void stream_mjpeg_cleanup(display_stream *st)
 {
 jpeg_destroy_decompress(>mjpeg_cinfo);
-g_free(st->out_frame);
-st->out_frame = NULL;
+g_clear_pointer(>out_frame, g_free);
 }
diff --git a/src/channel-display.c b/src/channel-display.c
index 431c2e7..b6c79e0 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -831,11 +831,8 @@ static void destroy_canvas(display_surface *surface)
 zlib_decoder_destroy(surface->zlib_decoder);
 jpeg_decoder_destroy(surface->jpeg_decoder);
 
-g_free(surface->data);
-surface->data = NULL;
-
-surface->canvas->ops->destroy(surface->canvas);
-surface->canvas = NULL;
+g_clear_pointer(>data, g_free);
+g_clear_pointer(>canvas, surface->canvas->ops->destroy);
 }
 
 static display_surface *find_surface(SpiceDisplayChannelPrivate *c, guint32 
surface_id)
@@ -1597,8 +1594,7 @@ static void clear_streams(SpiceChannel *channel)
 for (i = 0; i < c->nstreams; i++) {
 destroy_stream(channel, i);
 }
-g_free(c->streams);
-c->streams = NULL;
+g_clear_pointer(>streams, g_free);
 c->nstreams = 0;
 }
 
diff --git a/src/channel-main.c b/src/channel-main.c
index 4a1f58a..955b358 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -449,8 +449,7 @@ static void spice_main_channel_reset_agent(SpiceMainChannel 
*channel)
 c->agent_caps_received = FALSE;
 c->agent_display_config_sent = FALSE;
 c->agent_msg_pos = 0;
-g_free(c->agent_msg_data);
-c->agent_msg_data = NULL;
+g_clear_pointer(>agent_msg_data, g_free);
 c->agent_msg_size = 0;
 
 tasks = g_hash_table_get_values(c->file_xfer_tasks);
@@ -916,8 +915,7 @@ static void agent_free_msg_queue(SpiceMainChannel *channel)
 spice_msg_out_unref(out);
 }
 
-g_queue_free(c->agent_msg_queue);
-c->agent_msg_queue = NULL;
+g_clear_pointer(>agent_msg_queue, g_queue_free);
 }
 
 static gboolean flush_foreach_remove(gpointer key G_GNUC_UNUSED,
diff --git a/src/channel-playback.c b/src/channel-playback.c
index c97afd8..e931727 100644
--- a/src/channel-playback.c
+++ b/src/channel-playback.c
@@ -114,8 +114,7 @@ static void spice_playback_channel_finalize(GObject *obj)
 
 snd_codec_destroy(>codec);
 
-g_free(c->volume);
-c->volume = NULL;
+g_clear_pointer(>volume, g_free);
 
 if (G_OBJECT_CLASS(spice_playback_channel_parent_class)->finalize)
 G_OBJECT_CLASS(spice_playback_channel_parent_class)->finalize(obj);
diff --git a/src/channel-record.c b/src/channel-record.c
index 08269c9..09598b7 100644
--- a/src/channel-record.c
+++ b/src/channel-record.c
@@ -108,13 +108,11 @@ static void spice_record_channel_finalize(GObject *obj)
 {
 SpiceRecordChannelPrivate *c = SPICE_RECORD_CHANNEL(obj)->priv;
 
-g_free(c->last_frame);
-c->last_frame = NULL;
+g_clear_pointer(>last_frame, g_free);
 
 snd_codec_destroy(>codec);
 
-g_free(c->volume);
-c->volume = NULL;
+g_clear_pointer(>volume, g_free);
 
 if (G_OBJECT_CLASS(spice_record_channel_parent_class)->finalize)
 G_OBJECT_CLASS(spice_record_channel_parent_class)->finalize(obj);
@@ -166,8 +164,7 @@ static void channel_reset(SpiceChannel *channel, gboolean 
migrating)
 {
 SpiceRecordChannelPrivate *c = 

[Spice-devel] [PATCH spice-gtk v2 0/6] Cleanups for new gtk and glib

2016-04-06 Thread Pavel Grunt
Hi,

since we bumped the glib and gtk dependencies, it's possible to clean up
the code little bit. Patches silence some deprecated warnings and change
our code to use more g_clear_pointer and g_clear_object.

Thanks,
Pavel

v2 adds commits for checking version of glib and gtk (works when deprecated 
warnings are enabled), 
fixes the commit message in the PATCH 4, fixes wrong usage of g_clear_pointer 
in the PATCH 6

Pavel Grunt (6):
  Use GLIB_VERSION_MAX_ALLOWED
  Use GDK_VERSION_MAX_ALLOWED
  Use GMutex instead of GStaticMutex
  Use g_object_unref instead of gdk_cursor_unref
  Use g_clear_object if possible
  Use g_clear_pointer if possible

 configure.ac| 13 +++--
 src/bio-gio.c   |  3 +--
 src/channel-display-mjpeg.c |  3 +--
 src/channel-display.c   | 10 +++---
 src/channel-main.c  |  6 ++
 src/channel-playback.c  |  3 +--
 src/channel-record.c|  9 +++--
 src/channel-smartcard.c | 28 ++-
 src/channel-usbredir.c  |  9 +++--
 src/decode-glz.c|  3 +--
 src/desktop-integration.c   |  6 +++---
 src/smartcard-manager.c | 13 +++--
 src/spice-audio.c   |  5 +
 src/spice-channel.c | 37 
 src/spice-gstaudio.c| 32 +--
 src/spice-gtk-session.c | 12 +---
 src/spice-option.c  |  3 +--
 src/spice-pulse.c   | 46 +
 src/spice-session.c | 24 ++-
 src/spice-widget-cairo.c| 11 +++
 src/spice-widget.c  | 44 +++
 src/usb-acl-helper.c| 11 ++-
 src/usbutil.c   |  6 +++---
 src/wocky-http-proxy.c  |  6 ++
 24 files changed, 106 insertions(+), 237 deletions(-)

-- 
2.8.0

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk v2 5/6] Use g_clear_object if possible

2016-04-06 Thread Pavel Grunt
Acked-by: Eduardo Lima (Etrunko) 
---
kept separated per Christophe's suggestion
---
 src/spice-channel.c| 11 ++-
 src/spice-widget.c | 22 --
 src/wocky-http-proxy.c |  3 +--
 3 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/src/spice-channel.c b/src/spice-channel.c
index 8ae0e4d..e9c5a1b 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -155,10 +155,7 @@ static void spice_channel_dispose(GObject *gobject)
 
 spice_channel_disconnect(channel, SPICE_CHANNEL_CLOSED);
 
-if (c->session) {
- g_object_unref(c->session);
- c->session = NULL;
-}
+g_clear_object(>session);
 
 g_clear_error(>error);
 
@@ -2718,11 +2715,7 @@ static void channel_reset(SpiceChannel *channel, 
gboolean migrating)
 c->ctx = NULL;
 }
 
-if (c->conn) {
-g_object_unref(c->conn);
-c->conn = NULL;
-}
-
+g_clear_object(>conn);
 g_clear_object(>sock);
 
 c->fd = -1;
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 8ca8631..72a0355 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -439,20 +439,9 @@ static void spice_display_finalize(GObject *obj)
 g_free(d->activeseq);
 d->activeseq = NULL;
 
-if (d->show_cursor) {
-g_object_unref(d->show_cursor);
-d->show_cursor = NULL;
-}
-
-if (d->mouse_cursor) {
-g_object_unref(d->mouse_cursor);
-d->mouse_cursor = NULL;
-}
-
-if (d->mouse_pixbuf) {
-g_object_unref(d->mouse_pixbuf);
-d->mouse_pixbuf = NULL;
-}
+g_clear_object(>show_cursor);
+g_clear_object(>mouse_cursor);
+g_clear_object(>mouse_pixbuf);
 
 G_OBJECT_CLASS(spice_display_parent_class)->finalize(obj);
 }
@@ -2343,10 +2332,7 @@ static void cursor_set(SpiceCursorChannel *channel,
 
 cursor_invalidate(display);
 
-if (d->mouse_pixbuf) {
-g_object_unref(d->mouse_pixbuf);
-d->mouse_pixbuf = NULL;
-}
+g_clear_object(>mouse_pixbuf);
 
 if (rgba != NULL) {
 d->mouse_pixbuf = gdk_pixbuf_new_from_data(g_memdup(rgba, width * 
height * 4),
diff --git a/src/wocky-http-proxy.c b/src/wocky-http-proxy.c
index a1a030a..33d57d8 100644
--- a/src/wocky-http-proxy.c
+++ b/src/wocky-http-proxy.c
@@ -222,8 +222,7 @@ wocky_http_proxy_connect (GProxy *proxy,
   g_free (buffer);
   buffer = g_data_input_stream_read_until (data_in, HTTP_END_MARKER, NULL,
   cancellable, error);
-  g_object_unref (data_in);
-  data_in = NULL;
+  g_clear_object(_in);
 
   if (buffer == NULL)
 {
-- 
2.8.0

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk v2 1/6] Use GLIB_VERSION_MAX_ALLOWED

2016-04-06 Thread Pavel Grunt
In order to avoid using a too new GLib API.

Taken from virt-viewer 96d120903f0b95d49642e58d4f796b4f62aa8b20
---
v2: new patch
---
 configure.ac | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 4227fd8..817aaab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -166,7 +166,13 @@ fi
 
 AC_CHECK_FUNCS(clearenv strtok_r)
 
-PKG_CHECK_MODULES(GLIB2, glib-2.0)
+# Keep these two definitions in agreement.
+GLIB2_REQUIRED="2.36"
+GLIB2_ENCODED_VERSION="GLIB_VERSION_2_36"
+
+PKG_CHECK_MODULES(GLIB2, glib-2.0 >= $GLIB2_REQUIRED)
+GLIB2_CFLAGS="$GLIB2_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=$GLIB2_ENCODED_VERSION 
\
+  -DGLIB_VERSION_MAX_ALLOWED=$GLIB2_ENCODED_VERSION"
 AC_SUBST(GLIB2_CFLAGS)
 AC_SUBST(GLIB2_LIBS)
 
-- 
2.8.0

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH 04/10] Rename SmartCardDeviceState to RedCharDeviceSmartcard

2016-04-06 Thread Pavel Grunt
On Fri, 2016-04-01 at 15:51 -0500, Jonathon Jongsma wrote:
> More consistent with naming conventions, and prepares for converting
> this type to a GObject which inherits from RedCharDevice.

Acked-by: Pavel Grunt <pgr...@redhat.com>
> ---
>  server/smartcard.c | 260 ++-
> --
>  1 file changed, 130 insertions(+), 130 deletions(-)
> 
> diff --git a/server/smartcard.c b/server/smartcard.c
> index 03782e2..d138ea7 100644
> --- a/server/smartcard.c
> +++ b/server/smartcard.c
> @@ -49,11 +49,11 @@
>  // Maximal length of APDU
>  #define APDUBufSize 270
>  
> -typedef struct SmartCardDeviceState SmartCardDeviceState;
> +typedef struct RedCharDeviceSmartcard RedCharDeviceSmartcard;
>  
>  typedef struct SmartCardChannelClient {
>  RedChannelClient base;
> -SmartCardDeviceState *smartcard_state;
> +RedCharDeviceSmartcard *smartcard;
>  
>  /* read_from_client/write_to_device buffer.
>   * The beginning of the buffer should always be VSCMsgHeader*/
> @@ -75,7 +75,7 @@ struct RedCharDeviceSmartcardPrivate {
>  int  reader_added; // has reader_add been sent
> to the device
>  };
>  
> -struct SmartCardDeviceState {
> +struct RedCharDeviceSmartcard {
>  struct RedCharDeviceSmartcardPrivate priv[1];
>  };
>  
> @@ -120,52 +120,52 @@ static void
> smartcard_char_device_attach_client(
>  static void
> smartcard_channel_write_to_reader(RedCharDeviceWriteBuffer
> *write_buf);
>  
>  static MsgItem *smartcard_char_device_on_message_from_device(
> -SmartCardDeviceState *state, VSCMsgHeader *header);
> -static SmartCardDeviceState *smartcard_device_state_new(RedsState
> *reds, SpiceCharDeviceInstance *sin);
> -static void smartcard_device_state_free(SmartCardDeviceState* st);
> +RedCharDeviceSmartcard *dev, VSCMsgHeader *header);
> +static RedCharDeviceSmartcard *smartcard_device_new(RedsState *reds,
> SpiceCharDeviceInstance *sin);
> +static void smartcard_device_free(RedCharDeviceSmartcard* dev);
>  static void smartcard_init(RedsState *reds);
>  
> -static void smartcard_read_buf_prepare(SmartCardDeviceState *state,
> VSCMsgHeader *vheader)
> +static void smartcard_read_buf_prepare(RedCharDeviceSmartcard *dev,
> VSCMsgHeader *vheader)
>  {
>  uint32_t msg_len;
>  
>  msg_len = ntohl(vheader->length);
> -if (msg_len > state->priv->buf_size) {
> -state->priv->buf_size = MAX(state->priv->buf_size * 2,
> msg_len + sizeof(VSCMsgHeader));
> -state->priv->buf = spice_realloc(state->priv->buf, state-
> >priv->buf_size);
> +if (msg_len > dev->priv->buf_size) {
> +dev->priv->buf_size = MAX(dev->priv->buf_size * 2, msg_len +
> sizeof(VSCMsgHeader));
> +dev->priv->buf = spice_realloc(dev->priv->buf, dev->priv-
> >buf_size);
>  }
>  }
>  
>  static RedCharDeviceMsgToClient
> *smartcard_read_msg_from_device(SpiceCharDeviceInstance *sin,
>  void
> *opaque)
>  {
> -SmartCardDeviceState *state = opaque;
> +RedCharDeviceSmartcard *dev = opaque;
>  SpiceCharDeviceInterface *sif =
> spice_char_device_get_interface(sin);
> -VSCMsgHeader *vheader = (VSCMsgHeader*)state->priv->buf;
> +VSCMsgHeader *vheader = (VSCMsgHeader*)dev->priv->buf;
>  int n;
>  int remaining;
>  int actual_length;
>  
> -while ((n = sif->read(sin, state->priv->buf_pos, state->priv-
> >buf_size - state->priv->buf_used)) > 0) {
> +while ((n = sif->read(sin, dev->priv->buf_pos, dev->priv-
> >buf_size - dev->priv->buf_used)) > 0) {
>  MsgItem *msg_to_client;
>  
> -state->priv->buf_pos += n;
> -state->priv->buf_used += n;
> -if (state->priv->buf_used < sizeof(VSCMsgHeader)) {
> +dev->priv->buf_pos += n;
> +dev->priv->buf_used += n;
> +if (dev->priv->buf_used < sizeof(VSCMsgHeader)) {
>  continue;
>  }
> -smartcard_read_buf_prepare(state, vheader);
> +smartcard_read_buf_prepare(dev, vheader);
>  actual_length = ntohl(vheader->length);
> -if (state->priv->buf_used - sizeof(VSCMsgHeader) <
> actual_length) {
> +if (dev->priv->buf_used - sizeof(VSCMsgHeader) <
> actual_length) {
>  continue;
>  }
> -msg_to_client =
> smartcard_char_device_on_message_from_device(state, vheader);
> -remaining = state->priv->buf_used - sizeof(VSCMsg

[Spice-devel] [PATCH spice-gtk] Do not use deprecated GtkStock

2016-04-07 Thread Pavel Grunt
Use labels or named icons

Deprecated since Gtk 3.10
---
 src/spicy.c | 23 +++
 src/usb-device-widget.c | 12 ++--
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/src/spicy.c b/src/spicy.c
index ca9db84..0475530 100644
--- a/src/spicy.c
+++ b/src/spicy.c
@@ -143,9 +143,9 @@ static int ask_user(GtkWidget *parent, char *title, char 
*message,
 dialog = gtk_dialog_new_with_buttons(title,
  parent ? GTK_WINDOW(parent) : NULL,
  GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_OK,
+ "_OK",
  GTK_RESPONSE_ACCEPT,
- GTK_STOCK_CANCEL,
+ "_Cancel",
  GTK_RESPONSE_REJECT,
  NULL);
 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
@@ -370,7 +370,7 @@ static void menu_cb_select_usb_devices(GtkAction *action, 
void *data)
 "Select USB devices for redirection",
 GTK_WINDOW(win->toplevel),
 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT,
+"_Close", GTK_RESPONSE_ACCEPT,
 NULL);
 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
 gtk_container_set_border_width(GTK_CONTAINER(dialog), 12);
@@ -462,7 +462,7 @@ static void menu_cb_about(GtkAction *action, void *data)
   "authors", authors,
   "comments",comments,
   "copyright",   copyright,
-  "logo-icon-name",  GTK_STOCK_ABOUT,
+  "logo-icon-name",  "help-about",
   "website", website,
   "version", PACKAGE_VERSION,
   "license", "LGPLv2.1",
@@ -640,12 +640,12 @@ static const GtkActionEntry entries[] = {
 
 /* File menu */
 .name= "Connect",
-.stock_id= GTK_STOCK_CONNECT,
+.stock_id= "_Connect",
 .label   = "_Connect ...",
 .callback= G_CALLBACK(menu_cb_connect),
 },{
 .name= "Close",
-.stock_id= GTK_STOCK_CLOSE,
+.stock_id= "window-close",
 .label   = "_Close",
 .callback= G_CALLBACK(menu_cb_close),
 .accelerator = "", /* none (disable default "W") */
@@ -653,13 +653,13 @@ static const GtkActionEntry entries[] = {
 
 /* Edit menu */
 .name= "CopyToGuest",
-.stock_id= GTK_STOCK_COPY,
+.stock_id= "edit-copy",
 .label   = "_Copy to guest",
 .callback= G_CALLBACK(menu_cb_copy),
 .accelerator = "", /* none (disable default "C") */
 },{
 .name= "PasteFromGuest",
-.stock_id= GTK_STOCK_PASTE,
+.stock_id= "edit-paste",
 .label   = "_Paste from guest",
 .callback= G_CALLBACK(menu_cb_paste),
 .accelerator = "", /* none (disable default "V") */
@@ -667,7 +667,7 @@ static const GtkActionEntry entries[] = {
 
 /* View menu */
 .name= "Fullscreen",
-.stock_id= GTK_STOCK_FULLSCREEN,
+.stock_id= "view-fullscreen",
 .label   = "_Fullscreen",
 .callback= G_CALLBACK(menu_cb_fullscreen),
 .accelerator = "F11",
@@ -695,7 +695,7 @@ static const GtkActionEntry entries[] = {
 
 /* Help menu */
 .name= "About",
-.stock_id= GTK_STOCK_ABOUT,
+.stock_id= "help-about",
 .label   = "_About ...",
 .callback= G_CALLBACK(menu_cb_about),
 }
@@ -1486,8 +1486,7 @@ TransferTaskWidgets 
*transfer_task_widgets_new(SpiceFileTransferTask *task)
 
 widgets->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
 widgets->hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
-widgets->cancel = gtk_button_new_from_icon_name(GTK_STOCK_CANCEL,
-
GTK_ICON_SIZE_SMALL_TOOLBAR);
+widgets->cancel = gtk_button_new_with_label("_Cancel");
 
 widgets->progress = gtk_progress_bar_new();
 widgets->label = 
gtk_label_new(spice_file_transfer_task_get_filename(task));
diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c
index d3ea79a..05c7054 100644
--- a/src/usb-device-widget.c
+++ b/src/usb-device-widget.c
@@ -166,8 +166,8 @@ spice_usb_device_widget_show_info_bar(SpiceUsbDeviceWidget 
*self,
 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
 gtk_container_add(GTK_CONTAINER(content_area), hbox);
 
-widget = 

Re: [Spice-devel] [PATCH 1/2] define SPICE_CONSTRUCTOR_FUNC and SPICE_DESTRUCTOR_FUNC macros

2016-03-19 Thread Pavel Grunt
On Wed, 2016-03-16 at 11:52 -0400, Frediano Ziglio wrote:
> > 
> > 
> > Hi,
> > 
> > On Mon, Feb 29, 2016 at 10:36:53AM +, Frediano Ziglio wrote:
> > > 
> > > Allow to define functions executed at program/shared object
> > > initialization
> > > or close.
> > > 
> > > Signed-off-by: Frediano Ziglio 
> > > ---
> > >  common/macros.h | 22 ++
> > >  1 file changed, 22 insertions(+)
> > > 
> > > diff --git a/common/macros.h b/common/macros.h
> > > index 47289be..fe36929 100644
> > > --- a/common/macros.h
> > > +++ b/common/macros.h
> > > @@ -29,5 +29,27 @@
> > >  #define SPICE_ATTR_PRINTF
> > >  #endif /* __GNUC__ */
> > >  
> > > +#ifdef __GNUC__
> > > +#define SPICE_CONSTRUCTOR_FUNC(func_name) \
> > > +static void __attribute__((constructor)) func_name(void)
> > > +#define SPICE_DESTRUCTOR_FUNC(func_name) \
> > > +static void __attribute__((destructor)) func_name(void)
> > > +#elif defined(_MSC_VER)
> > > +#define SPICE_CONSTRUCTOR_FUNC(func_name) \
> > > +static void func_name(void); \
> > > +static int func_name ## _wrapper(void) { func_name(); return
> > > 0; } \
> > > +__pragma(section(".CRT$XCU",read)) \
> > > +__declspec(allocate(".CRT$XCU")) static int (* _array ##
> > > func_name)(void) = func_name ## _wrapper; \
> > > +static void func_name(void)
> > > +#define SPICE_DESTRUCTOR_FUNC(func_name) \
> > > +static void func_name(void); \
> > > +static int func_name ## _wrapper(void) { func_name(); return
> > > 0; } \
> > > +__pragma(section(".CRT$XPU",read)) \
> > > +__declspec(allocate(".CRT$XPU")) static int (* _array ##
> > > func_name)(void) = func_name ## _wrapper; \
> > > +static void func_name(void)
> > > +#else
> > > +#error Please implement SPICE_CONSTRUCTOR_FUNC and
> > > SPICE_DESTRUCTOR_FUNC
> > > for this compiler
> > > +#endif
> > > +
> > >  
> > >  #endif /* __MACROS_H */
> > > --
> > > 2.5.0
> > Testes, works without issues.
> > 
> > I'm wondering why not to include the whole header from glib [0] and
> > maybe file a bug to ask them to export in the future.
> > 
> > [0] https://git.gnome.org/browse/glib/tree/glib/gconstructor.h
> > 
> > Then, in case G_HAS_CONSTRUCTORS is not defined we can include
> > different
> > arch constructors. What do you think?
> > 
> > PS: while looking for an open bug:
> > aix: https://bugzilla.gnome.org/show_bug.cgi?id=763560
> > hp-ux/ia: https://bugzilla.gnome.org/show_bug.cgi?id=763466
> > 
> > cheers,
> >   toso
> > 
> Do we want to support HP-UX or AIX? I did work on HP-UX and from what
> I
> can see not even HP is supporting that much this OS.
> Personally I don't like Gnome implementation, particularly the atexit
> call
> on Windows.
> I don't understand the g_slist_find call either.
> 
> Frediano


What about clang ? Does it work there?

Pavel
> ___
> 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] [PATCH spice-gtk 5/5] Adjust to Gtk+ 3.10

2016-03-19 Thread Pavel Grunt
Dependency since f9a1aad85fcc76dd76c454b51fbce5e07c9b145f

Remove unneeded GTK_CHECK_VERSION guards
---
 src/gtk-compat.h|  2 --
 src/spicy.c | 16 
 src/usb-device-widget.c |  9 -
 3 files changed, 27 deletions(-)

diff --git a/src/gtk-compat.h b/src/gtk-compat.h
index b2cf6d6..39438f9 100644
--- a/src/gtk-compat.h
+++ b/src/gtk-compat.h
@@ -22,12 +22,10 @@
 
 #include 
 
-#if GTK_CHECK_VERSION (2, 91, 0)
 static inline void gdk_drawable_get_size(GdkWindow *w, gint *ww, gint *wh)
 {
 *ww = gdk_window_get_width(w);
 *wh = gdk_window_get_height(w);
 }
-#endif
 
 #endif /* GTK_COMPAT_H */
diff --git a/src/spicy.c b/src/spicy.c
index c3564f0..6ca014b 100644
--- a/src/spicy.c
+++ b/src/spicy.c
@@ -1001,11 +1001,7 @@ static SpiceWindow *create_spice_window(spice_connection 
*conn, SpiceChannel *ch
  G_CALLBACK(grab_keys_pressed_cb), win);
 
 /* status line */
-#if GTK_CHECK_VERSION(3,0,0)
 win->statusbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 1);
-#else
-win->statusbar = gtk_hbox_new(FALSE, 1);
-#endif
 
 win->status = gtk_label_new("status line");
 gtk_misc_set_alignment(GTK_MISC(win->status), 0, 0.5);
@@ -1025,11 +1021,7 @@ static SpiceWindow *create_spice_window(spice_connection 
*conn, SpiceChannel *ch
 }
 
 /* Make a vbox and put stuff in */
-#if GTK_CHECK_VERSION(3,0,0)
 vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 1);
-#else
-vbox = gtk_vbox_new(FALSE, 1);
-#endif
 gtk_container_set_border_width(GTK_CONTAINER(vbox), 0);
 gtk_container_add(GTK_CONTAINER(win->toplevel), vbox);
 gtk_box_pack_start(GTK_BOX(vbox), win->menubar, FALSE, FALSE, 0);
@@ -1510,28 +1502,20 @@ TransferTaskWidgets 
*transfer_task_widgets_new(SpiceFileTransferTask *task)
 {
 TransferTaskWidgets *widgets = g_new0(TransferTaskWidgets, 1);
 
-#if GTK_CHECK_VERSION(3,0,0)
 widgets->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
 widgets->hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
 widgets->cancel = gtk_button_new_from_icon_name(GTK_STOCK_CANCEL,
 
GTK_ICON_SIZE_SMALL_TOOLBAR);
-#else
-widgets->vbox = gtk_vbox_new(FALSE, 0);
-widgets->hbox = gtk_hbox_new(FALSE, 6);
-widgets->cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
-#endif
 
 widgets->progress = gtk_progress_bar_new();
 widgets->label = 
gtk_label_new(spice_file_transfer_task_get_filename(task));
 
-#if GTK_CHECK_VERSION(3,0,0)
 gtk_widget_set_halign(widgets->label, GTK_ALIGN_START);
 gtk_widget_set_valign(widgets->label, GTK_ALIGN_BASELINE);
 gtk_widget_set_valign(widgets->progress, GTK_ALIGN_CENTER);
 gtk_widget_set_hexpand(widgets->progress, TRUE);
 gtk_widget_set_valign(widgets->cancel, GTK_ALIGN_CENTER);
 gtk_widget_set_hexpand(widgets->progress, FALSE);
-#endif
 
 gtk_box_pack_start(GTK_BOX(widgets->hbox), widgets->progress,
TRUE, TRUE, 0);
diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c
index 8f85ae9..3b060e9 100644
--- a/src/usb-device-widget.c
+++ b/src/usb-device-widget.c
@@ -94,12 +94,7 @@ struct _SpiceUsbDeviceWidgetPrivate {
 
 static guint signals[LAST_SIGNAL] = { 0, };
 
-#if GTK_CHECK_VERSION(3,0,0)
 G_DEFINE_TYPE(SpiceUsbDeviceWidget, spice_usb_device_widget, GTK_TYPE_BOX);
-#else
-G_DEFINE_TYPE(SpiceUsbDeviceWidget, spice_usb_device_widget, GTK_TYPE_VBOX);
-#endif
-
 
 static void spice_usb_device_widget_get_property(GObject *gobject,
  guintprop_id,
@@ -168,11 +163,7 @@ spice_usb_device_widget_show_info_bar(SpiceUsbDeviceWidget 
*self,
 gtk_info_bar_set_message_type(GTK_INFO_BAR(info_bar), message_type);
 
 content_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(info_bar));
-#if GTK_CHECK_VERSION(3,0,0)
 hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
-#else
-hbox = gtk_hbox_new(FALSE, 12);
-#endif
 gtk_container_add(GTK_CONTAINER(content_area), hbox);
 
 widget = gtk_image_new_from_stock(stock_icon_id,
-- 
2.7.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk 3/3] spicy: s/Automagic/Automatic/

2016-03-19 Thread Pavel Grunt
---
It's A Kind of Magic
---
 src/spicy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/spicy.c b/src/spicy.c
index 12ae653..a3f357a 100644
--- a/src/spicy.c
+++ b/src/spicy.c
@@ -738,7 +738,7 @@ static const GtkToggleActionEntry tentries[] = {
 .callback= G_CALLBACK(menu_cb_bool_prop),
 },{
 .name= "auto-clipboard",
-.label   = "Automagic clipboard sharing between host and guest",
+.label   = "Automatic clipboard sharing between host and guest",
 .callback= G_CALLBACK(menu_cb_bool_prop),
 },{
 .name= "auto-usbredir",
-- 
2.7.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk 4/5] Adjust to GLib 2.36

2016-03-19 Thread Pavel Grunt
Dependency since 8693e7d3f7de1ff102082212fa6e35fb1a252ef7

Remove glib-compat files and most of GLIB_CHECK_VERSION guards
---
 doc/reference/Makefile.am  |   1 -
 po/POTFILES.skip   |   1 -
 src/Makefile.am|   5 --
 src/channel-cursor.c   |   1 -
 src/channel-display.c  |   1 -
 src/channel-main.c |   1 -
 src/channel-port.c |   1 -
 src/channel-usbredir.c |   9 ---
 src/channel-webdav.c   |   1 -
 src/controller/dump.c  |   3 -
 src/controller/test.c  |   3 -
 src/desktop-integration.c  |   1 -
 src/glib-compat.c  | 112 -
 src/glib-compat.h  |  65 ---
 src/smartcard-manager.c|   2 -
 src/spice-audio.c  |   2 -
 src/spice-channel.c|   1 -
 src/spice-client-glib-usb-acl-helper.c |   6 --
 src/spice-option.c |   1 -
 src/spice-pulse.c  |   1 -
 src/spice-session.c|   1 -
 src/spice-uri.c|   1 -
 src/spice-util-priv.h  |   8 ---
 src/spice-util.c   |   2 -
 src/spice-util.h   |   2 +-
 src/spice-widget.c |   1 -
 src/spicy-screenshot.c |   3 -
 src/spicy-stats.c  |   3 -
 src/spicy.c|   7 ---
 src/usb-acl-helper.c   |   1 -
 src/usb-device-manager.c   |   7 ---
 src/usb-device-widget.c|   1 -
 src/usbutil.c  |   2 -
 src/vmcstream.c|   1 -
 src/wocky-http-proxy.c |   1 -
 src/wocky-http-proxy.h |   2 -
 tests/coroutine.c  |   4 --
 tests/mock-acl-helper.c|   4 --
 38 files changed, 1 insertion(+), 268 deletions(-)
 delete mode 100644 src/glib-compat.c
 delete mode 100644 src/glib-compat.h

diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
index b76a9cf..cb01f97 100644
--- a/doc/reference/Makefile.am
+++ b/doc/reference/Makefile.am
@@ -32,7 +32,6 @@ IGNORE_HFILES=\
decode.h\
display \
gio-coroutine.h \
-   glib-compat.h   \
smartcard-manager-priv.h\
spice-audio-priv.h  \
spice-channel-cache.h   \
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
index 4da36d0..0dd1912 100644
--- a/po/POTFILES.skip
+++ b/po/POTFILES.skip
@@ -1,3 +1,2 @@
 spice-common/python_modules/spice_parser.py
 spice-common/spice_codegen.py
-src/glib-compat.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 2e7aa3b..e393913 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -122,7 +122,6 @@ SPICE_GTK_LIBADD_COMMON =   \
$(NULL)
 
 SPICE_GTK_SOURCES_COMMON = \
-   glib-compat.h   \
gtk-compat.h\
spice-util.c\
spice-util-priv.h   \
@@ -214,8 +213,6 @@ endif
 libspice_client_glib_2_0_la_SOURCES =  \
bio-gio.c   \
bio-gio.h   \
-   glib-compat.c   \
-   glib-compat.h   \
spice-audio.c   \
spice-audio-priv.h  \
spice-common.h  \
@@ -389,8 +386,6 @@ spicy_CPPFLAGS =\
 
 if WITH_POLKIT
 spice_client_glib_usb_acl_helper_SOURCES = \
-   glib-compat.c   \
-   glib-compat.h   \
spice-client-glib-usb-acl-helper.c  \
$(NULL)
 
diff --git a/src/channel-cursor.c b/src/channel-cursor.c
index 0765209..2ae8f86 100644
--- a/src/channel-cursor.c
+++ b/src/channel-cursor.c
@@ -17,7 +17,6 @@
 */
 #include "config.h"
 
-#include "glib-compat.h"
 #include "spice-client.h"
 #include "spice-common.h"
 
diff --git a/src/channel-display.c b/src/channel-display.c
index f576679..2c54df7 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -21,7 +21,6 @@
 #include 
 #endif
 
-#include "glib-compat.h"
 #include "spice-client.h"
 #include "spice-common.h"
 
diff --git a/src/channel-main.c b/src/channel-main.c
index 276799f..1c19de1 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -21,7 +21,6 @@
 #include 
 #include 
 
-#include "glib-compat.h"
 #include "spice-client.h"
 #include "spice-common.h"
 #include "spice-marshal.h"
diff --git 

Re: [Spice-devel] [PATCH spice-gtk 3/3] spicy: s/Automagic/Automatic/

2016-03-19 Thread Pavel Grunt
On Wed, 2016-03-16 at 17:16 -0300, Eduardo Lima (Etrunko) wrote:
> On 03/16/2016 10:46 AM, Pavel Grunt wrote:
> > 
> > ---
> > It's A Kind of Magic
> > ---
> >  src/spicy.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/src/spicy.c b/src/spicy.c
> > index 12ae653..a3f357a 100644
> > --- a/src/spicy.c
> > +++ b/src/spicy.c
> > @@ -738,7 +738,7 @@ static const GtkToggleActionEntry tentries[] =
> > {
> >  .callback= G_CALLBACK(menu_cb_bool_prop),
> >  },{
> >  .name= "auto-clipboard",
> > -.label   = "Automagic clipboard sharing between host
> > and guest",
> > +.label   = "Automatic clipboard sharing between host
> > and guest",
> >  .callback= G_CALLBACK(menu_cb_bool_prop),
> >  },{
> >  .name= "auto-usbredir",
> > 
> Acked-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
> 
> 

Thanks, pushed

Pavel

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk 3/5] Move strtok_r from glib-compat to spice-uri

2016-03-19 Thread Pavel Grunt
It is not glib specific and it is only used in spice-uri
---
 src/glib-compat.c | 31 ---
 src/glib-compat.h |  4 
 src/spice-uri.c   | 29 +
 3 files changed, 29 insertions(+), 35 deletions(-)

diff --git a/src/glib-compat.c b/src/glib-compat.c
index 41a7f52..622620b 100644
--- a/src/glib-compat.c
+++ b/src/glib-compat.c
@@ -110,34 +110,3 @@ g_queue_free_full (GQueue*queue,
   g_queue_free (queue);
 }
 #endif
-
-
-#ifndef HAVE_STRTOK_R
-G_GNUC_INTERNAL
-char *strtok_r(char *s, const char *delim, char **save_ptr)
-{
-char *token;
-
-if (s == NULL)
-s = *save_ptr;
-
-/* Scan leading delimiters. */
-s += strspn (s, delim);
-if (*s == '\0')
-return NULL;
-
-/* Find the end of the token. */
-token = s;
-s = strpbrk (token, delim);
-if (s == NULL)
-/* This token finishes the string. */
-*save_ptr = strchr (token, '\0');
-else
-{
-/* Terminate the token and make *SAVE_PTR point past it. */
-*s = '\0';
-*save_ptr = s + 1;
-}
-return token;
-}
-#endif
diff --git a/src/glib-compat.h b/src/glib-compat.h
index 512ea55..51eef5c 100644
--- a/src/glib-compat.h
+++ b/src/glib-compat.h
@@ -62,8 +62,4 @@ g_queue_free_full (GQueue*queue,
   } G_STMT_END
 #endif
 
-#ifndef HAVE_STRTOK_R
-char* strtok_r(char *s, const char *delim, char **save_ptr);
-#endif
-
 #endif /* GLIB_COMPAT_H */
diff --git a/src/spice-uri.c b/src/spice-uri.c
index e2c5c9a..d925973 100644
--- a/src/spice-uri.c
+++ b/src/spice-uri.c
@@ -60,6 +60,35 @@ enum  {
 SPICE_URI_PORT
 };
 
+#ifndef HAVE_STRTOK_R
+static char *strtok_r(char *s, const char *delim, char **save_ptr)
+{
+char *token;
+
+if (s == NULL)
+s = *save_ptr;
+
+/* Scan leading delimiters. */
+s += strspn (s, delim);
+if (*s == '\0')
+return NULL;
+
+/* Find the end of the token. */
+token = s;
+s = strpbrk (token, delim);
+if (s == NULL)
+/* This token finishes the string. */
+*save_ptr = strchr (token, '\0');
+else
+{
+/* Terminate the token and make *SAVE_PTR point past it. */
+*s = '\0';
+*save_ptr = s + 1;
+}
+return token;
+}
+#endif
+
 G_GNUC_INTERNAL
 SpiceURI* spice_uri_new(void)
 {
-- 
2.7.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk 2/5] spice-util: Fix alignment

2016-03-19 Thread Pavel Grunt
---
 src/spice-util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/spice-util.c b/src/spice-util.c
index fd97ee7..d2bcfbf 100644
--- a/src/spice-util.c
+++ b/src/spice-util.c
@@ -47,7 +47,7 @@ static void spice_util_enable_debug_messages(void)
 if (!doms) {
 g_setenv("G_MESSAGES_DEBUG", G_LOG_DOMAIN, 1);
 } else if (g_str_equal(doms, "all")) {
-   return;
+return;
 } else if (!strstr(doms, G_LOG_DOMAIN)) {
 gchar *newdoms = g_strdup_printf("%s %s", doms, G_LOG_DOMAIN);
 g_setenv("G_MESSAGES_DEBUG", newdoms, 1);
-- 
2.7.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk 2/3] spice-display: Remove auto-clipboard notify

2016-03-20 Thread Pavel Grunt
It was used to notify the (deprecated) auto-clipboard property of
the SpiceDisplay everytime the SpiceGtkSession emits its auto-clipboard
notify.

The commit 70a00b8fcc2ca85d3601f6ac4895f906f9032e77 removed the property
from SpiceDisplay causing a runtime warning:

GLib-GObject-WARNING **: g_object_notify: object class 'SpiceDisplay' has no 
property named 'auto-clipboard'
---
 src/spice-widget.c | 12 
 1 file changed, 12 deletions(-)

diff --git a/src/spice-widget.c b/src/spice-widget.c
index f86054f..30426be 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -390,15 +390,6 @@ static void spice_display_set_property(GObject  
*object,
 }
 }
 
-static void gtk_session_property_changed(GObject*gobject,
- GParamSpec *pspec,
- gpointeruser_data)
-{
-SpiceDisplay *display = user_data;
-
-g_object_notify(G_OBJECT(display), g_param_spec_get_name(pspec));
-}
-
 static void session_inhibit_keyboard_grab_changed(GObject*gobject,
   GParamSpec *pspec,
   gpointeruser_data)
@@ -689,9 +680,6 @@ spice_display_constructor(GType  gtype,
 }
 g_list_free(list);
 
-spice_g_signal_connect_object(d->gtk_session, "notify::auto-clipboard",
-  G_CALLBACK(gtk_session_property_changed), 
display, 0);
-
 spice_g_signal_connect_object(d->session, "notify::inhibit-keyboard-grab",
   
G_CALLBACK(session_inhibit_keyboard_grab_changed),
   display, 0);
-- 
2.7.3

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [spice-gtk] channel-usbredir: Fix crash due to a Task returning earlier than expected

2016-03-21 Thread Pavel Grunt
 n_params=, param_types=0x644d40) at gclosure.c:864
>  #33 0x724d1dd3 in g_signal_emit_valist (instance=0x80faa0,
> signal_id=, detail=0, var_args=var_args@entry=0x7f
> ffd9d0) at gsignal.c:3292
>  #34 0x724d28ff in g_signal_emit (instance=,
> signal_id=, detail=) at gsignal.c:3439
>  #35 0x73e6e4bc in gtk_widget_event_internal () at
> /lib64/libgtk-3.so.0
>  #36 0x73d2e34e in propagate_event () at /lib64/libgtk-3.so.0
>  #37 0x73d300fc in gtk_main_do_event () at /lib64/libgtk-
> 3.so.0
>  #38 0x738a8e92 in gdk_event_source_dispatch () at
> /lib64/libgdk-3.so.0
>  #39 0x721b8e3a in g_main_context_dispatch (context=0x647390)
> at gmain.c:3154
>  #40 0x721b8e3a in g_main_context_dispatch (context=context@e
> ntry=0x647390) at gmain.c:3769
>  #41 0x721b91d0 in g_main_context_iterate (context=0x647390, 
> block=block@entry=1, dispatch=dispatch@entry=1, self=)
> at gmain.c:3840
>  #42 0x721b94f2 in g_main_loop_run (loop=0x6e2730) at
> gmain.c:4034
>  #43 0x0040b2f9 in main (argc=1, argv=0x7fffde48) at
> spicy.c:1920
> 
> Signed-off-by: Fabiano Fidêncio <fiden...@redhat.com>

Tested-by: Pavel Grunt <pgr...@redhat.com>
Acked-by: Pavel Grunt <pgr...@redhat.com>

Thanks,
Pavel

> ---
>  src/channel-usbredir.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
> index d95a6c5..dca8455 100644
> --- a/src/channel-usbredir.c
> +++ b/src/channel-usbredir.c
> @@ -297,12 +297,12 @@ static void spice_usbredir_channel_open_acl_cb(
>  spice_usbredir_channel_open_device(channel, );
>  }
>  if (err) {
> -g_task_return_error(priv->task, err);
>  libusb_unref_device(priv->device);
>  priv->device = NULL;
>  g_boxed_free(spice_usb_device_get_type(), priv-
> >spice_device);
>  priv->spice_device = NULL;
>  priv->state  = STATE_DISCONNECTED;
> +g_task_return_error(priv->task, err);
>  } else {
>  g_task_return_boolean(priv->task, TRUE);
>  }
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [phodav PATCH 5/7 v3] spice-webdavd-windows: Automount shared folder

2016-03-20 Thread Pavel Grunt
Hi Lukas,

On Thu, 2016-03-17 at 14:47 +0100, Lukas Venhoda wrote:
> Try to connect to shared folder automatically on Windows.
> 
> On each loop of run_service(), run a GTask, that waits for 0.5s.
> If sharing is disabled, read_thread will immediately return and cause
> the main_loop to stop.
> This in turn causes the cancellable object to be canceled and the
> loop stops.
> 
> If nothing happens for 0.5s (no cancel is called), it means, that
> sharing is enabled,
> because read_thread (and main loop) is blocked, and we can call
> map_drive.
> 
> map_drive then enumerates free drive letters, and maps Spice Folder
> to highest possible
> (from Z: to A:).
> 
> If all drive letters are already assigned, show a critical error, but
> don't stop the service. The folder can still be accessed trough other
> means.
> ---
> Changes since v2:
>  - Changed for loop to gpoll
>  - split map_drive into 2 functions
>  - added enum for return values of map_drive
>  - added TODO for renaming the drive
>  - added explanation for the 0.5 delay into commit log
> 
> Changes since v1:
>  - Changed GThread to a GTask
>  - Only wait half a second, instead of 5
> 
> Changes since RFC:
>  - Calling WNetAddConnection2() blindly was slow and caause many
> threads to spawn.
> - Now only call it once, when it is sure, that it will connect.
>  - Now connects to a * drive, instead of always Z:
>  - Thread is now spawned and joined every time run_service() is
> called.
> ---
>  Makefile.am   |   4 ++
>  spice/spice-webdavd.c | 112
> ++
>  2 files changed, 116 insertions(+)
> 
> diff --git a/Makefile.am b/Makefile.am
> index 6127f93..d8e2d53 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -87,6 +87,10 @@ spice_webdavd_LDADD =  \
>   $(PIE_LDFLAGS)  \
>   $(NULL)
> 
> +if OS_WIN32
> +spice_webdavd_LDADD += -lnetapi32 -lmpr
> +endif
> +
>  deps.txt:
>   $(AM_V_GEN)rpm -qa | grep $(host_os) | sort | unix2dos > $@
> 
> diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c
> index f9c5cf1..49b1884 100644
> --- a/spice/spice-webdavd.c
> +++ b/spice/spice-webdavd.c
> @@ -737,11 +737,118 @@ open_mux_path (const char *path)
>    mux_queue = output_queue_new (G_OUTPUT_STREAM (mux_ostream));
>  }
> 
> +#ifdef G_OS_WIN32
> +typedef enum Tmap_drive_enum
> +{
> +  MAP_DRIVE_OK,
> +  MAP_DRIVE_TRY_AGAIN,
> +  MAP_DRIVE_ERROR
> +} map_drive_enum;
> +
> +gchar drive_letter;
You don't need this variable. map_drive can accept const gchar instead
of void.

> +
> +static gchar
> +get_free_drive_letter(void)
> +{
> +  const guint32 max_mask = 1 << 25;
> +  guint32 drives;
> +  guint32 mask;
> +  gint i;
> +
> +  drives = GetLogicalDrives ();
> +
> +  for (i = 0; i < 26; i++)
> +  {
> +  mask = max_mask >> i;
> +  if ((drives & mask) == 0)
> +return 'z' - i;
> +  }
> +
> +  return 0;
> +}
> +
> +static map_drive_enum
> +map_drive(void)
> +{
> +  gchar local_name[3];
> +  gchar remote_name[] = "http://localhost:9843/;;
it is only used in the net_resource
> +  NETRESOURCE net_resource;
> +  guint32 retval;
> +
> +  local_name[0] = drive_letter;
drive_letter should be parameter to this function
> +  local_name[1] = ':';
> +  local_name[2] = 0;
I would prefer some sprintf-like function instead
> +
> +  net_resource.dwType = RESOURCETYPE_DISK;
> +  net_resource.lpLocalName = local_name;
> +  net_resource.lpRemoteName = remote_name;
> +  net_resource.lpProvider = NULL;

In my opinion setting up net_resource should go to a separate
function,. You don't need 'local_name' and 'remote_name' to map the
drive, you need the net_resource.
> +
> +  retval = WNetAddConnection2 (_resource, NULL, NULL,
> CONNECT_TEMPORARY);
> +
> +  if (retval == NO_ERROR) {
> +g_debug ("map_drive ok");
> +return MAP_DRIVE_OK;
> +  } else if (retval == ERROR_ALREADY_ASSIGNED) {
> +g_debug ("map_drive already asigned");
> +return MAP_DRIVE_TRY_AGAIN;
> +  } else {
> +g_critical ("map_drive error %d", retval);
Is it critical enough to exit the program? I would use g_warning
> +return MAP_DRIVE_ERROR;
> +  }
> +}
> +
> +static void
> +map_drive_cb(GTask *task,
> +  gpointer source_object,
> +  gpointer task_data,
> +  GCancellable *cancellable)
> +{
> +  guint32 timeout = 500; //half a second
> +  GCancellable * cancel_map = task_data;
> +  GPollFD cancel_pollfd;
> +
> +  if (!g_cancellable_make_pollfd (cancel_map, _pollfd))
> +  {
> +g_critical ("GPollFD failed to create.");
critical/warning
> +return;
> +  }
> +
> +  if (g_poll (_pollfd, 1, timeout) <= 0)
> +  {
> +while (TRUE)
> +{
> +  if ((drive_letter = get_free_drive_letter ()) == 0)
I would move assignment from the condition
> +  {
> +g_critical ("all drive letters already assigned.");
critical/warning
> +break;
> +  }
> +
> +  if (map_drive () != MAP_DRIVE_TRY_AGAIN)
> +break;
> +}
> +
> +//TODO: Rename network 

Re: [Spice-devel] [PATCH] usbredir_handle_msg: rename data to err_data

2016-03-22 Thread Pavel Grunt
On Mon, 2016-03-21 at 12:07 +0100, Victor Toso wrote:
> On Sun, Mar 20, 2016 at 03:03:41PM +0200, Snir Sheriber wrote:
> > 
> > To better reflect what this variable is used for and change the
> > declare
> > location such that it will be declared only if it should
> Acked-by: Victor Toso 
> 

Pushed

> > 
> > ---
> >  src/channel-usbredir.c | 14 +++---
> >  1 file changed, 7 insertions(+), 7 deletions(-)
> > 
> > diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
> > index d04267f..0f76126 100644
> > --- a/src/channel-usbredir.c
> > +++ b/src/channel-usbredir.c
> > @@ -629,7 +629,6 @@ static void usbredir_handle_msg(SpiceChannel
> > *c, SpiceMsgIn *in)
> >  {
> >  SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(c);
> >  SpiceUsbredirChannelPrivate *priv = channel->priv;
> > -device_error_data data;
> >  int r, size;
> >  uint8_t *buf;
> >  
> > @@ -645,6 +644,7 @@ static void usbredir_handle_msg(SpiceChannel
> > *c, SpiceMsgIn *in)
> >  r = usbredirhost_read_guest_data(priv->host);
> >  if (r != 0) {
> >  SpiceUsbDevice *spice_device = priv->spice_device;
> > +device_error_data err_data;
> >  gchar *desc;
> >  GError *err;
> >  
> > @@ -674,14 +674,14 @@ static void usbredir_handle_msg(SpiceChannel
> > *c, SpiceMsgIn *in)
> >  
> >  CHANNEL_DEBUG(c, "%s", err->message);
> >  
> > -data.channel = channel;
> > -data.caller = coroutine_self();
> > -data.spice_device =
> > g_boxed_copy(spice_usb_device_get_type(), spice_device);
> > -data.error = err;
> > -g_idle_add(device_error, );
> > +err_data.channel = channel;
> > +err_data.caller = coroutine_self();
> > +err_data.spice_device =
> > g_boxed_copy(spice_usb_device_get_type(), spice_device);
> > +err_data.error = err;
> > +g_idle_add(device_error, _data);
> >  coroutine_yield(NULL);
> >  
> > -g_boxed_free(spice_usb_device_get_type(),
> > data.spice_device);
> > +g_boxed_free(spice_usb_device_get_type(),
> > err_data.spice_device);
> >  
> >  g_error_free(err);
> >  }
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH] char-device: Add helpers for SpiceCharDeviceCallbacks vfuncs

2016-03-22 Thread Pavel Grunt
On Mon, 2016-03-21 at 13:23 +, Frediano Ziglio wrote:
> From: Christophe Fergeau <cferg...@redhat.com>
> 
> Add helper functions wrapping calls to the virtual functions
> defined in SpiceCharDeviceCallbacks.
> ---
>  server/char-device.c | 78 +-
> --
>  1 file changed, 62 insertions(+), 16 deletions(-)
> 
> Changes:
> - removed excessive checks (proposed by Pavel Grunt).
> 
> I would ack it. Not clear if I can ack after I did the change (even
> if
> suggested by Pavel).

I would ack it as well

Pavel

> 
> diff --git a/server/char-device.c b/server/char-device.c
> index d3af960..ac25b01 100644
> --- a/server/char-device.c
> +++ b/server/char-device.c
> @@ -94,6 +94,56 @@ typedef struct SpiceCharDeviceMsgToClientItem {
>  SpiceCharDeviceMsgToClient *msg;
>  } SpiceCharDeviceMsgToClientItem;
>  
> +static SpiceCharDeviceMsgToClient *
> +spice_char_device_read_one_msg_from_device(SpiceCharDeviceState
> *dev)
> +{
> +   return dev->cbs.read_one_msg_from_device(dev->sin, dev->opaque);
> +}
> +
> +static SpiceCharDeviceMsgToClient *
> +spice_char_device_ref_msg_to_client(SpiceCharDeviceState *dev,
> +SpiceCharDeviceMsgToClient *msg)
> +{
> +   return dev->cbs.ref_msg_to_client(msg, dev->opaque);
> +}
> +
> +static void
> +spice_char_device_unref_msg_to_client(SpiceCharDeviceState *dev,
> +  SpiceCharDeviceMsgToClient
> *msg)
> +{
> +   dev->cbs.unref_msg_to_client(msg, dev->opaque);
> +}
> +
> +static void
> +spice_char_device_send_msg_to_client(SpiceCharDeviceState *dev,
> + SpiceCharDeviceMsgToClient
> *msg,
> + RedClient *client)
> +{
> +   dev->cbs.send_msg_to_client(msg, client, dev->opaque);
> +}
> +
> +static void
> +spice_char_device_send_tokens_to_client(SpiceCharDeviceState *dev,
> +RedClient *client,
> +uint32_t tokens)
> +{
> +   dev->cbs.send_tokens_to_client(client, tokens, dev->opaque);
> +}
> +
> +static void
> +spice_char_device_on_free_self_token(SpiceCharDeviceState *dev)
> +{
> +   if (dev->cbs.on_free_self_token != NULL) {
> +   dev->cbs.on_free_self_token(dev->opaque);
> +   }
> +}
> +
> +static void
> +spice_char_device_remove_client(SpiceCharDeviceState *dev, RedClient
> *client)
> +{
> +   dev->cbs.remove_client(client, dev->opaque);
> +}
> +
>  static void
> spice_char_device_write_buffer_free(SpiceCharDeviceWriteBuffer *buf)
>  {
>  if (buf == NULL)
> @@ -143,7 +193,7 @@ static void
> spice_char_device_client_send_queue_free(SpiceCharDeviceState *dev,
>  
>  link);
>  
>  ring_remove(item);
> -dev->cbs.unref_msg_to_client(msg_item->msg, dev->opaque);
> +spice_char_device_unref_msg_to_client(dev, msg_item->msg);
>  free(msg_item);
>  }
>  dev_client->num_send_tokens += dev_client->send_queue_size;
> @@ -189,7 +239,7 @@ static void
> spice_char_device_handle_client_overflow(SpiceCharDeviceClientState
>  {
>  SpiceCharDeviceState *dev = dev_client->dev;
>  spice_printerr("dev %p client %p ", dev, dev_client);
> -dev->cbs.remove_client(dev_client->client, dev->opaque);
> +spice_char_device_remove_client(dev, dev_client->client);
>  }
>  
>  static SpiceCharDeviceClientState
> *spice_char_device_client_find(SpiceCharDeviceState *dev,
> @@ -258,7 +308,7 @@ static void
> spice_char_device_add_msg_to_client_queue(SpiceCharDeviceClientState
>  }
>  
>  msg_item = spice_new0(SpiceCharDeviceMsgToClientItem, 1);
> -msg_item->msg = dev->cbs.ref_msg_to_client(msg, dev->opaque);
> +msg_item->msg = spice_char_device_ref_msg_to_client(dev, msg);
>  ring_add(_client->send_queue, _item->link);
>  dev_client->send_queue_size++;
>  if (!dev_client->wait_for_tokens_started) {
> @@ -280,7 +330,7 @@ static void
> spice_char_device_send_msg_to_clients(SpiceCharDeviceState *dev,
>  if (spice_char_device_can_send_to_client(dev_client)) {
>  dev_client->num_send_tokens--;
>  spice_assert(ring_is_empty(_client->send_queue));
> -dev->cbs.send_msg_to_client(msg, dev_client->client,
> dev->opaque);
> +spice_char_device_send_msg_to_client(dev, msg,
> dev_client->client);
>  
>  /* don't refer to d

Re: [Spice-devel] [PATCH spice-gtk 1/7] widget: remove superflous WIN32 check

2016-03-22 Thread Pavel Grunt
On Mon, 2016-03-21 at 19:14 +0100, Marc-André Lureau wrote:
> The egl call is already inside a X11 conditional block.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lur...@gmail.com>
Acked-by: Pavel Grunt <pgr...@redhat.com>
> ---
>  src/spice-widget.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index e329809..c8bb72c 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -580,13 +580,11 @@ drawing_area_realize(GtkWidget *area, gpointer
> user_data)
>  g_clear_error();
>  }
>  
> -#ifndef G_OS_WIN32
>  if (!spice_egl_realize_display(display,
> gtk_widget_get_window(area), )) {
>  g_critical("egl realize failed: %s", err->message);
>  g_clear_error();
>  }
>  #endif
> -#endif
>  }
>  
>  static void spice_display_init(SpiceDisplay *display)
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [spice-gtk] vmcstream, gtask: Fix crash when trying to use webdav

2016-03-22 Thread Pavel Grunt
Ack. 

Pavel

On Mon, 2016-03-21 at 16:02 +0100, Fabiano Fidêncio wrote:
> Don't try to get the cancellable from a task that is, for sure
> (ensured
> by us), NULL. See the backtrace:
> 
>  #0  0x729cf250 in g_task_get_cancellable () at
> /lib64/libgio-2.0.so.0
>  #1  0x778a9012 in spice_vmc_input_stream_read_all_async
> (stream=, buffer=0x7070f8, count=8,
> io_priority=, cancellable=0x7fffcc00a470,
> callback=0x7788c190 , user_data=0x707b30) at
> vmcstream.c:187
>  #2  0x7788c0ab in start_demux (self=0x707b30) at channel-
> webdav.c:498
>  #3  0x72700578 in g_closure_invoke () at /lib64/libgobject-
> 2.0.so.0
>  #4  0x727135f0 in signal_emit_unlocked_R () at
> /lib64/libgobject-2.0.so.0
>  #5  0x7271c43c in g_signal_emit_valist () at
> /lib64/libgobject-2.0.so.0
>  #6  0x7788acca in emit_main_context (opaque=0x7fffbfffe880)
> at gio-coroutine.c:200
>  #7  0x7242bab3 in g_main_context_dispatch () at
> /lib64/libglib-2.0.so.0
>  #8  0x7242be60 in g_main_context_iterate.isra () at
> /lib64/libglib-2.0.so.0
>  #9  0x7242c182 in g_main_loop_run () at /lib64/libglib-
> 2.0.so.0
>  #10 0x00405df6 in main (argc=,
> argv=) at spicy.c:1897
> 
> It was pointed out during the review and, somehow, missed :-\
> 
> Signed-off-by: Fabiano Fidêncio <fiden...@redhat.com>
> Signed-off-by: Pavel Grunt <pgr...@redhat.com>
> ---
>  src/vmcstream.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/src/vmcstream.c b/src/vmcstream.c
> index 48f9513..8a31a47 100644
> --- a/src/vmcstream.c
> +++ b/src/vmcstream.c
> @@ -184,7 +184,6 @@
> spice_vmc_input_stream_read_all_async(GInputStream*stream,
>  
>  /* no concurrent read permitted by ginputstream */
>  g_return_if_fail(self->task == NULL);
> -g_return_if_fail(g_task_get_cancellable(self->task) == NULL);
>  self->all = TRUE;
>  self->buffer = buffer;
>  self->count = count;
> @@ -236,7 +235,6 @@
> spice_vmc_input_stream_read_async(GInputStream*stream,
>  
>  /* no concurrent read permitted by ginputstream */
>  g_return_if_fail(self->task == NULL);
> -g_return_if_fail(g_task_get_cancellable(self->task) == NULL);
>  self->all = FALSE;
>  self->buffer = buffer;
>  self->count = count;
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [spice-server] doc: Add virgl documentation

2016-03-23 Thread Pavel Grunt
On Wed, 2016-03-23 at 17:45 +0100, Christophe Fergeau wrote:
> On Wed, Mar 23, 2016 at 05:36:04PM +0100, Pavel Grunt wrote:
> > 
> > Hi Christophe,
> > 
> > On Wed, 2016-03-23 at 17:18 +0100, Christophe Fergeau wrote:
> > > 
> > > On Mon, Mar 21, 2016 at 03:28:41PM +0100, Christophe Fergeau
> > > wrote:
> > > > 
> > > > 
> > > > On Mon, Mar 21, 2016 at 02:57:18PM +0100, Pavel Grunt wrote:
> > > > > 
> > > > > 
> > > > > Thanks!
> > > > > 
> > > > > Acked-by: Pavel Grunt <pgr...@redhat.com>
> > > > > 
> > > > > On Fri, 2016-03-18 at 17:12 +0100, Christophe Fergeau wrote:
> > > > > > 
> > > > > > 
> > > > > > +GL acceleration (virgl)
> > > > > > +===
> > > > > > +
> > > > > > +OpenGL acceleration is currently local only (it has to go
> > > > > > through a
> > > > > > Unix socket)
> > > > > > +and it needs guest support. It's currently limited to
> > > > > > recent
> > > > > > linux
> > > > > > +distributions (for example up to date Fedora 23).
> > > > > > +
> > > > After running more tests, I realized that on a f23 guest, you
> > > > need
> > > > to
> > > > update mesa from Gerd's copr, I'll have to adjust the wording
> > > > here.
> > > I"ll change it to
> > > 
> > > -distributions (for example up to date Fedora 23).
> > > +distributions (for example up to date Fedora 23 + updated mesa
> > > packages from
> > > +copr:kraxel).
> > I would keep up to date Fedora 23. Mesa should have virgl support -
> > see http://koji.fedoraproject.org/koji/buildinfo?buildID=739036 
> But it seems these are good enough, when I tested this, Xorg was
> picking
> the QXL driver, which gave me a blackscreen with the f23 packages.
> With
> packages from kraxel's repository, the correct driver was picked up,
> and
> I could get a working guest display. Which is why I want to mention
> them
> now ;)
> 
ok maybe it deserves a bug report. I already acked the patch, but would
you mind adding a link to the copr repo [0] ?

Pavel

[0] https://copr.fedorainfracloud.org/coprs/kraxel/virgl/


___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk v2 8/8] widget: modify update-area to not require primary surface

2016-03-23 Thread Pavel Grunt
Hi,

as we discussed, I prefer this patch to go in after 9/8 to avoid some
incorrect resizes

On Tue, 2016-03-22 at 13:57 +0100, Marc-André Lureau wrote:
> If egl display is enabled, use GL scanout geometry to check
> intersection
> with the monitor area. This solves displaying GL display without
> software canvas.
What are the issues?

Pavel
> 
> Signed-off-by: Marc-André Lureau 
> ---
>  src/spice-widget.c | 41 -
>  1 file changed, 28 insertions(+), 13 deletions(-)
> 
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index e16126a..4b7e202 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -2190,32 +2190,47 @@ static void update_area(SpiceDisplay
> *display,
>  gint x, gint y, gint width, gint height)
>  {
>  SpiceDisplayPrivate *d = display->priv;
> -GdkRectangle primary = {
> -.x = 0,
> -.y = 0,
> -.width = d->width,
> -.height = d->height
> -};
> -GdkRectangle area = {
> +GdkRectangle primary;
> +
> +SPICE_DEBUG("update area +%d+%d %dx%d", x, y, width, height);
> +d->area = (GdkRectangle) {
>  .x = x,
>  .y = y,
>  .width = width,
>  .height = height
>  };
>  
> -SPICE_DEBUG("update area, primary: %dx%d, area: +%d+%d %dx%d",
> d->width, d->height, area.x, area.y, area.width, area.height);
> +#ifndef G_OS_WIN32
> +if (d->egl.enabled) {
> +primary = (GdkRectangle) {
> +.width = d->egl.scanout.width,
> +.height = d->egl.scanout.height
> +};
> +} else
> +#endif
> +{
> +primary = (GdkRectangle) {
> +.width = d->width,
> +.height = d->height
> +};
> +}
>  
> -if (!gdk_rectangle_intersect(, , )) {
> +SPICE_DEBUG("primary: %dx%d", primary.width, primary.height);
> +if (!gdk_rectangle_intersect(, >area, >area)) {
>  SPICE_DEBUG("The monitor area is not intersecting primary
> surface");
>  memset(>area, '\0', sizeof(d->area));
>  set_monitor_ready(display, false);
>  return;
>  }
>  
> -spicex_image_destroy(display);
> -d->area = area;
> -if (gtk_widget_get_realized(GTK_WIDGET(display)))
> -update_image(display);
> +#ifndef G_OS_WIN32
> +if (!d->egl.enabled)
> +#endif
> +{
> +spicex_image_destroy(display);
> +if (gtk_widget_get_realized(GTK_WIDGET(display)))
> +update_image(display);
> +}
>  
>  update_size_request(display);
>  
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk v2 1/8] widget: remove superflous WIN32 check

2016-03-23 Thread Pavel Grunt
Acked-by: Pavel Grunt <pgr...@redhat.com>

On Tue, 2016-03-22 at 13:57 +0100, Marc-André Lureau wrote:
> The egl call is already inside a X11 conditional block.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lur...@gmail.com>
> ---
>  src/spice-widget.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index e329809..c8bb72c 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -580,13 +580,11 @@ drawing_area_realize(GtkWidget *area, gpointer
> user_data)
>  g_clear_error();
>  }
>  
> -#ifndef G_OS_WIN32
>  if (!spice_egl_realize_display(display,
> gtk_widget_get_window(area), )) {
>  g_critical("egl realize failed: %s", err->message);
>  g_clear_error();
>  }
>  #endif
> -#endif
>  }
>  
>  static void spice_display_init(SpiceDisplay *display)
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk v2 5/8] widget: make gl-scanout and update-monitor-area privately exported

2016-03-23 Thread Pavel Grunt
Acked-by: Pavel Grunt <pgr...@redhat.com>

On Tue, 2016-03-22 at 13:57 +0100, Marc-André Lureau wrote:
> The following changes will call these functions from spice-widget-
> egl.c
> 
> Signed-off-by: Marc-André Lureau <marcandre.lur...@gmail.com>
> ---
>  src/spice-widget-priv.h |  3 +++
>  src/spice-widget.c  | 17 +++--
>  2 files changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/src/spice-widget-priv.h b/src/spice-widget-priv.h
> index bafeb7d..95bca8a 100644
> --- a/src/spice-widget-priv.h
> +++ b/src/spice-widget-priv.h
> @@ -163,6 +163,9 @@ gboolean
> spice_egl_update_scanout(SpiceDisplay *display,
>    GError **err);
>  void spice_egl_cursor_set(SpiceDisplay
> *display);
>  
> +void spice_display_widget_gl_scanout (SpiceDisplay
> *display);
> +void spice_display_widget_update_monitor_area(SpiceDisplay
> *display);
> +
>  G_END_DECLS
>  
>  #endif
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index 198d0cd..f0f065c 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -264,7 +264,8 @@ static void set_monitor_ready(SpiceDisplay *self,
> gboolean ready)
>  update_ready(self);
>  }
>  
> -static void update_monitor_area(SpiceDisplay *display)
> +G_GNUC_INTERNAL
> +void spice_display_widget_update_monitor_area(SpiceDisplay *display)
>  {
>  SpiceDisplayPrivate *d = display->priv;
>  SpiceDisplayMonitorConfig *cfg, *c = NULL;
> @@ -339,7 +340,7 @@ static void
> spice_display_set_property(GObject  *object,
>  case PROP_MONITOR_ID:
>  d->monitor_id = g_value_get_int(value);
>  if (d->display) /* if constructed */
> -update_monitor_area(display);
> +spice_display_widget_update_monitor_area(display);
>  break;
>  case PROP_KEYBOARD_GRAB:
>  d->keyboard_grab_enable = g_value_get_boolean(value);
> @@ -2230,7 +2231,7 @@ static void primary_create(SpiceChannel
> *channel, gint format,
>  d->height = height;
>  d->data_origin = d->data = imgdata;
>  
> -update_monitor_area(display);
> +spice_display_widget_update_monitor_area(display);
>  }
>  
>  static void primary_destroy(SpiceChannel *channel, gpointer data)
> @@ -2480,7 +2481,8 @@ static void cursor_reset(SpiceCursorChannel
> *channel, gpointer data)
>  }
>  
>  #ifndef G_OS_WIN32
> -static void gl_scanout(SpiceDisplay *display)
> +G_GNUC_INTERNAL
> +void spice_display_widget_gl_scanout(SpiceDisplay *display)
>  {
>  SpiceDisplayPrivate *d = display->priv;
>  const SpiceGlScanout *scanout;
> @@ -2555,15 +2557,18 @@ static void channel_new(SpiceSession *s,
> SpiceChannel *channel, gpointer data)
>  spice_g_signal_connect_object(channel, "display-mark",
>    G_CALLBACK(mark), display,
> G_CONNECT_AFTER | G_CONNECT_SWAPPED);
>  spice_g_signal_connect_object(channel, "notify::monitors",
> -  G_CALLBACK(update_monitor_area
> ), display, G_CONNECT_AFTER | G_CONNECT_SWAPPED);
> +  G_CALLBACK(spice_display_widge
> t_update_monitor_area),
> +  display, G_CONNECT_AFTER |
> G_CONNECT_SWAPPED);
>  if (spice_display_get_primary(channel, 0, )) {
>  primary_create(channel, primary.format, primary.width,
> primary.height,
> primary.stride, primary.shmid,
> primary.data, display);
>  mark(display, primary.marked);
>  }
> +
>  #ifndef G_OS_WIN32
>  spice_g_signal_connect_object(channel, "notify::gl-scanout",
> -  G_CALLBACK(gl_scanout),
> display, G_CONNECT_SWAPPED);
> +  G_CALLBACK(spice_display_widge
> t_gl_scanout),
> +  display, G_CONNECT_SWAPPED);
>  spice_g_signal_connect_object(channel, "gl-draw",
>    G_CALLBACK(gl_draw), display,
> G_CONNECT_SWAPPED);
>  #endif
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk v2 9/8] main: don't update display timer for unchanged config

2016-03-23 Thread Pavel Grunt
Hi,

So the timer is the main problem ?

It also solves/avoids problems with a guest running on wayland when the
"resize-guest" property is TRUE.
See bug https://bugzilla.redhat.com/show_bug.cgi?id=1266484 
It avoids destroying the primary surface when the display configuration
has not changed

I would like to hear from Jonathon what he thinks about it. There were
some concerns / discussion whether it should be compared to the "real"
state of displays in the guest.
https://lists.freedesktop.org/archives/spice-devel/2015-October/022785.
html

Maybe some check should be done on the server side because it is
"closer" to the guest.

Pavel

On Wed, 2016-03-23 at 18:02 +0100, Marc-André Lureau wrote:
> 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
> has a
> no-op and keep configuration timer unchanged. This fixes monitor
> autoconfig with virgl (when the display is regularly updated).
> 
> Signed-off-by: Marc-André Lureau 
> ---
>  src/channel-main.c | 29 ++---
>  1 file changed, 18 insertions(+), 11 deletions(-)
> 
> diff --git a/src/channel-main.c b/src/channel-main.c
> index 1c19de1..b4875f6 100644
> --- a/src/channel-main.c
> +++ b/src/channel-main.c
> @@ -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;
>  boolagent_connected;
> @@ -140,13 +148,7 @@ struct _SpiceMainChannelPrivate  {
>  guint   agent_msg_pos;
>  uint8_t agent_msg_size;
>  uint32_tagent_caps[VD_AGENT_CAPS_SIZE];
> -struct {
> -int x;
> -int y;
> -int width;
> -int height;
> -SpiceDisplayState   display_state;
> -} display[MAX_DISPLAY];
> +SpiceDisplayConfig  display[MAX_DISPLAY];
>  ginttimer_id;
>  GQueue  *agent_msg_queue;
>  GHashTable  *file_xfer_tasks;
> @@ -2686,10 +2688,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[id],
> sizeof(SpiceDisplayConfig)) == 0)
> +return;
> +
> +c->display[id] = display;
>  
>  if (update)
>  update_display_timer(channel, 1);
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk v2 4/8] display: return NULL in spice_display_get_gl_scanout()

2016-03-23 Thread Pavel Grunt
Hi Marc-André,

On Tue, 2016-03-22 at 13:57 +0100, Marc-André Lureau wrote:
> If there is no valid scanout, return NULL.

When / how it can happen ? Looking at gl_scanout() there is g_return if
scanout == NULL, if NULL is a valid/expected return value then that
g_return should be changed.

Pavel
> 
> Signed-off-by: Marc-André Lureau 
> ---
>  src/channel-display.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/channel-display.c b/src/channel-display.c
> index 2c54df7..90d155e 100644
> --- a/src/channel-display.c
> +++ b/src/channel-display.c
> @@ -532,7 +532,7 @@ void
> spice_display_change_preferred_compression(SpiceChannel *channel,
> gint comp
>   * spice_display_get_gl_scanout:
>   * @channel: a #SpiceDisplayChannel
>   *
> - * Returns: the current GL scanout
> + * Returns: the current GL scanout, or %NULL if none or not valid
>   *
>   * Since: 0.31
>   **/
> @@ -541,7 +541,7 @@ spice_display_get_gl_scanout(SpiceDisplayChannel
> *channel)
>  {
>  g_return_val_if_fail(SPICE_IS_DISPLAY_CHANNEL(channel), NULL);
>  
> -return >priv->scanout;
> +return channel->priv->scanout.fd != -1 ? >priv->scanout 
> : NULL;
>  }
>  
>  /* ---
> --- */
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk v2 3/8] widget: enable egl before updating scanout

2016-03-23 Thread Pavel Grunt
Acked-by: Pavel Grunt <pgr...@redhat.com>

On Tue, 2016-03-22 at 13:57 +0100, Marc-André Lureau wrote:
> The GLArea is realized lazily, when it is made visible in
> set_egl_enabled(). The egl context is initialized once the GLArea is
> realized. Enable egl before updating the scanout.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lur...@gmail.com>
> ---
>  src/spice-widget.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index 8518ec6..198d0cd 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -2486,14 +2486,14 @@ static void gl_scanout(SpiceDisplay *display)
>  const SpiceGlScanout *scanout;
>  GError *err = NULL;
>  
> +SPICE_DEBUG("%s: got scanout",  __FUNCTION__);
> +set_egl_enabled(display, true);
> +
>  g_return_if_fail(d->egl.context_ready);
>  
>  scanout = spice_display_get_gl_scanout(SPICE_DISPLAY_CHANNEL(d-
> >display));
>  g_return_if_fail(scanout != NULL);
>  
> -SPICE_DEBUG("%s: got scanout",  __FUNCTION__);
> -set_egl_enabled(display, true);
> -
>  if (!spice_egl_update_scanout(display, scanout, )) {
>  g_critical("update scanout failed: %s", err->message);
>  g_clear_error();
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk v2 2/8] egl: check context is ready

2016-03-23 Thread Pavel Grunt
Acked-by: Pavel Grunt <pgr...@redhat.com>

On Tue, 2016-03-22 at 13:57 +0100, Marc-André Lureau wrote:
> Add a new GL status field to check if the GL context is ready. This
> helps debugging races where GL is called before the context is ready.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lur...@gmail.com>
> ---
>  src/spice-widget-egl.c  | 10 --
>  src/spice-widget-priv.h |  1 +
>  src/spice-widget.c  |  5 +
>  3 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
> index a9bea52..8ac3b90 100644
> --- a/src/spice-widget-egl.c
> +++ b/src/spice-widget-egl.c
> @@ -208,7 +208,7 @@ gboolean spice_egl_init(SpiceDisplay *display,
> GError **err)
>  d->egl.ctx = eglGetCurrentContext();
>  dpy =
> (EGLNativeDisplayType)gdk_wayland_display_get_wl_display(gdk_dpy);
>  d->egl.display = eglGetDisplay(dpy);
> -return spice_egl_init_shaders(display, err);
> +goto end;
>  }
>  #endif
>  #ifdef GDK_WINDOWING_X11
> @@ -267,7 +267,13 @@ gboolean spice_egl_init(SpiceDisplay *display,
> GError **err)
>  eglMakeCurrent(d->egl.display, EGL_NO_SURFACE, EGL_NO_SURFACE,
> d->egl.ctx);
>  
> -return spice_egl_init_shaders(display, err);
> +end:
> +if (!spice_egl_init_shaders(display, err))
> +return FALSE;
> +
> +d->egl.context_ready = TRUE;
> +
> +return TRUE;
>  }
>  
>  static gboolean spice_widget_init_egl_win(SpiceDisplay *display,
> GdkWindow *win,
> diff --git a/src/spice-widget-priv.h b/src/spice-widget-priv.h
> index 2f7e39e..bafeb7d 100644
> --- a/src/spice-widget-priv.h
> +++ b/src/spice-widget-priv.h
> @@ -129,6 +129,7 @@ struct _SpiceDisplayPrivate {
>  #endif
>  #ifndef G_OS_WIN32
>  struct {
> +gbooleancontext_ready;
>  gbooleanenabled;
>  EGLSurface  surface;
>  EGLDisplay  display;
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index c8bb72c..8518ec6 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -2486,6 +2486,8 @@ static void gl_scanout(SpiceDisplay *display)
>  const SpiceGlScanout *scanout;
>  GError *err = NULL;
>  
> +g_return_if_fail(d->egl.context_ready);
> +
>  scanout = spice_display_get_gl_scanout(SPICE_DISPLAY_CHANNEL(d-
> >display));
>  g_return_if_fail(scanout != NULL);
>  
> @@ -2504,8 +2506,11 @@ static void gl_draw(SpiceDisplay *display,
>  SpiceDisplayPrivate *d = display->priv;
>  
>  SPICE_DEBUG("%s",  __FUNCTION__);
> +
>  set_egl_enabled(display, true);
>  
> +g_return_if_fail(d->egl.context_ready);
> +
>  #if GTK_CHECK_VERSION(3,16,0)
>  GtkWidget *gl = gtk_stack_get_child_by_name(GTK_STACK(display),
> "gl-area");
>  
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk v2 7/8] widget: update d->ready based on scanout image available

2016-03-23 Thread Pavel Grunt
Acked-by: Pavel Grunt <pgr...@redhat.com>

On Tue, 2016-03-22 at 13:57 +0100, Marc-André Lureau wrote:
> d->ready is updated based on monitor area & canvas. In case of GL
> rendering, update it based on monitor area & scanout and add check
> before drawing update.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lur...@gmail.com>
> ---
>  src/spice-widget-egl.c | 6 ++
>  src/spice-widget.c | 6 +-
>  2 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
> index d6f436d..5fcdcaa 100644
> --- a/src/spice-widget-egl.c
> +++ b/src/spice-widget-egl.c
> @@ -396,7 +396,7 @@ void spice_egl_resize_display(SpiceDisplay
> *display, int w, int h)
>  apply_ortho(d->egl.mproj, 0, w, 0, h, -1, 1);
>  glViewport(0, 0, w, h);
>  
> -if (d->egl.image)
> +if (d->ready)
>  spice_egl_update_display(display);
>  
>  glUseProgram(prog);
> @@ -506,9 +506,7 @@ void spice_egl_update_display(SpiceDisplay
> *display)
>  gdouble tx, ty, tw, th;
>  int prog;
>  
> -g_return_if_fail(d->egl.image != NULL);
> -if (d->egl.surface == EGL_NO_SURFACE)
> -return;
> +g_return_if_fail(d->ready);
>  
>  spice_display_get_scaling(display, , , , , );
>  
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index f0f065c..e16126a 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -234,7 +234,11 @@ static void update_ready(SpiceDisplay *display)
>  SpiceDisplayPrivate *d = display->priv;
>  gboolean ready;
>  
> -ready = d->mark != 0 && d->monitor_ready;
> +ready = d->monitor_ready &&
> +#ifndef G_OS_WIN32
> +d->egl.enabled ? d->egl.image != NULL :
> +#endif
> +d->mark;
>  
>  /* If the 'resize-guest' property is set, the application
> expects spice-gtk
>   * to manage the size and state of the displays, so update the
> 'enabled'
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk v2 6/8] egl: check and update scanout after egl init

2016-03-23 Thread Pavel Grunt
Hi,

On Tue, 2016-03-22 at 13:57 +0100, Marc-André Lureau wrote:
> Once the egl/GL context are initialized, check if there is a scanout
> to
> associate to display widget. This solves races when scanout update is
> happening before the egl/GL context is ready.
> 
Is it common that the display channel has the scanout before the widget
is initialized ? What about adding a debug when it happens?

> Signed-off-by: Marc-André Lureau 
> ---
>  src/spice-widget-egl.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
> index 8ac3b90..d6f436d 100644
> --- a/src/spice-widget-egl.c
> +++ b/src/spice-widget-egl.c
> @@ -273,6 +273,11 @@ end:
>  
>  d->egl.context_ready = TRUE;
>  
> +if (spice_display_get_gl_scanout(SPICE_DISPLAY_CHANNEL(d-
> >display))) {
I prefer explicit comparison to NULL 
> +spice_display_widget_gl_scanout(display);
> +spice_display_widget_update_monitor_area(display);
> +}
> +
>  return TRUE;
>  }
>  

Thanks,
Pavel

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [spice-gtk 0/2] Introduce gtask-helper.[ch]

2016-03-23 Thread Pavel Grunt
Hi Fabiano,

On Wed, 2016-03-23 at 10:48 +0100, Fabiano Fidêncio wrote:
> The first patch is only about reverting a patch that, even if it
> fixed
> the problem, it wasn't done in the proper way.
> The second patch introduces and uses new helpers for GTask, providing
> them functions that will explicitely return in idle instead of
> leaving
> the decision to the GTask heurestic (which doesn't work with
> Coroutine).
> 
> Fabiano Fidêncio (2):
>   Revert "channel-usbredir: Fix crash due to a Task returning earlier
> than expected"
>   Introduce gtask-helper.[ch]
> 

you should the order of the patches otherwise the crash would be
reintroduced

Pavel
>  m4/manywarnings.m4   |   1 -
>  src/Makefile.am  |   2 +
>  src/channel-base.c   |   4 +-
>  src/channel-main.c   |  12 ++--
>  src/channel-usbredir.c   |  12 ++--
>  src/gtask-helper.c   | 152
> +++
>  src/gtask-helper.h   |  43 
>  src/spice-channel.c  |   4 +-
>  src/spice-gstaudio.c |   6 +-
>  src/usb-acl-helper.c |  12 ++--
>  src/usb-device-manager.c |  18 ++---
>  src/vmcstream.c  |  35 ++
>  src/win-usb-driver-install.c |  21 +++---
>  13 files changed, 254 insertions(+), 68 deletions(-)
>  create mode 100644 src/gtask-helper.c
>  create mode 100644 src/gtask-helper.h
> 
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk v2 4/8] display: return NULL in spice_display_get_gl_scanout()

2016-03-24 Thread Pavel Grunt
On Thu, 2016-03-24 at 11:59 +0100, Marc-André Lureau wrote:
> On Thu, Mar 24, 2016 at 12:39 AM, Marc-André Lureau  om> wrote:
> > 
> > > 
> > > When / how it can happen ? Looking at gl_scanout() there is
> > > g_return if
> > > scanout == NULL, if NULL is a valid/expected return value then
> > > that
> > > g_return should be changed.
> > Good point. AI think I wrote this initially thinking that no one
> > should ever call get_gl_scanout() without having first received the
> > scanout notification, but that assumption is wrong. It should be
> > fine to call get_gl_scanout() and it's easier to deal with a NULL
> > return value rather than checking the returned scanout.fd ==
> > -1.  I'll change the assert. (btw, the set_static_boxed for the
> > property should be fine)
> 
> Actually, gl_scanout() should only be called with a valid scanout,
> the
> patch doesn't need to be modified then. If you prefer, we can add a
> comment above the g_return_if_fail(scanout).
> 
Yes please

Pavel

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH 3/5] removed unused tree debugging function

2016-03-24 Thread Pavel Grunt
Removed in

*39e1cbe3211b06bca6e5d906ffb4d0582440c5cc*


I would ack it but Fabiano had some comments about it

https://lists.freedesktop.org/archives/spice-devel/2015-November/024060.html



On Thu, Mar 24, 2016 at 12:45 PM, Victor Toso  wrote:

> Hi,
>
> On Thu, Mar 24, 2016 at 08:53:00AM +, Frediano Ziglio wrote:
> > Support for this debugging was removed time ago.
> >
>
> Can you point it out when it was removed?
> Thanks,
>
> > Signed-off-by: Frediano Ziglio 
> > ---
> >  server/tree.c | 161
> --
> >  server/tree.h |   1 -
> >  2 files changed, 162 deletions(-)
> >
> > diff --git a/server/tree.c b/server/tree.c
> > index 9e5a281..3866616 100644
> > --- a/server/tree.c
> > +++ b/server/tree.c
> > @@ -24,167 +24,6 @@
> >
> >  #include "tree.h"
> >
> > -static const char *draw_type_to_str(uint8_t type)
> > -{
> > -switch (type) {
> > -case QXL_DRAW_FILL:
> > -return "QXL_DRAW_FILL";
> > -case QXL_DRAW_OPAQUE:
> > -return "QXL_DRAW_OPAQUE";
> > -case QXL_DRAW_COPY:
> > -return "QXL_DRAW_COPY";
> > -case QXL_DRAW_TRANSPARENT:
> > -return "QXL_DRAW_TRANSPARENT";
> > -case QXL_DRAW_ALPHA_BLEND:
> > -return "QXL_DRAW_ALPHA_BLEND";
> > -case QXL_COPY_BITS:
> > -return "QXL_COPY_BITS";
> > -case QXL_DRAW_BLEND:
> > -return "QXL_DRAW_BLEND";
> > -case QXL_DRAW_BLACKNESS:
> > -return "QXL_DRAW_BLACKNESS";
> > -case QXL_DRAW_WHITENESS:
> > -return "QXL_DRAW_WHITENESS";
> > -case QXL_DRAW_INVERS:
> > -return "QXL_DRAW_INVERS";
> > -case QXL_DRAW_ROP3:
> > -return "QXL_DRAW_ROP3";
> > -case QXL_DRAW_COMPOSITE:
> > -return "QXL_DRAW_COMPOSITE";
> > -case QXL_DRAW_STROKE:
> > -return "QXL_DRAW_STROKE";
> > -case QXL_DRAW_TEXT:
> > -return "QXL_DRAW_TEXT";
> > -default:
> > -return "?";
> > -}
> > -}
> > -
> > -static void show_red_drawable(RedDrawable *drawable, const char *prefix)
> > -{
> > -if (prefix) {
> > -printf("%s: ", prefix);
> > -}
> > -
> > -printf("%s effect %d bbox(%d %d %d %d)",
> > -   draw_type_to_str(drawable->type),
> > -   drawable->effect,
> > -   drawable->bbox.top,
> > -   drawable->bbox.left,
> > -   drawable->bbox.bottom,
> > -   drawable->bbox.right);
> > -
> > -switch (drawable->type) {
> > -case QXL_DRAW_FILL:
> > -case QXL_DRAW_OPAQUE:
> > -case QXL_DRAW_COPY:
> > -case QXL_DRAW_TRANSPARENT:
> > -case QXL_DRAW_ALPHA_BLEND:
> > -case QXL_COPY_BITS:
> > -case QXL_DRAW_BLEND:
> > -case QXL_DRAW_BLACKNESS:
> > -case QXL_DRAW_WHITENESS:
> > -case QXL_DRAW_INVERS:
> > -case QXL_DRAW_ROP3:
> > -case QXL_DRAW_COMPOSITE:
> > -case QXL_DRAW_STROKE:
> > -case QXL_DRAW_TEXT:
> > -break;
> > -default:
> > -spice_error("bad drawable type");
> > -}
> > -printf("\n");
> > -}
> > -
> > -static void show_draw_item(DrawItem *draw_item, const char *prefix)
> > -{
> > -if (prefix) {
> > -printf("%s: ", prefix);
> > -}
> > -printf("effect %d bbox(%d %d %d %d)\n",
> > -   draw_item->effect,
> > -   draw_item->base.rgn.extents.x1,
> > -   draw_item->base.rgn.extents.y1,
> > -   draw_item->base.rgn.extents.x2,
> > -   draw_item->base.rgn.extents.y2);
> > -}
> > -
> > -typedef struct DumpItem {
> > -int level;
> > -Container *container;
> > -} DumpItem;
> > -
> > -static void dump_item(TreeItem *item, void *data)
> > -{
> > -DumpItem *di = data;
> > -const char *item_prefix = "|--";
> > -int i;
> > -
> > -if (di->container) {
> > -while (di->container != item->container) {
> > -di->level--;
> > -di->container = di->container->base.container;
> > -}
> > -}
> > -
> > -switch (item->type) {
> > -case TREE_ITEM_TYPE_DRAWABLE: {
> > -Drawable *drawable = SPICE_CONTAINEROF(item, Drawable,
> tree_item.base);
> > -const int max_indent = 200;
> > -char indent_str[max_indent + 1];
> > -int indent_str_len;
> > -
> > -for (i = 0; i < di->level; i++) {
> > -printf("  ");
> > -}
> > -printf(item_prefix, 0);
> > -show_red_drawable(drawable->red_drawable, NULL);
> > -for (i = 0; i < di->level; i++) {
> > -printf("  ");
> > -}
> > -printf("|  ");
> > -show_draw_item(>tree_item, NULL);
> > -indent_str_len = MIN(max_indent, strlen(item_prefix) +
> di->level * 2);
> > -memset(indent_str, ' ', indent_str_len);
> > -indent_str[indent_str_len] = 0;
> > -region_dump(>rgn, indent_str);
> > -printf("\n");
> > -break;
> > -}
> > -case TREE_ITEM_TYPE_CONTAINER:
> > -di->level++;
> > -   

[Spice-devel] [spice v11 05/27] replay: Add an option to change video codec

2016-03-25 Thread Pavel Grunt
---
 server/tests/replay.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/server/tests/replay.c b/server/tests/replay.c
index 7e4659b..025b20c 100644
--- a/server/tests/replay.c
+++ b/server/tests/replay.c
@@ -290,7 +290,7 @@ int main(int argc, char **argv)
 {
 GError *error = NULL;
 GOptionContext *context = NULL;
-gchar *client = NULL, **file = NULL;
+gchar *client = NULL, *codecs = NULL, **file = NULL;
 gint port = 5000, compression = SPICE_IMAGE_COMPRESSION_AUTO_GLZ;
 gint streaming = SPICE_STREAM_VIDEO_FILTER;
 gboolean wait = FALSE;
@@ -300,6 +300,7 @@ int main(int argc, char **argv)
 { "client", 'c', 0, G_OPTION_ARG_STRING, , "Client", "CMD" },
 { "compression", 'C', 0, G_OPTION_ARG_INT, , "Compression 
(default 2)", "INT" },
 { "streaming", 'S', 0, G_OPTION_ARG_INT, , "Streaming 
(default 3)", "INT" },
+{ "video-codecs", 'v', 0, G_OPTION_ARG_STRING, , "Video 
codecs", "STRING" },
 { "port", 'p', 0, G_OPTION_ARG_INT, , "Server port (default 
5000)", "PORT" },
 { "wait", 'w', 0, G_OPTION_ARG_NONE, , "Wait for client", NULL },
 { "slow", 's', 0, G_OPTION_ARG_INT, , "Slow down replay. Delays 
USEC microseconds before each command", "USEC" },
@@ -386,6 +387,14 @@ int main(int argc, char **argv)
 server = spice_server_new();
 spice_server_set_image_compression(server, compression);
 spice_server_set_streaming_video(server, streaming);
+
+if (codecs != NULL) {
+if (spice_server_set_video_codecs(server, codecs) != 0) {
+g_warning("could not set codecs: %s", codecs);
+}
+g_free(codecs);
+}
+
 spice_server_set_port(server, port);
 spice_server_set_noauth(server);
 
-- 
2.7.0

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk] usb-device-manager: Remove invalid return annotation

2016-03-21 Thread Pavel Grunt
---
 src/usb-device-manager.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 417c5b2..85231a1 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -1568,8 +1568,6 @@ gboolean spice_usb_device_manager_connect_device_finish(
  * @device: a #SpiceUsbDevice to disconnect
  *
  * Disconnects the @device.
- *
- * Returns: %TRUE if @device has an associated USB redirection channel
  */
 void spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager *self,
 SpiceUsbDevice *device)
-- 
2.7.4

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [spice-server] doc: Add virgl documentation

2016-03-21 Thread Pavel Grunt
Thanks!

Acked-by: Pavel Grunt <pgr...@redhat.com>

On Fri, 2016-03-18 at 17:12 +0100, Christophe Fergeau wrote:
> Document how to use virgl with QEMU/libvirt
> 
> virt-manager documentation still needs to be added.
> ---
>  docs/manual/manual.txt | 55
> ++
>  1 file changed, 55 insertions(+)
> 
> diff --git a/docs/manual/manual.txt b/docs/manual/manual.txt
> index 2c0035a..a89a702 100644
> --- a/docs/manual/manual.txt
> +++ b/docs/manual/manual.txt
> @@ -901,6 +901,61 @@ folder will show up in GNOME Files network
> places (or Nautilus). It
>  can then be mounted and browsed in traditional applications thanks
> to
>  `gvfs-fuse`.
>  
> +GL acceleration (virgl)
> +===
> +
> +OpenGL acceleration is currently local only (it has to go through a
> Unix socket)
> +and it needs guest support. It's currently limited to recent linux
> +distributions (for example up to date Fedora 23).
> +
> +Configuration
> +-
> +
> +.Using libvirt
> +
> +You need to add a virtio-gpu video device to your virtual machine
> instead of QXL.
> +[source,xml]
> +
> +  
> +
> +  
> +
> +
> +Then you need to enable OpenGL on your SPICE graphics node:
> +[source,xml]
> +
> +  
> +
> +
> +You don't need any port/address as they won't be usable with
> +GL.
> +
> +.Using QEMU
> +
> +You need to add a virtio-gpu device on QEMU command line,
> +as well as enable GL with SPICE. port/tls-port/addr arguments
> +won't be used in this setup. You need to configure a Unix socket to
> +connect to the VM display.
> +
> +[source,sh]
> +-device virtio-vga,virgl=on -spice
> gl=on,unix,addr=/run/user/1000/spice.sock
> +
> +Connecting to the guest
> +---
> +
> +Connecting to the guest when virgl is in use is slightly different
> +than usual
> +
> +.If libvirt is being used
> +
> +[source,sh]
> +client$ virt-viewer -a $vmname
> +
> +.If a Unix socket has been set on QEMU command line
> +
> +[source,sh]
> +client$ remote-viewer spice+unix:///run/user/1000/spice.sock
> +
>  QEMU Spice reference
>  
>  
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk] Remove extra checks before g_cancellable_disconnect()

2016-03-21 Thread Pavel Grunt
If cancellable is NULL or handler_id is 0 the function does nothing.
---
 src/spice-pulse.c |  4 +---
 src/vmcstream.c   | 15 +++
 2 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/src/spice-pulse.c b/src/spice-pulse.c
index 8d45dbe..6bc3014 100644
--- a/src/spice-pulse.c
+++ b/src/spice-pulse.c
@@ -945,9 +945,7 @@ static gboolean free_async_task(gpointer user_data)
 if (task->pa_op != NULL)
 pa_operation_unref(task->pa_op);
 
-if (task->cancel_id != 0)
-g_cancellable_disconnect(g_task_get_cancellable(task->gtask),
- task->cancel_id);
+g_cancellable_disconnect(g_task_get_cancellable(task->gtask), 
task->cancel_id);
 
 if (task->gtask)
 g_object_unref(task->gtask);
diff --git a/src/vmcstream.c b/src/vmcstream.c
index 48f9513..a206961 100644
--- a/src/vmcstream.c
+++ b/src/vmcstream.c
@@ -116,7 +116,6 @@ spice_vmc_input_stream_co_data(SpiceVmcInputStream *self,
 self->coroutine = coroutine_self();
 
 while (size > 0) {
-GCancellable *cancellable;
 SPICE_DEBUG("spicevmc co_data %p", self->task);
 if (!self->task)
 coroutine_yield(NULL);
@@ -140,9 +139,7 @@ spice_vmc_input_stream_co_data(SpiceVmcInputStream *self,
 
 g_task_return_int(self->task, self->pos);
 
-cancellable = g_task_get_cancellable(self->task);
-if (cancellable)
-g_cancellable_disconnect(cancellable, self->cancel_id);
+g_cancellable_disconnect(g_task_get_cancellable(self->task), 
self->cancel_id);
 
 g_clear_object(>task);
 }
@@ -208,16 +205,13 @@ spice_vmc_input_stream_read_all_finish(GInputStream 
*stream,
GError **error)
 {
 GTask *task = G_TASK(result);
-GCancellable *cancellable;
 SpiceVmcInputStream *self = SPICE_VMC_INPUT_STREAM(stream);
 
 g_return_val_if_fail(g_task_is_valid(task, self), -1);
 
 /* FIXME: calling _finish() is required. Disconnecting in
read_cancelled() causes a deadlock. #705395 */
-cancellable = g_task_get_cancellable(task);
-if (cancellable)
-g_cancellable_disconnect(cancellable, self->cancel_id);
+g_cancellable_disconnect(g_task_get_cancellable(task), self->cancel_id);
 
 return g_task_propagate_int(task, error);
 }
@@ -258,16 +252,13 @@ spice_vmc_input_stream_read_finish(GInputStream *stream,
GError **error)
 {
 GTask *task = G_TASK(result);
-GCancellable *cancellable;
 SpiceVmcInputStream *self = SPICE_VMC_INPUT_STREAM(stream);
 
 g_return_val_if_fail(g_task_is_valid(task, self), -1);
 
 /* FIXME: calling _finish() is required. Disconnecting in
read_cancelled() causes a deadlock. #705395 */
-cancellable = g_task_get_cancellable(task);
-if (cancellable)
-g_cancellable_disconnect(cancellable, self->cancel_id);
+g_cancellable_disconnect(g_task_get_cancellable(task), self->cancel_id);
 
 return g_task_propagate_int(task, error);
 }
-- 
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] Avoid to access array with negative numbers

2016-03-23 Thread Pavel Grunt
Hi,

according to GdkEventButton documentation [0] the 'button' is guint so
the button_gdk_to_spice() should take guint instead of int.

Pavel

[0] https://developer.gnome.org/gdk3/stable/gdk3-Event-Structures.html#
GdkEventButton

On Wed, 2016-03-23 at 15:28 +, Frediano Ziglio wrote:
> ---
>  src/spice-widget.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index 19753e7..d2fd789 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -1549,7 +1549,7 @@ static int button_gdk_to_spice(int gdk)
>  [ 5 ] = SPICE_MOUSE_BUTTON_DOWN,
>  };
>  
> -if (gdk < SPICE_N_ELEMENTS(map)) {
> +if (gdk >= 0 && gdk < SPICE_N_ELEMENTS(map)) {
>  return map [ gdk ];
>  }
>  return 0;
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH 2/2] use macro to define constructor function

2016-03-23 Thread Pavel Grunt
On Mon, 2016-02-29 at 10:36 +, Frediano Ziglio wrote:
> Avoid having to call function at runtime to inialize static.
> Old functions are defined as deprecated for compatibility.
> 
> Signed-off-by: Frediano Ziglio <fzig...@redhat.com>
Acked-by: Pavel Grunt <pgr...@redhat.com>
> ---
>  common/gdi_canvas.c |  2 --
>  common/gl_canvas.c  |  2 --
>  common/quic.c   | 11 ++-
>  common/quic.h   |  2 +-
>  common/rop3.c   |  8 +---
>  common/rop3.h   |  2 +-
>  common/sw_canvas.c  | 12 +---
>  common/sw_canvas.h  |  2 +-
>  8 files changed, 7 insertions(+), 34 deletions(-)
> 
> diff --git a/common/gdi_canvas.c b/common/gdi_canvas.c
> index 3c434d6..fcc5fc9 100644
> --- a/common/gdi_canvas.c
> +++ b/common/gdi_canvas.c
> @@ -1857,6 +1857,4 @@ void gdi_canvas_init(void) //unsafe global
> function
>  gdi_canvas_ops.put_image = gdi_canvas_put_image;
>  gdi_canvas_ops.clear = gdi_canvas_clear;
>  gdi_canvas_ops.destroy = gdi_canvas_destroy;
> -
> -rop3_init();
>  }
> diff --git a/common/gl_canvas.c b/common/gl_canvas.c
> index 9c5b98c..5ffb47b 100644
> --- a/common/gl_canvas.c
> +++ b/common/gl_canvas.c
> @@ -908,6 +908,4 @@ void gl_canvas_init(void) //unsafe global
> function
>  gl_canvas_ops.group_start = gl_canvas_group_start;
>  gl_canvas_ops.group_end = gl_canvas_group_end;
>  gl_canvas_ops.destroy = gl_canvas_destroy;
> -
> -rop3_init();
>  }
> diff --git a/common/quic.c b/common/quic.c
> index 88cf143..f014a2a 100644
> --- a/common/quic.c
> +++ b/common/quic.c
> @@ -1634,13 +1634,11 @@ int quic_decode(QuicContext *quic,
> QuicImageType type, uint8_t *buf, int stride)
>  return QUIC_OK;
>  }
>  
> -static int need_init = TRUE;
> -
>  QuicContext *quic_create(QuicUsrContext *usr)
>  {
>  Encoder *encoder;
>  
> -if (!usr || need_init || !usr->error || !usr->warn || !usr->info 
> || !usr->malloc ||
> +if (!usr || !usr->error || !usr->warn || !usr->info || !usr-
> >malloc ||
>  !usr->free || !usr->more_space || !usr->more_lines) {
>  return NULL;
>  }
> @@ -1671,13 +1669,8 @@ void quic_destroy(QuicContext *quic)
>  encoder->usr->free(encoder->usr, encoder);
>  }
>  
> -void quic_init(void)
> +SPICE_CONSTRUCTOR_FUNC(quic_global_init)
>  {
> -if (!need_init) {
> -return;
> -}
> -need_init = FALSE;
> -
>  family_init(_8bpc, 8, DEFmaxclen);
>  family_init(_5bpc, 5, DEFmaxclen);
>  }
> diff --git a/common/quic.h b/common/quic.h
> index ee5fb17..97622b3 100644
> --- a/common/quic.h
> +++ b/common/quic.h
> @@ -63,7 +63,7 @@ int quic_decode(QuicContext *quic, QuicImageType
> type, uint8_t *buf, int stride)
>  QuicContext *quic_create(QuicUsrContext *usr);
>  void quic_destroy(QuicContext *quic);
>  
> -void quic_init(void);
> +static inline SPICE_GNUC_DEPRECATED void quic_init(void) {}
>  
>  SPICE_END_DECLS
>  
> diff --git a/common/rop3.c b/common/rop3.c
> index 1a18fe9..2a0a167 100644
> --- a/common/rop3.c
> +++ b/common/rop3.c
> @@ -376,16 +376,10 @@ ROP3_HANDLERS(DPSoo, *src | *pat | *dest,
> 0xfe);
>  rop3_test_handlers_32[index] = rop3_test32_##op; \
>  rop3_test_handlers_16[index] = rop3_test16_##op;
>  
> -void rop3_init(void)
> +SPICE_CONSTRUCTOR_FUNC(rop3_global_init)
>  {
> -static int need_init = 1;
>  int i;
>  
> -if (!need_init) {
> -return;
> -}
> -need_init = 0;
> -
>  for (i = 0; i < ROP3_NUM_OPS; i++) {
>  rop3_with_pattern_handlers_32[i] =
> default_rop3_with_pattern_handler;
>  rop3_with_pattern_handlers_16[i] =
> default_rop3_with_pattern_handler;
> diff --git a/common/rop3.h b/common/rop3.h
> index 7e00499..20e100c 100644
> --- a/common/rop3.h
> +++ b/common/rop3.h
> @@ -32,7 +32,7 @@ void do_rop3_with_pattern(uint8_t rop3,
> pixman_image_t *d, pixman_image_t *s, Sp
>  void do_rop3_with_color(uint8_t rop3, pixman_image_t *d,
> pixman_image_t *s, SpicePoint *src_pos,
>  uint32_t rgb);
>  
> -void rop3_init(void);
> +static inline SPICE_GNUC_DEPRECATED void rop3_init(void) {}
>  
>  SPICE_END_DECLS
>  
> diff --git a/common/sw_canvas.c b/common/sw_canvas.c
> index a43cee4..e8b0f3b 100644
> --- a/common/sw_canvas.c
> +++ b/common/sw_canvas.c
> @@ -1188,7 +1188,6 @@ static void canvas_destroy(SpiceCanvas
> *spice_canvas)
>  free(canvas);
>  }
>  
> -static int need_init = 1;
>  static SpiceCanvasOps sw_canvas_ops;
>  
>  static SpiceCanvas *canvas_create_common(pixman_image_t *image,
&

Re: [Spice-devel] [spice-gtk v2] Avoid to access array with negative numbers

2016-03-23 Thread Pavel Grunt
On Wed, 2016-03-23 at 15:40 +, Frediano Ziglio wrote:

Acked-by: Pavel Grunt <pgr...@redhat.com>

> ---
>  src/spice-widget.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Changes from v1:
> - make parameter guint as GdkEventButton::button is guint.
> 
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index 19753e7..b1a9423 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -1539,7 +1539,7 @@ static gboolean focus_out_event(GtkWidget
> *widget, GdkEventFocus *focus G_GNUC_U
>  return true;
>  }
>  
> -static int button_gdk_to_spice(int gdk)
> +static int button_gdk_to_spice(guint gdk)
>  {
>  static const int map[] = {
>  [ 1 ] = SPICE_MOUSE_BUTTON_LEFT,
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH] use constructor/destructor macros

2016-03-23 Thread Pavel Grunt
On Wed, 2016-03-23 at 15:23 +, Frediano Ziglio wrote:
> Initialize global images at load time:
> - make sure these stuff are initialized without using runtime
> resources;
> - make sure stuff are initialize really earlier.
> Do not use atexit function but a destructor.
> 
> Signed-off-by: Frediano Ziglio <fzig...@redhat.com>
Acked-by: Pavel Grunt <pgr...@redhat.com>
> ---
>  server/red-qxl.c | 7 ---
>  server/reds.c| 7 +--
>  spice-common | 2 +-
>  3 files changed, 2 insertions(+), 14 deletions(-)
> 
> diff --git a/server/red-qxl.c b/server/red-qxl.c
> index 3fd5c12..fbce510 100644
> --- a/server/red-qxl.c
> +++ b/server/red-qxl.c
> @@ -961,13 +961,6 @@ void red_qxl_init(RedsState *reds, QXLInstance
> *qxl)
>  
>  spice_return_if_fail(qxl != NULL);
>  
> -static gsize initialized = FALSE;
> -if (g_once_init_enter()) {
> -quic_init();
> -sw_canvas_init();
> -g_once_init_leave(, TRUE);
> -}
> -
>  qxl_state = spice_new0(QXLState, 1);
>  qxl_state->reds = reds;
>  qxl_state->qxl = qxl;
> diff --git a/server/reds.c b/server/reds.c
> index 254840b..38a369c 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -2801,7 +2801,7 @@ static void reds_cleanup(RedsState *reds)
>  #endif
>  }
>  
> -static void reds_exit(void)
> +SPICE_DESTRUCTOR_FUNC(reds_exit)
>  {
>  GList *l;
>  
> @@ -3335,7 +3335,6 @@ static void
> reds_init_vd_agent_resources(RedsState *reds)
>  
>  static int do_spice_init(RedsState *reds, SpiceCoreInterface
> *core_interface)
>  {
> -static gboolean first = TRUE;
>  spice_info("starting %s", VERSION);
>  
>  if (core_interface->base.major_version !=
> SPICE_INTERFACE_CORE_MAJOR) {
> @@ -3416,10 +3415,6 @@ static int do_spice_init(RedsState *reds,
> SpiceCoreInterface *core_interface)
>  if (reds->allow_multiple_clients) {
>  spice_warning("spice: allowing multiple client
> connections");
>  }
> -if (first) {
> -atexit(reds_exit);
> -first = FALSE;
> -}
>  servers = g_list_prepend(servers, reds);
>  return 0;
>  
> diff --git a/spice-common b/spice-common
> index 00db440..5b6be16 16
> --- a/spice-common
> +++ b/spice-common
> @@ -1 +1 @@
> -Subproject commit 00db44087807335e74c8f65ea3e6fde0b684e7db
> +Subproject commit 5b6be16b37370bb774aa3c2a7d5c41791fdc3a1e
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH v2 spice-gtk 2/2] widget: use allocation instead of window size

2016-03-23 Thread Pavel Grunt
On Wed, 2016-03-23 at 12:25 +0100, Marc-André Lureau wrote:
> Since spice-gtk 57df040cc, the SpiceDisplay no longer forces its own
> window. Get allocation instead of window size.  This fixes a "top
> border" issue in spicy with gtk+ >= 3.19.8.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lur...@gmail.com>
Acked-by: Pavel Grunt <pgr...@redhat.com>

Thanks,
Pavel
> ---
>  src/Makefile.am  |  1 -
>  src/gtk-compat.h | 31 ---
>  src/spice-gtk-session.c  |  1 -
>  src/spice-widget-cairo.c |  4 ++--
>  src/spice-widget-egl.c   |  1 -
>  src/spice-widget.c   |  9 -
>  src/vncdisplaykeymap.c   |  1 -
>  7 files changed, 6 insertions(+), 42 deletions(-)
>  delete mode 100644 src/gtk-compat.h
> 
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 66ba58b..330c85d 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -122,7 +122,6 @@ SPICE_GTK_LIBADD_COMMON = \
>   $(NULL)
>  
>  SPICE_GTK_SOURCES_COMMON =   \
> - gtk-compat.h\
>   spice-util.c\
>   spice-util-priv.h   \
>   spice-gtk-session.c \
> diff --git a/src/gtk-compat.h b/src/gtk-compat.h
> deleted file mode 100644
> index 39438f9..000
> --- a/src/gtk-compat.h
> +++ /dev/null
> @@ -1,31 +0,0 @@
> -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
> -/*
> -   Copyright (C) 2012-2014 Red Hat, Inc.
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 of the License, or (at your option) any later
> version.
> -
> -   This library is distributed in the hope that it will be useful,
> -   but WITHOUT ANY WARRANTY; without even the implied warranty of
> -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library; if not, see <http://www.gnu.org/
> licenses/>.
> -*/
> -#ifndef GTK_COMPAT_H
> -#define GTK_COMPAT_H
> -
> -#include "config.h"
> -
> -#include 
> -
> -static inline void gdk_drawable_get_size(GdkWindow *w, gint *ww,
> gint *wh)
> -{
> -*ww = gdk_window_get_width(w);
> -*wh = gdk_window_get_height(w);
> -}
> -
> -#endif /* GTK_COMPAT_H */
> diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> index 4201ee0..380b0bb 100644
> --- a/src/spice-gtk-session.c
> +++ b/src/spice-gtk-session.c
> @@ -38,7 +38,6 @@
>  #include 
>  #include 
>  #include "desktop-integration.h"
> -#include "gtk-compat.h"
>  #include "spice-common.h"
>  #include "spice-gtk-session.h"
>  #include "spice-gtk-session-priv.h"
> diff --git a/src/spice-widget-cairo.c b/src/spice-widget-cairo.c
> index c92d4ec..8c45524 100644
> --- a/src/spice-widget-cairo.c
> +++ b/src/spice-widget-cairo.c
> @@ -17,7 +17,6 @@
>  */
>  #include "config.h"
>  
> -#include "gtk-compat.h"
>  #include "spice-widget.h"
>  #include "spice-widget-priv.h"
>  #include "spice-gtk-session-priv.h"
> @@ -78,7 +77,8 @@ void spicex_draw_event(SpiceDisplay *display,
> cairo_t *cr)
>  
>  spice_display_get_scaling(display, , , , , );
>  
> -gdk_drawable_get_size(gtk_widget_get_window(GTK_WIDGET(display))
> , , );
> +ww = gtk_widget_get_allocated_width(GTK_WIDGET(display));
> +wh = gtk_widget_get_allocated_height(GTK_WIDGET(display));
>  
>  /* We need to paint the bg color around the image */
>  rect.x = 0;
> diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
> index 5d839a3..4254628 100644
> --- a/src/spice-widget-egl.c
> +++ b/src/spice-widget-egl.c
> @@ -22,7 +22,6 @@
>  #define EGL_EGLEXT_PROTOTYPES
>  #define GL_GLEXT_PROTOTYPES
>  
> -#include "gtk-compat.h"
>  #include "spice-widget.h"
>  #include "spice-widget-priv.h"
>  #include "spice-gtk-session-priv.h"
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index 12be7c2..a9387ad 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -42,8 +42,6 @@
>  #include "vncdisplaykeymap.h"
>  #include "spice-grabsequence-priv.h"
>  
> -#include "gtk-compat.h"
> -
>  /* Some compatibility defines to let us build on both Gtk2 and Gtk3
> */
>  
>  /**
> @@ -2411,9 +2409,10 @@ void spice_di

Re: [Spice-devel] [spice-server] doc: Add virgl documentation

2016-03-23 Thread Pavel Grunt
Hi Christophe,

On Wed, 2016-03-23 at 17:18 +0100, Christophe Fergeau wrote:
> On Mon, Mar 21, 2016 at 03:28:41PM +0100, Christophe Fergeau wrote:
> > 
> > On Mon, Mar 21, 2016 at 02:57:18PM +0100, Pavel Grunt wrote:
> > > 
> > > Thanks!
> > > 
> > > Acked-by: Pavel Grunt <pgr...@redhat.com>
> > > 
> > > On Fri, 2016-03-18 at 17:12 +0100, Christophe Fergeau wrote:
> > > > 
> > > > +GL acceleration (virgl)
> > > > +===
> > > > +
> > > > +OpenGL acceleration is currently local only (it has to go
> > > > through a
> > > > Unix socket)
> > > > +and it needs guest support. It's currently limited to recent
> > > > linux
> > > > +distributions (for example up to date Fedora 23).
> > > > +
> > After running more tests, I realized that on a f23 guest, you need
> > to
> > update mesa from Gerd's copr, I'll have to adjust the wording here.
> I"ll change it to
> 
> -distributions (for example up to date Fedora 23).
> +distributions (for example up to date Fedora 23 + updated mesa
> packages from
> +copr:kraxel).

I would keep up to date Fedora 23. Mesa should have virgl support -
see http://koji.fedoraproject.org/koji/buildinfo?buildID=739036 

Pavel
> 
> Christophe
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH v3 6/9] egl: check and update scanout after egl init

2016-03-24 Thread Pavel Grunt
On Thu, 2016-03-24 at 12:32 +0100, Marc-André Lureau wrote:
> Once the egl/GL context are initialized, check if there is a scanout
> to
> associate to display widget. This solves races when scanout update is
> happening before the egl/GL context is ready.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lur...@gmail.com>
Acked-by: Pavel Grunt <pgr...@redhat.com>
> ---
>  src/spice-widget-egl.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
> index 151970c..b9bec68 100644
> --- a/src/spice-widget-egl.c
> +++ b/src/spice-widget-egl.c
> @@ -272,6 +272,12 @@ end:
>  
>  d->egl.context_ready = TRUE;
>  
> +if (spice_display_get_gl_scanout(SPICE_DISPLAY_CHANNEL(d-
> >display)) != NULL) {
> +SPICE_DEBUG("scanout present during egl init, updating
> widget");
> +spice_display_widget_gl_scanout(display);
> +spice_display_widget_update_monitor_area(display);
> +}
> +
>  return TRUE;
>  }
>  
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk v2 8/8] widget: modify update-area to not require primary surface

2016-03-24 Thread Pavel Grunt
On Wed, 2016-03-23 at 19:32 -0400, Marc-André Lureau wrote:
> Hi
> 
> - Original Message -
> > 
> > Hi,
> > 
> > as we discussed, I prefer this patch to go in after 9/8 to avoid
> > some
> > incorrect resizes
> Ok
> 
> > 
> > 
> > On Tue, 2016-03-22 at 13:57 +0100, Marc-André Lureau wrote:
> > > 
> > > If egl display is enabled, use GL scanout geometry to check
> > > intersection
> > > with the monitor area. This solves displaying GL display without
> > > software canvas.
> > What are the issues?
> There is no interesection with monitor area & missing primary canvas,
> so d->area is not set and gl update display fails.
> 
Thanks, ack

Pavel

> > 
> > 
> > Pavel
> > > 
> > > 
> > > Signed-off-by: Marc-André Lureau 
> > > ---
> > >  src/spice-widget.c | 41 --
> > > ---
> > >  1 file changed, 28 insertions(+), 13 deletions(-)
> > > 
> > > diff --git a/src/spice-widget.c b/src/spice-widget.c
> > > index e16126a..4b7e202 100644
> > > --- a/src/spice-widget.c
> > > +++ b/src/spice-widget.c
> > > @@ -2190,32 +2190,47 @@ static void update_area(SpiceDisplay
> > > *display,
> > >  gint x, gint y, gint width, gint height)
> > >  {
> > >  SpiceDisplayPrivate *d = display->priv;
> > > -GdkRectangle primary = {
> > > -.x = 0,
> > > -.y = 0,
> > > -.width = d->width,
> > > -.height = d->height
> > > -};
> > > -GdkRectangle area = {
> > > +GdkRectangle primary;
> > > +
> > > +SPICE_DEBUG("update area +%d+%d %dx%d", x, y, width,
> > > height);
> > > +d->area = (GdkRectangle) {
> > >  .x = x,
> > >  .y = y,
> > >  .width = width,
> > >  .height = height
> > >  };
> > >  
> > > -SPICE_DEBUG("update area, primary: %dx%d, area: +%d+%d
> > > %dx%d",
> > > d->width, d->height, area.x, area.y, area.width, area.height);
> > > +#ifndef G_OS_WIN32
> > > +if (d->egl.enabled) {
> > > +primary = (GdkRectangle) {
> > > +.width = d->egl.scanout.width,
> > > +.height = d->egl.scanout.height
> > > +};
> > > +} else
> > > +#endif
> > > +{
> > > +primary = (GdkRectangle) {
> > > +.width = d->width,
> > > +.height = d->height
> > > +};
> > > +}
> > >  
> > > -if (!gdk_rectangle_intersect(, , )) {
> > > +SPICE_DEBUG("primary: %dx%d", primary.width,
> > > primary.height);
> > > +if (!gdk_rectangle_intersect(, >area, >area))
> > > {
> > >  SPICE_DEBUG("The monitor area is not intersecting
> > > primary
> > > surface");
> > >  memset(>area, '\0', sizeof(d->area));
> > >  set_monitor_ready(display, false);
> > >  return;
> > >  }
> > >  
> > > -spicex_image_destroy(display);
> > > -d->area = area;
> > > -if (gtk_widget_get_realized(GTK_WIDGET(display)))
> > > -update_image(display);
> > > +#ifndef G_OS_WIN32
> > > +if (!d->egl.enabled)
> > > +#endif
> > > +{
> > > +spicex_image_destroy(display);
> > > +if (gtk_widget_get_realized(GTK_WIDGET(display)))
> > > +update_image(display);
> > > +}
> > >  
> > >  update_size_request(display);
> > >  
> > ___
> > 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


Re: [Spice-devel] [spice-html5] Fix 2 typos in comments

2016-03-08 Thread Pavel Grunt
Acked-by: Pavel Grunt <pgr...@redhat.com>

On Tue, 2016-03-08 at 11:39 +0100, Christophe Fergeau wrote:
> ---
>  utils.js | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/utils.js b/utils.js
> index 9eb42ff..f1a5748 100644
> --- a/utils.js
> +++ b/utils.js
> @@ -100,7 +100,7 @@ function hexdump_buffer(a)
>  /*
> 
>  ** Converting keycodes to AT scancodes is very hard.
>  ** luckly there are some resources on the web and in the Xorg driver
> that help
> -** us figure out what browser depenend keycodes match to what
> scancodes.
> +** us figure out what browser dependent keycodes match to what
> scancodes.
>  **
>  ** This will most likely not work for non US keyboard and browsers
> other than
>  ** modern Chrome and FireFox.
> @@ -155,7 +155,7 @@ common_scanmap[121]= KEY_F10;
>  common_scanmap[122]= KEY_F11;
>  common_scanmap[123]= KEY_F12;
>  
> -/* These externded scancodes do not line up with values from
> atKeynames */
> +/* These extended scancodes do not line up with values from
> atKeynames */
>  common_scanmap[42] = 99;
>  common_scanmap[19] = 101;// Break
>  common_scanmap[111]= 0xE035; // KP_Divide
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [spice v10 07/27] replay: Add an option to change video codec

2016-03-01 Thread Pavel Grunt
Signed-off-by: Francois Gouget 
---
 server/tests/replay.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/server/tests/replay.c b/server/tests/replay.c
index f3b670f..5bbca5e 100644
--- a/server/tests/replay.c
+++ b/server/tests/replay.c
@@ -284,7 +284,7 @@ int main(int argc, char **argv)
 {
 GError *error = NULL;
 GOptionContext *context = NULL;
-gchar *client = NULL, **file = NULL;
+gchar *client = NULL, *codecs = NULL, **file = NULL;
 gint port = 5000, compression = SPICE_IMAGE_COMPRESSION_AUTO_GLZ;
 gint streaming = SPICE_STREAM_VIDEO_FILTER;
 gboolean wait = FALSE;
@@ -294,6 +294,7 @@ int main(int argc, char **argv)
 { "client", 'c', 0, G_OPTION_ARG_STRING, , "Client", "CMD" },
 { "compression", 'C', 0, G_OPTION_ARG_INT, , "Compression 
(default 2)", "INT" },
 { "streaming", 'S', 0, G_OPTION_ARG_INT, , "Streaming 
(default 3)", "INT" },
+{ "video-codecs", 'v', 0, G_OPTION_ARG_STRING, , "Video 
codecs", "STRING" },
 { "port", 'p', 0, G_OPTION_ARG_INT, , "Server port (default 
5000)", "PORT" },
 { "wait", 'w', 0, G_OPTION_ARG_NONE, , "Wait for client", NULL },
 { "slow", 's', 0, G_OPTION_ARG_INT, , "Slow down replay. Delays 
USEC microseconds before each command", "USEC" },
@@ -378,6 +379,14 @@ int main(int argc, char **argv)
 server = spice_server_new();
 spice_server_set_image_compression(server, compression);
 spice_server_set_streaming_video(server, streaming);
+
+if (codecs != NULL) {
+if (spice_server_set_video_codecs(server, codecs) != 0) {
+g_warning("could not set codecs: %s", codecs);
+}
+g_free(codecs);
+}
+
 spice_server_set_port(server, port);
 spice_server_set_noauth(server);
 
-- 
2.7.0

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk] widget-egl: Define label only if can be used

2016-04-01 Thread Pavel Grunt
The label can be used only with GDK_WINDOWING_WAYLAND

Silence -Wunused-label
---
 src/spice-widget-egl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
index 51bb5c5..c54d9f6 100644
--- a/src/spice-widget-egl.c
+++ b/src/spice-widget-egl.c
@@ -266,7 +266,10 @@ gboolean spice_egl_init(SpiceDisplay *display, GError 
**err)
 eglMakeCurrent(d->egl.display, EGL_NO_SURFACE, EGL_NO_SURFACE,
d->egl.ctx);
 
+#ifdef GDK_WINDOWING_WAYLAND
 end:
+#endif
+
 if (!spice_egl_init_shaders(display, err))
 return FALSE;
 
-- 
2.8.0

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] "undefined reference" errors while running make

2016-04-04 Thread Pavel Grunt
Hi,

On Mon, 2016-04-04 at 09:59 +0200, Christophe Fergeau wrote:
> On Sat, Apr 02, 2016 at 02:14:11PM +, Mahmood Naderan wrote:
> > 
> > Hi Eduardo,I have to say that the latest git revision doesn't
> > include your patch.  So, I applied your patch manually into the
> > latest revision.
> > That undefined error has been solved, but now I see a new
> > error.Please note that it is saying I have to include two compiler
> > options. Should I do that or you have a netter idea?
> > 
> > Please see the full log below
> > 
> > 
> > 
> > 
> > root@cluster:spice-src# git rev-parse HEAD
> > 77946c395ba9ff3e6e03386a43f7451ddf1e38a0
> This does not correspond to a sha1 in the upstream repository.
> Things should be good starting from
> https://cgit.freedesktop.org/spice/spice-common/commit/?id=6c7552d543
> 69ced08a9b2c61587cad44c04d4ab9

There hasn't been a submodule update which contains that commit, that
is a reason why making spice server fails.

About the 'g_get_monotonic_time' it is available since glib 2.28 and I
think it is reasonable to start requiring it (at least for the unstable
branch). It's been there for five years.

And for the redefinition of typedef's there is a Christophe's patch &
discussion in the mailing list:
https://lists.freedesktop.org/archives/spice-devel/2016-March/027808.ht
ml

Pavel

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [spice-common 1/3] log: Clamp SPICE_DEBUG_LEVEL if it's too high

2016-04-05 Thread Pavel Grunt
Hi,

ack for the series.

Pavel

On Tue, 2016-04-05 at 12:56 +0200, Christophe Fergeau wrote:
> This matches how SPICE_DEBUG_LEVEL behaved before switching to glib
> logging.
> ---
>  common/log.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/common/log.c b/common/log.c
> index 8d47cb6..5f08470 100644
> --- a/common/log.c
> +++ b/common/log.c
> @@ -67,6 +67,9 @@ static void spice_log_set_debug_level(void)
>  /* FIXME: To be removed after enough deprecation time */
>  g_warning("Setting SPICE_DEBUG_LEVEL is deprecated, use
> G_MESSAGES_DEBUG instead");
>  debug_level = atoi(debug_str);
> +if (debug_level > SPICE_LOG_LEVEL_DEBUG) {
> +debug_level = SPICE_LOG_LEVEL_DEBUG;
> +}
>  glib_debug_level = spice_log_level_to_glib(debug_level);
>  
>  /* If the debug level is too high, make sure we don't
> try to enable
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [spice-server 1/3] Remove duplicate typedef from headers

2016-03-30 Thread Pavel Grunt
Hi,

I agree that there should be the only one typedef. But I don't
understand why not to include the needed header directly. We should try
to "untagle" these header dependencies.

Pavel

On Wed, 2016-03-30 at 11:46 +0200, Christophe Fergeau wrote:
> This is causing compile errors with older gcc versions.
> 
> reds.h includes reds-stream.h through red-channel.h so it will get
> the
> RedsState typedef this way.
> 
> red-qxl.h includes spice-qxl.h through red-channel.h and then
> spice.h,
> so it will get the QXLState typedef this way.
> ---
>  server/red-qxl.h | 2 --
>  server/reds.h| 2 --
>  2 files changed, 4 deletions(-)
> 
> diff --git a/server/red-qxl.h b/server/red-qxl.h
> index b1ebbe1..ce80f97 100644
> --- a/server/red-qxl.h
> +++ b/server/red-qxl.h
> @@ -20,8 +20,6 @@
>  
>  #include "red-channel.h"
>  
> -typedef struct QXLState QXLState;
> -
>  typedef struct AsyncCommand AsyncCommand;
>  
>  void red_qxl_init(SpiceServer *reds, QXLInstance *qxl);
> diff --git a/server/reds.h b/server/reds.h
> index 5966dc3..c2968c2 100644
> --- a/server/reds.h
> +++ b/server/reds.h
> @@ -31,8 +31,6 @@
>  #include "main-dispatcher.h"
>  #include "migration-protocol.h"
>  
> -typedef struct RedsState RedsState;
> -
>  static inline QXLInterface * qxl_get_interface(QXLInstance *qxl)
>  {
>  return SPICE_CONTAINEROF(qxl->base.sif, QXLInterface, base);
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [spice-server 2/3] Update NEWS for 0.13.1

2016-03-30 Thread Pavel Grunt
The series looks good, ack

Pavel

On Wed, 2016-03-30 at 11:46 +0200, Christophe Fergeau wrote:
> ---
>  NEWS | 14 +-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/NEWS b/NEWS
> index e906e88..ecedcd8 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -1,4 +1,4 @@
> -Major changes in 0.13.0:
> +Major changes in 0.13.1:
>  
>  
>  *** IMPORTANT ***
> @@ -6,6 +6,18 @@ The 0.13.x release series is an unstable release
> series, if you are looking for
>  stability for daily use, please use the latest 0.12.x release. We
> are trying to
>  keep the code as functional as 0.12, but regressions or bugs could
> still happen.
>  
> +* add spice_qxl_gl_scanout() spice_qxl_gl_draw_async() for local
> virgl support
> +* spice_server_set_keepalive_timeout() has been removed in favour of
> +  unconditionally sending keepalive probes every 10 minutes
> +* the rework started in 0.13.0 has moved forward. The global
> RedsState *reds
> +  variable has now been removed, GLib mainloop is now used for the
> RedWorker thread
> +  rather than an adhoc implementation, some core classes have been
> ported to
> +  GObject, ...
> +* some crash/leak fixes in corner cases
> +
> +Major changes in 0.13.0:
> +
> +
>  * Start of a large code rework to attempt to make the codebase more
>    maintainable. With this first release, the huge red_worker.c file
> has been split
>    in multiple smaller files.
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [spice-gtk] build-sys: Update symbol files

2016-03-30 Thread Pavel Grunt
On Wed, 2016-03-30 at 10:59 +0200, Christophe Fergeau wrote:
> The OSX-specific symbol files were not updated after the recent API
> additions/removals, and some removed symbols were still listed in
> map-file.

Acked-by: Pavel Grunt <pgr...@redhat.com>

> ---
>  src/map-file| 4 +---
>  src/spice-glib-sym-file | 3 +++
>  src/spice-gtk-sym-file  | 2 --
>  3 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/src/map-file b/src/map-file
> index 9df9017..589da21 100644
> --- a/src/map-file
> +++ b/src/map-file
> @@ -22,7 +22,6 @@ spice_client_error_quark;
>  spice_cursor_channel_get_type;
>  spice_display_change_preferred_compression;
>  spice_display_channel_get_type;
> -spice_display_copy_to_guest;
>  spice_display_get_gl_scanout;
>  spice_display_get_grab_keys;
>  spice_display_get_pixbuf;
> @@ -33,7 +32,6 @@ spice_display_key_event_get_type;
>  spice_display_mouse_ungrab;
>  spice_display_new;
>  spice_display_new_with_monitor;
> -spice_display_paste_from_guest;
>  spice_display_send_keys;
>  spice_display_set_grab_keys;
>  spice_file_transfer_task_cancel;
> @@ -133,12 +131,12 @@ spice_usb_device_manager_connect_device_finish;
>  spice_usb_device_manager_disconnect_device;
>  spice_usb_device_manager_disconnect_device_async;
>  spice_usb_device_manager_disconnect_device_finish;
> -spice_usb_device_manager_is_redirecting;
>  spice_usb_device_manager_get;
>  spice_usb_device_manager_get_devices;
>  spice_usb_device_manager_get_devices_with_filter;
>  spice_usb_device_manager_get_type;
>  spice_usb_device_manager_is_device_connected;
> +spice_usb_device_manager_is_redirecting;
>  spice_usb_device_widget_get_type;
>  spice_usb_device_widget_new;
>  spice_usbredir_channel_get_type;
> diff --git a/src/spice-glib-sym-file b/src/spice-glib-sym-file
> index d49a713..0657dcb 100644
> --- a/src/spice-glib-sym-file
> +++ b/src/spice-glib-sym-file
> @@ -108,11 +108,14 @@ spice_usb_device_manager_can_redirect_device
>  spice_usb_device_manager_connect_device_async
>  spice_usb_device_manager_connect_device_finish
>  spice_usb_device_manager_disconnect_device
> +spice_usb_device_manager_disconnect_device_async
> +spice_usb_device_manager_disconnect_device_finish
>  spice_usb_device_manager_get
>  spice_usb_device_manager_get_devices
>  spice_usb_device_manager_get_devices_with_filter
>  spice_usb_device_manager_get_type
>  spice_usb_device_manager_is_device_connected
> +spice_usb_device_manager_is_redirecting
>  spice_usbredir_channel_get_type
>  spice_util_get_debug
>  spice_util_get_version_string
> diff --git a/src/spice-gtk-sym-file b/src/spice-gtk-sym-file
> index 1574e07..e52334b 100644
> --- a/src/spice-gtk-sym-file
> +++ b/src/spice-gtk-sym-file
> @@ -1,4 +1,3 @@
> -spice_display_copy_to_guest
>  spice_display_get_grab_keys
>  spice_display_get_pixbuf
>  spice_display_get_type
> @@ -6,7 +5,6 @@ spice_display_key_event_get_type
>  spice_display_mouse_ungrab
>  spice_display_new
>  spice_display_new_with_monitor
> -spice_display_paste_from_guest
>  spice_display_send_keys
>  spice_display_set_grab_keys
>  spice_grab_sequence_as_string
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk 0/6] Fixes for autogenerated documentation

2016-03-30 Thread Pavel Grunt
On Wed, 2016-03-30 at 10:49 +0200, Christophe Fergeau wrote:
> Acked-by: Christophe Fergeau <cferg...@redhat.com>
> 
Thank you, pushed

> On Wed, Mar 30, 2016 at 09:00:15AM +0200, Pavel Grunt wrote:
> > 
> > Hi,
> > 
> > Following patches adjust autogenerated docs (can be found at [0])
> > to recent
> > changes (some classes are final now, there are new functions).
> > They also silence some warnings when the docs are generated.
> > 
> > Pavel
> > 
> > [0] http://www.spice-space.org/spice-gtk.html
> > 
> > Pavel Grunt (6):
> >   usb-device-manager: Fix docstring
> >   doc: Remove private structs
> >   doc: channel stability should be Stable
> >   spice-file-transfer-task: Fix docstring
> >   doc: Ignore spicy-connect
> >   doc: Add description for spice_display_get_gl_scanout()
> > 
> >  doc/reference/Makefile.am|  1 +
> >  doc/reference/spice-gtk-sections.txt |  8 +---
> >  src/channel-display.c|  2 ++
> >  src/channel-smartcard.c  |  2 +-
> >  src/channel-usbredir.c   |  2 +-
> >  src/spice-file-transfer-task.h   |  2 +-
> >  src/usb-device-manager.c | 14 +-
> >  7 files changed, 16 insertions(+), 15 deletions(-)
> > 
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [spice-server] doc: Add virgl documentation

2016-03-29 Thread Pavel Grunt
On Thu, 2016-03-24 at 13:58 +0100, Christophe Fergeau wrote:
> On Wed, Mar 23, 2016 at 05:59:03PM +0100, Pavel Grunt wrote:
> > 
> > On Wed, 2016-03-23 at 17:45 +0100, Christophe Fergeau wrote:
> > > 
> > > But it seems these are good enough, when I tested this, Xorg was
> > > picking
> > > the QXL driver, which gave me a blackscreen with the f23
> > > packages.
> > > With
> > > packages from kraxel's repository, the correct driver was picked
> > > up,
> > > and
> > > I could get a working guest display. Which is why I want to
> > > mention
> > > them
> > > now ;)
> > > 
> > ok maybe it deserves a bug report.
> Do you mean bug report against fedora? Or somewhere else?
> 
Yes, I meant a bug for Fedora.

Pavel

> > 
> > I already acked the patch, but would you mind adding a link to the
> > copr repo [0] ?
> I added this and pushed.
> 
> Christophe
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk] widget: Use parentheses around ternary conditional

2016-03-29 Thread Pavel Grunt
"&&" has higher precedency than "?:"

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=94738
---
 src/spice-widget.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/spice-widget.c b/src/spice-widget.c
index 21b1c14..67a9cc1 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -232,12 +232,11 @@ static void update_ready(SpiceDisplay *display)
 SpiceDisplayPrivate *d = display->priv;
 gboolean ready;
 
-ready = d->monitor_ready &&
 #ifndef G_OS_WIN32
-d->egl.enabled ? d->egl.image != NULL :
+ready = d->monitor_ready && (d->egl.enabled ? d->egl.image != NULL : 
d->mark != 0);
+#else
+ready = d->monitor_ready && d->mark != 0;
 #endif
-d->mark;
-
 /* If the 'resize-guest' property is set, the application expects spice-gtk
  * to manage the size and state of the displays, so update the 'enabled'
  * state here. If 'resize-guest' is false, we can assume that the
-- 
2.7.4

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH 01/11] Rename some missing names related to RedCharDevice

2016-04-01 Thread Pavel Grunt
Acked-by: Pavel Grunt <pgr...@redhat.com>

On Fri, 2016-04-01 at 13:37 +0100, Frediano Ziglio wrote:
> ---
>  server/char-device.c | 6 +++---
>  server/char-device.h | 2 +-
>  server/reds.c| 2 +-
>  3 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/server/char-device.c b/server/char-device.c
> index 2957a1b..22f2de2 100644
> --- a/server/char-device.c
> +++ b/server/char-device.c
> @@ -92,7 +92,7 @@ static void red_char_device_ref(RedCharDevice
> *char_dev);
>  static void red_char_device_unref(RedCharDevice *char_dev);
>  static void
> red_char_device_write_buffer_unref(RedCharDeviceWriteBuffer
> *write_buf);
>  
> -static void spice_char_dev_write_retry(void *opaque);
> +static void red_char_device_write_retry(void *opaque);
>  
>  typedef struct RedCharDeviceMsgToClientItem {
>  RingItem link;
> @@ -566,7 +566,7 @@ static int
> red_char_device_write_to_device(RedCharDevice *dev)
>  return total;
>  }
>  
> -static void spice_char_dev_write_retry(void *opaque)
> +static void red_char_device_write_retry(void *opaque)
>  {
>  RedCharDevice *dev = opaque;
>  
> @@ -750,7 +750,7 @@ RedCharDevice
> *red_char_device_create(SpiceCharDeviceInstance *sin,
>  sif = spice_char_device_get_interface(char_dev->priv->sin);
>  if (sif->base.minor_version <= 2 ||
>  !(sif->flags & SPICE_CHAR_DEVICE_NOTIFY_WRITABLE)) {
> -char_dev->priv->write_to_dev_timer =
> reds_core_timer_add(reds, spice_char_dev_write_retry, char_dev);
> +char_dev->priv->write_to_dev_timer =
> reds_core_timer_add(reds, red_char_device_write_retry, char_dev);
>  if (!char_dev->priv->write_to_dev_timer) {
>  spice_error("failed creating char dev write timer");
>  }
> diff --git a/server/char-device.h b/server/char-device.h
> index f3ae6cb..b0efa1f 100644
> --- a/server/char-device.h
> +++ b/server/char-device.h
> @@ -158,7 +158,7 @@ int red_char_device_restore(RedCharDevice *dev,
>   * protocol:
>   *  The client tokens' are set only once, when the main channel is
> initialized.
>   *  Instead, it would have been more appropriate to reset them upon
> AGEN_CONNECT.
> - *  The client tokens are tracked as part of the
> SpiceCharDeviceClientState. Thus,
> + *  The client tokens are tracked as part of the
> RedCharDeviceClient. Thus,
>   *  in order to be backwartd compatible with the client, we need to
> track the tokens
>   *  event when the agent is detached. We don't destroy the
> char_device state, and
>   *  instead we just reset it.
> diff --git a/server/reds.c b/server/reds.c
> index 12de608..d913539 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -425,7 +425,7 @@ static void reds_reset_vdp(RedsState *reds)
>   * tokens management in the vdagent protocol:
>   *  The client tokens' are set only once, when the main channel
> is initialized.
>   *  Instead, it would have been more appropriate to reset them
> upon AGEN_CONNECT.
> - *  The client tokens are tracked as part of the
> SpiceCharDeviceClientState. Thus,
> + *  The client tokens are tracked as part of the
> RedCharDeviceClient. Thus,
>   *  in order to be backward compatible with the client, we need
> to track the tokens
>   *  even if the agent is detached. We don't destroy the
> char_device state, and
>   *  instead we just reset it.
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk v2] widget: Avoid combining ternary with another operators

2016-03-29 Thread Pavel Grunt
Logical operators like "&&" has higher precedency than "?:".
Readiness of SpiceDisplay was wrongly determined due to missing
parentheses around the ternary operator.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=94738
---
 src/spice-widget.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/spice-widget.c b/src/spice-widget.c
index 21b1c14..f605439 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -230,14 +230,15 @@ static gint get_display_id(SpiceDisplay *display)
 static void update_ready(SpiceDisplay *display)
 {
 SpiceDisplayPrivate *d = display->priv;
-gboolean ready;
+gboolean ready = FALSE;
 
-ready = d->monitor_ready &&
+if (d->monitor_ready) {
 #ifndef G_OS_WIN32
-d->egl.enabled ? d->egl.image != NULL :
+ready = d->egl.enabled ? d->egl.image != NULL : d->mark != 0;
+#else
+ready = d->mark != 0;
 #endif
-d->mark;
-
+}
 /* If the 'resize-guest' property is set, the application expects spice-gtk
  * to manage the size and state of the displays, so update the 'enabled'
  * state here. If 'resize-guest' is false, we can assume that the
-- 
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] widget: Use parentheses around ternary conditional

2016-03-29 Thread Pavel Grunt
On Tue, 2016-03-29 at 15:39 +0200, Victor Toso wrote:
> Hey,
> 
> Works fine! Thanks!
> 
> On Tue, Mar 29, 2016 at 03:03:03PM +0200, Pavel Grunt wrote:
> > 
> > "&&" has higher precedency than "?:"
> Maybe a small summary of the issue that his patch fixes?
> 
> > 
> > 
> > Fixes:
> > https://bugs.freedesktop.org/show_bug.cgi?id=94738
> > ---
> >  src/spice-widget.c | 7 +++
> >  1 file changed, 3 insertions(+), 4 deletions(-)
> > 
> > diff --git a/src/spice-widget.c b/src/spice-widget.c
> > index 21b1c14..67a9cc1 100644
> > --- a/src/spice-widget.c
> > +++ b/src/spice-widget.c
> > @@ -232,12 +232,11 @@ static void update_ready(SpiceDisplay
> > *display)
> >  SpiceDisplayPrivate *d = display->priv;
> >  gboolean ready;
> > 
> > -ready = d->monitor_ready &&
> >  #ifndef G_OS_WIN32
> > -d->egl.enabled ? d->egl.image != NULL :
> > +ready = d->monitor_ready && (d->egl.enabled ? d->egl.image !=
> > NULL : d->mark != 0);
> > +#else
> > +ready = d->monitor_ready && d->mark != 0;
> >  #endif
> > -d->mark;
> I would go with something like
> 
> gboolean ready = FALSE;
> ...
> if (d->monitor_ready) {
> #ifndef G_OS_WIN32
>   ready = d->egl.enabled ? d->egl.image != NULL : d->mark != 0;
> #else
>   ready = d->mark != 0;
> #endif
> }
> 
> But either way is fine (I'm not really picky with this things)
> 
> Acked-by: Victor Toso <victort...@redhat.com>

I will go for your suggestion

Pavel

> 
> > 
> > -
> >  /* If the 'resize-guest' property is set, the application
> > expects spice-gtk
> >   * to manage the size and state of the displays, so update the
> > 'enabled'
> >   * state here. If 'resize-guest' is false, we can assume that
> > the
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk 2/6] doc: Remove private structs

2016-03-30 Thread Pavel Grunt
---
 doc/reference/spice-gtk-sections.txt | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/doc/reference/spice-gtk-sections.txt 
b/doc/reference/spice-gtk-sections.txt
index 0c05168..a6fcfbf 100644
--- a/doc/reference/spice-gtk-sections.txt
+++ b/doc/reference/spice-gtk-sections.txt
@@ -337,8 +337,6 @@ SpiceUsbDeviceManagerPrivate
 
 spice-gtk-session
 SpiceGtkSession
-SpiceGtkSession
-SpiceGtkSessionClass
 spice_gtk_session_get
 spice_gtk_session_copy_to_guest
 spice_gtk_session_paste_from_guest
@@ -357,8 +355,6 @@ SpiceGtkSessionPrivate
 
 spice-widget
 SpiceDisplay
-SpiceDisplay
-SpiceDisplayClass
 SpiceDisplayKeyEvent
 spice_display_new
 spice_display_new_with_monitor
@@ -368,7 +364,6 @@ spice_display_get_grab_keys
 spice_display_send_keys
 spice_display_get_pixbuf
 
-SpiceGrabSequence
 spice_grab_sequence_new
 spice_grab_sequence_new_from_string
 spice_grab_sequence_copy
@@ -393,8 +388,6 @@ SpiceDisplayPrivate
 
 usb-device-widget
 SpiceUsbDeviceWidget
-SpiceUsbDeviceWidget
-SpiceUsbDeviceWidgetClass
 
 spice_usb_device_widget_new
 
-- 
2.7.4

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk 4/6] spice-file-transfer-task: Fix docstring

2016-03-30 Thread Pavel Grunt
---
 src/spice-file-transfer-task.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/spice-file-transfer-task.h b/src/spice-file-transfer-task.h
index b97d107..18dc509 100644
--- a/src/spice-file-transfer-task.h
+++ b/src/spice-file-transfer-task.h
@@ -37,7 +37,7 @@ typedef struct _SpiceFileTransferTaskPrivate 
SpiceFileTransferTaskPrivate;
 /**
  * SpiceFileTransferTask:
  *
- * The #FileTransferTask struct is opaque and should not be accessed directly.
+ * The #SpiceFileTransferTask struct is opaque and should not be accessed 
directly.
  */
 struct _SpiceFileTransferTask
 {
-- 
2.7.4

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk 5/6] doc: Ignore spicy-connect

2016-03-30 Thread Pavel Grunt
---
 doc/reference/Makefile.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
index cb01f97..5aa8557 100644
--- a/doc/reference/Makefile.am
+++ b/doc/reference/Makefile.am
@@ -46,6 +46,7 @@ IGNORE_HFILES=\
spice-uri-priv.h\
spice-util-priv.h   \
spice-widget-priv.h \
+   spicy-connect.h \
usb-acl-helper.h\
usb-device-manager-priv.h   \
usbutil.h   \
-- 
2.7.4

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk 1/6] usb-device-manager: Fix docstring

2016-03-30 Thread Pavel Grunt
Add description, "Since" and change the parameter name in the docstring
to match parameter name in the function definition.
---
 doc/reference/spice-gtk-sections.txt |  1 +
 src/usb-device-manager.c | 14 +-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/doc/reference/spice-gtk-sections.txt 
b/doc/reference/spice-gtk-sections.txt
index 8947893..0c05168 100644
--- a/doc/reference/spice-gtk-sections.txt
+++ b/doc/reference/spice-gtk-sections.txt
@@ -311,6 +311,7 @@ spice_usb_device_manager_get
 spice_usb_device_manager_get_devices
 spice_usb_device_manager_get_devices_with_filter
 spice_usb_device_manager_is_device_connected
+spice_usb_device_manager_is_redirecting
 spice_usb_device_manager_disconnect_device
 spice_usb_device_manager_can_redirect_device
 spice_usb_device_manager_connect_device_async
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index c36a9a8..da7e596 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -232,11 +232,15 @@ G_DEFINE_BOXED_TYPE(SpiceUsbDevice, spice_usb_device, 
g_object_ref, g_object_unr
 #endif
 
 /**
-* spice_usb_device_manager_is_redirecting:
-* @manager: the #SpiceUsbDeviceManager manager
-*
-* Returns: %TRUE if device redirection negotiation flow is in progress
-*/
+ * spice_usb_device_manager_is_redirecting:
+ * @self: the #SpiceUsbDeviceManager manager
+ *
+ * Checks whether a device is being redirected
+ *
+ * Returns: %TRUE if device redirection negotiation flow is in progress
+ *
+ * Since: 0.32
+ */
 gboolean spice_usb_device_manager_is_redirecting(SpiceUsbDeviceManager *self)
 {
 #ifdef USE_USBREDIR
-- 
2.7.4

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk 6/6] doc: Add description for spice_display_get_gl_scanout()

2016-03-30 Thread Pavel Grunt
---
 src/channel-display.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/channel-display.c b/src/channel-display.c
index 90d155e..431c2e7 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -532,6 +532,8 @@ void 
spice_display_change_preferred_compression(SpiceChannel *channel, gint comp
  * spice_display_get_gl_scanout:
  * @channel: a #SpiceDisplayChannel
  *
+ * Retrieves the GL scanout if available
+ *
  * Returns: the current GL scanout, or %NULL if none or not valid
  *
  * Since: 0.31
-- 
2.7.4

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk 3/6] doc: channel stability should be Stable

2016-03-30 Thread Pavel Grunt
---
 src/channel-smartcard.c | 2 +-
 src/channel-usbredir.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/channel-smartcard.c b/src/channel-smartcard.c
index 7f3306e..21df98a 100644
--- a/src/channel-smartcard.c
+++ b/src/channel-smartcard.c
@@ -35,7 +35,7 @@
  * @title: Smartcard Channel
  * @section_id:
  * @see_also: #SpiceSmartcardManager, #SpiceSession
- * @stability: API Stable (channel in development)
+ * @stability: Stable
  * @include: spice-client.h
  *
  * The Spice protocol defines a set of messages to forward smartcard
diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index a251855..9066b4a 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -42,7 +42,7 @@
  * @short_description: usb redirection
  * @title: USB Redirection Channel
  * @section_id:
- * @stability: API Stable (channel in development)
+ * @stability: Stable
  * @include: spice-client.h
  *
  * The Spice protocol defines a set of messages to redirect USB devices
-- 
2.7.4

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk 0/6] Fixes for autogenerated documentation

2016-03-30 Thread Pavel Grunt
Hi,

Following patches adjust autogenerated docs (can be found at [0]) to recent
changes (some classes are final now, there are new functions).
They also silence some warnings when the docs are generated.

Pavel

[0] http://www.spice-space.org/spice-gtk.html

Pavel Grunt (6):
  usb-device-manager: Fix docstring
  doc: Remove private structs
  doc: channel stability should be Stable
  spice-file-transfer-task: Fix docstring
  doc: Ignore spicy-connect
  doc: Add description for spice_display_get_gl_scanout()

 doc/reference/Makefile.am|  1 +
 doc/reference/spice-gtk-sections.txt |  8 +---
 src/channel-display.c|  2 ++
 src/channel-smartcard.c  |  2 +-
 src/channel-usbredir.c   |  2 +-
 src/spice-file-transfer-task.h   |  2 +-
 src/usb-device-manager.c | 14 +-
 7 files changed, 16 insertions(+), 15 deletions(-)

-- 
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 1/2] widget: offset draw updates by widget allocation if necessary

2016-03-23 Thread Pavel Grunt
Hi Marc-André,

On Tue, 2016-03-22 at 19:27 +0100, Marc-André Lureau wrote:
> According to gtk_widget_queue_draw_area() documentation:
> 
> "The region here is specified in widget coordinates. Widget
> coordinates
> are a bit odd; for historical reasons, they are defined as
> widget->window coordinates for widgets that return TRUE for
> gtk_widget_get_has_window(), and are relative to widget->allocation.x 
> ,
> widget->allocation.y otherwise."
> 
> Since spice-gtk 57df040cc, the SpiceDisplay no longer forces its own
> window. During gtk+ 3.19.8, gtk stack also no longer use its own
> window (commit 9d0e8401). In order to make drawing update resilient
> to
> such changes, add a function applying offset if necessary.
> 
> This solves drawing glitches with spice-gtk git and gtk+ >= 3.19.8.
> 
This also fixes slowness of spicy for me

> Signed-off-by: Marc-André Lureau <marcandre.lur...@gmail.com>
> ---
>  src/spice-widget.c | 30 ++
>  1 file changed, 22 insertions(+), 8 deletions(-)
> 
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index 4b7e202..e45513e 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -2267,6 +2267,21 @@ static void primary_destroy(SpiceChannel
> *channel, gpointer data)
>  set_monitor_ready(display, false);
>  }
>  
> +static void queue_draw_area(SpiceDisplay *display, gint x, gint y,
> +gint width, gint height)
> +{
> +if (!gtk_widget_get_has_window(GTK_WIDGET(display))) {
> +GtkAllocation allocation;
> +
> +gtk_widget_get_allocation(GTK_WIDGET(display), );
> +x += allocation.x;
> +y += allocation.y;
> +}
> +
> +gtk_widget_queue_draw_area(GTK_WIDGET(display),
> +   x, y, width, height);
> +}
> +
>  static void invalidate(SpiceChannel *channel,
> gint x, gint y, gint w, gint h, gpointer
> data)
>  {
> @@ -2304,9 +2319,8 @@ static void invalidate(SpiceChannel *channel,
>  x2 = ceil ((rect.x - d->area.x + rect.width) * s);
>  y2 = ceil ((rect.y - d->area.y + rect.height) * s);
>  
> -gtk_widget_queue_draw_area(GTK_WIDGET(display),
> -   display_x + x1, display_y + y1,
> -   x2 - x1, y2-y1);
> +queue_draw_area(display, display_x + x1, display_y + y1,
> +x2 - x1, y2 - y1);

I would move 'display_x + x1, display_y + y1,' to separate line to keep
the same style.

>  }
>  
>  static void mark(SpiceDisplay *display, gint mark)
> @@ -2457,11 +2471,11 @@ static void cursor_invalidate(SpiceDisplay
> *display)
>  
>  spice_display_get_scaling(display, , , , NULL, NULL);
>  
> -gtk_widget_queue_draw_area(GTK_WIDGET(display),
> -   floor ((d->mouse_guest_x - d-
> >mouse_hotspot.x - d->area.x) * s) + x,
> -   floor ((d->mouse_guest_y - d-
> >mouse_hotspot.y - d->area.y) * s) + y,
> -   ceil (gdk_pixbuf_get_width(d-
> >mouse_pixbuf) * s),
> -   ceil (gdk_pixbuf_get_height(d-
> >mouse_pixbuf) * s));
> +queue_draw_area(display,
> +floor ((d->mouse_guest_x - d->mouse_hotspot.x -
> d->area.x) * s) + x,
> +floor ((d->mouse_guest_y - d->mouse_hotspot.y -
> d->area.y) * s) + y,
> +ceil (gdk_pixbuf_get_width(d->mouse_pixbuf) *
> s),
> +ceil (gdk_pixbuf_get_height(d->mouse_pixbuf) *
> s));
>  }
>  
>  static void cursor_move(SpiceCursorChannel *channel, gint x, gint y,
> gpointer data)

Acked-by: Pavel Grunt <pgr...@redhat.com>

and thanks for fixing it!

Pavel


___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk 2/2] widget: use allocation instead of window size

2016-03-23 Thread Pavel Grunt
Hi,

This fixes the "top border" in spicy.

considering how the allocation is used I would prefer some helper
function to get the width and height. 

Thanks,
Pavel

On Tue, 2016-03-22 at 19:27 +0100, Marc-André Lureau wrote:
> Since spice-gtk 57df040cc, the SpiceDisplay no longer forces its own
> window. Get allocation instead of window size.
> 
> Signed-off-by: Marc-André Lureau 
> ---
>  src/Makefile.am  |  1 -
>  src/gtk-compat.h | 31 ---
>  src/spice-gtk-session.c  |  1 -
>  src/spice-widget-cairo.c |  6 --
>  src/spice-widget-egl.c   |  1 -
>  src/spice-widget.c   | 11 ++-
>  src/vncdisplaykeymap.c   |  1 -
>  7 files changed, 10 insertions(+), 42 deletions(-)
>  delete mode 100644 src/gtk-compat.h
> 
> diff --git a/src/Makefile.am b/src/Makefile.am
> index 66ba58b..330c85d 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -122,7 +122,6 @@ SPICE_GTK_LIBADD_COMMON = \
>   $(NULL)
>  
>  SPICE_GTK_SOURCES_COMMON =   \
> - gtk-compat.h\
>   spice-util.c\
>   spice-util-priv.h   \
>   spice-gtk-session.c \
> diff --git a/src/gtk-compat.h b/src/gtk-compat.h
> deleted file mode 100644
> index 39438f9..000
> --- a/src/gtk-compat.h
> +++ /dev/null
> @@ -1,31 +0,0 @@
> -/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
> -/*
> -   Copyright (C) 2012-2014 Red Hat, Inc.
> -
> -   This library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 of the License, or (at your option) any later
> version.
> -
> -   This library is distributed in the hope that it will be useful,
> -   but WITHOUT ANY WARRANTY; without even the implied warranty of
> -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with this library; if not, see  licenses/>.
> -*/
> -#ifndef GTK_COMPAT_H
> -#define GTK_COMPAT_H
> -
> -#include "config.h"
> -
> -#include 
> -
> -static inline void gdk_drawable_get_size(GdkWindow *w, gint *ww,
> gint *wh)
> -{
> -*ww = gdk_window_get_width(w);
> -*wh = gdk_window_get_height(w);
> -}
> -
> -#endif /* GTK_COMPAT_H */
> diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> index 4201ee0..380b0bb 100644
> --- a/src/spice-gtk-session.c
> +++ b/src/spice-gtk-session.c
> @@ -38,7 +38,6 @@
>  #include 
>  #include 
>  #include "desktop-integration.h"
> -#include "gtk-compat.h"
>  #include "spice-common.h"
>  #include "spice-gtk-session.h"
>  #include "spice-gtk-session-priv.h"
> diff --git a/src/spice-widget-cairo.c b/src/spice-widget-cairo.c
> index c92d4ec..6a8afda 100644
> --- a/src/spice-widget-cairo.c
> +++ b/src/spice-widget-cairo.c
> @@ -17,7 +17,6 @@
>  */
>  #include "config.h"
>  
> -#include "gtk-compat.h"
>  #include "spice-widget.h"
>  #include "spice-widget-priv.h"
>  #include "spice-gtk-session-priv.h"
> @@ -78,7 +77,10 @@ void spicex_draw_event(SpiceDisplay *display,
> cairo_t *cr)
>  
>  spice_display_get_scaling(display, , , , , );
>  
> -gdk_drawable_get_size(gtk_widget_get_window(GTK_WIDGET(display))
> , , );
> +GtkAllocation allocation;
> +gtk_widget_get_allocation(GTK_WIDGET(display), );
> +ww = allocation.width;
> +wh = allocation.height;
>  
>  /* We need to paint the bg color around the image */
>  rect.x = 0;
> diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
> index 5fcdcaa..7a9ba73 100644
> --- a/src/spice-widget-egl.c
> +++ b/src/spice-widget-egl.c
> @@ -22,7 +22,6 @@
>  #define EGL_EGLEXT_PROTOTYPES
>  #define GL_GLEXT_PROTOTYPES
>  
> -#include "gtk-compat.h"
>  #include "spice-widget.h"
>  #include "spice-widget-priv.h"
>  #include "spice-gtk-session-priv.h"
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index e45513e..b409063 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -42,8 +42,6 @@
>  #include "vncdisplaykeymap.h"
>  #include "spice-grabsequence-priv.h"
>  
> -#include "gtk-compat.h"
> -
>  /* Some compatibility defines to let us build on both Gtk2 and Gtk3
> */
>  
>  /**
> @@ -2410,9 +2408,12 @@ void spice_display_get_scaling(SpiceDisplay
> *display,
>  int x, y, w, h;
>  double s;
>  
> -if (gtk_widget_get_realized (GTK_WIDGET(display)))
> -gdk_drawable_get_size(gtk_widget_get_window(GTK_WIDGET(displ
> ay)), , );
> -else {
> +if (gtk_widget_get_realized (GTK_WIDGET(display))) {
> +GtkAllocation allocation;
> +gtk_widget_get_allocation(GTK_WIDGET(display), );
> +ww = allocation.width;
> +wh = allocation.height;
> +} else {
>  ww = fbw;
>  wh = fbh;
>  }
> 

Re: [Spice-devel] [spice-common] tests: Fix glib version check

2016-03-31 Thread Pavel Grunt
Ack,
Pavel

On Thu, 2016-03-31 at 13:35 +0200, Christophe Fergeau wrote:
> The glib version checks were using #ifdef GLIB_CHECK_VERSION() rather
> than  #if GLIB_CHECK_VERSION()
> ---
>  tests/test-logging.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/test-logging.c b/tests/test-logging.c
> index c02905f..cb929f9 100644
> --- a/tests/test-logging.c
> +++ b/tests/test-logging.c
> @@ -43,7 +43,7 @@ LOG_OTHER_HELPER(message, MESSAGE)
>  LOG_OTHER_HELPER(warning, WARNING)
>  LOG_OTHER_HELPER(critical, CRITICAL)
>  
> -#ifdef GLIB_CHECK_VERSION(2,38,0)
> +#if GLIB_CHECK_VERSION(2,38,0)
>  /* Checks that spice_warning() aborts after changing
> SPICE_ABORT_LEVEL */
>  static void test_spice_abort_level(void)
>  {
> @@ -401,7 +401,7 @@ int main(int argc, char **argv)
>   * test cases are going to test */
>  g_log_set_always_fatal(fatal_mask & G_LOG_LEVEL_MASK);
>  
> -#ifdef GLIB_CHECK_VERSION(2,38,0)
> +#if GLIB_CHECK_VERSION(2,38,0)
>  g_test_add_func("/spice-common/spice-abort-level",
> test_spice_abort_level);
>  g_test_add_func("/spice-common/spice-abort-level-gwarning",
> test_spice_abort_level_g_warning);
>  g_test_add_func("/spice-common/spice-debug-level",
> test_spice_debug_level);
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH 01/14] Store display in Drawable struct

2016-04-22 Thread Pavel Grunt
Hi Jonathon,

On Thu, 2016-04-21 at 16:43 -0500, Jonathon Jongsma wrote:
> If the Drawable keeps a pointer to the Display channel that it is
> associated with, we can unref it directly and not need to pass the
> 'display' parameter separately to the unref function

So drawable needs 'display' just for unref'ing surface(s) - detach_stream()
doesn't need DisplayChannel, the same applies for
drawable_remove_dependencies(). Looking at the DisplayChannel struct it still
has an array of Drawables and free_drawables. (It is not clear to me - I need to
read previous reviews)

> ---
> NEW PATCH. This prepares for the UpgradeItem change as discussed on the
> previous review.
> 
>  server/dcc.c | 14 +-
>  server/display-channel.c | 17 +++--
>  server/display-channel.h |  4 +++-
>  3 files changed, 19 insertions(+), 16 deletions(-)
> 
> diff --git a/server/dcc.c b/server/dcc.c
> index 91c3f82..4f3f227 100644
> --- a/server/dcc.c
> +++ b/server/dcc.c
> @@ -277,13 +277,11 @@ static void
> add_drawable_surface_images(DisplayChannelClient *dcc, Drawable *dra
>  void drawable_pipe_item_free(PipeItem *item)
>  {
>  DrawablePipeItem *dpi = SPICE_CONTAINEROF(item, DrawablePipeItem,
> dpi_pipe_item);
> -DisplayChannel *display = DCC_TO_DC(dpi->dcc);
> -
>  spice_assert(item->refcount == 0);
>  
>  spice_warn_if_fail(!ring_item_is_linked(>link));
>  spice_warn_if_fail(!ring_item_is_linked(>base));
> -display_channel_drawable_unref(display, dpi->drawable);
> +drawable_unref(dpi->drawable);
>  free(dpi);
>  }
>  
> @@ -1591,20 +1589,18 @@ int dcc_handle_migrate_data(DisplayChannelClient *dcc,
> uint32_t size, void *mess
>  return TRUE;
>  }
>  
> -static void upgrade_item_unref(DisplayChannel *display, UpgradeItem *item)
> +static void upgrade_item_unref(UpgradeItem *item)
>  {
>  if (--item->refs != 0)
>  return;
>  
> -display_channel_drawable_unref(display, item->drawable);
> +drawable_unref(item->drawable);
>  free(item->rects);
>  free(item);
>  }
>  
>  static void release_item_after_push(DisplayChannelClient *dcc, PipeItem
> *item)
dcc is unused in the function, it should be removed

The patch makes a sense to me, in my opinion more cleanups should be done.

Pavel

>  {
> -DisplayChannel *display = DCC_TO_DC(dcc);
> -
>  switch (item->type) {
>  case PIPE_ITEM_TYPE_DRAW:
>  case PIPE_ITEM_TYPE_IMAGE:
> @@ -1613,7 +1609,7 @@ static void release_item_after_push(DisplayChannelClient
> *dcc, PipeItem *item)
>  pipe_item_unref(item);
>  break;
>  case PIPE_ITEM_TYPE_UPGRADE:
> -upgrade_item_unref(display, (UpgradeItem *)item);
> +upgrade_item_unref((UpgradeItem *)item);
>  break;
>  case PIPE_ITEM_TYPE_GL_SCANOUT:
>  case PIPE_ITEM_TYPE_GL_DRAW:
> @@ -1651,7 +1647,7 @@ static void
> release_item_before_push(DisplayChannelClient *dcc, PipeItem *item)
>  }
>  case PIPE_ITEM_TYPE_STREAM_CLIP:
>  case PIPE_ITEM_TYPE_UPGRADE:
> -upgrade_item_unref(display, (UpgradeItem *)item);
> +upgrade_item_unref((UpgradeItem *)item);
>  break;
>  case PIPE_ITEM_TYPE_IMAGE:
>  case PIPE_ITEM_TYPE_MONITORS_CONFIG:
> diff --git a/server/display-channel.c b/server/display-channel.c
> index 88dbc74..f2bdc1d 100644
> --- a/server/display-channel.c
> +++ b/server/display-channel.c
> @@ -397,7 +397,7 @@ static void current_remove_drawable(DisplayChannel
> *display, Drawable *item)
>  ring_remove(>tree_item.base.siblings_link);
>  ring_remove(>list_link);
>  ring_remove(>surface_list_link);
> -display_channel_drawable_unref(display, item);
> +drawable_unref(item);
>  display->current_size--;
>  }
>  
> @@ -495,7 +495,7 @@ static int current_add_equal(DisplayChannel *display,
> DrawItem *item, TreeItem *
>  pipes_add_drawable(display, drawable);
>  }
>  drawable_remove_from_pipes(other_drawable);
> -display_channel_drawable_unref(display, other_drawable);
> +drawable_unref(other_drawable);
>  return TRUE;
>  }
>  
> @@ -538,7 +538,7 @@ static int current_add_equal(DisplayChannel *display,
> DrawItem *item, TreeItem *
>  /* not sending other_drawable where possible */
>  drawable_remove_from_pipes(other_drawable);
>  
> -display_channel_drawable_unref(display, other_drawable);
> +drawable_unref(other_drawable);
>  return TRUE;
>  }
>  break;
> @@ -1192,7 +1192,7 @@ void display_channel_process_draw(DisplayChannel
> *display, RedDrawable *red_draw
>  
>  display_channel_add_drawable(display, drawable);
>  
> -display_channel_drawable_unref(display, drawable);
> +drawable_unref(drawable);
>  }
>  
>  int display_channel_wait_for_migrate_data(DisplayChannel *display)
> @@ -1380,6 +1380,10 @@ Drawable
> *display_channel_drawable_try_new(DisplayChannel *display,
>  }
>  
>  

Re: [Spice-devel] [spice-gtk] Spice-widget: Allow smaller widget with scaling enabled

2016-04-22 Thread Pavel Grunt
On Fri, 2016-04-22 at 09:57 +0200, Javier Celaya wrote:
> Hi
> 
> El 22/04/16 a las 09:19, Pavel Grunt escribió:
> > Hi Javier,
> > 
> > sorry, I must have missed the patch. Can you please explain the problem? How
> > to
> > reproduce it? Is it about spicy?
>  Sorry, the commit message may be a bit short. I'll send a second version with
> a longer explanation, along with the the declaration of update_size_request().
> I found the problem with spicy, but I suppose it affects other clients too.
> You can reproduce it checking the "scale display" option and unchecking the
> "resize guest to match window size" option. Then, the spice widget takes a
> minimum size of the current guest resolution. The window can be made bigger,
> but never smaller.

I see, so steps to reproduce are:
1) connect with spicy to a guest
2) resize the guest to be bigger than minimal spicy resolution 640x480
3) uncheck "resize guest", check "scale display"
4) Try to scale down

Thanks,
Pavel

> > About the patch - you should declare the update_size_request() function
> > instead
> > of moving scaling_updated() down - it would be more clear what has changed.
> > 
> > Thanks,
> > Pavel 
> > 
> > On Fri, 2016-04-22 at 08:06 +0200, Javier Celaya wrote:
> > > Can someone review this patch, please?
> > > Thank you
> > > 
> > > El 13/04/16 a las 13:42, Javier Celaya escribió:
> > > > With scaling enabled, the size request of the widget must be 640x480
> > > > (the same as with resize_guest_enable) so that the widget can be
> > > > actually scalled down.
> > > > ---
> > > >  src/spice-widget.c | 25 +
> > > >  1 file changed, 13 insertions(+), 12 deletions(-)
> > > > 
> > > > diff --git a/src/spice-widget.c b/src/spice-widget.c
> > > > index 6f638fb..f445f3f 100644
> > > > --- a/src/spice-widget.c
> > > > +++ b/src/spice-widget.c
> > > > @@ -169,23 +169,12 @@ static void
> > > > spice_display_get_property(GObject*object,
> > > >  }
> > > >  }
> > > >  
> > > > -static void scaling_updated(SpiceDisplay *display)
> > > > -{
> > > > -SpiceDisplayPrivate *d = display->priv;
> > > > -GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(display));
> > > > -
> > > > -recalc_geometry(GTK_WIDGET(display));
> > > > -if (d->ximage && window) { /* if not yet shown */
> > > > -gtk_widget_queue_draw(GTK_WIDGET(display));
> > > > -}
> > > > -}
> > > > -
> > > >  static void update_size_request(SpiceDisplay *display)
> > > >  {
> > > >  SpiceDisplayPrivate *d = display->priv;
> > > >  gint reqwidth, reqheight;
> > > >  
> > > > -if (d->resize_guest_enable) {
> > > > +if (d->resize_guest_enable || d->allow_scaling) {
> > > >  reqwidth = 640;
> > > >  reqheight = 480;
> > > >  } else {
> > > > @@ -197,6 +186,18 @@ static void update_size_request(SpiceDisplay
> > > > *display)
> > > >  recalc_geometry(GTK_WIDGET(display));
> > > >  }
> > > >  
> > > > +static void scaling_updated(SpiceDisplay *display)
> > > > +{
> > > > +SpiceDisplayPrivate *d = display->priv;
> > > > +GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(display));
> > > > +
> > > > +recalc_geometry(GTK_WIDGET(display));
> > > > +if (d->ximage && window) { /* if not yet shown */
> > > > +gtk_widget_queue_draw(GTK_WIDGET(display));
> > > > +}
> > > > +update_size_request(display);
> > > > +}
> > > > +
> > > >  static void update_keyboard_focus(SpiceDisplay *display, gboolean
> > > > state)
> > > >  {
> > > >  SpiceDisplayPrivate *d = display->priv;
> > >  
> > > -- 
> > > 
> > > 
> > >   Javier Celaya Software Engineer  javier.cel...@flexvdi.com  
> > > 
> > >   +34 876 60 00 73 @j_celaya 
> > > ___
> > > Spice-devel mailing list
> > > Spice-devel@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/spice-devel
>  
> -- 
> 
> 
>   Javier Celaya Software Engineer  javier.cel...@flexvdi.com  
>   +34 876 60 00 73 @j_celaya 
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [spice-gtk] Spice-widget: Allow smaller widget with scaling enabled

2016-04-22 Thread Pavel Grunt
Hi Javier,

sorry, I must have missed the patch. Can you please explain the problem? How to
reproduce it? Is it about spicy?

About the patch - you should declare the update_size_request() function instead
of moving scaling_updated() down - it would be more clear what has changed.

Thanks,
Pavel 

On Fri, 2016-04-22 at 08:06 +0200, Javier Celaya wrote:
> Can someone review this patch, please?
> Thank you
> 
> El 13/04/16 a las 13:42, Javier Celaya escribió:
> > With scaling enabled, the size request of the widget must be 640x480
> > (the same as with resize_guest_enable) so that the widget can be
> > actually scalled down.
> > ---
> >  src/spice-widget.c | 25 +
> >  1 file changed, 13 insertions(+), 12 deletions(-)
> > 
> > diff --git a/src/spice-widget.c b/src/spice-widget.c
> > index 6f638fb..f445f3f 100644
> > --- a/src/spice-widget.c
> > +++ b/src/spice-widget.c
> > @@ -169,23 +169,12 @@ static void
> > spice_display_get_property(GObject*object,
> >  }
> >  }
> >  
> > -static void scaling_updated(SpiceDisplay *display)
> > -{
> > -SpiceDisplayPrivate *d = display->priv;
> > -GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(display));
> > -
> > -recalc_geometry(GTK_WIDGET(display));
> > -if (d->ximage && window) { /* if not yet shown */
> > -gtk_widget_queue_draw(GTK_WIDGET(display));
> > -}
> > -}
> > -
> >  static void update_size_request(SpiceDisplay *display)
> >  {
> >  SpiceDisplayPrivate *d = display->priv;
> >  gint reqwidth, reqheight;
> >  
> > -if (d->resize_guest_enable) {
> > +if (d->resize_guest_enable || d->allow_scaling) {
> >  reqwidth = 640;
> >  reqheight = 480;
> >  } else {
> > @@ -197,6 +186,18 @@ static void update_size_request(SpiceDisplay *display)
> >  recalc_geometry(GTK_WIDGET(display));
> >  }
> >  
> > +static void scaling_updated(SpiceDisplay *display)
> > +{
> > +SpiceDisplayPrivate *d = display->priv;
> > +GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(display));
> > +
> > +recalc_geometry(GTK_WIDGET(display));
> > +if (d->ximage && window) { /* if not yet shown */
> > +gtk_widget_queue_draw(GTK_WIDGET(display));
> > +}
> > +update_size_request(display);
> > +}
> > +
> >  static void update_keyboard_focus(SpiceDisplay *display, gboolean state)
> >  {
> >  SpiceDisplayPrivate *d = display->priv;
>  
> -- 
> 
> 
>   Javier Celaya Software Engineer  javier.cel...@flexvdi.com  
>   +34 876 60 00 73 @j_celaya 
> ___
> 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


Re: [Spice-devel] How to look information of the debugging of spice-server?

2016-04-22 Thread Pavel Grunt
Hello,

On Fri, 2016-04-22 at 15:43 +0800, #嚣张的狼# wrote:
>        Thank you for taking time out of your busy schedule to see this
> letter.I am student who has been studying Spice and have some questions about
> using Spice-server.
> 
>         Recently, I am studying some pathes released in "https://patchwork.fre
> edesktop.org" , But I don't know  where I can find information of
> "spice_debug". I have set SPICE_DEBUG_LEVEL=5, but there have no changes in 
> /var/log/libvirt/qemu/XX.log.
> 
Where did you set the variable ? If you use libvirt you need to edit the domain
(virsh edit domain) and do some changes.
Please see http://www.spice-space.org/page/SpiceLogging for more info about it.

Regards,
Pavel


>        Could you give me some help?
> ___
> 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


Re: [Spice-devel] [spice-gtk v2] Spice-widget: Allow smaller widget with scaling enabled

2016-04-22 Thread Pavel Grunt
Hi Javier,

Acked-by: Pavel Grunt <pgr...@redhat.com>

On Fri, 2016-04-22 at 10:08 +0200, Javier Celaya wrote:
> When resize-guest-to-match-window-size is disabled, the size request
> (minimum size) of the spice widget is set to the current guest
> resolution. The client window cannot be made smaller, even with
> scale-display enabled.
> 
> This patch sets a size request of 640x480 when either
> resize-guest-to-match-window-size OR scale-display are enabled, making
> it posible to shrink the window and scale down the display.
> ---
>  src/spice-widget.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/spice-widget.c b/src/spice-widget.c
> index 6f638fb..a7f31c4 100644
> --- a/src/spice-widget.c
> +++ b/src/spice-widget.c
> @@ -169,6 +169,8 @@ static void spice_display_get_property(GObject*object,
>  }
>  }
>  
> +static void update_size_request(SpiceDisplay *display);
> +
I will move the declaration up so it is groupped with other declaration and push
the patch.

Thanks,
Pavel


>  static void scaling_updated(SpiceDisplay *display)
>  {
>  SpiceDisplayPrivate *d = display->priv;
> @@ -178,6 +180,7 @@ static void scaling_updated(SpiceDisplay *display)
>  if (d->ximage && window) { /* if not yet shown */
>  gtk_widget_queue_draw(GTK_WIDGET(display));
>  }
> +update_size_request(display);
>  }
>  
>  static void update_size_request(SpiceDisplay *display)
> @@ -185,7 +188,7 @@ static void update_size_request(SpiceDisplay *display)
>  SpiceDisplayPrivate *d = display->priv;
>  gint reqwidth, reqheight;
>  
> -if (d->resize_guest_enable) {
> +if (d->resize_guest_enable || d->allow_scaling) {
>  reqwidth = 640;
>  reqheight = 480;
>  } else {
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice 4/4] manual: Remove spicec screenshot

2016-04-22 Thread Pavel Grunt
---
 docs/manual/images/spicec01.png | Bin 10244 -> 0 bytes
 docs/manual/manual.txt  |   4 
 2 files changed, 4 deletions(-)
 delete mode 100644 docs/manual/images/spicec01.png

diff --git a/docs/manual/images/spicec01.png b/docs/manual/images/spicec01.png
deleted file mode 100644
index 
e2cf8c5dd86e18516e36b343fdefde3bd0c709eb..
GIT binary patch
literal 0
HcmV?d1

literal 10244
zcmcI~WmFq&*KR5lEyW5gMG8e4NO6ioi@SS)prN?Cq)?m|DH^mCD;6lhwYWpEASqs;
zSaFBs3(xbs@A=L-?>g)JI44)!ji_C0HI)L%H1cRCIA2c_Z8%
zaoC?Q-firWTEhf#?Bn+H{Z|Ag$dXr_|EbMZU6uw)|HU_
z79cI-5%wUiyMl@gF6s^;Av2-gnKAaYi;k@ojIRGn#lmpy@h6-NtF9YiydFC
zRh81)*OHR@~t^ynU*=z1|s*W@Tf4L3ZIyPFh
zi-w*TCw}TClly7pg^HqrvoRk0lVQ)mFuA9jJ~-E
z1?W+N^L^g%lKw(t15JLti4g+_AKFOi<)b3L_+P>Zvy~X3q4>R+?u`8c)r*9^?0S-A
z?OIj;!91tUjEnt`mnfg^4i+mdG)HEy39Z+3p1rL%G>cD>gwv6
zo0|(KrWJngrGY1$pSbRWE)TIXK(CHsEFt53`HAqY7<3smaH(U7Twu#53z-%H8W8@5
zbBoJ}=_A^MdN{kL=A}?Wsv=85))t3Ro%39SNA286=y(-1ZEDRdcnSo~+En%4+pl
ztZ1d%`tW)-be`*j9lRdW6GPkRx#PQ$pF+uD0#XCVvlOsf;ZOKt4};2k9qM!kcJOh
zwTM|$XjIup4((A{VB==rjrMw~k#q^Dje(7Uf-y_+6_Ey
ztgfz(l|Y{nayB_%?$m55PsxXnyv_Jz29cYIk;XPxN`q^P}h1h@jXttM>X8W
z2@|E6wSf3OFA7b=)9mLA*ib6cwmn=M!X_<1l-t;N*{}saR64@SHC$eQad}zZd@{Qm
zuT1F%b0_}}e{7y7YvMs(
z;@A0+TA-PfRL8>A(1J3I$7-P^09E7Ac(xpU9hsxqkHOJY1m^!~+->26o)2VSOcWB+
z2s$4Q3HW85KEUifSUBqzp!45r!=>|HOkcQKD^N*CUt`%_YB{ew{A5v_VzpcRtc5%&3M>iF#7e)}Fw38fE@C7Y
z?XmNNO8Y1C*260(d3BF5uxm(jIEgAQe+r6zdmc;z1fe@pSDo^C-J1CX4{5XpX
zV)^;eVR_pn9<^IIdC!^J=9ym5bcjMJBr+m0GF6|1`x0}2ar)i9*hAiP?Y4KYNGto&
zqqs5FNAQcr*4o>NuvC4bITSs|Ri&?BdTJ_6R$?XxmzF;&-086|6WwKAci?7wZqEmw
zhaJrIn*CJ{=^@-?`kj$|Abc@*gh~EjasNe^vojGf-POWUt}&5S
z`cq1&2fv#j4|Z1d=y&|>;Orte3!sgtsbcJ}hJ3OfQKzj5x=*~Oq1zuH|5(ue?X
zsg+e-I;3tbu6OK(7ou-TxOVmOvl2ZLKL`}!s8`xV;!s1b+T+sS;4k1ud@P&|cDqByHShFy6
zN~1RY75O$Lx=+0U-!#1TCP!Nou5|moSfHk16TfcF*5m#TJIr9MUVang42SOC~WV
z1km(cAI;T{9C<2PsVPG683yq)X`$p{s?yH%5bh}A0ga`%U=Huv0=>JYm
zp{SD`B#&<@In44D9bS{F8Os>)J7+4~j?>oRwv%yi$@}W-R9@Z4Z2hzxFuXNL26JBv
zf?oEh{k+t>oG@~bzIr_UIE81;`;u_0+tS+?3?xE?d)+ctFk
z1c2dzi>T(7N~Ngc0;-pw%dK+%otTm}v3bUy2m?_rv@nPvLf+=j#>k`KNO_xl(X#F_
zMH>iYD6M*}X{WgD)!lc86n4h?yh`#NBv*?U0ohoV{7%ISn|USb=g$b`y42&72B*Uk
z83x!sQYl5*$|%}N6eW%s+R!P2)Hdcns7UL-$8k2%(>LEs?=$o{grBX<*zJB8F|gKO
z;x*9`A1z
z_9cgr5kUGI*>>xc3m`j!Hfv~Yma$Rt(?;?QuLt1T2$FHVs!v~dO~q*EX9lZw3kXY~
zYIkjpWA2)0k4f!S;2g-3GPE12DYW?=TWwBt=R1=u@^0E6$+PwMyBlh1B^>r3MH7+Q
z50V8>dFgUC&$ic+Ycg^zn7<`6HBZK?6pnX(!j+@+v1*Ox}7x~C=C*4gL2`2|?1
zqiGXwkm{^JmY~eMqs*P~tM=m4oo{E#MO?tHuPMHHfh82Irsu~;
z7TNtpQgNs>DN34goO%;x@M!6ea!h8G!#a}^V{*LU0Re!8yMo1?_z_e&=1bYm
zk4gt0Xq-=_BTkaUCV$(XV`>WG)x28SH#^=hgGjLhCtqF@Ch2+&2wlbtwAJ#hy
zeyQ$9dCJN4#COQ0rKi*MWQsVU6oa%Bil9BbZ~}F=GPaT@~oG!?$Pe<4LpRt(nW)bJ;flK)OL*2;n#A&;@kre6vR!)
zAX(4{Id2i4MQss~QsGeb)^SC=Fz2p1=;!Q>!}jt_kjEJQ;_unbkb7u-qO^_
z(5IL|0jbkt44in$LK2W#`d#?j#-Hr6Zmth;z{Em(wODHZPb1eMe2gsXG-6~y1!j*W
z*;j2eZTFP>@Hha1mti^tHZ?Is9M~HRsCBJYqQfI{Vz4SWv9g=ITwyMyqDU3G%$z7%KY%|CL
z4q$Wa5*2lUdS1ts-OM^`7gQ%b)CC+RAODCUQ#Q9h7Xv-*Frg(+e&(Ijc}+$cM6>_W
z8rj+T@df_VcP%tP51y`_&|9

[Spice-devel] [PATCH spice 3/4] manual: No need to use sudo to run qemu

2016-04-22 Thread Pavel Grunt
---
 docs/manual/manual.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/manual/manual.txt b/docs/manual/manual.txt
index 348e5e0..f172ab4 100644
--- a/docs/manual/manual.txt
+++ b/docs/manual/manual.txt
@@ -240,7 +240,7 @@ population. I assume that you have a locally stored ISO of 
your
 favourite operating system so you can use it for installation.
 
 [source,sh]
-host$ sudo qemu-kvm -boot order=dc -vga qxl \
+host$ qemu-kvm -boot order=dc -vga qxl \
 -spice port=3001,disable-ticketing -soundhw ac97 \
 -device virtio-serial -chardev 
spicevmc,id=vdagent,debug=0,name=vdagent \
 -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \
-- 
2.8.1

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice 2/4] manual: Recommend UsbDk instead of USB Clerk

2016-04-22 Thread Pavel Grunt
---
 docs/manual/manual.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/manual/manual.txt b/docs/manual/manual.txt
index 3f869bf..348e5e0 100644
--- a/docs/manual/manual.txt
+++ b/docs/manual/manual.txt
@@ -1026,8 +1026,8 @@ The recommended way of getting all the needed drivers 
installed is to
 use the all-in-one Spice guest tools installer which can be found on
 http://spice-space.org/download/windows/spice-guest-tools/[spice-space.org].
 
-To get USB redirection working on Windows, you need to install USB
-Clerk (TODO: add link)
+To get USB redirection working on Windows, you need to install
+http://www.spice-space.org/download/windows/usbdk/[UsbDk]
 
 If you want to manually install them, the QXL driver can be downloaded
 from http://spice-space.org/download/windows/qxl/[this location] ,
-- 
2.8.1

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk 2/2] channel: Abort migration in delayed unref

2016-04-22 Thread Pavel Grunt
When channel is unref'ed during migration migrate_channel_event_cb
is called causing a crash by coroutine yielding to nonexistent channel.

As comment in spice_channel_coroutine says:
  Co-routine exits now - the SpiceChannel object may no longer exist,
  so don't do anything else now unless you like SEGVs

Related: rhbz#1318574
---
 src/spice-channel.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/spice-channel.c b/src/spice-channel.c
index 19237b3..7b0a3dc 100644
--- a/src/spice-channel.c
+++ b/src/spice-channel.c
@@ -2296,6 +2296,7 @@ static gboolean spice_channel_delayed_unref(gpointer data)
 SpiceChannel *channel = SPICE_CHANNEL(data);
 SpiceChannelPrivate *c = channel->priv;
 gboolean was_ready = c->state == SPICE_CHANNEL_STATE_READY;
+SpiceSession *session;
 
 CHANNEL_DEBUG(channel, "Delayed unref channel %p", channel);
 
@@ -2303,6 +2304,13 @@ static gboolean spice_channel_delayed_unref(gpointer 
data)
 
 c->state = SPICE_CHANNEL_STATE_UNCONNECTED;
 
+session = spice_channel_get_session(channel);
+if (spice_session_is_for_migration(session)) {
+/* error during migration - abort migration */
+spice_session_abort_migration(session);
+return FALSE;
+}
+
 if (c->event != SPICE_CHANNEL_NONE) {
 g_coroutine_signal_emit(channel, signals[SPICE_CHANNEL_EVENT], 0, 
c->event);
 c->event = SPICE_CHANNEL_NONE;
-- 
2.8.1

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk 1/2] channel-main: Use CHANNEL_DEBUG for migration events

2016-04-22 Thread Pavel Grunt
To show which channel got an error or an unhandled event
---
 src/channel-main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/channel-main.c b/src/channel-main.c
index 604f333..3966e49 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -2286,7 +2286,7 @@ static void migrate_channel_event_cb(SpiceChannel 
*channel, SpiceChannelEvent ev
 coroutine_yieldto(mig->from, NULL);
 break;
 default:
-SPICE_DEBUG("error or unhandled channel event during migration: %d", 
event);
+CHANNEL_DEBUG(channel, "error or unhandled channel event during 
migration: %d", event);
 /* go back to main channel to report error */
 coroutine_yieldto(mig->from, NULL);
 }
-- 
2.8.1

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice 1/4] manual: Recommend enabling monitors using remote-viewer's menu

2016-04-22 Thread Pavel Grunt
On Fri, 2016-04-22 at 16:01 +0200, Christophe Fergeau wrote:
> ACK series.

Pushed, thanks
> 
> Christophe
> 
> On Fri, Apr 22, 2016 at 03:09:03PM +0200, Pavel Grunt wrote:
> > ---
> >  docs/manual/manual.txt | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/docs/manual/manual.txt b/docs/manual/manual.txt
> > index 9e41c36..3f869bf 100644
> > --- a/docs/manual/manual.txt
> > +++ b/docs/manual/manual.txt
> > @@ -656,9 +656,8 @@ that is already there:
> >  Client
> >  --
> >  
> > -You can enable additional displays either from the "Display/Displays"
> > -menu in remote-viewer, or from your guest OS display configuration
> > -tool.
> > +You can enable additional displays from the "View -> Displays"
> > +menu in remote-viewer.
> >  
> >  TLS
> >  ===
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] How to modify spice version?

2016-04-28 Thread Pavel Grunt
Hi,

On Thu, 2016-04-28 at 14:09 +0800, Chen yu wrote:
> Thank you for taking time out of your busy schedule to see this letter.
> I am trying to compile spice downloaded from github, but the versions of these
> are 'UNKNOWN'. when I compiled QEMU with these spice, there have some errors
> in the process of 'make'. 
> Could I modify the version of spice (spice-server and spice-gtk) temporarily
> for testing and how should I do?


Please, use repos from freedesktop https://cgit.freedesktop.org/spice/
The github repos are mirrored, but they don't have tags, so they cannot generate
version.

Pavel

> ___
> 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


Re: [Spice-devel] [PATCH spice-gtk 2/2] channel: Abort migration in delayed unref

2016-04-26 Thread Pavel Grunt
Hi,

On Tue, 2016-04-26 at 12:05 +0200, Victor Toso wrote:
> Hi,
> 
> On Fri, Apr 22, 2016 at 04:47:48PM +0200, Pavel Grunt wrote:
> > When channel is unref'ed during migration migrate_channel_event_cb
> > is called causing a crash by coroutine yielding to nonexistent channel.
> > 
> > As comment in spice_channel_coroutine says:
> >   Co-routine exits now - the SpiceChannel object may no longer exist,
> >   so don't do anything else now unless you like SEGVs
> > 
> > Related: rhbz#1318574
> > ---
> >  src/spice-channel.c | 8 
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/src/spice-channel.c b/src/spice-channel.c
> > index 19237b3..7b0a3dc 100644
> > --- a/src/spice-channel.c
> > +++ b/src/spice-channel.c
> > @@ -2296,6 +2296,7 @@ static gboolean spice_channel_delayed_unref(gpointer
> > data)
> >  SpiceChannel *channel = SPICE_CHANNEL(data);
> >  SpiceChannelPrivate *c = channel->priv;
> >  gboolean was_ready = c->state == SPICE_CHANNEL_STATE_READY;
> > +SpiceSession *session;
> >  
> >  CHANNEL_DEBUG(channel, "Delayed unref channel %p", channel);
> >  
> > @@ -2303,6 +2304,13 @@ static gboolean spice_channel_delayed_unref(gpointer
> > data)
> >  
> >  c->state = SPICE_CHANNEL_STATE_UNCONNECTED;
> >  
> > +session = spice_channel_get_session(channel);
> > +if (spice_session_is_for_migration(session)) {
> > +/* error during migration - abort migration */
> > +spice_session_abort_migration(session);
> > +return FALSE;
> > +}
> > +
> 
> Just to be sure if I got it right. The migration fails for some reason which
> triggers and error in the migration process for spice-gtk. That will make the
> channel for the target host to be delayed_unref.
> 
> If we don't spice_session_abort_migration() now, migrate_channel_event_cb()
> will
> be called for the channel for the former host which will try to yield to a
> coroutine and cause the crash.
yes
> 
> Does this only happen under failure in the migration like [0] or it could
> happen
> if we do cancel the migration in the right moment?

if migration is canceled by the SPICE_MSG_MAIN_MIGRATE_CANCEL
message, spice_session_abort_migration() is called.

Looking at the backtrace of [0] the patch addresses the same issue.

Pavel

> 
> [0] https://bugs.freedesktop.org/show_bug.cgi?id=92019
> 
> Cheers,
>   toso
> 
> >  if (c->event != SPICE_CHANNEL_NONE) {
> >  g_coroutine_signal_emit(channel, signals[SPICE_CHANNEL_EVENT], 0,
> > c->event);
> >  c->event = SPICE_CHANNEL_NONE;
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH] Fix make dist

2016-04-25 Thread Pavel Grunt
On Mon, 2016-04-25 at 17:21 -0300, Eduardo Lima (Etrunko) wrote:
> spicec screenshot has been removed since commit
> b0186fe1267dfa2b8534c7c083dc301791279f08
> 
> Signed-off-by: Eduardo Lima (Etrunko) <etru...@redhat.com>
Acked-by: Pavel Grunt <pgr...@redhat.com>

Thanks,
Pavel
> ---
>  docs/manual/Makefile.am | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/docs/manual/Makefile.am b/docs/manual/Makefile.am
> index ead5f46..24a11fe 100644
> --- a/docs/manual/Makefile.am
> +++ b/docs/manual/Makefile.am
> @@ -5,7 +5,6 @@ ASCIIDOC_FLAGS = -a icons -a toc
>  EXTRA_DIST = \
>   images/icons/important.png  \
>   images/icons/note.png   \
> - images/spicec01.png \
>   manual.html \
>   manual.chunked  \
>   manual.txt  \
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk v3 6/7] spice-uri: Check if port is in allowed range

2016-05-20 Thread Pavel Grunt
On Fri, 2016-05-20 at 14:50 +0200, Christophe Fergeau wrote:
> On Thu, May 19, 2016 at 06:38:08PM +0200, Pavel Grunt wrote:
> > Related: rhbz#1335239
> > ---
> >  src/spice-uri.c| 8 ++--
> >  tests/test-spice-uri.c | 2 ++
> >  2 files changed, 8 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/spice-uri.c b/src/spice-uri.c
> > index b483374..6a43461 100644
> > --- a/src/spice-uri.c
> > +++ b/src/spice-uri.c
> > @@ -165,8 +165,8 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar
> > *_uri, GError **error)
> >  uri_port = uriv[1];
> >  
> >  if (uri_port != NULL) {
> > -char *endptr;
> > -guint port = strtoul(uri_port, , 10);
> > +gchar *endptr;
> > +gint64 port = g_ascii_strtoll(uri_port, , 10);
> 
> Not sure this is 100% related to this change? but why not

It helps to detect negative values (strtoul "converts" negative number to
positive/treats it as negative w/o the sign?) - I'll mention the reason for
change in the commit log.
> 
> >  if (*endptr != '\0') {
> >  g_set_error(error, SPICE_CLIENT_ERROR,
> > SPICE_CLIENT_ERROR_FAILED,
> >  "Invalid uri port: %s", uri_port);
> > @@ -175,6 +175,10 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar
> > *_uri, GError **error)
> >  g_set_error(error, SPICE_CLIENT_ERROR,
> > SPICE_CLIENT_ERROR_FAILED, "Missing uri port");
> >  goto end;
> >  }
> > +if (port < 0 || port > 65535) {
> > +g_set_error(error, SPICE_CLIENT_ERROR,
> > SPICE_CLIENT_ERROR_FAILED, "Port out of range");
> > +goto end;
> > +}
> 
> I'd check for <= 0

Ok, I'll change it.

Thanks

Pavel

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [spice v14 00/29] Add GStreamer support for video streaming

2016-05-18 Thread Pavel Grunt
Hi Francois,

I pushed the spice-gtk part upstream.

Thanks!
Pavel

On Wed, 2016-05-04 at 11:40 +0200, Francois Gouget wrote:
> This patch series adds support for using GStreamer to encode and 
> decode the video streams, adding support for VP8 and h264 codecs.
> 
> As before the patches can also be grabbed from the gst branch of the
> repositories below:
> 
> spice:  https://github.com/fgouget/spice
> spice-gtk:  https://github.com/fgouget/spice-gtk
> xf86-video-qxl: https://github.com/fgouget/xf86-video-qxl
> spice-protocol: https://github.com/fgouget/spice-protocol
> 
> See also gst-sync for the old spice-gtk code. (there's also 'extras'
> branches with more experimental/future patches for the curious)
> 
> Note also that I added gst-v10, gst-v11, gst-v12 and gst-v13 branches to 
> help comparing these revisions.
> 
> Note that to test GStreamer support with QEMU you probably need to grab 
> the patch below and set the video-codecs option to something like 
> gstreamer:h264 or gstreamer:vp8.
> 
> https://lists.freedesktop.org/archives/spice-devel/2015-May/019771.html
> 
> 
> Changes from v13:
> 
> Rebased + some changes suggested by Christophe Fergeau.
> 
> 
> Changes from v12:
> 
> This round focused on performance and reliability in various special 
> cases such as low bandwidth operation.
> 
>  * The server no longer rebuilds the pipeline from scratch every time 
>    the frame size or bitrate changes. The trick to it is to transition 
>    to the NULL state (instead of the PAUSED one as before).
>  * I also unified configure_pipeline() and reconfigure_pipeline() by 
>    moving all the one-time configuration operations to 
>    create_pipeline() and tracking the configuration changes to apply.
>  * The server can now also apply bitrate changes directly if the codec 
>    advertises it can be changed in the PLAYING state. This is the case 
>    for the x264enc codec.
>  * The server can now detect when the GStreamer pipeline error occurs 
>    instead of getting stuck waiting for the compressed buffer.
>  * I fixed the value for the error-resilient vp8enc option.
>  * I removed the resize-allowed=true vp8enc setting as tests showed the 
>    decoder was sometimes not restoring a full-size frame.
>  * I removed the 'frame' SpiceGstVideoBuffer field as it was not used.
>  * push_raw_frame() now avoids allocating memory for chunk_copy() if 
>    zero_copy() was able to take care of the whole frame.
> 
>  * The client no longer rebuilds or even reconfigure the pipeline from 
>    scratch every time the frame size changes. It turns out that the 
>    decoders don't care (unlike the encoders).
>  * I have protected the PTS calculation against underflows. This fixes 
>    freezes that could occasionally happen with negative latencies near 
>    the start of a stream (i.e. in low bandwidth cases).
>  * I renamed SpiceFrameMeta to just SpiceFrame since it also contains 
>    the sample once the frame has been decoded, and is thus not just 
>    metadata. I also cleaned up the naming of the corresponding queues.
>  * The GStreamer pipeline sometimes returns multiple buffers with the 
>    same PTS. The first buffer would remove its SpiceFrame from the 
>    decoding_queue so that the next one would not find a match, thus 
>    clearing the decoding_queue in the process. As a result the next 
>    buffer would not find a match either, again clearing the 
>    decoding_queue in the process, etc. So buffers that have an unknown 
>    PTS no longer clear the decoding_queue.
>  * When frames are late for display the client now tries to display the 
>    least out of date one in the display_queue so there are at least 
>    some screen updates.
>  * I removed the qos=true appsink option. It's not clear that it was 
>    helping so I decided to remove it until there is more evidence that 
>    it is needed.
>  * I renamed stream_dropped_frame() to 
>    stream_dropped_frame_on_playback() to make it clearer that it's 
>    unrelated to the stream report data (which is based on arrival time).
> 
> 
> Besides rebases, the changes from v11 are limited to spice-gtk. 
> Specifically they fix two compatibility issues:
>  * v11 used a GAsyncQueue and relied on g_async_queue_push_front() which 
>    is only available in GLib >= 2.46 which is unfortunately not 
>    available in Debian 8 and presumably on many other Linux 
>    distributions.
>  * It also associated the original network message with the 
>    corresponding GStreamer buffer using the GstMeta API. This is 
>    necessary in order to know where to display the decoded frame as this 
>    could change from one frame to the next. However some GStreamer 
>    elements have (refcounting) bugs that caused the metadata to be lost 
>    in the pipeline. I had a workaround in place that worked on Debian 
>    Testing but did not on Debian 8.
>    https://bugzilla.gnome.org/show_bug.cgi?id=757254
> 
> So in the end I reworked both by putting the metadata in a 

Re: [Spice-devel] [PATCH 1/2] Remove unnecessary cursor_pipe_item_ref()

2016-05-20 Thread Pavel Grunt
Hi,

Am I right that your next step is to remove hold_item() ?

On Thu, 2016-05-19 at 14:05 -0500, Jonathon Jongsma wrote:
> Use the base red_pipe_item_ref() instead of adding an additional static
> wrapper function.

Acked-by: Pavel Grunt <pgr...@redhat.com>
> ---
>  server/cursor-channel.c | 14 +-
>  1 file changed, 1 insertion(+), 13 deletions(-)
> 
> diff --git a/server/cursor-channel.c b/server/cursor-channel.c
> index c0b2fda..fa462c5 100644
> --- a/server/cursor-channel.c
> +++ b/server/cursor-channel.c
> @@ -340,23 +340,11 @@ static void cursor_channel_send_item(RedChannelClient
> *rcc, RedPipeItem *pipe_it
>  red_channel_client_begin_send_message(rcc);
>  }
>  
> -static RedCursorPipeItem *cursor_pipe_item_ref(RedCursorPipeItem *item)
> -{
> -spice_return_val_if_fail(item, NULL);
> -
> -red_pipe_item_ref(item);
> -return item;
> -}
> -
> -
>  static void cursor_channel_hold_pipe_item(RedChannelClient *rcc, RedPipeItem
> *item)
>  {
> -RedCursorPipeItem *cursor_pipe_item;
> -
>  spice_return_if_fail(item);
>  
> -cursor_pipe_item = SPICE_CONTAINEROF(item, RedCursorPipeItem, base);
> -cursor_pipe_item_ref(cursor_pipe_item);
> +red_pipe_item_ref(item);
>  }
>  
>  CursorChannel* cursor_channel_new(RedWorker *worker)
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH 2/2] Simplify DisplayChannel hold_item()

2016-05-20 Thread Pavel Grunt
On Thu, 2016-05-19 at 14:05 -0500, Jonathon Jongsma wrote:
> Since all pipe items implement refcounting now, just call
> red_pipe_item_ref() and eliminate the switch statement.

Acked-by: Pavel Grunt <pgr...@redhat.com>
> ---
>  server/display-channel.c | 11 +--
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/server/display-channel.c b/server/display-channel.c
> index 1487f10..3f414fd 100644
> --- a/server/display-channel.c
> +++ b/server/display-channel.c
> @@ -1934,16 +1934,7 @@ static void hold_item(RedChannelClient *rcc,
> RedPipeItem *item)
>  {
>  spice_return_if_fail(item);
>  
> -switch (item->type) {
> -case RED_PIPE_ITEM_TYPE_DRAW:
> -case RED_PIPE_ITEM_TYPE_IMAGE:
> -case RED_PIPE_ITEM_TYPE_STREAM_CLIP:
> -case RED_PIPE_ITEM_TYPE_UPGRADE:
> -red_pipe_item_ref(item);
> -break;
> -default:
> -spice_warn_if_reached();
> -}
> +red_pipe_item_ref(item);
>  }
>  
>  static int handle_migrate_flush_mark(RedChannelClient *rcc)
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk v3 5/7] spice-uri: Do not allow empty port string

2016-05-20 Thread Pavel Grunt
On Fri, 2016-05-20 at 10:32 +0200, Victor Toso wrote:
> Hi,
> 
> On Thu, May 19, 2016 at 06:38:07PM +0200, Pavel Grunt wrote:
> > Related: rhbz#1335239
> > ---
> >  src/spice-uri.c| 3 +++
> >  tests/test-spice-uri.c | 1 +
> >  2 files changed, 4 insertions(+)
> > 
> > diff --git a/src/spice-uri.c b/src/spice-uri.c
> > index 04ea3cb..b483374 100644
> > --- a/src/spice-uri.c
> > +++ b/src/spice-uri.c
> > @@ -171,6 +171,9 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar
> > *_uri, GError **error)
> >  g_set_error(error, SPICE_CLIENT_ERROR,
> > SPICE_CLIENT_ERROR_FAILED,
> >  "Invalid uri port: %s", uri_port);
> >  goto end;
> > +} else if (endptr == uri_port) {
> > +g_set_error(error, SPICE_CLIENT_ERROR,
> > SPICE_CLIENT_ERROR_FAILED, "Missing uri port");
> > +goto end;
> 
> You might want to use/include the return value of strtoul for zero in this
> case

I would not change the value, parsing failed so SpiceURI should not be consider
valid

Pavel

> 
> Acked-by: Victor Toso <victort...@redhat.com>
> 
> >  }
> >  spice_uri_set_port(self, port);
> >  }
> > diff --git a/tests/test-spice-uri.c b/tests/test-spice-uri.c
> > index 1b14dbb..42c9aad 100644
> > --- a/tests/test-spice-uri.c
> > +++ b/tests/test-spice-uri.c
> > @@ -34,6 +34,7 @@ static void test_spice_uri_ipv4(void)
> >  {"http://:80;, "http", NULL, 80, NULL, NULL}, /* missing hostname
> > */
> >  {"http://;, "http", NULL, 3128, NULL, NULL},
> >  {"http://127.0.0.1:port;, "http", "127.0.0.1", 3128, NULL, NULL},
> > /* invalid port */
> > +{"http://127.0.0.1:;, "http", "127.0.0.1", 3128, NULL, NULL},
> >  };
> >  const struct test_case valid_test_cases[] = {
> >  {"http://user:password@host:80;, "http", "host", 80, "user",
> > "password"},
> > -- 
> > 2.8.2
> > 
> > ___
> > 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


Re: [Spice-devel] [PATCH spice-gtk v3 3/7] spice-uri: Add missing include

2016-05-20 Thread Pavel Grunt
On Fri, 2016-05-20 at 10:14 +0200, Victor Toso wrote:
> Hi,
> 
> On Thu, May 19, 2016 at 06:38:05PM +0200, Pavel Grunt wrote:
> > Related: rhbz#1335239
> > ---
> >  src/spice-uri.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/src/spice-uri.c b/src/spice-uri.c
> > index 8cf870d..3bdb502 100644
> > --- a/src/spice-uri.c
> > +++ b/src/spice-uri.c
> > @@ -22,6 +22,7 @@
> > 
> >  #include "spice-client.h"
> >  #include "spice-uri.h"
> > +#include "spice-uri-priv.h"
> 
> The -priv is internal and it always includes the non -priv one.
> I would change the include above spice-uri.h to spice-uri-priv.h

I would include both, but can remove the other one if you prefer.

Pavel

> 
> Acked-by: Victor Toso <victort...@redhat.com>
> 
> >  
> >  /**
> >   * SECTION:spice-uri
> > -- 
> > 2.8.2
> > 
> > ___
> > 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


Re: [Spice-devel] [PATCH spice-gtk v3 7/7] spice-uri: Add ipv6 support

2016-05-20 Thread Pavel Grunt
On Fri, 2016-05-20 at 10:54 +0200, Victor Toso wrote:
> Hi,
> 
> On Thu, May 19, 2016 at 06:38:09PM +0200, Pavel Grunt wrote:
> > Just basic support -  http://user:password@[host]:port
> > 
> > Resolves: rhbz#1335239
> > ---
> >  src/spice-uri.c| 25 +
> >  tests/test-spice-uri.c | 42 ++
> >  2 files changed, 63 insertions(+), 4 deletions(-)
> > 
> > diff --git a/src/spice-uri.c b/src/spice-uri.c
> > index 6a43461..323fbf7 100644
> > --- a/src/spice-uri.c
> > +++ b/src/spice-uri.c
> > @@ -150,10 +150,29 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar
> > *_uri, GError **error)
> >  uri = next;
> >  }
> >  
> > -/* max 2 parts, host:port */
> > -gchar **uriv = g_strsplit(uri, ":", 2);
> > +gchar **uriv;
> >  const gchar *uri_port = NULL;
> >  
> > +if (*uri == '[') { /* ipv6 address */
> > +uriv = g_strsplit(uri + 1, "]", 2);
> > +if (uriv[1] == NULL) {
> > +g_set_error(error, SPICE_CLIENT_ERROR,
> > SPICE_CLIENT_ERROR_FAILED,
> > +"Missing ']' in ipv6 uri");
> > +goto end;
> > +}
> > +if (*uriv[1] == ':') {
> > +uri_port = uriv[1] + 1;
> > +} else if (strlen(uriv[1]) > 0) { /* invalid string after the
> > hostname */
> > +g_set_error(error, SPICE_CLIENT_ERROR,
> > SPICE_CLIENT_ERROR_FAILED,
> > +"Invalid uri address");
> > +goto end;
> > +}
> > +} else {
> > +/* max 2 parts, host:port */
> > +uriv = g_strsplit(uri, ":", 2);
> > +uri_port = uriv[1];
> > +}
> > +
> 
> This seems to leak (I think Frediano said it before)
> 
This should not leak, uriv is initialized by g_strsplit() and in the
end g_strfreev(uriv) is called.

The leaks come from the patch "spice-uri: Reset SpiceUri before parsing" as you
noticed before

Thanks!
Pavel


> Full valgrind in the end.
> 
> 
> >  if (uriv[0] == NULL || strlen(uriv[0]) == 0) {
> >  g_set_error(error, SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED,
> >  "Invalid hostname in uri address");
> > @@ -161,8 +180,6 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar
> > *_uri, GError **error)
> >  }
> >  
> >  spice_uri_set_hostname(self, uriv[0]);
> > -if (uriv[0] != NULL)
> > -uri_port = uriv[1];
> >  
> >  if (uri_port != NULL) {
> >  gchar *endptr;
> > diff --git a/tests/test-spice-uri.c b/tests/test-spice-uri.c
> > index c32a343..9cdcb90 100644
> > --- a/tests/test-spice-uri.c
> > +++ b/tests/test-spice-uri.c
> > @@ -66,11 +66,53 @@ static void test_spice_uri_ipv4(void)
> >  g_object_unref(uri);
> >  }
> >  
> > +static void test_spice_uri_ipv6(void)
> > +{
> > +const struct test_case invalid_test_cases[] = {
> > +{"http://[]:80;, "http", NULL, 80, NULL, NULL},
> > +{"http://[::1;, "http", NULL, 3128, NULL, NULL},
> > +{"http://[host]1234;, "http", "host", 3128, NULL, NULL},
> > +{"http://[host]foo/;, "http", "host", 3128, NULL, NULL},
> > +{"http://[::1]:port;, "http", "::1", 3128, NULL, NULL},
> > +{"http://[::127.0.0.1]:;, "http", "::127.0.0.1", 3128, NULL, NULL},
> > +{"http://[::127.0.0.1]:-42;, "http", "::127.0.0.1", 3128, NULL,
> > NULL},
> > +{"[3ffe:2a00:100:7031::1]:4200", "http",
> > "3ffe:2a00:100:7031::1", 3128, NULL, NULL},
> > +};
> > +const struct test_case valid_test_cases[] = {
> > +{"http://user:password@[host]:80/;, "http", "host", 80, "user",
> > "password"},
> > +{"http://user@[1080:0:0:0:8:800:200C:4171]:100;, "http",
> > "1080:0:0:0:8:800:200C:4171", 100,
> > + "user", NULL},
> > +{"https://[1080::8:800:200C:417A];, "https",
> > "1080::8:800:200C:417A", 3129, NULL, NULL},
> > +{"[3ffe:2a00:100:7031::1]", "http", "3ffe:2a00:100:7031::1", 3128,
> > NULL, NULL},
> > +};
> > +
> >

Re: [Spice-devel] [PATCH spice-gtk v3 6/7] spice-uri: Check if port is in allowed range

2016-05-20 Thread Pavel Grunt
On Fri, 2016-05-20 at 10:36 +0200, Victor Toso wrote:
> Hi,
> 
> On Thu, May 19, 2016 at 06:38:08PM +0200, Pavel Grunt wrote:
> > Related: rhbz#1335239
> > ---
> >  src/spice-uri.c| 8 ++--
> >  tests/test-spice-uri.c | 2 ++
> >  2 files changed, 8 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/spice-uri.c b/src/spice-uri.c
> > index b483374..6a43461 100644
> > --- a/src/spice-uri.c
> > +++ b/src/spice-uri.c
> > @@ -165,8 +165,8 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar
> > *_uri, GError **error)
> >  uri_port = uriv[1];
> >  
> >  if (uri_port != NULL) {
> > -char *endptr;
> > -guint port = strtoul(uri_port, , 10);
> > +gchar *endptr;
> > +gint64 port = g_ascii_strtoll(uri_port, , 10);
> >  if (*endptr != '\0') {
> >  g_set_error(error, SPICE_CLIENT_ERROR,
> > SPICE_CLIENT_ERROR_FAILED,
> >  "Invalid uri port: %s", uri_port);
> > @@ -175,6 +175,10 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar
> > *_uri, GError **error)
> >  g_set_error(error, SPICE_CLIENT_ERROR,
> > SPICE_CLIENT_ERROR_FAILED, "Missing uri port");
> >  goto end;
> >  }
> > +if (port < 0 || port > 65535) {
> > +g_set_error(error, SPICE_CLIENT_ERROR,
> > SPICE_CLIENT_ERROR_FAILED, "Port out of range");
> > +goto end;
> > +}
> >  spice_uri_set_port(self, port);
> >  }
> >  
> > diff --git a/tests/test-spice-uri.c b/tests/test-spice-uri.c
> > index 42c9aad..c32a343 100644
> > --- a/tests/test-spice-uri.c
> > +++ b/tests/test-spice-uri.c
> > @@ -35,6 +35,8 @@ static void test_spice_uri_ipv4(void)
> >  {"http://;, "http", NULL, 3128, NULL, NULL},
> >  {"http://127.0.0.1:port;, "http", "127.0.0.1", 3128, NULL, NULL},
> > /* invalid port */
> >  {"http://127.0.0.1:;, "http", "127.0.0.1", 3128, NULL, NULL},
> > +{"http://127.0.0.1:-80;, "http", "127.0.0.1", 3128, NULL, NULL},
> > +{"http://127.0.0.1:800;, "http", "127.0.0.1", 3128, NULL,
> > NULL},
> >  };
> >  const struct test_case valid_test_cases[] = {
> >  {"http://user:password@host:80;, "http", "host", 80, "user",
> > "password"},
> 
> Looks good. You might want to include test to check the error you have
> included.

Check for the error message ? Code/domain is the same.

I will add it.

Thanks,
Pavel

> 
> Acked-by: Victor Toso <victort...@redhat.com>
> 
> > -- 
> > 2.8.2
> > 
> > ___
> > 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


Re: [Spice-devel] [PATCHv2 1/3] egl: don't destroy wayland egl context

2016-05-23 Thread Pavel Grunt
On Mon, 2016-05-23 at 13:01 +0200, Marc-André Lureau wrote:
> The egl context is from Gtk on Wayland. Destroy it only on X11.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lur...@gmail.com>
Acked-by: Pavel Grunt <pgr...@redhat.com>
> ---
>  src/spice-widget-egl.c | 28 +---
>  1 file changed, 17 insertions(+), 11 deletions(-)
> 
> diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
> index 961dcfa..a3db856 100644
> --- a/src/spice-widget-egl.c
> +++ b/src/spice-widget-egl.c
> @@ -364,10 +364,6 @@ void spice_egl_unrealize_display(SpiceDisplay *display)
>  d->egl.tex_pointer_id = 0;
>  }
>  
> -if (d->egl.surface != EGL_NO_SURFACE) {
> -eglDestroySurface(d->egl.display, d->egl.surface);
> -d->egl.surface = EGL_NO_SURFACE;
> -}
>  if (d->egl.vbuf_id) {
>  glDeleteBuffers(1, >egl.vbuf_id);
>  d->egl.vbuf_id = 0;
> @@ -378,14 +374,24 @@ void spice_egl_unrealize_display(SpiceDisplay *display)
>  d->egl.prog = 0;
>  }
>  
> -if (d->egl.ctx) {
> -eglDestroyContext(d->egl.display, d->egl.ctx);
> -d->egl.ctx = 0;
> +if (GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
> +/* egl.surface && egl.ctx are only created on x11, see
> +   spice_egl_init() */
> +
> +if (d->egl.surface != EGL_NO_SURFACE) {
> +eglDestroySurface(d->egl.display, d->egl.surface);
> +d->egl.surface = EGL_NO_SURFACE;
> +}
> +
> +if (d->egl.ctx) {
> +eglDestroyContext(d->egl.display, d->egl.ctx);
> +d->egl.ctx = 0;
> +}
> +
> +eglMakeCurrent(d->egl.display, EGL_NO_SURFACE, EGL_NO_SURFACE,
> +   EGL_NO_CONTEXT);
> +eglTerminate(d->egl.display);
>  }
> -
> -eglMakeCurrent(d->egl.display, EGL_NO_SURFACE, EGL_NO_SURFACE,
> -   EGL_NO_CONTEXT);
> -eglTerminate(d->egl.display);
>  }
>  
>  G_GNUC_INTERNAL
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk v2 3/5] spice-uri: Set user & password to NULL when not specified

2016-05-19 Thread Pavel Grunt
On Thu, 2016-05-19 at 06:24 -0400, Frediano Ziglio wrote:
> > 
> > 
> > Avoid using old values after parsing a new uri.
> > 
> > Related: rhbz#1335239
> > ---
> >  src/spice-uri.c| 3 +++
> >  tests/test-spice-uri.c | 2 +-
> >  2 files changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/spice-uri.c b/src/spice-uri.c
> > index 0cc2195..35d773e 100644
> > --- a/src/spice-uri.c
> > +++ b/src/spice-uri.c
> > @@ -141,6 +141,9 @@ gboolean spice_uri_parse(SpiceURI *self, const gchar
> > *_uri, GError **error)
> >  spice_uri_set_user(self, user);
> >  spice_uri_set_password(self, pass);
> >  uri = next;
> > +} else {
> > +spice_uri_set_user(self, NULL);
> > +spice_uri_set_password(self, NULL);
> >  }
> >  
> 
> Why not setting all to NULL at the beginning ?

Sure
> Does the internal state has to be unchanged if the function returns FALSE ?

I don't think so
> 
> >  /* max 2 parts, host:port */
> > diff --git a/tests/test-spice-uri.c b/tests/test-spice-uri.c
> > index e8cfcc9..3d21fa7 100644
> > --- a/tests/test-spice-uri.c
> > +++ b/tests/test-spice-uri.c
> > @@ -36,10 +36,10 @@ static void test_spice_uri_ipv4(void)
> >  {"http://127.0.0.1:port;, "http", "127.0.0.1", 3128, NULL, NULL},
> > /*
> >  invalid port */
> >  };
> >  const struct test_case valid_test_cases[] = {
> > +{"http://user:password@host:80;, "http", "host", 80, "user",
> > "password"},
> >  {"http://127.0.0.1/;, "http", "127.0.0.1", 3128, NULL, NULL},
> >  {"https://127.0.0.1;, "https", "127.0.0.1", 3129, NULL, NULL},
> >  {"127.0.0.1", "http", "127.0.0.1", 3128, NULL, NULL},
> > -{"http://user:password@host:80;, "http", "host", 80, "user",
> > "password"},
> >  };
> >  
> 
> I think a comment stating why they are in this order would be good.

Right, it was in previous version.

Pavel
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk v3 0/7] Allow ipv6 proxy url

2016-05-19 Thread Pavel Grunt
Hi,

these patches add ipv6 support to SpiceUri, so it can be used in SPICE_PROXY.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1335239

v3 per Frediano's review:
 - Added test for port out of range (0, 65535)
 - reset all values of SpiceUri before parsing

v2 contains changes suggested by Frediano and Victor:
 - more tests (missing port, missing ending bracket)
 - tests are defined in array, so it is easier to add new test cases
 - follow ipv6 address format http://user:password@[ipv6]:port

Thanks,*

Pavel Grunt (7):
  tests: Add test for SpiceUri
  spice-uri: Mark parameter as unused
  spice-uri: Add missing include
  spice-uri: Reset SpiceUri before parsing
  spice-uri: Do not allow empty port string
  spice-uri: Check if port is in allowed range
  spice-uri: Add ipv6 support

 src/spice-uri.c|  46 ---
 tests/Makefile.am  |   2 +
 tests/test-spice-uri.c | 118 +
 3 files changed, 159 insertions(+), 7 deletions(-)
 create mode 100644 tests/test-spice-uri.c

-- 
2.8.2

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


<    2   3   4   5   6   7   8   9   10   11   >