Re: [Spice-devel] [PATCH v5 0/6] Implement record/replay

2015-08-21 Thread Jonathon Jongsma
ACK series with a couple minor comments on commit messages (patch #5 and #6) (sorry, one of my comments was on a v4 patch, I wasn't paying close enough attention) On Fri, 2015-08-21 at 09:46 +0100, Frediano Ziglio wrote: > With this series of patches is possible to record what happens to > spic

Re: [Spice-devel] [PATCH v5 6/6] Allow to specify a filter for record output

2015-08-21 Thread Jonathon Jongsma
So I thought you were going to remove this functionality after talking with marc-andre? Or did the alternate method end up not working? On Fri, 2015-08-21 at 09:46 +0100, Frediano Ziglio wrote: > This allows compressions using external programs or any type > of filters. Would be useful to specif

Re: [Spice-devel] [PATCH v4 5/6] server/tests/replay: introduce

2015-08-21 Thread Jonathon Jongsma
On Wed, 2015-08-19 at 15:39 +0100, Frediano Ziglio wrote: > From: Alon Levy > > usage: replay -p -c Update commit message for new executable name: usage: spice-server-relay -p ... > > will run the commands from cmdfile ignoring timestamps, right after a > connection is established from th

Re: [Spice-devel] [spice-protocol PATCH v2 00/10] building with clang

2015-08-21 Thread Frediano Ziglio
> From: "Victor Toso" > > Hey, > > On Fri, Aug 21, 2015 at 04:51:59AM -0400, Frediano Ziglio wrote: > > Patches looks good. > > There are only a small thing that puzzle me but if there are no objection > > I'll ack them. > > > > Looking at code after the changes using CAST macros you can see som

Re: [Spice-devel] [PATCH spice-gtk] session: update spice_session_connect() doc

2015-08-21 Thread Victor Toso
On Fri, Aug 21, 2015 at 08:28:10AM -0400, Frediano Ziglio wrote: > > > > Update the documentation about the return value, and how to watch for > > connection success. > > > > Releated to: > > https://bugzilla.redhat.com/show_bug.cgi?id=1253848 > > --- > > gtk/spice-session.c | 6 +- ^ it

Re: [Spice-devel] [PATCH spice-gtk] session: update spice_session_connect() doc

2015-08-21 Thread Marc-André Lureau
Hi - Original Message - > > > > Update the documentation about the return value, and how to watch for > > connection success. > > > > Releated to: > > https://bugzilla.redhat.com/show_bug.cgi?id=1253848 > > --- > > gtk/spice-session.c | 6 +- > > 1 file changed, 5 insertions(+), 1 d

Re: [Spice-devel] [spice-protocol PATCH v2 00/10] building with clang

2015-08-21 Thread Victor Toso
Hey, On Fri, Aug 21, 2015 at 04:51:59AM -0400, Frediano Ziglio wrote: > Patches looks good. > There are only a small thing that puzzle me but if there are no objection > I'll ack them. > > Looking at code after the changes using CAST macros you can see something > (mostly the same for all occurren

Re: [Spice-devel] [PATCH spice-gtk] session: update spice_session_connect() doc

2015-08-21 Thread Frediano Ziglio
> > Update the documentation about the return value, and how to watch for > connection success. > > Releated to: > https://bugzilla.redhat.com/show_bug.cgi?id=1253848 > --- > gtk/spice-session.c | 6 +- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/gtk/spice-session.c b/

Re: [Spice-devel] [PATCH spice-gtk] session: update spice_session_connect() doc

2015-08-21 Thread Victor Toso
Hey, On Fri, Aug 21, 2015 at 02:02:42PM +0200, Marc-André Lureau wrote: > Update the documentation about the return value, and how to watch for > connection success. > > Releated to: > https://bugzilla.redhat.com/show_bug.cgi?id=1253848 > --- > gtk/spice-session.c | 6 +- > 1 file changed, 5

[Spice-devel] [PATCH spice-gtk] session: update spice_session_connect() doc

2015-08-21 Thread Marc-André Lureau
Update the documentation about the return value, and how to watch for connection success. Releated to: https://bugzilla.redhat.com/show_bug.cgi?id=1253848 --- gtk/spice-session.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gtk/spice-session.c b/gtk/spice-session.c ind

[Spice-devel] Strange patch about image compression

2015-08-21 Thread Frediano Ziglio
Hi, I came to look close at this patch http://cgit.freedesktop.org/spice/spice/commit/?id=c914e96fb4de3ba8b2df174d7c7af8ff76af1081 I think the intention of the patch is to change the image compression from the client size. The strange thing is that is change the worker image_compression and

[Spice-devel] [PATCH] avoid to call red_get_streams_timout twice computing timeout

2015-08-21 Thread Frediano Ziglio
Due to how the MIN macro is defined the function was called twice unless the compiler could demonstrate that was returning the same value (which actually is impossible as function as clock_gettime are not deterministic). Signed-off-by: Frediano Ziglio --- server/red_worker.c | 9 + 1 fil

[Spice-devel] [PATCH] optimized SAME_PIXEL macro in glz code

2015-08-21 Thread Frediano Ziglio
SAME_PIXEL macro is used a lot for 32 bit images. On such configuration the macro can be optimized quite a lot reading and comparing the entire pixel instead of splitting the components and comparing one by one. Signed-off-by: Frediano Ziglio --- server/glz_encode_tmpl.c | 7 ++- 1 file chan

[Spice-devel] [PATCH 2/3] improve performances comparing image pixels

2015-08-21 Thread Frediano Ziglio
This patch contains a bit of small optimizations. It avoid booleans operations which could involve branches replacing with binary operations (equal/all_ident -> some_differences). The other optimization avoid the use of ABS. First the way the macro was used (with a large expression) was not easy to

[Spice-devel] [PATCH 1/3] use local variable to compute gradual score

2015-08-21 Thread Frediano Ziglio
Due to aliasing using pointers lead to some sub-optimization. Use local variable and then write them to output to improve performances. Signed-off-by: Frediano Ziglio --- server/red_bitmap_utils.h | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/server/red_bitmap

[Spice-devel] [PATCH 0/3] Small image optimization

2015-08-21 Thread Frediano Ziglio
Profiling reveals the some image computations are quite expensive. This small set of patches try to optimize gradual computation. Frediano Ziglio (3): use local variable to compute gradual score improve performances comparing image pixels optimize end of row check for images server/red_bit

[Spice-devel] [PATCH 3/3] optimize end of row check for images

2015-08-21 Thread Frediano Ziglio
Doing profiles reveals that the check for "is this pixel at end of row?" if ((cur_pix + 1 - lines) % width == 0) leads to 2 divisions, one to compute (cur_pix + 1 - lines) (divided by sizeof(*cur_pix) which could be 3) and one for (x % width). Although the substituted code looks more long is fa

[Spice-devel] [PATCH] constify some variable

2015-08-21 Thread Frediano Ziglio
Although minor change allows the compiler to do some possible code optimization. Signed-off-by: Frediano Ziglio --- server/main_channel.c | 4 ++-- server/red_channel.c| 6 +++--- server/red_dispatcher.c | 8 server/red_worker.c | 36 ++-- 4

[Spice-devel] [PATCH] remove unused SAME_PIXEL macro

2015-08-21 Thread Frediano Ziglio
Signed-off-by: Frediano Ziglio --- server/red_bitmap_utils.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/server/red_bitmap_utils.h b/server/red_bitmap_utils.h index 6d508a7..1c13ced 100644 --- a/server/red_bitmap_utils.h +++ b/server/red_bitmap_utils.h @@ -52,8 +52,6 @@ #define SAM

[Spice-devel] [PATCH] Avoid core calling spice_server_destroy

2015-08-21 Thread Frediano Ziglio
spice_server_destroy calls reds_exit which is called also at exit time (is registered with atexit) so avoid to keep dandling pointers. Signed-off-by: Frediano Ziglio --- server/reds.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/reds.c b/server/reds.c index c

[Spice-devel] [PATCH] remove wrong statement terminator from preprocessor macro

2015-08-21 Thread Frediano Ziglio
Actually not causing problems as when used is always followed by another terminator but better to fix the definition. Signed-off-by: Frediano Ziglio --- server/glz_encode_tmpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/glz_encode_tmpl.c b/server/glz_encode_tmpl.

[Spice-devel] [PATCH] Use MAX macro to compute the maximum value

2015-08-21 Thread Frediano Ziglio
Signed-off-by: Frediano Ziglio --- server/red_channel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/red_channel.c b/server/red_channel.c index f7aa3f7..3f40fab 100644 --- a/server/red_channel.c +++ b/server/red_channel.c @@ -2291,7 +2291,7 @@ uint32_t red_channel_ma

[Spice-devel] [PATCH] Validate correctly surfaces

2015-08-21 Thread Frediano Ziglio
Do not just give warning and continue to use an invalid index into an array. Signed-off-by: Frediano Ziglio --- server/red_worker.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/red_worker.c b/server/red_worker.c index e70c008..cd7fea4 100644 --- a/serv

[Spice-devel] [PATCH] prevent free setting same cursor in worker in red_set_cursor

2015-08-21 Thread Frediano Ziglio
Currently caller don't call red_set_cursor with cursor in worker->cursor but in theory is possible. Doing so could cause the cursor to be freed and than reused as initially the reference counter is 1 so object is freed but then attempted to be used again. Incrementing the reference counter before t

[Spice-devel] [PATCH] prevent integer overflow on 32 bit

2015-08-21 Thread Frediano Ziglio
On 32 bit machine timespec->tv_sec (time_t) is 32 bit. Also 1000 * 1000 * 1000 is 32 bit. The multiplication 32 x 32 lead to a 32 bit however this can overflow. Convert the first factor to 64 bit before multiply solve the issue. Signed-off-by: Frediano Ziglio --- server/red_worker.c | 2 +- 1 fi

Re: [Spice-devel] [spice-protocol PATCH v2 00/10] building with clang

2015-08-21 Thread Frediano Ziglio
Patches looks good. There are only a small thing that puzzle me but if there are no objection I'll ack them. Looking at code after the changes using CAST macros you can see something (mostly the same for all occurrences) *SPICE_ALIGNED_CAST(uint32_t, compressed_lines) = htonl(enc_size); Just

[Spice-devel] [PATCH v5 5/6] server/tests/replay: introduce

2015-08-21 Thread Frediano Ziglio
From: Alon Levy usage: replay -p -c will run the commands from cmdfile ignoring timestamps, right after a connection is established from the client, and will SIGINT the client on end of cmdfile, and exit itself after waiting for the client. spicy-stats from spice-gtk is useful for testing, i

[Spice-devel] [PATCH v5 3/6] server/red_{record, replay}.[ch]: introduce

2015-08-21 Thread Frediano Ziglio
From: Alon Levy Currently hand crafted with some sed scripts and alot of vim macros from red_parse_qxl after considering the logger in qemu/hw/qxl-logger.c and seeing it was incomplete. The only problem with logging from the server and not from qemu is that it requires coordinated shutdown to avo

[Spice-devel] [PATCH v5 1/6] tests: use glib main loop

2015-08-21 Thread Frediano Ziglio
From: Marc-André Lureau --- server/tests/Makefile.am| 2 + server/tests/basic_event_loop.c | 285 ++-- 2 files changed, 97 insertions(+), 190 deletions(-) diff --git a/server/tests/Makefile.am b/server/tests/Makefile.am index 8b08d1c..a52ad59 100644

[Spice-devel] [PATCH v5 2/6] server/dispatcher: add extra_dispatcher, hack for red_record

2015-08-21 Thread Frediano Ziglio
From: Alon Levy Signed-off-by: Alon Levy --- server/dispatcher.c | 10 ++ server/dispatcher.h | 12 2 files changed, 22 insertions(+) diff --git a/server/dispatcher.c b/server/dispatcher.c index 298f5f9..d6c03ca 100644 --- a/server/dispatcher.c +++ b/server/dispatcher.c @@

[Spice-devel] [PATCH v5 4/6] server/red_worker: record to SPICE_WORKER_RECORD_FILENAME

2015-08-21 Thread Frediano Ziglio
From: Alon Levy if the environment variable in the title is set and can be opened for writing a log of all display commands (no cursor commands yet) and any QXLWorker calls (particularily primary create and destroy) will be logged to that file, and possible to replay using the replay utility intr

[Spice-devel] [PATCH v5 0/6] Implement record/replay

2015-08-21 Thread Frediano Ziglio
With this series of patches is possible to record what happens to spice-server and replay it. The main purpose is debugging. These are part of a long series of patches. Started playing with it quite a lot and are very useful for profiling and debugging. Actually valgrind shows some leaks due to a

[Spice-devel] [PATCH v5 6/6] Allow to specify a filter for record output

2015-08-21 Thread Frediano Ziglio
This allows compressions using external programs or any type of filters. Signed-off-by: Frediano Ziglio --- server/red_record_qxl.c | 50 + server/red_record_qxl.h | 2 ++ server/red_worker.c | 2 +- 3 files changed, 53 insertions(+), 1 delet