[Spice-devel] [linux/vd-agent] vdagent: Do not send empty screen resolution messages

2018-11-15 Thread Victor Toso
From: Victor Toso 

Easier to trigger on Wayland guest by running

> xrandr --output XWAYLAND0 --rotate left

In current master, this causes the spice-vdagentd to disconnect from
the client. In 0.18 branch (latest release), mouse becomes unusable as
mentioned in the referred bug below.

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

Signed-off-by: Victor Toso 
---
 src/vdagent/x11-randr.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/vdagent/x11-randr.c b/src/vdagent/x11-randr.c
index c5fba51..81a2cd6 100644
--- a/src/vdagent/x11-randr.c
+++ b/src/vdagent/x11-randr.c
@@ -959,6 +959,12 @@ no_info:
 }
 }
 
+if (screen_count == 0) {
+syslog(LOG_DEBUG, "Screen count is zero, are we on wayland?");
+g_free(res);
+return;
+}
+
 if (x11->debug) {
 syslog(LOG_DEBUG, "Sending guest screen resolutions to vdagentd:");
 for (i = 0; i < screen_count; i++) {
-- 
2.19.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] channel-display-mjpeg: Fix encoding for big endian machines

2018-11-15 Thread Victor Toso
On Fri, Nov 02, 2018 at 09:38:12AM +, Frediano Ziglio wrote:
> Make sure components are ordered in the same way in memory.
> This was tested with a virtual MIPS machine.
> 
> Signed-off-by: Frediano Ziglio 
> ---
>  src/channel-display-mjpeg.c | 4 
>  1 file changed, 4 insertions(+)
> 
> Changes since v1:
> - fix typo in commit message title
> 
> diff --git a/src/channel-display-mjpeg.c b/src/channel-display-mjpeg.c
> index 83cd391b..94e56205 100644
> --- a/src/channel-display-mjpeg.c
> +++ b/src/channel-display-mjpeg.c
> @@ -108,7 +108,11 @@ static gboolean mjpeg_decoder_decode_frame(gpointer 
> video_decoder)
>  
>  #ifdef JCS_EXTENSIONS
>  // requires jpeg-turbo
> +#  if SPICE_ENDIAN == SPICE_ENDIAN_LITTLE
>  decoder->mjpeg_cinfo.out_color_space = JCS_EXT_BGRX;
> +#  else
> +decoder->mjpeg_cinfo.out_color_space = JCS_EXT_XRGB;
> +#  endif
^^
Why the spaces

>  #else
>  #warning "You should consider building with libjpeg-turbo"
>  decoder->mjpeg_cinfo.out_color_space = JCS_RGB;
> -- 
> 2.17.2
> 
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


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


Re: [Spice-devel] [PATCH spice-gtk v2] channel-display-mjpeg: Fix encoding for big endian machines

2018-11-15 Thread Frediano Ziglio
> 
> On Fri, Nov 02, 2018 at 09:38:12AM +, Frediano Ziglio wrote:
> > Make sure components are ordered in the same way in memory.
> > This was tested with a virtual MIPS machine.
> > 
> > Signed-off-by: Frediano Ziglio 
> > ---
> >  src/channel-display-mjpeg.c | 4 
> >  1 file changed, 4 insertions(+)
> > 
> > Changes since v1:
> > - fix typo in commit message title
> > 
> > diff --git a/src/channel-display-mjpeg.c b/src/channel-display-mjpeg.c
> > index 83cd391b..94e56205 100644
> > --- a/src/channel-display-mjpeg.c
> > +++ b/src/channel-display-mjpeg.c
> > @@ -108,7 +108,11 @@ static gboolean mjpeg_decoder_decode_frame(gpointer
> > video_decoder)
> >  
> >  #ifdef JCS_EXTENSIONS
> >  // requires jpeg-turbo
> > +#  if SPICE_ENDIAN == SPICE_ENDIAN_LITTLE
> >  decoder->mjpeg_cinfo.out_color_space = JCS_EXT_BGRX;
> > +#  else
> > +decoder->mjpeg_cinfo.out_color_space = JCS_EXT_XRGB;
> > +#  endif
> ^^
> Why the spaces
> 

indentation.

Maybe something like:

if (SPICE_ENDIAN == SPICE_ENDIAN_LITTLE) {
decoder->mjpeg_cinfo.out_color_space = JCS_EXT_BGRX;
} else {
decoder->mjpeg_cinfo.out_color_space = JCS_EXT_XRGB;
}

would be better. It looks like less efficient but if the compiler
cannot turn this to just an assignment I would consider more a bug in
the compiler. Also this form has the advantage to compile all code
(big endian machines are neither common nor much tested).

> >  #else
> >  #warning "You should consider building with libjpeg-turbo"
> >  decoder->mjpeg_cinfo.out_color_space = JCS_RGB;

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


[Spice-devel] [PATCH spice-gtk v3] channel-display-mjpeg: Fix encoding for big endian machines

2018-11-15 Thread Frediano Ziglio
Make sure components are ordered in the same way in memory.
This was tested with a virtual MIPS machine.

Signed-off-by: Frediano Ziglio 
---
 src/channel-display-mjpeg.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

Changes since v2:
- use if instead of #if, compile all code and compiler will
  strip unwanted code (condition is always comparing 2 compile
  time constants)

diff --git a/src/channel-display-mjpeg.c b/src/channel-display-mjpeg.c
index 83cd391b..3bb832d8 100644
--- a/src/channel-display-mjpeg.c
+++ b/src/channel-display-mjpeg.c
@@ -108,7 +108,11 @@ static gboolean mjpeg_decoder_decode_frame(gpointer 
video_decoder)
 
 #ifdef JCS_EXTENSIONS
 // requires jpeg-turbo
-decoder->mjpeg_cinfo.out_color_space = JCS_EXT_BGRX;
+if (SPICE_ENDIAN == SPICE_ENDIAN_LITTLE) {
+decoder->mjpeg_cinfo.out_color_space = JCS_EXT_BGRX;
+} else {
+decoder->mjpeg_cinfo.out_color_space = JCS_EXT_XRGB;
+}
 #else
 #warning "You should consider building with libjpeg-turbo"
 decoder->mjpeg_cinfo.out_color_space = JCS_RGB;
-- 
2.17.2

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


Re: [Spice-devel] [linux/vd-agent] vdagent: Do not send empty screen resolution messages

2018-11-15 Thread Frediano Ziglio
> 
> From: Victor Toso 
> 
> Easier to trigger on Wayland guest by running
> 
> > xrandr --output XWAYLAND0 --rotate left
> 
> In current master, this causes the spice-vdagentd to disconnect from
> the client. In 0.18 branch (latest release), mouse becomes unusable as
> mentioned in the referred bug below.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1641723
> 
> Signed-off-by: Victor Toso 
> ---
>  src/vdagent/x11-randr.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/vdagent/x11-randr.c b/src/vdagent/x11-randr.c
> index c5fba51..81a2cd6 100644
> --- a/src/vdagent/x11-randr.c
> +++ b/src/vdagent/x11-randr.c
> @@ -959,6 +959,12 @@ no_info:
>  }
>  }
>  
> +if (screen_count == 0) {
> +syslog(LOG_DEBUG, "Screen count is zero, are we on wayland?");
> +g_free(res);
> +return;
> +}
> +
>  if (x11->debug) {
>  syslog(LOG_DEBUG, "Sending guest screen resolutions to vdagentd:");
>  for (i = 0; i < screen_count; i++) {

Sounds reasonable.

Acked-by: Frediano Ziglio 

On the other hand looks like:
- a bug in Wayland X11 emulation. Why Xrandr function fails?
- partial. What happens to screen size? Does the mouse is limited
  in a different are (can you move it all around the screen?)
  Or maybe later another event with correct values arrives?

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


[Spice-devel] [PATCH] x11-randr: Fix typo in error message

2018-11-15 Thread Frediano Ziglio
The function name is XRRGetScreenSizeRange not RRGetScreenSizeRange.

Signed-off-by: Frediano Ziglio 
---
 src/vdagent/x11-randr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/vdagent/x11-randr.c b/src/vdagent/x11-randr.c
index c5fba51..be6a43a 100644
--- a/src/vdagent/x11-randr.c
+++ b/src/vdagent/x11-randr.c
@@ -120,7 +120,7 @@ static void update_randr_res(struct vdagent_x11 *x11, int 
poll)
   >randr.min_height,
   >randr.max_width,
   >randr.max_height) != 1) {
-syslog(LOG_ERR, "update_randr_res: RRGetScreenSizeRange failed");
+syslog(LOG_ERR, "update_randr_res: XRRGetScreenSizeRange failed");
 }
 }
 
-- 
2.17.2

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


[Spice-devel] [PATCH] udscs: Avoid file descriptor leak

2018-11-15 Thread Frediano Ziglio
If connection fails the socket descriptor is not closed causing
a leak.

Signed-off-by: Frediano Ziglio 
---
 src/udscs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/udscs.c b/src/udscs.c
index 62abc97..7fe74b9 100644
--- a/src/udscs.c
+++ b/src/udscs.c
@@ -119,6 +119,7 @@ struct udscs_connection *udscs_connect(const char 
*socketname,
 if (conn->debug) {
 syslog(LOG_DEBUG, "connect %s: %m", socketname);
 }
+close(conn->fd);
 g_free(conn);
 return NULL;
 }
-- 
2.17.2

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


Re: [Spice-devel] Feature suggestion: Port tunneling between VM & client over spice-channel

2018-11-15 Thread wangjiedong
Hi , I'm using spice web client because of your introduction.i have some 
questions to ask for help.


i configure webcocket with command "python2-websockify 5959 
192.168.84.203:5900" , then if i use url 
"http://192.168.84.203/spice-web-client/index.html?host=192.168.84.203=5959;,
 if failed with 

"Connection error. Please, close this window." , then if i configure js.run :

..

 app.run({
'callback': f,
'context': this,
'host': '192.168.84.203',
'port': 5959,
'protocol': getURLParameter('protocol') || 'ws',
..
then use url "http://192.168.84.203/spice-web-client/index.html;, it failed 
with "Could not open websocket at host 192.168.84.203. Websocket server may be 
down. Also your browser may not trust the certificate. If so, please instruct 
your browser to trust the certificate for 192.168.84.203 and try again to open 
console."


Is websocket proxy wrong ? or How can i use it successfully ? 



Thank you for help!___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice-gtk] channel-display-gst: Fix typo in comment

2018-11-15 Thread Frediano Ziglio
gstvideoooverlay -> gstvideooverlay

Signed-off-by: Frediano Ziglio 
---
 src/channel-display-gst.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index c909e206..2c07f350 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -424,7 +424,7 @@ static gboolean create_pipeline(SpiceGstDecoder *decoder)
 decoder->appsink = GST_APP_SINK(sink);
 } else {
 /* handle has received, it means playbin will render directly into
- * widget using the gstvideoooverlay interface instead of app-sink.
+ * widget using the gstvideooverlay interface instead of app-sink.
  * Also avoid using vaapisink if exist since vaapisink could be
  * buggy when it is combined with playbin. changing its rank to
  * none will make playbin to avoid of using it.
-- 
2.17.2

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


Re: [Spice-devel] [PATCH spice-gtk] channel-display-gst: Fix typo in comment

2018-11-15 Thread Victor Toso
On Thu, Nov 15, 2018 at 08:53:13AM +, Frediano Ziglio wrote:
> gstvideoooverlay -> gstvideooverlay
> 
> Signed-off-by: Frediano Ziglio 
Acked-by: Victor Toso 
> ---
>  src/channel-display-gst.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
> index c909e206..2c07f350 100644
> --- a/src/channel-display-gst.c
> +++ b/src/channel-display-gst.c
> @@ -424,7 +424,7 @@ static gboolean create_pipeline(SpiceGstDecoder *decoder)
>  decoder->appsink = GST_APP_SINK(sink);
>  } else {
>  /* handle has received, it means playbin will render directly into
> - * widget using the gstvideoooverlay interface instead of app-sink.
> + * widget using the gstvideooverlay interface instead of app-sink.
>   * Also avoid using vaapisink if exist since vaapisink could be
>   * buggy when it is combined with playbin. changing its rank to
>   * none will make playbin to avoid of using it.
> -- 
> 2.17.2
> 
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


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


Re: [Spice-devel] [PATCH spice-gtk v2] channel-display-mjpeg: Fix encoding for big endian machines

2018-11-15 Thread Frediano Ziglio
ping

> 
> Make sure components are ordered in the same way in memory.
> This was tested with a virtual MIPS machine.
> 
> Signed-off-by: Frediano Ziglio 
> ---
>  src/channel-display-mjpeg.c | 4 
>  1 file changed, 4 insertions(+)
> 
> Changes since v1:
> - fix typo in commit message title
> 
> diff --git a/src/channel-display-mjpeg.c b/src/channel-display-mjpeg.c
> index 83cd391b..94e56205 100644
> --- a/src/channel-display-mjpeg.c
> +++ b/src/channel-display-mjpeg.c
> @@ -108,7 +108,11 @@ static gboolean mjpeg_decoder_decode_frame(gpointer
> video_decoder)
>  
>  #ifdef JCS_EXTENSIONS
>  // requires jpeg-turbo
> +#  if SPICE_ENDIAN == SPICE_ENDIAN_LITTLE
>  decoder->mjpeg_cinfo.out_color_space = JCS_EXT_BGRX;
> +#  else
> +decoder->mjpeg_cinfo.out_color_space = JCS_EXT_XRGB;
> +#  endif
>  #else
>  #warning "You should consider building with libjpeg-turbo"
>  decoder->mjpeg_cinfo.out_color_space = JCS_RGB;
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-server] red-replay-qxl: Remove useless end of line

2018-11-15 Thread Frediano Ziglio
ping

> 
> spice_debug already add a end of line.
> 
> Signed-off-by: Frediano Ziglio 
> ---
>  server/red-replay-qxl.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
> index bd33b581..6958a495 100644
> --- a/server/red-replay-qxl.c
> +++ b/server/red-replay-qxl.c
> @@ -1289,7 +1289,7 @@ static void replay_handle_dev_input(QXLWorker *worker,
> SpiceReplay *replay,
>  // safe to ignore
>  break;
>  default:
> -spice_debug("unhandled %d\n", message);
> +spice_debug("unhandled %d", message);
>  }
>  }
>  
> @@ -1321,7 +1321,7 @@ SPICE_GNUC_VISIBLE QXLCommandExt*
> spice_replay_next_cmd(SpiceReplay *replay,
>  cmd = replay_malloc0(replay, sizeof(QXLCommandExt));
>  cmd->cmd.type = type;
>  cmd->group_id = 0;
> -spice_debug("command %"SCNu64", %d\r", timestamp, cmd->cmd.type);
> +spice_debug("command %"SCNu64", %d", timestamp, cmd->cmd.type);
>  switch (cmd->cmd.type) {
>  case QXL_CMD_DRAW:
>  cmd->flags = 0;
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel