pve-spiceterm/spice/ChangeLog
Valery Inozemtsev b52ad4743d 3.0.4-alt1
- 3.0-4
2017-07-19 09:15:26 +00:00

12184 lines
473 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

2016-07-13 Frediano Ziglio <fziglio@redhat.com>
worker: don't process drawable if it can't be allocated
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
(cherry picked from commit 63b8ea5afba5c6eb1b9825b06f2006930c318aed)
2016-07-13 Marc-André Lureau <marcandre.lureau@gmail.com>
worker: remove assertion on alloc_drawable
There is no guarantee in the code that this can't be hit, so we should
cope with it (the condition can be reached easily by running the server
without waiting for blocked clients or pipe size)
The following commit will attempt to address this.
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
(cherry picked from commit 5c7e248445f95c3fa2627532780950cf604b9e20)
2016-07-08 Christophe Fergeau <cfergeau@redhat.com>
Update NEWS for 0.12.8 release
2016-07-07 Marc-Andre Lureau <marcandre.lureau@redhat.com>
smartcard: allocate msg with the expected size
This is related to CVE-2016-0749
==529== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60040009c098 at pc 0x7fffee0eda6d bp 0x7fffffffcd00 sp 0x7fffffffccf0
WRITE of size 4 at 0x60040009c098 thread T0
#0 0x7fffee0eda6c in smartcard_char_device_notify_reader_add /home/elmarco/pkg/spice/spice-0.12.4/server/smartcard.c:334
#1 0x7fffee0ef783 in smartcard_add_reader /home/elmarco/pkg/spice/spice-0.12.4/server/smartcard.c:642
#2 0x7fffee0f0568 in smartcard_channel_handle_message /home/elmarco/pkg/spice/spice-0.12.4/server/smartcard.c:757
#3 0x7fffee032f3f in red_peer_handle_incoming /home/elmarco/pkg/spice/spice-0.12.4/server/red_channel.c:304
#4 0x7fffee033216 in red_channel_client_receive /home/elmarco/pkg/spice/spice-0.12.4/server/red_channel.c:322
#5 0x7fffee03bf1f in red_channel_client_event /home/elmarco/pkg/spice/spice-0.12.4/server/red_channel.c:1561
#6 0x555555c3c53d in qemu_iohandler_poll /home/elmarco/src/qemu/iohandler.c:143
#7 0x555555c3b800 in main_loop_wait /home/elmarco/src/qemu/main-loop.c:504
#8 0x5555556f160c in main_loop /home/elmarco/src/qemu/vl.c:1818
#9 0x5555556f160c in main /home/elmarco/src/qemu/vl.c:4394
#10 0x7fffed80eb14 in __libc_start_main /usr/src/debug/glibc-2.17-c758a686/csu/libc-start.c:274
#11 0x5555556f9c20 in _start (/home/elmarco/src/qemu/x86_64-softmmu/qemu-system-x86_64+0x1a5c20)
0x60040009c098 is located 0 bytes to the right of 8-byte region [0x60040009c090,0x60040009c098)
allocated by thread T0 here:
#0 0x7ffff4e612be in __interceptor_realloc /usr/src/debug/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/x86_64-redhat-linux/libsanitizer/asan/../../../../libsanitizer/asan/asan_malloc_linux.cc:92
#1 0x7fffee121308 in spice_realloc /home/elmarco/pkg/spice/spice-0.12.4/spice-common/common/mem.c:123
#2 0x7fffee004a48 in __spice_char_device_write_buffer_get /home/elmarco/pkg/spice/spice-0.12.4/server/char_device.c:516
#3 0x7fffee004e87 in spice_char_device_write_buffer_get /home/elmarco/pkg/spice/spice-0.12.4/server/char_device.c:557
#4 0x7fffee0ed8b9 in smartcard_char_device_notify_reader_add /home/elmarco/pkg/spice/spice-0.12.4/server/smartcard.c:325
#5 0x7fffee0ef783 in smartcard_add_reader /home/elmarco/pkg/spice/spice-0.12.4/server/smartcard.c:642
#6 0x7fffee0f0568 in smartcard_channel_handle_message /home/elmarco/pkg/spice/spice-0.12.4/server/smartcard.c:757
#7 0x7fffee032f3f in red_peer_handle_incoming /home/elmarco/pkg/spice/spice-0.12.4/server/red_channel.c:304
#8 0x7fffee033216 in red_channel_client_receive /home/elmarco/pkg/spice/spice-0.12.4/server/red_channel.c:322
#9 0x7fffee03bf1f in red_channel_client_event /home/elmarco/pkg/spice/spice-0.12.4/server/red_channel.c:1561
#10 0x555555c3c53d in qemu_iohandler_poll /home/elmarco/src/qemu/iohandler.c:143
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/elmarco/pkg/spice/spice-0.12.4/server/smartcard.c:334 smartcard_char_device_notify_reader_add
smartcard: add a ref to item before adding to pipe
There is an unref when the message is sent.
This is related to CVE-2016-0749
==17204== ERROR: AddressSanitizer: heap-use-after-free on address 0x6008000144a8 at pc 0x7fffee0ce245 bp 0x7fffffffc630 sp 0x7fffffffc620
READ of size 4 at 0x6008000144a8 thread T0
#0 0x7fffee0ce244 in smartcard_unref_vsc_msg_item /home/elmarco/src/spice/spice/server/smartcard.c:608
#1 0x7fffee0cb451 in smartcard_unref_msg_to_client /home/elmarco/src/spice/spice/server/smartcard.c:178
#2 0x7fffedfcdf14 in spice_char_device_read_from_device /home/elmarco/src/spice/spice/server/char-device.c:330
#3 0x7fffedfd1763 in spice_char_device_wakeup /home/elmarco/src/spice/spice/server/char-device.c:901
#4 0x7fffee05da98 in spice_server_char_device_wakeup /home/elmarco/src/spice/spice/server/reds.c:2990
#5 0x55555593fa34 in spice_chr_write /home/elmarco/src/qemu/spice-qemu-char.c:189
#6 0x5555559375f1 in qemu_chr_fe_write /home/elmarco/src/qemu/qemu-char.c:220
#7 0x555555b3b682 in ccid_card_vscard_send_msg.isra.2 /home/elmarco/src/qemu/hw/usb/ccid-card-passthru.c:76
#8 0x555555b3c466 in ccid_card_vscard_send_error /home/elmarco/src/qemu/hw/usb/ccid-card-passthru.c:91
#9 0x555555b3c466 in ccid_card_vscard_handle_message /home/elmarco/src/qemu/hw/usb/ccid-card-passthru.c:242
#10 0x555555b3c466 in ccid_card_vscard_read /home/elmarco/src/qemu/hw/usb/ccid-card-passthru.c:289
#11 0x55555593f169 in vmc_write /home/elmarco/src/qemu/spice-qemu-char.c:41
#12 0x7fffedfcee6d in spice_char_device_write_to_device /home/elmarco/src/spice/spice/server/char-device.c:477
#13 0x7fffedfcfd31 in spice_char_device_write_buffer_add /home/elmarco/src/spice/spice/server/char-device.c:629
#14 0x7fffee0ce9df in smartcard_channel_write_to_reader /home/elmarco/src/spice/spice/server/smartcard.c:675
#15 0x7fffee0cc7db in smartcard_char_device_notify_reader_add /home/elmarco/src/spice/spice/server/smartcard.c:341
#16 0x7fffee0ce4f3 in smartcard_add_reader /home/elmarco/src/spice/spice/server/smartcard.c:648
#17 0x7fffee0cf2e2 in smartcard_channel_handle_message /home/elmarco/src/spice/spice/server/smartcard.c:763
#18 0x7fffedffe21f in red_peer_handle_incoming /home/elmarco/src/spice/spice/server/red-channel.c:307
#19 0x7fffedffe4f6 in red_channel_client_receive /home/elmarco/src/spice/spice/server/red-channel.c:325
#20 0x7fffee00726c in red_channel_client_event /home/elmarco/src/spice/spice/server/red-channel.c:1566
#21 0x555555c3c53d in qemu_iohandler_poll /home/elmarco/src/qemu/iohandler.c:143
#22 0x555555c3b800 in main_loop_wait /home/elmarco/src/qemu/main-loop.c:504
#23 0x5555556f160c in main_loop /home/elmarco/src/qemu/vl.c:1818
#24 0x5555556f160c in main /home/elmarco/src/qemu/vl.c:4394
#25 0x7fffed7d0b14 in __libc_start_main /usr/src/debug/glibc-2.17-c758a686/csu/libc-start.c:274
#26 0x5555556f9c20 in _start (/home/elmarco/src/qemu/x86_64-softmmu/qemu-system-x86_64+0x1a5c20)
0x6008000144a8 is located 24 bytes inside of 40-byte region [0x600800014490,0x6008000144b8)
freed by thread T0 here:
#0 0x7ffff4e61009 in __interceptor_free /usr/src/debug/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/x86_64-redhat-linux/libsanitizer/asan/../../../../libsanitizer/asan/asan_malloc_linux.cc:61
#1 0x7fffee0ce2a1 in smartcard_unref_vsc_msg_item /home/elmarco/src/spice/spice/server/smartcard.c:610
#2 0x7fffee0cdd58 in smartcard_channel_release_pipe_item /home/elmarco/src/spice/spice/server/smartcard.c:548
#3 0x7fffee000668 in red_channel_client_release_item /home/elmarco/src/spice/spice/server/red-channel.c:602
#4 0x7fffee0006ef in red_channel_client_release_sent_item /home/elmarco/src/spice/spice/server/red-channel.c:609
#5 0x7fffee0007b5 in red_channel_peer_on_out_msg_done /home/elmarco/src/spice/spice/server/red-channel.c:620
#6 0x7fffedffed7e in red_peer_handle_outgoing /home/elmarco/src/spice/spice/server/red-channel.c:385
#7 0x7fffee0057bb in red_channel_client_send /home/elmarco/src/spice/spice/server/red-channel.c:1294
#8 0x7fffee0076e6 in red_channel_client_begin_send_message /home/elmarco/src/spice/spice/server/red-channel.c:1605
#9 0x7fffee0cdccd in smartcard_channel_send_item /home/elmarco/src/spice/spice/server/smartcard.c:541
#10 0x7fffee000570 in red_channel_client_send_item /home/elmarco/src/spice/spice/server/red-channel.c:588
#11 0x7fffee005bfb in red_channel_client_push /home/elmarco/src/spice/spice/server/red-channel.c:1347
#12 0x7fffee007ef7 in red_channel_client_pipe_add_push /home/elmarco/src/spice/spice/server/red-channel.c:1673
#13 0x7fffee0cde4d in smartcard_channel_client_pipe_add_push /home/elmarco/src/spice/spice/server/smartcard.c:571
#14 0x7fffee0cb567 in smartcard_send_msg_to_client /home/elmarco/src/spice/spice/server/smartcard.c:187
#15 0x7fffedfcdba2 in spice_char_device_send_msg_to_clients /home/elmarco/src/spice/spice/server/char-device.c:282
#16 0x7fffedfcdea4 in spice_char_device_read_from_device /home/elmarco/src/spice/spice/server/char-device.c:329
#17 0x7fffedfd1763 in spice_char_device_wakeup /home/elmarco/src/spice/spice/server/char-device.c:901
#18 0x7fffee05da98 in spice_server_char_device_wakeup /home/elmarco/src/spice/spice/server/reds.c:2990
#19 0x55555593fa34 in spice_chr_write /home/elmarco/src/qemu/spice-qemu-char.c:189
2016-07-01 Frediano Ziglio <fziglio@redhat.com>
improve primary surface parameter checks
Primary surface, as additional surfaces, can be used to access
host memory from the guest using invalid parameters.
The removed warning is not enough to prevent all cases. Also a warning
is not enough to stop an escalation to happen.
The red_validate_surface do different checks to make sure surface
request is valid and not cause possible buffer/integer overflows:
- format is valid;
- width is not large to cause overflow compared to stride;
- stride is not -2^31 (a number which negate is still <0);
- stride * height does not overflow.
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1312980.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
factor out red_validate_surface function to validate surface parameters
Make possible to reuse it outside red-parse-qxl.c.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-04-14 Christophe Fergeau <cfergeau@redhat.com>
Revert "Set TCP_KEEPINTVL when enabling TCP keepalive"
This reverts commit 3336d892c3d8647868423300905e5cad67de1db1.
This was NACK'ed for the master branch, but was pushed by mistake to the
0.12 branch
Update NEWS file for 0.12.7
Update libtool versioning for 0.12.7 release
Update spice-common
Revert spice-protocol/codegen changes.
This was causing build failures when trying to compile an older spice-server
release against a newer spice-protocol release with new message/channel
additions
spice-common changes this brings in:
Christophe Fergeau (2):
proto: Rename image_compress to image_compression
proto: Use proper type for preferred_compression field
Marc-André Lureau (1):
Revert "Remove files moved to spice-protocol"
2016-04-14 Frediano Ziglio <fziglio@redhat.com>
red-channel: make red_client_{ref,unref} thread safe
These function are called on both sides of dispatcher so the
increment/decrement of the counter is done in multiple threads.
This caused the counter to not get incremented correctly and
freed the structure too early, leaving a dangling pointer in
the other thread.
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1253375.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-29 Frediano Ziglio <fziglio@redhat.com>
memslot: do not crash if guest provide a wrong address
This could happen with buggy driver.
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1264356
Acked-by: Pavel Grunt <pgrunt@redhat.com>
channel: do not free rcc->stream in red_channel_client_disconnect
This fixes a crash if red_channel_client disconnect is called
handling a message.
This can happen for instance while handling SPICE_MSGC_ACK which calls
red_channel_client_push which tries to detect write errors while writing
to a socket (for instance socket disconnection).
Messages are read in a loop and red_channel_client_disconnect would
cause rcc->stream to be NULL which will result in a use-after-free
problem (stream in red_peer_handle_incoming will use cached stream value).
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-10 Christophe Fergeau <cfergeau@redhat.com>
Set TCP_KEEPINTVL when enabling TCP keepalive
Otherwise we are only changing the timeout before the first keepalive
probe is sent.
Remove spice_server_set_keepalive_timeout
This public API is no longer needed as the keepalive interval does not
need to be configurable. This API was never in a stable 0.12 release, so
it's OK to remove it now.
Always enable TCP keepalive
Always enabled, hardcoded interval
as per https://bugzilla.redhat.com/show_bug.cgi?id=1298590
2016-01-13 Christophe Fergeau <cfergeau@redhat.com>
Update spice-common
This fixes a compilation problem on EL6. git shortlog of the
spice-common changes brought in by the submodule update:
Christophe Fergeau (2):
m4: Fix SPICE_WARNING on el6
test: Use _LDADD rather than _LDFLAGS
Frediano Ziglio (1):
ring: use NULL instead of 0 for null pointers
Lukas Venhoda (9):
pixman_utils: Add macros for color byte ordering
pixman_utils: Use PIXMAN_LE_ constants in spice_bitmap_try_as_pixman()
ppc: Add support for bigendian color byte order
ppc: Fix colors on ppc when using QUIC
ppc: Fix colors on ppc when using LZ
ppc: Fix colors on ppc when using LZ4
ppc: Fix colors on ppc when using jpeg
ppc: Fix alpha state checking on BE machines
Remove trailing whitespace
Pavel Grunt (1):
m4: Add macro for --with-sasl
Victor Toso (1):
Remove headers that are included in spice_common.h
Update NEWS for 0.12.7 release
spicevmc: Drop unsent data on client disconnection
When redirecting a USB webcam over a slow link, it's currently possible
to hit an assertion in spice-server by running cheese (application using
the webcam), killing the client with ctrl+c and then restarting the
client:
qemu-kvm: spicevmc.c:324: spicevmc_red_channel_alloc_msg_rcv_buf:
Assertion `!state->recv_from_client_buf' failed.
This happens when red_peer_handle_incoming tries to allocate memory for
a message using spicevmc:
handler->msg = handler->cb->alloc_msg_buf(handler->opaque, msg_type,
msg_size);
red_peer_handle_incoming() is called when there is client data to be
read, and does
- call alloc_msg_buf() to allocate memory for the message
- read the message
- if the read was partial, return early, the main loop will call again
red_peer_handle_incoming() when there is more data available for that
channel
- parse the message
- call release_msg_buf() to free the message
For channels based on spicevmc (usbredir and port), alloc_msg_buf()
stores message data in SpiceVmcState::recv_from_client_buf and before
allocating new memory, it asserts that it's NULL.
This is what causes this crash in the following scenario:
- SpiceVmc::alloc_msg_buf() is called and allocates memory for a new
message in SpiceVmcState::recv_from_client_buf
- red_peer_handle_incoming() returns early as all the spicevmc message
data hasn't been received yet
- the client gets killed
- the main channel notices the disconnect and calls
main_dispatcher_client_disconnect() which will disconnect all the
channels
- SpiceVmc::on_disconnect is called
- after the new client connects, SpiceVmc::alloc_msg_buf() is called,
notices that SpiceVmcState::recv_from_client_buf is already set, and
asserts()
This commit makes sure the partial SpiceVmcState::recv_from_client_buf
data is cleared on disconnect so that the assert does not trigger.
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1264113
2016-01-13 Frediano Ziglio <fziglio@redhat.com>
pass proper type to SPICE_CONTAINEROF
In some case the member specified to SPICE_CONTAINEROF was not
exactly the same type of the pointer passed.
This can cause issues if structure changes so use proper member.
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-01-13 Sunny Shin <sunny4s.git@gmail.com>
channel: add option tcp keepalive timeout to channels
2016-01-13 Francois Gouget <fgouget@codeweavers.com>
server: Fix conversions between QXLPHYSICAL and pointers
This avoids compilation errors with -Werror on 32 bit systems as the
pointer size differs from that of a QXLPHYSICAL.
server: Simplify the next chunk initialization in red_replay_data_chunks()
server: Fix a pointer to uint64_t cast in spice_replay_next_cmd()
This avoids a compilation error with -Werror on 32 bit systems as the
pointer size differs from that of an uint64_t.
server: Use '%zu' to print size_t variables
The size_t definition is different between 32 and 64 bit systems so that
neither '%u' nor '%lu' work for both. '%zu' should be used instead.
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
server: Use PRI macros in printf for 32/64 bit compatibility
Some integer type definitions are different between 32 and 64 bit
systems which causes problems in printf. The PRI macros automatically
provide the printf format appropriate for the system.
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-01-13 Victor Toso <victortoso@redhat.com>
spicevmc: set state of DeviceInstance to NULL
After spice_char_device_state_destroy is called spicevmc should not keep
reference to that memory. state->chardev_st and sin->st point to the
same SpiceCharDeviceState and both should be set to NULL when it is
destroyed.
char-device: set to NULL freed pointers on destroy
As SpiceCharDeviceState is only unref'ed on
spice_char_device_state_destroy the same device could be destroyed more
then once so the pointers that are freed should be set to NULL.
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1281455
char-device: free all memory pool when no clients
When no client is connect we should not need to keep the memory pool
used by char-device. In most situations this is not significant but
when using webdav this could mean freeing MAX_POOL_SIZE bytes
Related: https://bugs.freedesktop.org/show_bug.cgi?id=91350
char-device: Define a memory pool limit
Otherwise the amount of unused memory could grow while transfering big
chunks of data. This change only means that once the memory was used it
will not be stored again after the limit was reached.
Related: https://bugs.freedesktop.org/show_bug.cgi?id=91350
char-device: fix usage of free/unref on WriteBuffer
There are places were the could should definetly free the
SpiceCharDeviceWriteBuffer and places that it should only unref it. The
current use of spice_char_device_write_buffer_free was missleading.
This patch creates the spice_char_device_write_buffer_unref and properly
call these two functions.
Related: https://bugs.freedesktop.org/show_bug.cgi?id=91350
2016-01-13 Lukas Venhoda <lvenhoda@redhat.com>
dcc: Don't disconnect channel, when compression is not supported
Don't disconnect the display channel, when unsupported compression is
requested from the client. Not changing the compression is enough.
https://bugs.freedesktop.org/show_bug.cgi?id=92821
Acked-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-07 Pavel Grunt <pgrunt@redhat.com>
spicevmc: Return early when instance has no device state
Same approach as in spice_server_char_device_wakeup().
Avoid segmentation fault when the webdav channel (spice port channel) is
used with the vnc display:
#0 0x00007ffff7aab734 in spice_char_device_state_opaque_get (dev=0x0)
at char_device.c:720
#1 0x00007ffff7b0850c in spice_server_port_event (sin=<optimized out>, event=<optimized out>) at spicevmc.c:578
#2 0x0000555555787ba4 in set_guest_connected (port=<optimized out>, guest_connected=1) at hw/char/virtio-console.c:89
#3 0x0000555555678d7c in control_out (len=<optimized out>, buf=0x55555775c3a0, vser=0x5555578d1540) at /home/pgrunt/RH/qemu/hw/char/virtio-serial-bus.c:404
#4 0x0000555555678d7c in control_out (vdev=0x5555578d1540, vq=0x555557941bc8)
at /home/pgrunt/RH/qemu/hw/char/virtio-serial-bus.c:441
#5 0x000055555588eb98 in aio_dispatch (ctx=0x5555562e1a50) at aio-posix.c:160
#6 0x00005555558829ee in aio_ctx_dispatch (source=<optimized out>, callback=<optimized out>, user_data=<optimized out>) at async.c:226
#7 0x00007ffff2010e3a in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
#8 0x000055555588d8fb in main_loop_wait () at main-loop.c:211
#9 0x000055555588d8fb in main_loop_wait (timeout=<optimized out>)
at main-loop.c:256
#10 0x000055555588d8fb in main_loop_wait (nonblocking=<optimized out>)
at main-loop.c:504
#11 0x000055555561b664 in main () at vl.c:1891
reds: Do not abort due to wrong header
Just prevent the buggy client from connecting.
#0 0x00007fffe83b2a98 in raise () at /lib64/libc.so.6
#1 0x00007fffe83b469a in abort () at /lib64/libc.so.6
#2 0x00007ffff7b1533d in spice_logv (log_domain=0x7ffff7b87226 "Spice", log_level=SPICE_LOG_LEVEL_ERROR, strloc=0x7ffff7b92aba "reds.c:1373", function=0x7ffff7b94f40 <__FUNCTION__.31775> "reds_send_link_ack", format=0x7ffff7b871fe "assertion `%s' failed", args=args@entry=0x7fffffffcb68) at log.c:109
#3 0x00007ffff7b15468 in spice_log (log_domain=log_domain@entry=0x7ffff7b87226 "Spice", log_level=log_level@entry=SPICE_LOG_LEVEL_ERROR, strloc=strloc@entry=0x7ffff7b92aba "reds.c:1373", function=function@entry=0x7ffff7b94f40 <__FUNCTION__.31775> "reds_send_link_ack", format=format@entry=0x7ffff7b871fe "assertion `%s' failed") at log.c:123
#4 0x00007ffff7aee335 in reds_handle_read_link_done (link=0x555556b27c70)
at reds.c:1373
#5 0x00007ffff7aee335 in reds_handle_read_link_done (opaque=0x555556b27c70)
at reds.c:2139
#6 0x000055555588acc6 in qemu_iohandler_poll ()
#7 0x000055555588a8e1 in main_loop_wait ()
#8 0x0000555555614064 in main ()
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1281442
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-07 Marc-André Lureau <mlureau@redhat.com>
build-sys: disable static lib by default
It's not used in general, so no need to build it by default.
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-07 Christophe Fergeau <cfergeau@redhat.com>
build: Remove unused SPICEC_STATIC_LINKAGE_BSTATIC
A left-over from the client code.
2016-01-07 Frediano Ziglio <fziglio@redhat.com>
replay: better help for -s option
-s accepts an option to delay command queueing.
Acked-by: Marc-André Lureau <mlureau@redhat.com>
2015-12-14 Jeremy White <jwhite@codeweavers.com>
Flush display commands before validating the surface.
This fixes a display glitch in xspice which is caused when
a surface create is queued, but then a direct call to update
the area is issued. Unless we flush the queue, the surface
does not exist, and we fail.
2015-12-11 Frediano Ziglio <fziglio@redhat.com>
dcc: do not cause problem with multiple threads.
With multiple cards configured you can have multiple workers running in
different thread.
With such configuration static variables not syncronized could lead
to undefined behavior.
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-12-11 Marc-André Lureau <marcandre.lureau@gmail.com>
smartcard: include libcacard.h if possible
Add travis CI file
2015-12-11 Christophe Fergeau <cfergeau@redhat.com>
Update spice-common
shortlog for the spice-common changes this brings in:
Christophe Fergeau (3):
build-sys: Add missing # to comment
ssl-verify: Handle NULL return from g_inet_address_new_from_string()
ssl-verify: Don't leak GInetAddress
Francois Gouget (3):
build-sys: Add the SPICE_WARNING() and SPICE_PRINT_MESSAGES m4 macros
build-sys: Add SPICE_CHECK_GSTREAMER()
build-sys: Add SPICE_CHECK_GSTREAMER_ELEMENTS()
Lukas Venhoda (1):
canvas_base: Remove redundant switch case block
Marc-André Lureau (2):
Fix make distcheck
Use new libcacard.h if possible
build-sys: Adjust to new spice-common spice-deps.m4
This commit also updates the spice-common submodule
Christophe Fergeau (7):
Add marshaller test case
build-sys: Use ${PKG_CONFIG} rather than pkg-config
build-sys: Rework SPICE_CHECK_* m4 macros
build-sys: Add gio-2.0 to SPICE_CHECK_GLIB2
build-sys: Fix error in SPICE_CHECK_LZ4 description
build-sys: Set automake conditional in SPICE_CHECK_SMARTCARD
build-sys: Rename SUPPORT_GL to HAVE_GL
Javier Celaya (1):
Fix linearization of several marshallers with one item
Lukas Venhoda (3):
ssl-verify: Only check addr length when using IP addr
m4: Require glib version >= 2.22
ssl-verify: Changed IPv4 hostname to IPv6
2015-12-11 Frediano Ziglio <fziglio@redhat.com>
remove small leak in MJPEG code
cinfo.dest is allocated in spice_jpeg_mem_dest but never freed.
Note that jpeg_destroy_compress does not free this field as is
supposed to be a buffer provided by jpeg caller.
2015-12-11 Christophe Fergeau <cfergeau@redhat.com>
Add missing license headers
syntax-check: Exclude png files from sc_prohibit_empty_lines_at_EOF
syntax-check: Clean-up exception rules
Some files no longer exists, some exceptions are no longer needed, ...
syntax-check: Remove unused #include <strings.h>
syntax-check: Add missing #include <config.h>
syntax-check: Don't use tabs for indentation
syntax-check: Exclude red_replay_qxl.c from sc_cast_of_argument_to_free
red_replay_qxl.c stores some pointers QXLPHYSICAL data members (ie
uint64_t), and then needs to free them, so the cast is required.
syntax-check: Ignore .png files in sc_trailing_blank test
syntax-check: manual: Remove duplicate word
syntax-check: Add missing AUTHORS
2015-12-11 snir sheriber <ssheribe@redhat.com>
fix spelling mistakes in comments (reseting to resetting & dummym to dummy)
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-12-11 Jeremy White <jwhite@codeweavers.com>
Update the .gitignore files for the new manual, for a few newly generated tests, and for the spice-server.h.
2015-10-12 Frediano Ziglio <fziglio@redhat.com>
Simplify pointer computation
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-10-07 Christophe Fergeau <cfergeau@redhat.com>
build-sys: Remove client check from configure.ac
configure.ac is checking for pyparsing availability if
client/generated_marshallers.cpp is missing. The client/ code is gone, and
the python modules checks are done in spice-common/configure.ac
nowadays, so we can get rid of this check.
2015-10-06 Frediano Ziglio <fziglio@redhat.com>
build-sys: bump libtool version information
As one interface was added bump the version and put a comment to avoid
too much updates.
2015-10-06 Christophe Fergeau <cfergeau@redhat.com>
Mention the 2 recently fixed CVEs in NEWS
2015-10-06 Frediano Ziglio <fziglio@redhat.com>
Prevent leak if size from red_get_data_chunks don't match in red_get_image
Prevent data_size to be set independently from data
There was not check for data_size field so one could set data to
a small set of data and data_size much bigger than size of data
leading to buffer overflow.
Avoid race condition copying segments in red_get_path
The guest can attempt to increase the number of segments while
spice-server is reading them.
Make sure we don't copy more then the allocated segments.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Make sure we can read QXLPathSeg structures
start pointer points to a QXLPathSeg structure.
Before reading from the structure, make sure the structure is contained
in the memory range checked.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Fix some possible overflows in red_get_string for 32 bit
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Prevent DoS from guest trying to allocate too much data on host for chunks
Limit number of chunks to a given amount to avoid guest trying to
allocate too much memory. Using circular or nested chunks lists
guest could try to allocate huge amounts of memory.
Considering the list can be infinite and guest can change data this
also prevents strange security attacks from guest.
Prevent memory leak if red_get_data_chunks_ptr fails
Free linked list if client tries to do nasty things
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Fix race condition in red_get_data_chunks_ptr
Do not read multiple times data from guest as this can be changed by
other guest vcpus. This causes races and security problems if these
data are used for buffer allocation or checks.
Actually, the 'data' member can't change during read as it is just a
pointer to a fixed array contained in qxl. However, this change will
make it clear that there can be no race condition.
Fix integer overflow computing glyph_size in red_get_string
If bpp is int the formula can lead to weird overflows. width and height
are uint16_t so the formula is:
size_t = u16 * (u16 * int + const_int) / const_int;
so it became
size_t = (int) u16 * ((int) u16 * int + const_int) / const_int;
However the (int) u16 * (int) u16 can then became negative to overflow.
Under 64 bit architectures size_t is 64 and int usually 32 so converting
this negative 32 bit number to a unsigned 64 bit lead to a very big
number as the signed is extended and then converted to unsigned.
Using unsigned arithmetic prevent extending the sign.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Fix race condition in red_get_string
Do not read multiple time an array size that can be changed.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Fix race in red_get_image
Do not read multiple times data from guest as this could be changed
by other vcpu threads.
This causes races and security problems if these data are used for
buffer allocation or checks.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Fix race condition on red_get_clip_rects
Do not read multiple time an array size that can be changed.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Prevent 32 bit integer overflow in bitmap_consistent
The overflow may lead to buffer overflow as the row size computed from
width (bitmap->x) can be bigger than the size in bytes (bitmap->stride).
This can make spice-server accept the invalid sizes.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Fix buffer reading overflow
Not security risk as just for read.
However, this could be used to attempt integer overflows in the
following lines.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Check properly surface to be created
Check format is valid.
Check stride is at least the size of required bytes for a row.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
Fix some integer overflow causing large memory allocations
Prevent integer overflow when computing image sizes.
Image index computations are done using 32 bit so this can cause easily
security issues. MAX_DATA_CHUNK is larger than the virtual
card limit, so this is not going to cause change in behaviours.
Comparing size calculation results with MAX_DATA_CHUNK will allow us to
catch overflows.
Prevent guest from allocating large amount of memory.
Define a constant to limit data from guest.
This limit will prevent guest trying to do nasty things and DoS to host.
worker: avoid double free or double create of surfaces
A driver can overwrite surface state creating a surface with the same
id of a previous one.
Also can try to destroy surfaces that are not created.
Both requests cause invalid internal states that could lead to crashes
or memory corruptions.
worker: validate correctly surfaces
Do not just give warning and continue to use an invalid index into
an array.
Resolves: CVE-2015-5260
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-10-05 Marc-André Lureau <marcandre.lureau@gmail.com>
worker: make it clear it returns from process when no cmd
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-10-02 Marc-André Lureau <marcandre.lureau@gmail.com>
server: remove useless includes
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-10-01 Christophe Fergeau <cfergeau@redhat.com>
manual: Fix Arnon last name
It's "Gilboa", not "Giloba"
manual: Add section about debugging
This details the basics for now, but can be detailed in the future.
Update NEWS
2015-09-29 Marc-André Lureau <marcandre.lureau@gmail.com>
worker: count in drawable_new()
2015-09-29 Jonathon Jongsma <jjongsma@redhat.com>
PALLET -> PALETTE
Use the correct spelling for the enumeration
2015-09-29 Christophe Fergeau <cfergeau@redhat.com>
tests: Fix -Werror=format-zero-length build failure
replay.c: In function 'replay_channel_event':
replay.c:226:16: error: zero-length gnu_printf format string
[-Werror=format-zero-length]
g_printerr("");
2015-09-24 Christophe Fergeau <cfergeau@redhat.com>
display: Advertise preferred compression cap
The patches adding a way for the client to set its preferred compression
method added a new capability so that the server can indicate support
for this feature. However, spice-server was not setting this capability
on its display channel, which means clients are not going to try to send
'preferred-compression' messages even though the user request it.
2015-09-15 Marc-André Lureau <marcandre.lureau@gmail.com>
manual: add smartcard channel section
Add some basic instructions to setup smartcard channel
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
manual: add missing space
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
manual: update webdav virt-manager section
virt-manager can add webdav channel for a while now.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-09-08 Frediano Ziglio <fziglio@redhat.com>
Avoid race conditions reading monitor configs from guest
For security reasons do not assume guest do not change structures it
pass to Qemu.
Guest could change count field while Qemu is copying QXLMonitorsConfig
structure leading to heap corruption.
This patch avoid it reading count only once.
This patch solves CVE-2015-3247.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
replay: fix formatting string
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-09-07 Frediano Ziglio <fziglio@redhat.com>
build-sys: Update warning message
arch_warn was set to 1 only if architecture is not x86, x64 or arm.
Update the message as we actually mainly test x64.
Define the warning message and do the architecture checks in the
same place so that they are easier to keep in sync.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-09-04 Frediano Ziglio <fziglio@redhat.com>
improve performances comparing image pixels
This patch contains a bit of small optimizations.
It avoid boolean operations which could involve branches replacing
with binary operations (equal/all_ident -> some_differences).
The other optimization avoids the use of ABS. First the way the macro
was used (with a large expression) was not easy to optimize by the
compiler.
Then instead of using ABS a much simpler range check is used so instead
of (ABS(n) >= k) a ((n) <= -k || (n) >= k) is used. This looks small
but modern compilers can translate this not in range check in a couple
of machine instructions (and a single compare).
Using operf on same samples (using spice-server-replay) and trying 2 runs
I got
run 1 2
-------------------------
before 104441 106267
after 92387 91083
So the performance increase is about 13%.
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-09-03 Frediano Ziglio <fziglio@redhat.com>
avoid to call red_get_streams_timout twice computing timeout
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).
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
spice_timer_queue: fix access after free
Do not access to timer after we call the associated function.
Some of these callbacks can call spice_timer_remove making the pointer
pointing to freed data.
This happen for instance when the client is disconnecting.
This does not cause memory corruption on current allocator
implementations as all freeing/accessing happen on a single thread quite
closely and allocators use different pools for different thread.
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-09-01 Frediano Ziglio <fziglio@redhat.com>
replay: compatibility with former version
GMutex usage in replay.c was not working so replace with plain pthread.
replay: do not define same type twice
Avoid to use typedef twice for the same type as some compiler
complaints about it.
SpiceTimer and SpiceWatch are defined in server/spice-core.h
as an abstract type which should be defined by some code (as
server/tests/basic_event_loop.c does).
2015-09-01 Christophe Fergeau <cfergeau@redhat.com>
Update spice-common submodule
Christophe Fergeau (1):
build-sys: Remove code generation files from EXTRA_DIST
Frediano Ziglio (1):
common: Fix typo in comment
build-sys: Add missing header files to _SOURCES
2 newly-added header files were not added to _SOURCES, breaking make
distcheck.
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-09-01 Marc-André Lureau <marcandre.lureau@gmail.com>
Remove useless pack attribute
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
server: remove srand(time(NULL))
This is clearly not a library responsability.
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-09-01 Alon Levy <alon@pobox.com>
server/red_worker: remove redundant spice_warn_if in validate_surface
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-09-01 Marc-André Lureau <marcandre.lureau@gmail.com>
server: remove hardcoded RED_MAX_RENDERERS
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-08-28 Frediano Ziglio <fziglio@redhat.com>
Simplify set_surface_release_info
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
replay: fix typo in message
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-08-26 Frediano Ziglio <fziglio@redhat.com>
Avoid core calling spice_server_destroy
spice_server_destroy calls reds_exit which is called also at exit time
(is registered with atexit) so avoid to keep dangling pointers.
Currently this does not happen as spice_server_destroy is not called
by Qemu.
prevent integer overflow on 32 bit
On 32 bit machine timespec->tv_sec (time_t) is 32 bit.
Also 1000 * 1000 * 1000 is 32 bit.
The multiplication of 2 32 bit integers gives a 32 bit integer, however
this can overflow.
Converting the first factor to 64 bit before the multiplication solves
the issue.
remove unused SAME_PIXEL macro
2015-08-26 Christophe Fergeau <cfergeau@redhat.com>
build-sys: Remove test_spice_version.h
This script was used at make distcheck time to verify consistency of the
version number defined in configure.ac and in spice-server headers.
Since commit ab12cf414c, these 2 version numbers can no longer be out of
sync, so we can drop this script.
server: Readd spice-experimental.h
Commit 3c6b4e41 removed spice-experimental.h as this header was not
used, nor supposed to be used. However, QEMU had been including it
(without using any of its symbols) until commit v2.3.0-rc0~135^2~1
As this is fairly recent (Nov 2014), building older QEMUs with new
spice-server releases, or even bisecting QEMU will be broken as they
will be looking for a no-longer available header.
This commit readds a spice-experimental.h file, however it only contains
a #warning indicating this file is deprecated. This means older QEMU
will build now, but only if they were configured with --disable-werror.
build-sys: Require a new enough spice-protocol in .pc file
spice-server headers expose SpiceImageCompression which is only available
from recent spice-protocol releases.
This dependency must be expressed in Requires and not Requires.private
2015-08-25 Frediano Ziglio <fziglio@redhat.com>
remove wrong statement terminator from preprocessor macro
Actually not causing problems as when used is always followed by another
terminator but better to fix the definition.
Acked-by: Pavel Grunt <pgrunt@redhat.com>
Use MAX macro to compute the maximum value
replay: use plain pthread for mutex/condition
Mutex/conditional require Glib 2.32 which is not available in RHEL6.
Use plain pthread to make this module compatible with RHEL6.
Acked-by: Fabiano Fidencio <ffidenci@redhat.com>
replay: fix check for QXL_SURF_FLAG_KEEP_DATA flag
A logical and (&&) was used instead of a bit one (&).
Was working just as is the only flag defined.
Acked-by: Fabiano Fidencio <ffidenci@redhat.com>
2015-08-24 Frediano Ziglio <fziglio@redhat.com>
worker: remove unused members from Drawable
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-08-22 Alon Levy <alon@pobox.com>
server/tests/spice-server-replay: introduce
usage: spice-server-replay -p <port> -c <client command line> <cmdfile>
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, it prints the summary
of the traffic on each channel.
You can also run with no client by doing:
spice-server-replay <cmdfile>
For example, the 300 MB file (compressed to 4 MB with xz -9) available
at [1] produces the following output:
spicy-stats total bytes read:
total bytes read:
inputs: 214
display: 1968983
cursor: 390
main: 256373
You could run it directly like so:
curl http://annarchy.freedesktop.org/~alon/win7_boot_shutdown.cmd.xz | \
xzcat | server/tests/spice-server-replay -p 12345 -c `which spicy-stats` -
Known Problems:
* Implementation is wrong. Should do a single device->host conversion
(i.e. get_virt), and then marshall/demarshall that (i.e. RedDrawable).
* segfault on file read done resulting in the above spicy-stats not
being reproducable (well, up to 1% yes).
[1] http://annarchy.freedesktop.org/~alon/win7_boot_shutdown.cmd.xz
Now based on glib including using an asyncqueue for reading the playback
file, and proper freeing of the allocated commands, with --slow,
--compression and a progress timer, and doesn't use more then nsurfaces.
2015-08-21 Alon Levy <alon@pobox.com>
server/red_worker: record to SPICE_WORKER_RECORD_FILENAME
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 introduced later.
For an example file (4 MB download, 300 MB after unpack with xz,
these 300 MB are themselves reduced from 1.2GB using zlib compression
for any chunk):
(old file without a header)
http://annarchy.freedesktop.org/~alon/win7_boot_shutdown.cmd.xz
server/red_{record, replay}.[ch]: introduce
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 avoid half a message.
Should be automatically generated from a declarative syntax, i.e. qxl.proto.
Note: zlib compression is introduced in a disabled state, see ZLIB
define
Now with a simple versioned header and generated ids by the server
instead of based on the recorded file, and doesn't use more then 1024
surfaces (configurable).
2015-08-20 Alon Levy <alon@pobox.com>
server/dispatcher: add extra_dispatcher, hack for red_record
2015-08-20 Marc-André Lureau <marcandre.lureau@redhat.com>
tests: use glib main loop
2015-08-20 Alon Levy <alon@pobox.com>
Remove use of INLINE
It's #define'd to 'inline', and only used in the GLZ encoder.
2015-08-20 Christophe Fergeau <cfergeau@redhat.com>
build-sys: Remove spice-protocol submodule
It's seeing regular releases and is API stable, so we don't need to
bundle it with spice-server
2015-08-20 Victor Toso <victortoso@redhat.com>
mjpeg and jpeg encoder: fix alignment warnings
As the input line could be uint8_t*, uint16_t* or uint32_t*, changing
the default from uint8_t* to void* seems the correct choice to deal with
upcasting warnings.
Regarding chunks->data allocation, I quote Frediano explantion:
"Lines came from spice_bitmap_get_line. This function assume that bitmap
data is split among chunks each containing some lines
(always full lines). If chunk->data is allocated using malloc or similar
SHOULD (not 100% sure) be 4 bytes aligned so in our cases
(8, 16, 24 or 32 bit images) should be aligned enough.
All the casts unfortunately came from the fact we compute based on
pixel bytes to make it generic so we use uint8_t*."
and
"Looking at code looks like these chunks came from the virtual machine.
So the question is... why should the virtual machine give use some
not-pixel align data?
I would put a large comment to state that we assume VM send aligned
data, would be stupid for the VM to not align it!"
clang output:
jpeg_encoder.c:109:26: error: cast from 'uint8_t *'
(aka 'unsigned char *') to 'uint16_t *' (aka 'unsigned short *')
increases required alignment from 1 to 2 [-Werror,-Wcast-align]
uint16_t *src_line = (uint16_t *)line;
^~~~~~~~~~~~~~~~
jpeg_encoder.c:144:26: error: cast from 'uint8_t *'
(aka 'unsigned char *') to 'uint32_t *' (aka 'unsigned int *')
increases required alignment from 1 to 4 [-Werror,-Wcast-align]
uint32_t *src_line = (uint32_t *)line;
^~~~~~~~~~~~~~~~
mjpeg_encoder.c:260:23: error: cast from 'uint8_t *'
(aka 'unsigned char *') to 'uint16_t *' (aka 'unsigned short *')
increases required alignment from 1 to 2 [-Werror,-Wcast-align]
uint16_t pixel = *(uint16_t *)src;
^~~~~~~~~~~~~~~
glz: WindowImageSegment lines lines_end as void*
Instead of using uint8_t* which can cause several warnings on casting as
the example below:
./glz_encode_tmpl.c:321:29: error: cast from 'uint8_t *'
(aka 'unsigned char *') to 'rgb16_pixel_t *' (aka 'unsigned short *')
increases required alignment from 1 to 2 [-Werror,-Wcast-align]
ref_limit = (PIXEL *)(seg->lines_end);
^~~~~~~~~~~~~~~~~~~~~~~~~
migration_protocol: use SPICE_MAGIC_CONST
spice-protocol has a new define to create the magic constants, let's use
that.
2015-08-12 Victor Toso <victortoso@redhat.com>
red_parse_qxl: Do not compute abs unsigned int
SpiceBitmap's stride is uint32_t.
from clang:
red_parse_qxl.c:452:41: error: taking the absolute value of unsigned
type 'uint32_t' (aka 'unsigned int') has no effect
bitmap_size = red->u.bitmap.y * abs(red->u.bitmap.stride);
^
2015-08-12 Alon Levy <alon@pobox.com>
server/inputs_channel: Cope with NULL keyboard in release_keys()
This fixes a test_display_no_ssl segfault on client disconnect when
the keyboard was never initialized.
2015-08-11 Victor Toso <victortoso@redhat.com>
red_parse_qxl: remove unused variable
2015-08-11 Jonathon Jongsma <jjongsma@redhat.com>
Remove unused struct RedsOutItem
RedChannel: remove unused BufDescriptor struct
2015-08-11 Christophe Fergeau <cfergeau@redhat.com>
Remove unused snd_get_playback_compression() method
Fix typo in comment in char_device.h
2015-08-11 Jonathon Jongsma <jjongsma@redhat.com>
Fix typo in comments
Move RedsMigSpice to main-channel.h
This is the place that needs the complete type definition. If it is
defined in reds.h, it can create circular references.
Cleanup: move static function declarations out of header
It doesn't make much sense to have static function declarations in a
header, even a private header. So move them down into the source file.
2015-08-11 Marc-André Lureau <marcandre.lureau@gmail.com>
worker: remove unused preload_group_id
channel: minor simplification
server: remove unused CursorData
server: use more const CoreInterface
worker: move red_init_*() functions
There is a red_init() methods, we can group all the red_init_*() calls
in it rather than calling red_init() followed by all these calls in our
main function.
2015-08-04 Uri Lublin <uril@redhat.com>
spice-common: codegen: ptypes.py: keep attribute names in sets
This fixes the build on RHEL-6
2015-07-29 Christophe Fergeau <cfergeau@redhat.com>
Adjust to new SpiceImageCompress name
This has been renamed to SpiceImageCompression in order to avoid clashes
with older spice-server in the SPICE_IMAGE_COMPRESS_ namespace. This
commit is a straight rename of SpiceImageCompress to
SpiceImageCompression and SPICE_IMAGE_COMPRESS_ to
SPICE_IMAGE_COMPRESSION_
2015-07-28 Jeremy White <jwhite@codeweavers.com>
Add libraries such as -lm and -lpthread to the tests build line.
This prevents a compile error on Debian Jessie, from git, such as this:
/usr/bin/ld: test_playback.o: undefined reference to symbol 'sin@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
This is fairly subtle, and Debian specific. It only happens when you use
autoreconf to generate a new libtool script. Debian patches that script
to require an explicit setting to link with all dependent libraries.
It should be harmless on other distros, and it does save us Debian guys some
hassle.
2015-07-20 Frediano Ziglio <fziglio@redhat.com>
reds: Assure we don't have stale statistic files before trying to create a new one
If a previous Qemu executable is not able to delete the statistic file
on the next creation with same name (statitics file are based on pid
numbers so if pid get reused for another Qemu process you get the same
name) it fails as you can't open a file with 0444 permissions (these
are the permission used to create these files).
This patch assure there are no stale file trying to remove it before the
creation of the new one. As file is based on pid and name used for spice
you are not deleting another file.
Fixes: rhbz#1177326
2015-07-20 Francois Gouget <fgouget@codeweavers.com>
server: spice_debug() messages don't need a trailing '\n'.
server: Weakly try to get a better latency value for the bandwidth test.
NET_TEST_WARMUP_BYTES is 0 so the warmup ping is the same as the one we
use to measure the latency. Even if it was not, the actual latency would
be the MIN() of both anyway so we might as well use both roundtrip times
to ward off latency jitter a bit.
server: Don't reset the latency before showing it in the invalid net test error message.
2015-07-13 Pavel Grunt <pgrunt@redhat.com>
Use desired image compression for the first image
red_marshall_image() allows to use other than QUIC compression only
when auto_lz or auto_glz image compression is set. Other images don't
have the problem because they are compressed using red_compress_image()
2015-06-30 Javier Celaya <javier.celaya@flexvm.es>
Handle preferred image compression messages
Use image compress constants from spice-protocol
2015-06-29 Francois Gouget <fgouget@codeweavers.com>
server: Remove the rate_control_is_active field from MJpegEncoder.
It is redundant with the corresponding callbacks.
server: Fix an incorrect time calculation.
HAVE_CLOCK_GETTIME is not used so remove it.
2015-06-29 Sandy Stutsman <sstutsma@redhat.com>
Lock the pixmap image cache for the entire fill_bits call
Locking the individual calls that access the pixmap cache in fill_bits is
not adequately thread safe. Often a windows guest with multiple monitors
will be sending the same image via different threads. Both threads can
be in fill_bits at the same time making changes to the cache for the same
image. This can result in images being deleted before all the client
channels are finished with them or with the same image being send multiple
times. Here's what can happen with out the lock in fill_bits
On the server in red_worker.c:fill_bits
Thread 1 calls pixmap_cache_hit for Image A and finds it isn't in cache
Thread 2 calls pixmap_cache_hit for Image A and finds it isn't in cache
Thread 1 adds Image 1 to pixmap_cache (1x)
Thread 2 adds Image 1 to pixmap_cache (2x)
On the client
Channel 1 adds Image A to image_cache (1x)
Channel 2 replaces Image A in image_cache (1x)
On server
Thread 1 sends Image A rendering commands
Thread N removes Image A from pixmap_cache (image remains - 1x)
Thread 2 sends Image A rendering commands
On client
Channe1 renders from Image A
Channel N removes Image a from image_cache (image is completely removed)
Channel2 render command hangs waiting for Image A
2015-06-26 Frediano Ziglio <fziglio@redhat.com>
server: allows to set maximum monitors
spice-server will attempt to limit number of monitors.
Guest machine can send monitor list it accepts. Limiting the number sent
by guest will limit the number of monitors client will try to enable.
The guest usually see client monitors enabled and start using it so
not seeing client monitor won't try to enable more monitor.
In this case the additional monitor guest can support will always be
seen as heads with no attached monitors.
This allows limiting monitors number without changing guest drivers.
2015-06-26 Christophe Fergeau <cfergeau@redhat.com>
build-sys: Fix build with automake < 1.13
AC_CONFIG_MACRO_DIRS is not available with older automake versions,
which causes autogen.sh failures on RHEL6. m4_include() can be used
instead.
2015-06-22 Francois Gouget <fgouget@codeweavers.com>
mjpeg: Convert rate control checks to asserts in encoder
The checks would lead the reader to think these functions can be called
when bit rate control is off when in fact they are only called when it
is active.
server: Refresh the input fps every 5 second, without a timer.
2015-06-22 Christophe Fergeau <cfergeau@redhat.com>
build-sys: Use spice-common m4 macro for lz4
This will allow to share this detection code with spice-gtk.
build-sys: Use spice-common m4 macro for opengl
This factorizes a bit of configure.ac m4 code.
build-sys: Use spice-common m4 macro for smartcard
Besides the code factorization, this will allow smartcard support to be
automatically enabled if libcacard is present and --disable-smartcard is
not used.
2015-06-17 Marc-André Lureau <marcandre.lureau@gmail.com>
reds: increase listening socket backlog
With a TCP socket, the backlog doesn't seem to matter much,
perhaps because of latency or underlying protocol behaviour. However,
on UNIX socket, it is fairly easy to reach the backlog limit and the
client will get an EAGAIN error (but not ECONNREFUSED as stated in
listen(7)) that is not easy to deal with: attempting to reconnect in a
loop might busy-loop forever as there are no guarantee the server will
accept new connections, so it will be inherently racy.
Typically, Spice server can easily have up to 15 concurrent incoming
connections that are established during initialization of the session.
To improve the situation, raise the backlog limit to the default maximum
system value, which is 128 on Linux.
2015-06-16 Cédric Bosdonnat <cbosdonnat@suse.com>
Add password length check
Don't allow setting a too long password.
2015-06-16 Frediano Ziglio <fziglio@redhat.com>
Use spice_malloc instead of malloc
Do not just check and give warning before crashing the program
accessing a NULL pointer but use spice_malloc which exits with a
proper message.
2015-06-15 Jonathon Jongsma <jjongsma@redhat.com>
Remove duplicate streaming enumeration
There is already a enumeration in a public header that defines the
different streaming options, so there's no need to duplicate that
enumeration internally. Just use the public enum values.
Use AS_HELP_STRING for configure options
2015-06-11 Frediano Ziglio <fziglio@redhat.com>
Fix typo in comment
Use MIN macro to compute a minimum
2015-06-11 Javier Celaya <javier.celaya@flexvm.es>
LZ4: warn if trying to set lz4 but not supported
2015-06-09 Francois Gouget <fgouget@codeweavers.com>
server: Remove an unused structure.
2015-06-04 Marc-André Lureau <marcandre.lureau@gmail.com>
sound: do not modify client state on migration
During migration, a volume jump is observed by the client. This is due
to qemu setting up destination server with default sound state, and the
server sending it after the client is connected. The volume is later
restored after migration is finished so there is no need to send this
default state values on connection.
Tested with both AC97 & HDA devices.
Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1012868
2015-04-23 Christophe Fergeau <cfergeau@redhat.com>
build-sys: Pass --enable-python-checks when running autogen.sh
This will tell spice-common configure.ac to test for the availability of
python-six when building from git.
Update spice-common submodule
This fixes a few issues with older python-six versions:
Christophe Fergeau (2):
configure.ac: Check for needed python modules for git builds
codegen: Use six.PY3 rather than six.PY2
2015-04-10 Christophe Fergeau <cfergeau@redhat.com>
build-sys: Replace cpu detection error with warning
configure.ac currently errors out when trying to build on
non-x86/non-ARM CPUs. Since the previous commits improved
big endian support a lot, this commit replaces the error
with a warning at configure time to make testing on big
endian platforms easier.
build-sys: Remove unused 'X86_64' conditional
X86_64 was defined as an AM_CONDITIONAL, but then nothing was using it.
This commit gets rid of it.
ppc: Fix glz magic endianess
This is a modified version of a patch initially by Erlon R. Cruz
<erlon.cruz@br.flextronics.com>
ppc: Fixing endianness for channel messages
This is a modified version of a patch initially from
Erlon R. Cruz <erlon.cruz@br.flextronics.com>
ppc: Update spice-common for endianness-related fixes
Alexander Wauck (1):
Make spice_codegen.py work on both Python 2 and 3
Christophe Fergeau (17):
Remove unused header file
build-sys: Remove unused X check
build-sys: Remove unused win32 check
build-sys: Remove unused WITH_SMARTCARD conditional
build-sys: Small cleanup of AM_CPPFLAGS
build-sys: Add fallback for AS_VAR_APPEND
build-sys: Move posix checks to a separate m4 macro
build-sys: Move smartcard check to m4 macro
build-sys: Move celt check to m4 macro
build-sys: Move opus check to m4 macro
build-sys: Move opengl check to m4 macro
build-sys: Move pixman check to m4 macro
Remove unused 'invers' arg from canvas_get_*
Remove redundant #if defined(SW_CANVAS_CACHE) ||
defined(SW_CANVAS_IMAGE_CACHE)
Remove another redundant (SW_CANVAS_CACHE) ||
(SW_CANVAS_IMAGE_CACHE) #ifdef
Get rid of SW_CANVAS_IMAGE_CACHE
ssl_verify: Move wincrypt.h related #ifdef closer to the include
Erlon Cruz (2):
ppc: Fix lz magic endianness
ppc: build-sys: Add big-endian support
Fabiano Fidêncio (1):
Fix typo in pixman_image_get_stride() function
Javier Celaya (6):
LZ4: Fix output buffer size
LZ4: Adjust reading the top_down flag
LZ4: Decode the image format from the stream
LZ4: Fix the row alignment when it is not on a 32bit boundary
LZ4: Add support for 24bit pixman surfaces
LZ4: Do not include arpa/inet.h in Windows builds
Victor Toso (1):
common: fix build with mingw
ppc: Fix endianness handling in initial SPICE connection
This commit fixes enough endianness issues that it's possible to
connect to a spice-server/qemu running on a big-endian box with a client
running on a little-endian machine.
I haven't tested more than getting to the bios/bootloader and typing a
bit on the keyboard as I did not manage to boot a distro afterwards :(
This is based on patches send by Erlon R. Cruz
<erlon.cruz@br.flextronics.com>
2015-03-15 Uri Lublin <uril@redhat.com>
m4: WARN FLAGS: Drop -Wenum-compare
My RHEL-6 gcc (4.4.7) complains a lot about it:
cc1: warning: command line option "-Wenum-compare" is
valid for C++/ObjC++ but not for C
For older gcc version (e.g. 4.4.7), man gcc says
-Wenum-compare is "C++ and Objective-C++ only".
For newer gcc (e.g. 4.9.2), man gcc says
"In C this warning is enabled by -Wall."
2015-02-25 Fabiano Fidêncio <fidencio@redhat.com>
Do not compress bitmaps on UNIX socket
On UNIX socket do not perform unnecessary image compression
2015-02-24 Fabiano Fidêncio <fidencio@redhat.com>
tests: Fix build on Hurd
As PATH_MAX is not defined on Hurd, let's check for it and define
whenever it is necessary.
https://bugs.freedesktop.org/show_bug.cgi?id=74313
2015-02-08 Uri Lublin <uril@redhat.com>
char-device: spice_char_device_write_to_device: protect against recursion
This fixes Spice's smart card support and is related to
commit 697f3214fd16adcd524456003619f7f44ddd031b.
Reported-by: Swapna Krishnan <skrishna@redhat.com>
Recursion is now possible starting with spice_char_device_write_to_device
going through spice_char_device_wakeup (after going through qemu),
calling again to spice_char_device_write_to_device.
The protecting code is the same as the one protecting the read path.
This function call loop makes the program to abort with the following messages:
usb-ccid: chardev: unexpected message of type 3000000
qemu: qemu_mutex_lock: Resource deadlock avoided
Backtrace:
(gdb) bt
* #0 0x00007ffff3fc78c7 in raise () from /lib64/libc.so.6
* #1 0x00007ffff3fc952a in abort () from /lib64/libc.so.6
* #2 0x0000555555969a95 in error_exit (err=35,
* msg=0x5555559f8c90 <__func__.5119> "qemu_mutex_lock")
* at util/qemu-thread-posix.c:48
* #3 0x0000555555969b82 in qemu_mutex_lock (mutex=0x5555562c4d60)
* at util/qemu-thread-posix.c:79
* #4 0x0000555555714771 in qemu_chr_fe_write (s=0x5555562c4d60,
* buf=0x7fffffffd2a0 "", len=12) at qemu-char.c:219
* #5 0x000055555586be49 in ccid_card_vscard_send_msg (s=0x5555565c5f80,
* type=VSC_Error, reader_id=0, payload=0x7fffffffd2e0 "", length=4)
* at hw/usb/ccid-card-passthru.c:75
* #6 0x000055555586bf00 in ccid_card_vscard_send_error (s=0x5555565c5f80,
* reader_id=0, code=VSC_GENERAL_ERROR) at
* hw/usb/ccid-card-passthru.c:91
* #7 0x000055555586c559 in ccid_card_vscard_handle_message (
* card=0x5555565c5f80, scr_msg_header=0x5555565c6008)
* at hw/usb/ccid-card-passthru.c:254
* #8 0x000055555586c72f in ccid_card_vscard_read (opaque=0x5555565c5f80,
* buf=0x5555565034b0 "", size=12) at hw/usb/ccid-card-passthru.c:289
* #9 0x00005555557149db in qemu_chr_be_write (s=0x5555562c4d60,
* buf=0x5555565034b0 "", len=12) at qemu-char.c:305
* #10 0x000055555571cde5 in vmc_write (sin=0x5555562c4e78,
* buf=0x5555565034b0 "", len=12) at spice-qemu-char.c:41
* #11 0x00007ffff4fa86aa in spice_char_device_write_to_device (
* dev=0x55555657f210) at char_device.c:462
* #12 0x00007ffff4fa9b48 in spice_char_device_wakeup (dev=0x55555657f210)
* at char_device.c:862
* #13 0x00007ffff4ff7658 in spice_server_char_device_wakeup
* (sin=0x5555562c4e78) at reds.c:2955
* #14 0x000055555571d1d2 in spice_chr_write (chr=0x5555562c4d60,
* buf=0x7fffffffd560 "", len=12) at spice-qemu-char.c:189
* #15 0x0000555555714789 in qemu_chr_fe_write (s=0x5555562c4d60,
* buf=0x7fffffffd560 "", len=12) at qemu-char.c:220
* #16 0x000055555586be49 in ccid_card_vscard_send_msg (s=0x5555565c5f80,
* type=VSC_Error, reader_id=0, payload=0x7fffffffd5a0 "", length=4)
* at hw/usb/ccid-card-passthru.c:75
* #17 0x000055555586bf00 in ccid_card_vscard_send_error
* (s=0x5555565c5f80,
* reader_id=0, code=VSC_SUCCESS) at hw/usb/ccid-card-passthru.c:91
* #18 0x000055555586c4fc in ccid_card_vscard_handle_message (
* card=0x5555565c5f80, scr_msg_header=0x5555565c6008)
* at hw/usb/ccid-card-passthru.c:242
* #19 0x000055555586c72f in ccid_card_vscard_read (opaque=0x5555565c5f80,
* buf=0x5555565034b0 "", size=12) at hw/usb/ccid-card-passthru.c:289
* #20 0x00005555557149db in qemu_chr_be_write (s=0x5555562c4d60,
* buf=0x5555565034b0 "", len=12) at qemu-char.c:305
* #21 0x000055555571cde5 in vmc_write (sin=0x5555562c4e78,
* buf=0x5555565034b0 "", len=12) at spice-qemu-char.c:41
* #22 0x00007ffff4fa86aa in spice_char_device_write_to_device (
* dev=0x55555657f210) at char_device.c:462
* #23 0x00007ffff4fa8d37 in spice_char_device_write_buffer_add (
* dev=0x55555657f210, write_buf=0x555556501f70) at char_device.c:597
* #24 0x00007ffff501142d in smartcard_channel_write_to_reader (
* write_buf=0x555556501f70) at smartcard.c:669
* #25 0x00007ffff501034c in smartcard_char_device_notify_reader_add (
* st=0x55555657ef00) at smartcard.c:335
* #26 0x00007ffff50112b3 in smartcard_add_reader (scc=0x555556493ee0,
* name=0x5555565023cc "E-Gate 0 0") at smartcard.c:642
* #27 0x00007ffff50118d2 in smartcard_channel_handle_message (
* rcc=0x555556493ee0, type=101, size=22, msg=0x5555565023c0 "\003")
* at smartcard.c:757
* #28 0x00007ffff4fbc168 in red_peer_handle_incoming
* (stream=0x555556588250, handler=0x555556497ff0) at red_channel.c:308
* #29 0x00007ffff4fbc231 in red_channel_client_receive
* (rcc=0x555556493ee0) at red_channel.c:326
* #30 0x00007ffff4fc0019 in red_channel_client_event (fd=59, event=1,
* data=0x555556493ee0) at red_channel.c:1574
* #31 0x00005555558b6076 in watch_read (opaque=0x5555565002f0)
* at ui/spice-core.c:101
* #32 0x00005555558e8d48 in qemu_iohandler_poll (pollfds=0x5555562b7630,
* ret=2) at iohandler.c:143
* #33 0x00005555558e89a4 in main_loop_wait (nonblocking=0) at
* main-loop.c:495
* #34 0x00005555557219b0 in main_loop () at vl.c:1794
* #35 0x0000555555729257 in main (argc=40, argv=0x7fffffffddc8,
* envp=0x7fffffffdf10) at vl.c:4350
2015-02-03 Javier Celaya <javier.celaya@flexvm.es>
LZ4: Send the original format with the compressed data
LZ4: Do not reverse bottom-up images
Reversing the bottom-up images in the server is not needed since Pixman,
in the client, is able to deal with them. As a result, the previous code
was more complex and wrong. This commit fixes and cleans it.
LZ4: Fix encoder output size
LZ4: Limit LZ4 to RGB formats
Currently, the LZ4 encoding only (partially) supports RGB images, so
we must check the image format before using it. In the future, indexed
formats may be implemented too, but their use is usually very small
compared to RGB.
2015-01-15 Marc-André Lureau <marcandre.lureau@gmail.com>
Remove spice-experimental
Remove unneded symbols that nobody should be using anyway.
ABI is modified with this patch, but the library version is not bumped.
Do not perform network tests on UNIX socket
By default, stream latency is 0 and bandwidth is infinite. On UNIX
socket do not perform unnecessary testing and keep those values.
reds-stream: add reds_stream_get_family() function
reds: add Unix socket support
Learn to listen on a Unix address. In this case, the connection is plain
only (non-tls).
2014-12-15 Christophe Fergeau <cfergeau@redhat.com>
inputs: Remove unneeded variable
inputs_channel_handle_parsed() is casting its void * argument to
a uint8_t * buf before recasting this 'buf' variable to different
other types. This intermediate 'buf' variable is not needed, especially
as we can then benefit from implicit casts from void * to the type we
need.
inputs: Split overlong line
Cosmetic change.
inputs: Fix key_up/key_down mismatch
When handling a KEY_UP message, the various variables were called
'key_down', and they were called 'key_up' when handling KEY_DOWN
messages. This commit makes the naming consistent.
2014-12-03 Christophe Fergeau <cfergeau@redhat.com>
Remove unused SPICE_CANVAS_INTERNAL
client: Remove client code
The client has been superseded by virt-viewer (
http://virt-manager.org/download/sources/virt-viewer/ ) and is no longer
being maintained.
2014-12-02 Javier Celaya <javier.celaya@flexvm.es>
Add LZ4 compression support.
- Add lz4 encoder to compress an image of type LZ4 (see spice_common).
- Add code in red_worker to use LZ4 when it is enabled, and the client
supports it through its display capability, or fallback to LZ.
- Add enable_lz4 switch in the configure script. Show LZ4 support at the
end.
2014-12-01 Christophe Fergeau <cfergeau@redhat.com>
configure.ac: Never add xinerama to SPICE_REQUIRES
SPICE_REQUIRES is only used to generate the Requires.private line of
spice-server.pc. The server code is not using xinerama, so we don't need
to list xinerama in Requires.private.
configure.ac: Only check for xinerama for client builds
Xinerama support is only used for the X11 client, but is currently
being checked even for server only builds. This commit ensures Xinerama
is not checked for/added to spice-server.pc when not building the
client.
2014-11-29 Marc-André Lureau <marcandre.lureau@gmail.com>
build-sys: fix out-of-tree build of tests
Fixes the following build error:
In file included from
/home/elmarco/src/spice-new/src/spice/server/tests/test_display_base.h:4:0,
from
/home/elmarco/src/spice-new/src/spice/server/tests/test_display_no_ssl.c:11:
/home/elmarco/src/spice-new/src/spice/server/spice.h:23:27:
fatal error: spice-version.h: No such file or directory
#include "spice-version.h"
^
2014-11-27 Marc-André Lureau <marcandre.lureau@gmail.com>
Add explicit spice-core.h include
Several functions use core interfaces, add and explicit include.
Move spice_server_get_num_clients() declaration
This function is not related to migration.
Rename mm_timer/mm_time
As suggested by Christophe on the mailing list.
Remove guest side video time-stamping
The multimedia time is defined by the server side monotonic time [1],
but the drawing time-stamp is done in guest side, so it requires
synchronization between host and guest. This is expensive, when no audio
is playing, there is a ~30x/sec wakeup to update the qxl device mmtime,
and it requires marking dirty the rom region.
Instead, the video timestamping can be done more efficiently on server
side, without visible drawbacks.
[1] a better timestamp could be the audio time, since audio players are
usually sync with audio time)
Related to:
https://bugzilla.redhat.com/show_bug.cgi?id=912763
build-sys: generate spice-version.h
Editing the hexadecimal value of spice-version and keeping it in sync
with actual release is a bit tedious. Let's generate it
automatically (although handling of bumps will need temporarily static
versions, when 0.12 -> 1.0 for example)
Split spice.h
Make it easier to read the Spice server API.
spice.h: remove redundant declarations
Those are already declared in <spice/qxl_dev.h>.
2014-11-25 Marc-André Lureau <marcandre.lureau@gmail.com>
Validate RedDrawable before allocating drawable
Avoid unnecessary allocation (and possibly leaking) if the RedDrawable
is not valid.
Related to: rhbz#1135372
chardev: remove write polling
In an effort to reduce the wakeups per second, get rid of the
"write_to_dev" timer when the implementation supports
SPICE_CHAR_DEVICE_NOTIFY_WRITABLE.
When this flag is set, the frontend instance is responsible for calling
spice_char_device_wakeup() when the device is ready to perform IO.
Related to:
https://bugzilla.redhat.com/show_bug.cgi?id=912763
2014-11-24 Christophe Fergeau <cfergeau@redhat.com>
Don't set SpiceLinkReply::pub_key if client advertises SASL cap
If the client advertises the SASL cap, it means it guarantees it will be
able to use SASL if the server supports, and that it does not need a valid
SpiceLinkReply::pub_key field when using SASL.
When the client cap is set, we thus don't need to create a RSA public key
if SASL is enabled server side.
The reason for needing client guarantees about not looking at the pub_key
field is that its presence and size is hardcoded in the protocol, but in
some hardened setups (using fips mode), generating a RSA 1024 bit key as
expected is forbidden and fails. With this new capability, the server
knows the client will be able to handle SASL if needed, and can skip
the generation of the key altogether. This means that on the setups
described above, SASL authentication has to be used.
Introduce red_link_info_test_capability()
This just hides a bit of pointer arithmetic away from reds_send_link_ack.
This helper will be used in the next commits.
Add const to test_capability first argument
We don't modify the capabilities content, so it can be marked as const.
2014-11-21 Alexander Tsoy <alexander@tsoy.me>
configure.ac: use portable shell
This fixes the following errors when configure run in dash:
./configure: 17366: ./configure: SPICE_NONPKGCONFIG_LIBS+= -pthread -lm -lrt: not found
./configure: 17974: ./configure: SPICE_REQUIRES+= glib-2.0 >= 2.22: not found
./configure: 18069: ./configure: SPICE_REQUIRES+= pixman-1 >= 0.17.7: not found
./configure: 18165: ./configure: SPICE_REQUIRES+= celt051 >= 0.5.1.1: not found
./configure: 18369: ./configure: SPICE_REQUIRES+= openssl: not found
./configure: 18477: ./configure: SPICE_NONPKGCONFIG_LIBS+= : not found
./configure: 18948: ./configure: SPICE_REQUIRES+= xinerama: not found
./configure: 20377: test: no: unexpected operator
./configure: 20409: test: no: unexpected operator
./configure: 23423: test: xno: unexpected operator
./configure: 23443: test: no: unexpected operator
2014-11-17 Christophe Fergeau <cfergeau@redhat.com>
manual: Add missing closure of XML tag
The <model type='qxl'> examples in the reference documentation are
missing a closing tag.
2014-10-17 Marc-André Lureau <marcandre.lureau@gmail.com>
server: fix crash when restarting VM with old client
The server will reset the vdagent char device when the client does not
implement SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS. This will nullify
dev->sin and the following crash will be reached on restart:
#0 0x00007fb05aa264a1 in spice_char_device_write_to_device (dev=dev@entry=0x7fb066ae5d30) at char_device.c:443
#1 0x00007fb05aa27137 in spice_char_device_write_to_device (dev=0x7fb066ae5d30) at char_device.c:436
#2 spice_char_device_start (dev=0x7fb066ae5d30) at char_device.c:798
#3 0x00007fb05aa6a981 in spice_server_vm_start (s=<optimized out>) at reds.c:3795
#4 0x00007fb0644b7f89 in qdev_reset_one (dev=<optimized out>, opaque=<optimized out>) at hw/core/qdev.c:241
#5 0x00007fb0644b7918 in qbus_walk_children (bus=0x7fb06661e870, pre_devfn=0x0, pre_busfn=0x0,
post_devfn=0x7fb0644b7f80 <qdev_reset_one>, post_busfn=0x7fb0644b6350 <qbus_reset_one>, opaque=0x0)
at hw/core/qdev.c:422
#6 0x00007fb0644b7848 in qdev_walk_children (dev=0x7fb0665f47a0, pre_devfn=0x0, pre_busfn=0x0,
post_devfn=0x7fb0644b7f80 <qdev_reset_one>, post_busfn=0x7fb0644b6350 <qbus_reset_one>, opaque=0x0)
at hw/core/qdev.c:456
#7 0x00007fb0644b7918 in qbus_walk_children (bus=0x7fb06647cde0, pre_devfn=0x0, pre_busfn=0x0,
post_devfn=0x7fb0644b7f80 <qdev_reset_one>, post_busfn=0x7fb0644b6350 <qbus_reset_one>, opaque=0x0)
at hw/core/qdev.c:422
#8 0x00007fb0644399fd in qemu_devices_reset () at vl.c:1830
After restart, qemu will reset the device instance (sin) when virtio
port is opened:
#0 spice_char_device_state_reset_dev_instance (state=0x7fe4873876d0, sin=sin@entry=0x7fe486fb0c68)
at char_device.c:667
#1 0x00007fe47b277516 in attach_to_red_agent (sin=0x7fe486fb0c68) at reds.c:2838
#2 spice_server_char_device_add_interface (sin=0x7fe486fb0c68, s=0x7fe486fb2e60) at reds.c:2962
#3 spice_server_add_interface (s=0x7fe486fb2e60, sin=0x7fe486fb0c68) at reds.c:3104
#4 0x00007fe484c69e57 in vmc_register_interface (scd=0x7fe486fb0c60) at spice-qemu-char.c:123
#5 0x00007fe484ce96b4 in set_guest_connected (port=<optimized out>, guest_connected=1)
at hw/char/virtio-console.c:89
#6 0x00007fe484ba70ed in handle_control_message (len=8, buf=0x7fe486fbdf70, vser=0x7fe48739ae98)
at /usr/src/debug/qemu-2.1.0/hw/char/virtio-serial-bus.c:382
Let's ignore the call to spice_char_device_{write,read}_to_device() when
dev->sin is NULL, similary to other conditions, such as dev->running.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1145919
2014-10-14 Uri Lublin <uril@redhat.com>
migration: Don't assert() if MIGRATE_DATA comes before attaching the agent
During seamless migration, after switching host, if a client was connected
during the migration, it will have data to send back to the new
qemu/spice-server instance. This is handled through MIGRATE_DATA messages.
SPICE char devices use such MIGRATE_DATA messages to restore their state.
However, the MIGRATE_DATA message can arrive any time after the new qemu
instance has started, this can happen before or after the SPICE char
devices have been created. In order to handle this, if the migrate data
arrives early, it's stored in reds->agent_state.mig_data, and
attach_to_red_agent() will restore the agent state as appropriate.
Unfortunately this does not work as expected, for main
channel (agent messages).
If attach_to_red_agent() is called before the MIGRATE_DATA
message reaches the server, all goes well,
but if MIGRATE_DATA reaches the server before
attach_to_red_agent() gets called, then some assert() gets
triggered in spice_char_device_state_restore():
((null):32507): Spice-ERROR **: char_device.c:937:spice_char_device_state_restore: assertion `dev->num_clients == 1 && dev->wait_for_migrate_data' failed
Thread 3 (Thread 0x7f406b543700 (LWP 32543)):
Thread 2 (Thread 0x7f40697ff700 (LWP 32586)):
Thread 1 (Thread 0x7f4079b45a40 (LWP 32507)):
When restoring state, a client must already be added to the
spice-char-device.
What happens is that a client is not being added to the char-device
when when MIGRATE_DATA arrives first, which leaves both
dev->num_clients and dev->wait_for_migrate_data value at 0.
This commit changes the logic in spice_server_char_device_add_interface(),
such that if there is migrate data pending in reds->agent_state.mig_data
but no client was added to the spice-char-device yet,
then first the client is added to the device by calling
spice_char_device_client_add(), and only then the state is restored.
=== How to Reproduce
To reproduce, add delays to the migration connection between
qmeu-kvm on the source host (SRC) and on the destination (DST).
Specifically I added a man in the middle DLY host between
migration ports from SRC to DST.
+-----+ +-----+ +-----+
| SRC |--> | DLY | --> | DST |
+-----+ +-----+ +-----+
DLY listens on port P1 (e.g. 4444) and DST listens on port
PINCOMING (e.g. 4444, from qemu-kvm '-incoming' command line option)
Precondition: make sure port P1 on DLY is accessible in iptables.
Option 1: use ssh tcp port forwarding
On DLY host run ssh:
ssh DLY:P1:DST:PINCOMING DST
Then use the following migration command (on qemu-kvm monitor):
client_migrate_info spice DST PSPICE
migrate -d tcp:DLY:P1
Option 2: Use a simple proxy program that forwards
packets from SRC to DST while adding some delays.
The program runs on DLY, listens to port D1, upon
accept connects to DST:PINCOMING and forward all
packets from DLY:D1 to DST:PINCOMING.
Then use the same migrate command as in option 1:
client_migrate_info spice DST PSPICE
migrate -d tcp:DLY:P1
=== How to Reproduce Ends
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1035184
Based-on-a-patch-by: Christophe Fergeau <cfergeau@redhat.com>
2014-10-10 Cole Robinson <crobinso@redhat.com>
m4: Update manywarnings from gnulib
Fixes these noisy errors on Fedora 21:
gcc: warning: switch '-Wmudflap' is no longer supported
2014-09-18 Christophe Fergeau <cfergeau@redhat.com>
Validate surface bounding box before using it
It's possible for a buggy guest driver to pass invalid bounding box
dimensions in QXL commands, which would then cause spice-server to
segfault. This patch checks the size of the bounding box of the QXL
command right after it has been parsed.
This fixes rhbz#1135372
Fix 'abberiviations' typo in comment
Fix indentation in red_get_opaque_ptr
This removes one extra space
server/tests/Makefile.am: White-space cleanup
Make sure the \ at the end of lines are nicely aligned
2014-09-12 Fabiano Fidêncio <fidencio@redhat.com>
Fix -Wunused-function
Fix -Wmissing-field-initializers
Fix -Wnonnull
Fix -Wformat
Fix -Wswitch
Fix -Wsign
Fix -Wunused-value
Fix -Wunused-parameter
server: Don't dump the bitmap when the format is invalid
Caught by covscan:
spice/server/spice_bitmap_utils.c:54: var_decl: Declaring variable "n_pixel_bits" without initializer.
spice/server/spice_bitmap_utils.c:106: uninit_use: Using uninitialized value "n_pixel_bits".
2014-09-08 Marc-André Lureau <marcandre.lureau@redhat.com>
clean-up: remove unused function
build-sys: check for spicy-screenshot
2014-09-08 Marc-André Lureau <marcandre.lureau@gmail.com>
reds: lookup corresponding channel id
In reds_send_link_ack(), lookup the channel with the same id as the link
message.
The bug was found during code review a while ago.
A reproducer bug was later reported:
https://bugzilla.redhat.com/show_bug.cgi?id=1058625
dispatcher: lower a monitor-config warning to a debug level
Some QXLInterface implementations might not have or succeed
with client_monitors_config(). Thus, lower warning to debug
level.
https://bugzilla.redhat.com/show_bug.cgi?id=1119220
2014-08-20 Christophe Fergeau <cfergeau@redhat.com>
spice.h: Don't use 48kHz for playback/recording rates
When adding Opus support, SPICE_INTERFACE_PLAYBACK_FREQ and
SPICE_INTERFACE_RECORD_FREQ in the public header 'spice.h' were changed
from 44100 to 48000.
However, this was not really useful as these constants are not used in
spice-server, but only by users of spice-server (ie QEMU).
It turns out changing these values is actually harmful. QEMU uses these
constants in 2 situations:
1. when it's a version of QEMU with this commit, but we are compiling
against older spice-server headers (before Opus support was added)
2. when it's a version of QEMU without commit 795ca114d35 which added
what is needed for Opus support
When we are in the second situation, having 48000 in the public header
will actually cause issues as spice-server will know QEMU does not
support Opus, so internally spice-server will be using a 44100 rate for
audio. However, QEMU will be using SPICE_INTERFACE_.*_FREQ and think it
should use a 48000 rate, which will cause distorsions as experienced in
bug https://bugzilla.redhat.com/show_bug.cgi?id=1129961
Reverting these constants back to 44100 will fix audio in the 'new
spice-server/old QEMU' scenario, and won't cause issues either when both
support Opus as in this case these constants are not used.
2014-08-07 Marc-André Lureau <marcandre.lureau@gmail.com>
Fix crash when clearing surface memory
The beginning of the surface data needs to be computed correctly if the
stride is negative, otherwise, it should point already to the beginning
of the surface data. This bug seems to exists since 4a208b (0.5.2)
https://bugzilla.redhat.com/show_bug.cgi?id=1029646
2014-07-25 Marc-André Lureau <marcandre.lureau@gmail.com>
server: don't assert on invalid client message
Some users have been reaching this error:
snd_receive: ASSERT n failed
A misbehaving client could easily hit that condition by sending too big
messages. Instead of assert(), replace with a warning. When a message
too big to fit is received, it will simply disconnect the channel.
https://bugzilla.redhat.com/show_bug.cgi?id=962187
2014-05-30 Jonathon Jongsma <jjongsma@redhat.com>
Fix assert in mjpeg_encoder_adjust_params_to_bit_rate()
If mjpeg_encoder_reset_quality() is called with the same quality as currently
set, it will not reset last_enc_size but not reset num_recent_enc_frames,
violating some assumptions in _adjust_params_to_bit_rate(). To avoid aborting
the server, simply return early from this function.
Resolves: rhbz#1086820
2014-05-26 Wang Qiang <wangqiang.hunan@gmail.com>
Fix make failed when uncommented COMPRESS_STAT in red_worker.c
https://bugs.freedesktop.org/show_bug.cgi?id=79246
As a developer, I maybe want to see the detail compress stat of spice, like this:
Method count orig_size(MB) enc_size(MB) enc_time(s)
QUIC 846 948.02 147.22 7.51
GLZ 2895 594.90 26.60 1.33
ZLIB GLZ 0 0.00 0.00 0.00
LZ 1 3.15 0.01 0.00
JPEG 0 0.00 0.00 0.00
JPEG-RGBA 0 0.00 0.00 0.00
----------------------------------------------------------------------------
Total 3742 1546.07 173.83 8.84
But when I uncommented the COMPRESS_STAT and COMPRESS_DEBUG in red_worker.c and make.
I got some error(in Bugzilla). This error because of some simple syntax errors.
Commit this patch to fix this issue.
2014-05-19 Christophe Fergeau <cfergeau@redhat.com>
Update libtool version information for 0.12.5 release
Update 'release' instructions in configure.ac
The instructions are obsolete, replace them with the explanation about
how to handle current/revision/age from libtool manual:
https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
Update NEWS
2014-05-16 Marc-André Lureau <marcandre.lureau@gmail.com>
server: use a warning when disconnecting unresponsive client
The debug level is not visible by default, since it is an unsolicited
server behaviour, make it a warning.
2014-05-15 Christophe Fergeau <cfergeau@redhat.com>
docs: Fix make distcheck
2014-05-15 소병철 <byungchul.so@samsung.com>
Use PRI macros in printf to keep compatibility between 32/64bit system
gcc's some integer type definitions are different between 32/64bit system.
This causes platform dependency problem with printf function. However,
we can avoid this problem by using PRI macros that supports platform
independent printf.
2014-04-16 Christophe Fergeau <cfergeau@redhat.com>
Fix submodule reference
Add missing buffer (re)allocation to reds_sasl_handle_auth_steplen()
We need to make sure we have a buffer big enough to accomodate the data
sent by the coming SASL step.
Call correct SASL helper in reds_handle_auth_sasl_step
sasl_handle_auth_start() was called instead of reds_sasl_handle_auth_step()
Add G_GNUC_UNUSED annotations to async_read_handler args
2 of the arguments are not used, the G_GNUC_UNUSED annotation will make
this explicit.
Make struct AsyncRead/async_read_handler private
All users are now contained in reds_stream.c
Remove RedLinkInfo::async_read
9feed69 moved the async reader code to RedsStream so that it can be used
for the SASL authentication code. In particular, it introduced a
RedsStream::async_read member which is used by the SASL authentication code
for its async operations.
However, what was not done is to remove the now redundant
RedLinkInfo::async_read field. This causes failures when using SASL
authentication as the async read error callback is getting set
on the RedLinkInfo::async_read structure, but then the SASL code is trying
to use the RedeStream::async_read structure for its async IOs, which do not
have the needed error callback set.
This commit makes use of the newly introduced reds_stream_async_read()
helper in order to make use of RedsStream::async_read.
Call AsyncRead variables 'async' instead of 'obj'
This is a more explicit name.
Add reds_stream_set_async_error_handler() helper
This replaces async_read_set_error_handler() which was unused. This sets a
callback to be called when an async operation fails.
We could pass the error_handler to each reds_stream_async_read() call, but as
we will be using the same one for all async calls, it's more convenient to set it
once and for all.
AsyncRead is going to be private to reds_stream.c in one of the next
commits, and the error handler will need to be set from reds.c,
hence the move to a public RedsStream method.
Introduce reds_stream_async_read() helper
This will allow to make RedsStream::async_read private
build-sys: Fix VPATH builds
Fixing this is a matter of picking the spice-common fix to generate the
(de)marshaller source files in the right place, and to adjust the compiler
flags to look for includes in the build directory as well.
Fix --without-sasl build
There are 2 SASL-related function prototypes which are unused in the
--without-sasl case. They cause a warning, and a build failure
when using -Werror. Wrapping them in #if HAVE_SASL avoids this issue.
doc: Generate chunked manual
This commit makes use of a2x in order to generate a chunked manual in
addition to the "all in one page" one.
2014-03-25 Marc-André Lureau <marcandre.lureau@gmail.com>
manual: improve text about ~/Public
2014-03-20 Christophe Fergeau <cfergeau@redhat.com>
Check RSA_generate_key_ex return value
This can fail in fips mode for example. If we ignore the failure, we'll get
a crash:
#0 0x00007f38d63728a0 in BN_num_bits () from /lib64/libcrypto.so.10
#1 0x00007f38d639661d in RSA_size () from /lib64/libcrypto.so.10
#2 0x00007f38d7991762 in reds_handle_read_link_done () from /lib64/libspice-server.so.1
#3 0x00007f38d7990c06 in spice_server_add_client () from /lib64/libspice-server.so.1
#4 0x00007f38d7990c6a in reds_accept () from /lib64/libspice-server.so.1
#5 0x00007f38dc0d2946 in qemu_iohandler_poll (pollfds=0x7f38dedce200, ret=755449965, ret@entry=1) at iohandler.c:143
#6 0x00007f38dc0d6ea8 in main_loop_wait (nonblocking=<optimized out>) at main-loop.c:465
#7 0x00007f38dbffd7c0 in main_loop () at vl.c:1988
#8 main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4357
This commit will cause the client connection to fail but qemu won't
segfault.
2014-03-20 David Gibson <dgibson@redhat.com>
Don't truncate large 'now' values in _spice_timer_set
static void _spice_timer_set(SpiceTimer *timer, uint32_t ms, uint32_t now)
The _spice_timer_set() function takes a 32-bit integer for the "now" value.
The now value passed in however, can exceed 2^32 (it's in ms and derived
from CLOCK_MONOTONIC, which will wrap around a 32-bit integer in around 46
days).
If the now value passed in exceeds 2^32, this will mean timers are inserted
into the active list with expiry values before the current time, they will
immediately trigger, and (if they don't make themselves inactive) be
reinserted still before the current time.
This leads to an infinite loop in spice_timer_queue_cb().
https://bugzilla.redhat.com/show_bug.cgi?id=1072700
2014-03-19 Marc-André Lureau <marcandre.lureau@gmail.com>
Update spice-common
manual: fix xml highlighting
manual: add folder sharing section
Translate docbook -> asciidoc
It's much much easier to read and edit, and the end results looks better
as well, see http://elmarco.fedorapeople.org/manual.html
Associate org.spice-space.webdav.0 port to webdav channel
For example, with qemu, a webdav channel can be created this way:
-chardev spiceport,name=org.spice-space.webdav.0,...
And redirected to a virtio port:
-device virtserialport,...,name=org.spice-space.webdav.0
build-sys: simplify manual html generation
SpiceUserManual.xml: small clean-ups
Remove some non-conventional/non-freesoftware editor-specific lines.
Remove trailing whitespaces
Get rid of DTD, which is too strict for docbook, see also:
http://docbook.org/tdg5/en/html/ch02.html
This get rids of the following warning/error:
I/O error : Attempt to load network entity
http://docbook.org/xml/5.0/dtd/docbook.dtd
/home/elmarco/src/spice/spice-master/docs/manual/SpiceUserManual.xml:4:
warning: failed to load external entity
"http://docbook.org/xml/5.0/dtd/docbook.dtd"
"http://docbook.org/xml/5.0/dtd/docbook.dtd">
^
2014-03-13 Christophe Fergeau <cfergeau@redhat.com>
Fix test_capability() typo
It was spelt 'capabilty'
Fix typo in log message
mjpeg: Don't warn on unsupported image formats
When trying to start mjpeg compression mode, mjpeg_encoder_start_frame()
tests the image format as its only able to compress 24/32bpp images. On
images with lower bit depths, we return MJPEG_ENCODER_FRAME_UNSUPPORTED to
indicate this is not a format we can compress. However, this return goes
with a spice_warning("unsupported format"). As the rest of the code can
cope with this unsupported format by not doing mjpeg compression, it's
nicer to downgrade this spice_warning() to spice_debug().
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1070028
2014-01-20 Christophe Fergeau <cfergeau@redhat.com>
Add reference manual
This manual documents how to enable/use various SPICE features when
creating a VM by running QEMU directly, or when using libvirt, or when
using virt-manager.
This is based on work by Lubos Kocman
Make RedsStream::info private
Introduce reds_stream_set_channel()
Introduce reds_stream_set_info_flag()
Make RedsStream::async_read private
Make RedsStream::sasl private
Make RedsStream read/write functions private
Make RedsStream::ssl private
Introduce reds_stream_is_ssl()
Add RedsStream::priv
The private data is allocated at the same time as RedsStream and
goes immediatly after the main RedsStream data.
This private member will allow to hide internal RedsStream
implementation details from the rest of spice-server.
Move SASL authentication to reds_stream.h
SASL authentication mostly use members from RedsStream to do its work, so
it makes sense to have its code in reds_stream.c. This should allow to make
RedsStream::sasl private in the future.
Move async code to RedsStream
The AsyncRead structure in reds.h wraps an async read + callback to
be done on a stream. Moving it to reds_stream.h is needed in order
to move SASL authentication there.
Move stream read/write callbacks to reds_stream.c
Now that stream creation and SSL enabling are done by helpers
in reds_stream.c, we can move the initialization of the vfunc
read/write pointers there too.
Introduce reds_stream_new() helper
Initializing a new stream means initializing quite a few fields.
This commit factors this initialization in a dedicated reds_stream_new
helper. This also helps moving more code from reds.c to reds_stream.c
reds: Move SSL-related code to RedsStream
Code to initiate a SSL stream belongs there
Move sync_write* to reds_stream.h
They are renamed to reds_stream_write*
Add reds_stream.[ch]
Gather common RedsStream code there rather than having it
in reds.c
Move SPICE_GNUC_VISIBLE to red_common.h
2014-01-02 Christophe Fergeau <cfergeau@redhat.com>
tests: Avoid malloc failures
test-display-streaming is calling malloc() without checking its return
value. Coverity warns about this. This commit switches to g_malloc() to
sidestep this warning (g_malloc() never returns NULL but aborts instead).
tests: Remove unused variables
coverity spotted some variables that were declared but not used in
server/tests
2014-01-02 Jeremy White <jwhite@codeweavers.com>
Fix typo; sampel --> sample
Add support for the Opus codec
Revise the spice client and server to use the new snd_codec functions in spice-common.
This makes celt optional, and paves the way to readily add additional codecs.
2013-12-12 David Jaša <djasa@redhat.com>
Use TLS version 1.0 or better
When creating a TLS socket, both spice-server and spice-gtk currently
call SSL_CTX_new(TLSv1_method()). The TLSv1_method() function set the
protocol version to TLS 1.0 exclusively. The correct way to support
multiple protocol versions is to call SSLv23_method() in spite of its
scary name. This method will enable all SSL/TLS protocol versions. The
protocol suite may be further narrowed down by setting respective
SSL_OP_NO_<version_code> options of SSL context. This possibility is
used in this patch in order to block use of SSLv3 that is enabled by
default in openssl for client sockets as of now but spice has never used
it.
2013-12-11 Christophe Fergeau <cfergeau@redhat.com>
Remove empty red_time.c
Add red_time.h to Makefile.am
This file was added in bc50ff076 a few months ago, but is not listed
in Makefile.am, and thus not part of tarballs. However, it's being included
from other C files, so not having it causes compilation breakage.
Update git-version-gen to latest version
Pick the latest git-version-gen version from
http://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/git-version-gen
Add .version to EXTRA_DIST
Newer versions of git-version-gen document that it should be done, and
builddir != srcdir builds are broken if it's not present in the tarball as
we'd attempt to generate this file in the read-only source directory (if
the source dir is read-only)
Fix snappy detection with newer spice-gtk
It was renamed to spicy-screenshot
2013-11-04 Christian Ruppert <idl0r@qasl.de>
Require alsa only with --enable-client
Hey guys,
the alsa libraries/header seem to be required only when configured with
--enable-client so I wrote a patch to make configure respect it.
--
Regards,
Christian Ruppert
From 53683cc75ba092799f856f710cb45b2aacfb6123 Mon Sep 17 00:00:00 2001
From: Christian Ruppert <idl0r@gentoo.org>
Date: Sun, 3 Nov 2013 18:36:26 +0100
Subject: [PATCH] Require alsa only with --enable-client
2013-10-30 Christophe Fergeau <cfergeau@redhat.com>
Fix buffer overflow when decrypting client SPICE ticket
reds_handle_ticket uses a fixed size 'password' buffer for the decrypted
password whose size is SPICE_MAX_PASSWORD_LENGTH. However,
RSA_private_decrypt which we call for the decryption expects the
destination buffer to be at least RSA_size(link->tiTicketing.rsa)
bytes long. On my spice-server build, SPICE_MAX_PASSWORD_LENGTH
is 60 while RSA_size() is 128, so we end up overflowing 'password'
when using long passwords (this was reproduced using the string:
'fullscreen=1proxy=#enter proxy here; e.g spice_proxy = http://[proxy]:[port]'
as a password).
When the overflow occurs, QEMU dies with:
*** stack smashing detected ***: qemu-system-x86_64 terminated
This commit ensures we use a corectly sized 'password' buffer,
and that it's correctly nul-terminated so that we can use strcmp
instead of strncmp. To keep using strncmp, we'd need to figure out
which one of 'password' and 'taTicket.password' is the smaller buffer,
and use that size.
This fixes rhbz#999839
2013-10-28 Christophe Fergeau <cfergeau@redhat.com>
Remove tunneling support
It's depending on an unmaintained package (slirp), and I don't
think anyone uses that code. It's not tested upstream nor in fedora,
so let's remove it.
Silence gcc false positive with -Wuninitialized
Some versions of gcc warn about:
red_channel.c: In function 'red_channel_client_wait_outgoing_item':
red_channel.c:2331: error: 'end_time' may be used uninitialized in this function [-Wuninitialized]
red_channel.c: In function 'red_channel_client_wait_pipe_item_sent':
red_channel.c:2363: error: 'end_time' may be used uninitialized in this function [-Wuninitialized]
red_channel.c: In function 'red_channel_wait_all_sent':
red_channel.c:2401: error: 'end_time' may be used uninitialized in this function [-Wuninitialized]
This is a false positive as end_time is unitialized when timeout is -1, and
we will only try to use end_time if timeout is not -1.
This commit initializes end_time to UINT64_MAX to avoid that warning. As
the test involving end_time will never be reached, we ensure it's always
TRUE so that it would be a noop even if it was reached.
2013-10-18 Axel Lin <axel.lin@ingics.com>
red_tunnel_worker: Fix build error due to missing monitor_latency argument
Fix missing monitor_latency argument in red_channel_client_create call.
2013-10-10 Christophe Fergeau <cfergeau@redhat.com>
Use latest warnings.m4 from gnulib
This fixes at least some issues when building with clang
Use hardened linker flags if available
This commit reuse several macros from libvirt to test for
support for "-Wl,-z -Wl,relro", "-Wl,-z -Wl,now" and
"-Wl,--no-copy-dt-needed-entries", and use them if available.
Don't ignore all of m4/ in .gitignore
m4/ contains several files tracked in git, so we should not ignore
the whole directory.
2013-10-09 Christophe Fergeau <cfergeau@redhat.com>
Fix PlaybackeCommand typo
2013-10-09 Jeremy White <jwhite@codeweavers.com>
Fix an overlooked x11 client case.
2013-10-08 Marc-André Lureau <marcandre.lureau@gmail.com>
reds: remove dead code
2013-10-08 Christophe Fergeau <cfergeau@redhat.com>
reds: Fix 'asyc' typo
Fix 'recive' typo throughout the code base
'receive' was mispelt 'recive' in multiple places.
Namespace RECEIVE_BUF_SIZE
2013-10-07 Marc-André Lureau <marcandre.lureau@gmail.com>
server: handle red_get_surface_cmd() error explicitely
Don't ignore red_get_surface_cmd() error, and explicitely interrupt and
free cmd before processing.
server: plug some leaks on error
Plug what looks like memory leaks, that could be potentially be
triggered by a misbehaving guest.
server: inputs s/relase/release
server: release all pressed keys on client disconnect
Releasing modifiers keys unconditionally on disconnect leads to
unexpected guest wakeups. To improve the situation, the server can
release only the pressed keys, which will prevent the wakeup in most
cases.
Furthermore, it's not sufficient to release only the modifiers keys.
Any key should be released on client disconnect to avoid sticky key
press across connections.
https://bugzilla.redhat.com/show_bug.cgi?id=871240
server: mark deprecated symbols
server/tests: avoid using deprecated symbols
server: set dispatcher before calling attache_worker
This allows to call spice_qxl_add_memslot during attache_worker(), like
done in the tests.
Update spice-common
2013-10-01 Marc-André Lureau <marcandre.lureau@gmail.com>
server: remove memslot unused functions
2013-09-30 Marc-André Lureau <marcandre.lureau@gmail.com>
cleanup: remove GITVERSION
This file is unneeded since d986fb46
server: remove unused fill_rects_clip
Unused since 62d0c076eb2eb0f9954c3870f31b4dd685e5f95c.
spicec: disable stencil test with primary fbo
The primary buffer doesn't use stencil test. However, this should be
explicitely disabled, since the canvas might change stencil state, and
this will affect primary stencil buffer, making some of further update
operations clipped in unwanted ways.
spicec: use pre/post copy
Ensure the GL state is appropriate for calling GCanvas::copy_pixels.
spicec: add sw canvas diff check
Setting CHECKDIFF=1 environment variable will compare the rendering of
the selected canvas with a software canvas. This is useful for debugging
some rendering issues, however it is far from being perfect, since it's
not able to tell whether one or the other is actually faulty. It's a
strong indication though of which operations are incorrect.
Ideally, all operations should be checked, however, a few of them are
disabled by default because they fail all the time, and it looks like
pixman is not very accurate for blending/compositing (at least visually,
it seems gl has better rendering)
spicec: do not abort if cache error
spicec: add SPICE_NOGRAB
Similar to spice-gtk, disable mouse and keyboard grab (useful when
running under a debugger)
spicec: remove dead GL code
spicec: use doublebuffer for opengl
This visually reduces glitches without noticeable speed difference.
It's also the traditionnal way of doing opengl.
spicec: fix non-doublebuffer drawing
First, context must set it, then Draw/ReadBuffer must be set to FRONT,
and then explicit Flush is needed.
This patch is mostly for future reference, it is mostly discarded in
following patch using double-buffer.
spicec: use standard opengl 3.0 framebuffer
spicec: refresh the display after display resize
spicec: warn when throwing exception
This helps to identify the code location of exception
update spice-common
2013-09-26 Yonit Halperin <yhalperi@redhat.com>
red_worker: disconnect the channel instead of shutdown in case of a blocking method failure
rhbz#1004443
The methods that trigger waitings on the client pipe require that
the waiting will succeed in order to continue, or otherwise, that
all the living pipe items will be released (e.g., when
we must destroy a surface, we need that all its related pipe items will
be released). Shutdown of the socket will eventually trigger
red_channel_client_disconnect (*), which will empty the pipe. However,
if the blocking method failed, we need to empty the pipe synchronously.
It is not safe(**) to call red_channel_client_disconnect from ChannelCbs
, but all the blocking calls in red_worker are done from callbacks that
are triggered from the device.
To summarize, calling red_channel_client_disconnect instead of calling
red_channel_client_shutdown will immediately release all the pipe items that are
held by the channel client (by calling red_channel_client_pipe_clear).
If red_clear_surface_drawables_from_pipe timeouts,
red_channel_client_disconnect will make sure that the surface we wish to
release is not referenced by any pipe-item.
(*) After a shutdown of a socket, we expect that later, when
red_peer_handle_incoming is called, it will encounter a socket
error and will call the channel's on_error callback which calls
red_channel_client_disconnect.
(**) I believe it was not safe before commit 2d2121a17038bc0 (before adding ref
count to ChannelClient). However, I think it might still be unsafe, because
red_channel_client_disconnect sets rcc->stream to NULL, and rcc->stream
may be referred later inside a red_channel_client method unsafely. So instead
of checking if (stream != NULL) after calling callbacks, we try to avoid
calling red_channel_client_disconnect from callbacks.
red_channel: cleanup of red_channel_client blocking methods
(1) receive timeout as a parameter.
(2) add a return value and pass the handling
of failures to the calling routine.
red_worker: cleanup red_clear_surface_drawables_from_pipes
(1) merge 'force' and 'wait_for_outgoing_item' to one parameter.
'wait_for_outgoing_item' is a derivative of 'force'.
(2) move the call to red_wait_outgoing_item to red_clear_surface_drawables_from_pipe
2013-09-17 Marc-André Lureau <marcandre.lureau@gmail.com>
build-sys: fix some automake warning
client/Makefile.am:199: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
server/tests/Makefile.am:3: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
2013-09-10 Dunrong Huang <riegamaths@gmail.com>
Fix _FORTIFY_SOURCE redefine error
If the _FORTIFY_SOURCE has been already defined, we shouldn't redefine
it, or it will raise a build error as below:
In file included from agent-msg-filter.c:21:0:
../config.h:17:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
agent-msg-filter.c:1:0: note: this is the location of the previous definition
Suggested-by: Christophe Fergeau <cfergeau@redhat.com>
2013-09-02 Christophe Fergeau <cfergeau@redhat.com>
red_parse_qxl: Change spice_error() to spice_warning()
After eb09c25c, red_parse_qxl.c still has some spice_error() which
will kill the server even though the code is trying to return an error
when the spice_error() is hit.
This commit replaces these occurrences with a spice_warning() which
will not kill spice-server.
2013-09-02 Uri Lublin <uril@redhat.com>
server: bitmap_consistent: replace spice_error with spice_warning
bitmap_consistent should return true or false.
Currently it aborts instead of returning false, due to spice_error.
Replacing spice_error with spice_warning, provides information and returns
false, as expected.
This fixes Fedora bz#997932
2013-08-29 Alon Levy <alevy@redhat.com>
client: add some missing USE_GUI define guards
2013-08-22 Yonit Halperin <yhalperi@redhat.com>
red_worker: fix call to dump_bitmap (too many args)
spice_bitmap_utils: fix dump_bitmap
2013-08-14 Yonit Halperin <yhalperi@redhat.com>
main_channel: monitoring client connection status
rhbz#994175
Start monitoring if the client connection is alive after completing
the bit-rate test.
red_channel: add option to monitor whether a channel client is alive
rhbz#994175
When a client connection is closed surprisingly (i.e., without a FIN
segment), we cannot identify it by a socket error (which is the only
way by which we identified disconnections so far).
This patch allows a channel client to periodically check the state of
the connection and identify surprise disconnections.
red_channel: add on_input callback for tracing incoming bytes
The callback will be used in the next patch.
spice_timer_queue: don't call timers repeatedly
For channels that don't run as part of the main loop, we use
spice_timer_queue, while for the other channels we use
qemu timers support. The callbacks for setting timers are supplied to
red_channel via SpiceCoreInterface, and their behavior should be
consistent. qemu timers are called only once per each call to
timer_start. This patch assigns the same behaviour to spice_timer_queue.
2013-08-14 Alon Levy <alevy@redhat.com>
server: split spice_image_cache from red_worker
server/red_worker: s/image_cache_eaging/image_cache_aging/
server: move surface_format_to_image_type to spice_bitmap_utils
server: s/red_wait_all_sent/red_channel_wait_all_sent/
server: move three functions to red_channel
Three blocking functions, one was split to leave the display channel
specific referencing of the DrawablePipeItem being sent inside
red_worker, but the rest (most) of the timeout logic was moved to
red_channel, including the associated constants.
Moved functions:
red_channel_client_wait_pipe_item_sent
red_wait_outgoing_item
red_wait_all_sent
Introduces red_time.h & red_time.c for a small helper function dealing
with time.h
server: move bit set/clear utilities out of red_worker.h
server: move dump_bitmap to separate file
server/red_worker.c:red_process_drawable: rename item to drawable
server/red_worker.c:red_process_drawable: rename drawable to red_drawable
red_worker: mark DRAW_ALL as broken
setting DRAW_ALL define doesn't produce correct rendering. Using
update_area instead of red_draw_qxl_drawable will work but it shouldn't
be required. This is not work I intend to do right now, so marking it
for anyone looking at this in the future.
2013-08-06 Yonit Halperin <yhalperi@redhat.com>
red_worker: decrease the timeout when flushing commands and waiting for the client.
150 seconds is way too long period for holding the guest driver and
waiting for a response for the client. This timeout was 15 seconds, but
when off-screen surfaces ware introduced it was arbitrarily multiplied by
10.
Other existing related bugs emphasize why it is important to decrease
the timeout:
(1) 994211 - the qxl driver waits for an async-io reponse for 60 seconds
and after that, it switches to sync-io mode. Not only that the
driver might use invalid data (since it didn't wait for the query to
complete), falling back to sync-io mode introduces other errors.
(2) 994175 - spice server sometimes doesn't recognize that the client
has disconnected.
(3) There might be cache inconsistency between the client and the server,
and then the display channel waits indefinitely for a cache item (e.g., bug
977998)
This patch changes the timeout to 30 seconds. I tested it under wifi +emulating 2.5Mbps network,
together with playing video on the guest and changing resolutions in a loop. The timeout didn't expired
during my tests.
This bug is related to rhbz#964136 (but from rhbz#964136 info it is still not
clear why the client wasn't responsive).
2013-07-29 Yonit Halperin <yhalperi@redhat.com>
log: improve debug information related to client disconnection
snd_worker/snd_disconnect_channel: don't call snd_channel_put if the channel has already been disconnected
The snd channels has one reference as long as their socket is active.
The playback channel has an additional reference for each frame that is
currently filled by the sound device.
Once the channel is disconnected (the socket has been freed and the
first reference is released) snd_disconnect_channel shouldn't release
a reference again.
snd_worker: fix memory leak of PlaybackChannel
When the sequence of calls bellow occurs, the PlaybackChannel
is not released (snd_channel_put is not called for the
samples that refer to the channel).
spice_server_playback_get_buffer
snd_channel_disconnect
spice_server_playback_put_samples
reds: s/red_client_disconnect/red_channel_client_shutdown inside callbacks
When we want to disconnect the main channel from a callback, it is
safer to use red_channel_client_shutdown, instead of directly
destroying the client. It is also more consistent with how other
channels treat errors.
red_channel_client_shutdown will trigger socket error in the main channel.
Then, main_channel_client_on_disconnect will be called,
and eventually, main_dispatcher_client_disconnect.
I didn't replace calls to reds_disconnect/reds_client_disconnect in
places where those calls were safe && that might need immediate client
disconnection.
decouple disconnection of the main channel from client destruction
Fixes rhbz#918169
Some channels make direct calls to reds/main_channel routines. If
these routines try to read/write to the socket, and they get socket
error, main_channel_client_on_disconnect is called, and triggers
red_client_destroy. In order to prevent accessing expired references
to RedClient, RedChannelClient, or other objects (inside the original call, after
red_client_destroy has been called) I made the call to
red_client_destroy asynchronous with respect to main_channel_client_on_disconnect.
I added MAIN_DISPATCHER_CLIENT_DISCONNECT to main_dispatcher.
main_channel_client_on_disconnect pushes this msg to the dispatcher,
instead of calling directly to reds_client_disconnect.
The patch uses RedClient ref-count in order to handle a case where
reds_client_disconnect is called directly (e.g., when a new client connects while
another one is connected), while there is already CLIENT_DISCONNECT msg
pending in the main_dispatcher.
Examples:
(1) snd_worker.c
snd_disconnect_channel()
channel->cleanup() //snd_playback_cleanup
reds_enable_mm_timer()
.
.
main_channel_push_multi_media_time()...socket_error
.
.
red_client_destory()
.
.
snd_disconnect_channel()
channel->cleanup()
celt051_encoder_destroy()
celt051_encoder_destory() // double release
Note that this bug could have been solved by changing the order of
calls: e.g., channel->stream = NULL before calling cleanup, and
some other changes + reference counting. However, I found other
places in the code with similar problems, and I looked for a general
solution, at least till we redesign red_channel to handle reference
counting more consistently.
(2) inputs_channel.c
inputs_connect()
main_channel_client_push_notify()...socket_error
.
.
red_client_destory()
.
.
red_channel_client_create() // refers to client which is already destroyed
(3) reds.c
reds_handle_main_link()
main_channel_push_init() ...socket error
.
.
red_client_destory()
.
.
main_channel_client_start_net_test(mcc) // refers to mcc which is already destroyed
This can explain the assert in rhbz#964136, comment #1 (but not the hang that occurred before).
main_dispatcher: add ref count protection to RedClient instances
red_channel: add ref count to RedClient
red_channel: prevent adding and pushing pipe items after a channel_client has diconnected
Fixes: leaks of pipe items & "red_client_destroy: assertion `rcc->send_data.size == 0'"
red_channel_disconnect clears the pipe. It is called only once. After,
it was called, not items should be added to the pipe.
An example of when this assert can occur:
on_new_cursor_channel (red_worker.c), pushes 2 pipe items.
When it pushes the first pipe item, if the client has disconnected,
it can hit a socket error, and then, red_channel_client_disconnect is called.
The second call to adding a pipe item, will add the item to
the pipe. red_channel_client_pipe_add_type also calls
red_channel_client_push, which will update the send_data.size.
Then, the push will also hit a socket error, but red_channel_client_disconnect
won't clear the pending pipe item again, since it was already called.
When red_client_destory is called, we hit assertion `rcc->send_data.size
== 0'.
Note that if a pipe item is added to the pipe after
red_channel_client_disconnect was called, but without pushing it,
we should hit "spice_assert(rcc->pipe_size == 0)".
2013-07-28 Alon Levy <alevy@redhat.com>
server/red_channel: fix unused variable
unused variable 'so_unsent_size' [-Werror=unused-variable]
2013-07-24 Alon Levy <alevy@redhat.com>
server/red_worker.c: remove unused pipe_item_remove
2013-07-22 Nahum Shalman <nshalman@elys.com>
TIOCOUTQ -> SIOCOUTQ and portability ifdefs
The ioctl on sockets is actually named SIOCOUTQ though its value
is identical to TIOCOUTQ which is for terminals.
SIOCOUTQ is linux specific so we add a header check and ifdef based
on the presence of the header
This prevents bogus ioctls on non-Linux platforms
configure.ac comment typo nit
2013-07-17 Uri Lublin <uril@redhat.com>
Release 0.12.4
Update spice-common submodule (get spice-protocol 0.12.6)
syntax-check: trailing whitespaces -- ignore binary files
2013-07-16 Uri Lublin <uril@redhat.com>
syntax-check: remove trailing whitespaces
Only whitespace changes in this commit.
syntax-check: make sure config.h is the first included .h file
syntax-check: use test A && test B instead of test A -a B
syntax-check: fix no-newline or empty line at EOF
syntax-check: s/the the/the/ in a comment
syntax-check: update AUTHORS
syntax-check: fix cast_of_argument_to_free
In this case, make syntax-check is wrong, and we actually do
need the cast.
A cast is needed when types are uint64_t <--> pointer
Using a local "ptr" variable makes both gcc and syntax-check happy.
syntax-check: fix avoid_if_before_free
server/tests: fix timer for test_empty_success
server/tests: test_display_width_stride: add destroy command
Otherwise, the test exits after the first iteration over all tests,
on the second attempt to create an already created surface.
server/tests: remove option from usage if AUTOMATED_TESTS is not configured
server/tests: invalid-option: print the bad argument
optind points to the next argument to parse.
server/tests: fix produce_command for create surface
Earlier in this function, test->target_surface is set to 1, which
is the only allowed non-primary surface currently.
If surface parameters are given (and specifically data is checked)
they are being used, otherwise a default surface is used.
Earlier in this function, "command" is set to a non-NULL value.
Thus, the else part was unreachable code, which is fixed now.
server/tests: test_display_base: set rect according to appropriate surface
When surface_id == 0, primary is used.
Otherwise (currently 1), secondary is used.
Also, remove unused test_width and test_height.
Since commit caea7699434c20dceef8fc79d21b8eeb663fbf53,
test->width and test->height are used.
red_channel: replace RING_FOREACH with RING_FOREACH_SAFE in some places
This was originally intended to fix the problem fixed by
commit 53488f0275d6c8a121af49f7ac817d09ce68090d.
What is left are FOREACH loops that are at less risk and maybe safe (no
read/write or disconnect/destroy are called from within them).
red_worker: use a generic SAFE_FOREACH macro
Introduce SAFE_FOREACH macro
Make other safe iterators use SAFE_FOREACH
red_worker: delete unused CCC_FOREACH
red_worker: make DRAWABLE_FOREACH_DPI safe
red_worker: use only DRAWABLE_FOREACH_GLZ_SAFE
red_worker: make WORKER_FOREACH_DCC safe
Specifically, the loop in red_pipes_add_draw can cause spice to abort.
In red_worker.c (WORKER_FOREACH_DCC):
red_pipes_add_drawable
red_pipe_add_drawable
red_handle_drawable_surfaces_client_synced
red_push_surface_image
red_channel_client_push
red_channel_client_send
red_peer_handle_outgoing
reds_stream_writev (if fails -- EPIPE)
handler->cb->on_error = red_channel_client_disconnect()
red_channel_remove_client()
ring_remove() -- of rcc from channel.clients ring.
red_worker: reuse DCC_FOREACH in WORKER_DCC_FOREACH
The only thing that is needed is to get the channel out of the worker.
red_worker: use only RCC_FOREACH_SAFE
RCC_FOREACH may be dangerous
The following patches replace FOREACH loops with a SAFE version.
Using unsafe loops may cause spice-server to abort (assert fails).
Specifically a read/write fail in those loops, may cause the client
to disconnect, removing the node currently iterated, which cause spice
to abort in ring_next():
-- assertion `pos->next != NULL && pos->prev != NULL' failed
2013-07-05 David Gibson <david@gibson.dropbear.id.au>
Use RING_FOREACH_SAFE in red_channel.c functions which are missing it
Currently, both red_channel_pipes_add_type() and
red_channel_pipes_add_empty_msg() use plaing RING_FOREACH() which is not
safe versus removals from the ring within the loop body.
Although it's rare, such a removal can occur in both cases. In the case
of red_channel_pipes_add_type() we have:
red_channel_pipes_add_type()
-> red_channel_client_pipe_add_type()
-> red_channel_client_push()
And in the case of red_channel_client_pipes_add_empty_msg() we have:
red_channel_client_pipes_add_empty_msg()
-> red_channel_client_pipe_add_empty_msg()
-> red_channel_client_push()
But red_channel_client_push() can cause a removal from the clients ring if
a network error occurs:
red_channel_client_push()
-> red_channel_client_send()
-> red_peer_handle_outgoing()
-> handler->cb->on_error callback
= red_channel_client_default_peer_on_error()
-> red_channel_client_disconnect()
-> red_channel_remove_client()
-> ring_remove()
When this error path does occur, the assertion in RING_FOREACH()'s
ring_next() trips, and the process containing the spice server is aborted.
i.e. your whole VM dies, as a result of an unfortunately timed network
error on the spice channel.
Please apply.
2013-06-25 Yonit Halperin <yhalperi@redhat.com>
red_worker: fix for stuck display_channel over WAN (jpeg_enabled=true)
The image descriptor flags shouldn't be copied as is from the flags that
were set by the driver. Specifically, the CACHE_ME flag shouldn't be copied,
since it is possible that (a) the image won't be cached (b) the image
is already cached, but in its lossy version, and we may want to set the bit for
CACHE_REPLACE_ME, in order to cache it in its lossless version.
In case (b), the client first looks for the CACHE_ME flag, and only if
it is not set it looks for CACHE_REPLACE_ME (see canvas_base.c). Since both flags where set,
the client ignored REPLACE_ME, and didn't turned off the lossy flag of the
cach item. Then, when a request from this lossles item reached the
client (FROM_CACHE_LOSSLESS), the client display channel waited
endlessly for the lossless version of the image.
2013-06-24 Yonit Halperin <yhalperi@redhat.com>
red_worker: improve stream stats readability and ease of parsing
also added start/end-bit-rate and avg-quality to the final stream stats.
mjpeg_encoder: add mjpeg_encoder_get_stats
spice: silencing most of the ping/pong logging
Those messages are too frequent and don't contribute much
2013-06-06 Hans de Goede <hdegoede@redhat.com>
server: Add support for filtering out agent file-xfer msgs (rhbz#961848)
2013-05-24 Yonit Halperin <yhalperi@redhat.com>
red_channel: replace an assert upon threads mismatch with a warning
The assert:
spice_assert(pthread_equal(pthread_self(), client->thread_id))
and the assert:
spice_assert(pthread_equal(pthread_self(), rcc->channel->thread_id))
were coded in order to protect data that is accessed from the main
context (red_client and most of the channels), from
access by threads of other channels (namely, the display and cursor
channels), and vice versa.
However, some of the calls to the sound channel interface,
and also the char_device interface, can be done from the vcpu thread.
It doesn't endanger these channels internal data, since qemu use global
mutex for the vcpu and io threads.
Thus, pthread_self() can be != channel->thread_id, if one of them is
the vcpu thread and the other is the io-thread, and we shouldn't assert.
Future plans: A more complete and complicated solution would be to manage our own thread for
spice-channels, and push input from qemu to this thread, instead of
counting on the global mutex of qemu
rhbz#823472
2013-05-23 Yonit Halperin <yhalperi@redhat.com>
main_channel: fix double release of migration target data
If client_migrate_info was called once with cert-host-subject and
then again without cert-host-subject, on a third call to
client_migrate info, the cert-host-subject from the first call would
have been freed for the second time.
2013-05-19 Christophe Fergeau <cfergeau@redhat.com>
Log actual address spice-server binds to
It's not always obvious what address spice-server will bind to,
in particular when the 'addr' parameter is omitted on QEMU
commandline. The decision of what address to bind to is made
in reds_init_socket with a call to getaddrinfo. Surprisingly,
that function had a call to getnameinfo() already, but it does
not seem to be using the result of that call in any way.
This commit moves this call after the socket is successfully bound
and add a log message to indicate which address it's bound to.
2013-05-17 Alon Levy <alevy@redhat.com>
0.12.3 release
server/red_parse_qxl: two coding convention pointer cast fix
server/dispatchers: initialize stack to 0 for valgrind
server/red_dispatcher: close pa hole in RedWorkerMessageDisplayConnect for valgrind
server/tests: test_display_width_stride
server/red_worker: simplify monitors_config update
server/tests/test_display_base: add missing set_client_capabilities, fix client_monitors_config signature
server/red_worker: turn critical (assert) non error into warning
The situation causing this assert is unknown but it doesn't cause
correctness issues with later rendering, and it is causing an abort.
server/red_worker: s/driver_has_monitors_config/driver_cap_monitors_config/ (plus small comment)
2013-05-09 Yonit Halperin <yhalperi@redhat.com>
red_worker: don't get bit_rate from main_channel_client, if it wasn't initialized
When setting an initial video stream bit rate, if the bit rate
wasn't calculated by main_channel_client, and we don't have
estimation from previos streams, use some default values.
The patch also removes updating dcc->streams_max_bit_rate when
the bit_rate held by the main_channel is larger than it. It is not necessary
since we compare those 2 values each time we set the initial bit rate
for a stream.
2013-05-08 Yonit Halperin <yhalperi@redhat.com>
reds: fix memory leak when core->base.minor_version < 3
reds: move handle_channel_event logic from main_dispatcher to reds
main_dispactcher role is to pass events to the main thread.
The logic that handles the event better not be inside main_dispatcher.
red_worker: fail handle_migrate_data instead of aborting when there is an error during restoration of surfaces
red_channel: notify and shutdown a channel client when its handle_migrate_data fails
red_channel: add spice_channel_client_error
spice_channel_client_error prints warning and shutdowns the
channel_client that hit the error.
This macro is useful for errors that are specific for one session
and that are unrecoverable only with respect to this session.
Prefer disconnecting a client over aborting when possible.
red_worker: fix incorrect is_low_bandwidth after migrating a low bandwidth connection
rhbz#956345
After a spice session has been migrated, we don't retest the network
(user experience considerations). Instead, we obtain the is_low_bandwidth flag
from the src-server, via the migration data.
Before this patch, if we migrated from server s1 to s2 and then to s3,
and if the connection to s1 was a low bandwidth one, we erroneously
passed is_low_bandwidth=FALSE from s2 to s3.
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
red_worker: cleanup: add is_low_bandwidth flag to CommonChannelClient
Replace the mixed calls to display_channel_client_is_low_bandwidth
and to main_channel_client_is_low_bandwidth, with one flag in
CommonChannelClient that is set upon channel creation.
main_channel: add routine for checking if a network test had been conducted and completed
2013-05-05 Alon Levy <alevy@redhat.com>
red_worker: remove wrong TODO
red_create_stream is called even without any client but there is no
encoding since the mjpeg encoder is now associated with StreamAgent
which is only created when we have a client.
2013-05-01 Yonit Halperin <yhalperi@redhat.com>
red_channel: on migration target, start sending ping messages only after the client's migration has completed
The connection to the target server is established before migration
starts. However, the client reads and replies to messages from the server only after
migration completes. Thus, we better not send ping msgs from the target
before migration completes (because the observed roundtrip duration will
be bigger than the real one).
red_channel: stop sending ping messages after migration has completed
We mustn't send any msg to the client, besides MSG_MIGRATE_DATA, after
we send MSG_MIGRATE.
reds: fix not sending the mm-time after migration when there is no audio playback
This bug results in the client dropping all the video frames after
migration in case that (1) the hosts involved in migration have different
mm-time; and that (2) there is no audio playback.
This is relvant only for the client that was connected during the
migration.
rhbz#958276
2013-04-30 Yonit Halperin <yhalperi@redhat.com>
red_channel: fix not handling self pipe items in red_channel_client_release_item
When a client disconnects, red_channel_client_pipe_clear is called.
Releasing pipe items of type == MIGRATE||EMPTY_MSG||PING
wasn't handled, and was passed to channel_cbs.release_item.
There, an error occured since the pipe items were not recognized.
2013-04-24 Hans de Goede <hdegoede@redhat.com>
server: Add public spice_qxl_driver_unload method
With a SPICE_DISPLAY_CAP_MONITORS_CONFIG capable client, the client needs to
know what part of the primary to use for each monitor. If the guest driver
does not support this, the server sends messages to the client for a
single monitor spanning the entire primary.
As soon as the guest calls spice_qxl_monitors_config_async once, we set
the red_worker driver_has_monitors_config flag and stop doing this.
This is a problem when the driver gets unloaded, for example after a reboot
or when switching to a text vc with usermode mode-setting under Linux.
To reproduce this start a multi-mon capable Linux guest which uses
usermode mode-setting and then once X has started switch to a text vc. Note
how the client window does not only not resize, if you try to resize it
manually you always keep blackborders since the aspect is wrong.
This patch is the spice-server side of fixing this, it adds a new
spice_qxl_driver_unload method which clears the driver_has_monitors_config
flag.
The other patch needed to fix this is in qemu, and will calls this new method
from qxl_enter_vga_mode.
2013-04-22 Yonit Halperin <yhalperi@redhat.com>
red_worker: assign mm_time to vga frames
red_worker: increase the interval limit for stream frames
collect and print video stream statistics
server/red_worker: add an option to supply the bandwidth via env var
SPICE_BIT_RATE can be set for supplying red_worker the available
bandwidth (in Mbps).
server/red_worker.c: use the bit rate of old streams as a start point for new streams
mjpeg_encoder modify the initial bit we supply it, according to the
client feedback. If it reaches a bit rate which is higher than the
initial one, we use the higher bit rate as the new bit rate estimation.
red_worker: video streams - adjust client playback latency
reds: support mm_time latency adjustments
When there is no audio playback, we set the mm_time in the client to be older
than the one in the server by at least the requested latency (the delta is
actually bigger, due to the network latency).
When there is an audio playback, we adjust the mm_time in the client by
adjusting the playback buffer using SPICE_MSG_PLAYBACK_LATENCY.
snd_worker: support sending SPICE_MSG_PLAYBACK_LATENCY
also update spice-common submodule
dispatcher.h: fix - s/#define MAIN_DISPATCHER_H/#define DISPATCHER_H
red_worker: ignoring video frame drops that are not due to pipe congestion
A frame can be dropped if a new frame was added during the same
call to red_process_command (we didn't attempt to send the older
frame). Such drops are ignored.
red_worker: notify mjpeg_encoder on server frame drops
red_worker: support SPICE_MSGC_DISPLAY_STREAM_REPORT
update mjpeg_encoder with reports from the client about
the playback quality.
The patch also updates the spice-common submodule.
red_worker: start using mjpeg_encoder rate control capabilities
This patch only employs setting the stream parameters based on
the initial given bit-rate, the latency, and the encoding size.
Later patches will also employ mjpeg_encoder response to client reports,
and its control over frame drops.
The patch also removes old stream bit rate calculations that weren't
used.
server/red_worker: enable latency monitoring in the display channel
red_worker: stream - update periodically the input frame rate
Periodically calculate the rate of frames arriving from the guest to the
server.
red_channel: monitor connection latency using MSG_PING
server/red_worker: assign timer callbacks to worker_core, using spice_timer_queue
display channel - supplying timeouts interface to red_channel, in order to allow
periodic latency monitoring (see next patch).
server: spice_timer_queue
Each thread can create a spice_timer_queue, for managing its
own timers.
mjpeg_encoder: add stream warmup time, in which we avoid server and client drops
The stream starts after lossless frames were sent to the client,
and without rate control (except for pipe congestion). Thus, on the beginning
of the stream, we might observe frame drops on the client and server side which
are not necessarily related to mis-estimation of the bit rate, and we would
like to wait till the stream stabilizes.
mjpeg_encoder: keep the average observed fps similar to the defined fps
The actual frames distribution does not necessarily fit the
condition "at least one frame every (1000/rate_contorl->fps)
milliseconds".
For keeping the average frame rate close to the defined fps, we
periodically measure the current average fps, and modify
rate_control->adjusted_fps accordingly. Then, we use
(1000/rate_control->adjusted_fps) as the interval between the
frames.
mjpeg_encoder: move the control over frame drops to mjpeg_encoder
mjpeg_encoder: update the client with estimations for the required playback latency
The required client playback latency is assessed based on the current
estimation of the bit rate, the network latency, and the encoding size
of the frames. When the playback delay that is reported by the client
seems too small, or when the stream parameters change, we send the
client an updated playback latency estimation.
mjpeg_encoder: modify stream bit rate based on server side pipe congestion
Downgrading stream bit rate when the input frame rate in the server
exceeds the output frame rate, and frames are being dropped from the
output pipe.
mjpeg_encoder: adjust the stream bit rate based on periodic client feedback
mjpeg_encoder can receive periodic reports about the playback status on
the client side. Then, mjpeg_encoder analyses the report and can
increase or decrease the stream bit rate, depending on the report.
When the bit rate is changed, the quality and frame rate of the stream
are re-evaluated.
mjpeg_encoder: re-configure stream parameters when the frame's encoding size changes
If the encoding size seems to get smaller/bigger, re-evaluate the
stream quality and frame rate.
mjpeg_encoder: configure mjpeg quality and frame rate according to a given bit rate
Previously, the mjpeg quality was always 70. The frame rate was
tuned according to the frames' congestion in the pipe.
This patch sets the quality and frame rate according to
a given bit rate and the size of the first encoded frames.
The following patches will introduce an adaptive video streaming, in which
the bit rate, the quality, and the frame rate, change in response to
different parameters.
Patches that make red_worker adopt this feature will also follow.
server/red_worker: streams: moving mjpeg_encoder from Stream to StreamAgent
The mjpeg_encoder should be client specific, and not shared between
different clients**, for the following reasons:
(1) Since we use abbreviated jpeg datastream for mjpeg, employing the same
mjpeg_encoder for different clients might cause errors when the
clients decode the jpeg data.
(2) The next patch introduces bit rate control to the mjpeg_encoder.
This feature depends on the bandwidth available, which is client
specific.
** at least till we change multi-clients not to re-encode the same
streams.
red_worker: stream agent - fix miscounting of frames
Frames counting was skipped when the previous frame was already
sent completely to the client.
2013-04-19 Hans de Goede <hdegoede@redhat.com>
snd_worker: Make sure we never send an empty volume message
My commit 71315b2e "snd_worker: Don't send empty audio-volume messages",
fixes only one case of sending an empty volume message, if the client connects
to a vm early during its boot sequence, while the snd hardware is being reset
by the guest driver, qemu will call spice_server_playback_set_volume() with
0 channels from the reset handler.
This patch also applies both fixes to the record channel.
2013-04-10 Hans de Goede <hdegoede@redhat.com>
spice-common: Update
2013-04-08 Yonit Halperin <yhalperi@redhat.com>
red_worker.c: fix not destroying streams before sending MSG_MIGRATE
When qemu migration completes, we need to stop the streams, and to send
the corresponding upgrade_items to the client.
Otherwise, (1) the client might display lossy regions that we don't track
(streams are not part of the migration data).
(2) streams_timeout may occur after MSG_MIGRATE has been sent, leading
to messages being sent to the client after MSG_MIGRATE and before
MSG_MIGRATE_DATA (e.g., STREAM_CLIP, STREAM_DESTROY, DRAW_COPY).
No message besides MSG_MIGRATE_DATA should be sent after
MSG_MIGRATE.
When a msg other than MIGRATE_DATA reached spice-gtk after MSG_MIGRATE,
spice-gtk sent it to dest server as the migration data, and the dest
server crashed with a "bad message size" assert.
red_worker.c: s/red_display_destroy_streams/red_display_destroy_streams_agents
In order not to confuse it with red_destroy_streams in the following
patch.
2013-04-01 Hans de Goede <hdegoede@redhat.com>
snd_worker: Don't send empty audio-volume messages
If no volume has been set it, we end up sending a volume message with
audio-volume for 0 channels (iow an empty message). This is not useful
and triggers the following warning in spice-gtk:
(remote-viewer:8726): GSpice-WARNING **: set_sink_input_volume() failed:
Invalid argument
2013-03-29 Hans de Goede <hdegoede@redhat.com>
char_device: Don't set active when stopped and don't access dev after unref
2 closely related changes in one:
1) When leaving the read or write loop because the chardev has been stopped
active should not be updated. It has been set to FALSE by
spice_char_device_stop and should stay FALSE
2) The updating of dev->active should be done *before* unref-ing dev
char_device: Don't set the write-retry timer when not running
The write-retry timer should not be set when we're leaving
spice_char_device_write_to_device because the char-dev has been stopped.
char_device: Properly update buffer status when leaving the write loop on stop
Before this patch the write-loop in spice_char_device_write_to_device would
break on running becoming 0, after having written some data, without updating
the buffer status, causing the same data to be written *again* when started.
2013-03-15 Hans de Goede <hdegoede@redhat.com>
inputs-channel: Don't send insecure keyb notify to in migrate client
This fixes spice-gtk printing message like these on migration:
(remote-viewer:18402): GSpice-CRITICAL **: spice_channel_iterate_read: assertion `c->state != SPICE_CHANNEL_STATE_MIGRATING' failed
inputs-channel: Handle printing of insecure keyboard notify
This is clearly something which should be handled in the inputs_channel code,
rather then having a special case for it in the generic channel handling
code in reds.c. Moving it here also fixes the TODO we had on only sending
this message to new clients.
main-channel: Add a main_channel_client_push_notify function
Sometimes we want to send a notify to a single client, rather then to
all of them.
main-channel: Make main_channel_push_notify deal with dynamic memory
Currently main_channel_push_notify only gets passed a static string, but
chances are in the future it may get passed dynamically allocated strings,
prepare it for this.
While at it also make clear that its argument is a string, and simplify
things a bit by making use of this knowledge (pushing the strlen call down).
2013-03-07 Hans de Goede <hdegoede@redhat.com>
server/reds: Send the agent a CLIENT_DISCONNECTED msg on client disconnect
Client -> agent messages can spawn multiple VDIChunks. When this happens
the agent re-assembles the chunks into a complete VDAgentMessage before
processing it. The server only guarentees coherency at the chunk level,
so it is not possible for a partial chunk to get delivered to the agent.
But it is possible for some chunks of a VDAgentMessage to be delivered to
the agent followed by a client to disconnect without the rest of the
VDAgentMessage being delivered!
This will leave the agent in a wrong state, and the first messages send to it
by the next client to connect will get seen as the rest of the VDAgentMessage
from the previous client.
This patch sends the agent a new VD_AGENT_CLIENT_DISCONNECTED message from the
VDP_SERVER_PORT, on which the agent can then reset its VDP_CLIENT_PORT state.
Note that no capability check is done for this, since the capabilities are
something negotiated between client and agent. The server will simply always
send this message on client disconnect, relying on older agents discarding the
message since it has an unknown type (which both the windows and linux agents
already do).
char_device: Add spice_char_device_write_buffer_get_server_no_token()
To allow the server to send agent messages without needing to wait for a
self-token. IE for sending VD_AGENT_CLIENT_DISCONNECTED messages.
Update spice-common
2013-03-04 Hans de Goede <hdegoede@redhat.com>
Silence __spice_char_device_write_buffer_get: internal buf is not available
These messages are printed when the server tries to push a mouse event to
the agent before the previous one has been flushed. This is a normal condition
(which gets tracked by the reds->pending_mouse_event boolean), and as such
it should *not* trigger the printing of error messages.
I've seen these messages occasionally before, but with agent file-xfer they
are trivial to trigger, simply send a large file to the agent and while it
is transferring move the mouse over the client window. Note that due to the
client tokens not allowing the client to completely saturate the agent
channel mouse events do still get send to the agent, just with a slightly
larger interval. So everything is working as designed and this spice_printerr
is just leading to people chasing ghosts.
2013-01-15 Hans de Goede <hdegoede@redhat.com>
worker_update_monitors_config: Drop bogus real_count accounting
1) This does not buy us much, as red_marshall_monitors_config() also
removes 0x0 sized monitors and does a much better job at it
(also removing intermediate ones, not only tailing ones)
2) The code is wrong, as it allocs space for real_count heads, where
real_count always <= monitors_config->count and then stores
monitors_config->count in worker->monitors_config->count, causing
red_marshall_monitors_config to potentially walk
worker->monitors_config->heads past its boundaries.
server: Fix SpiceWorker-CRITICAL **: red_worker.c:10968:red_push_monitors_config: condition `monitors_config != NULL' failed
During my dynamic monitor support testing today, I hit the following assert
in red_worker.c:
"red_push_monitors_config: condition `monitors_config != NULL' failed"
This is caused by the following scenario:
1) Guest causes handle_dev_monitors_config_async() to be called
2) handle_dev_monitors_config_async() calls worker_update_monitors_config()
3) handle_dev_monitors_config_async() pushes worker->monitors_config, this
takes a ref on the current monitors_config
4) Guest causes handle_dev_monitors_config_async() to be called *again*
5) handle_dev_monitors_config_async() calls worker_update_monitors_config()
6) worker_update_monitors_config() does a decref on worker->monitors_config,
releasing the workers reference, this monitor_config from step 2 is
not yet free-ed though as the pipe-item still holds a ref
7) worker_update_monitors_config() creates a new monitors_config with an
initial ref-count of 1 and stores that in worker->monitors_config
8) The pipe-item of the *first* monitors_config is send, upon completion
a decref is done on the monitors_config, and monitors_config_decref not
only frees the monitor_config, but *also* sets worker->monitors_config
to NULL, even though worker->monitors_config no longer refers to the
monitor_config being freed, it refers to the 2nd monitor_config!
9) The client which was connected when this all happened disconnects
10) A new client connects, leading to the assert:
at red_worker.c:9519
num_common_caps=1, common_caps=0x5555569b6f60, migrate=0,
stream=<optimized out>, client=<optimized out>, worker=<optimized out>)
at red_worker.c:10423
at red_worker.c:11301
Note that red_worker.c:9519 is:
red_push_monitors_config(dcc);
gdb does not point to the actual line of the assert because the function gets
inlined.
The fix is easy and obvious, don't set worker->monitors_config to NULL in
monitors_config_decref. I'm a bit baffled as to why that code is there in
the first place, the whole point of ref-counting is to not have one single
unique place to store the reference...
This fix should not have any adverse side-effects as the 4 callers of
monitors_config_decref fall into 2 categories:
1) Code which immediately after the decref replaces worker->monitors_config
with a new monitors_config:
worker_update_monitors_config()
set_monitors_config_to_primary()
2) pipe-item freeing code, which should not touch the worker state at all
to being with
2013-01-14 Michael Tokarev <mjt@tls.msk.ru>
link libspice server with libm libpthread
server/Makefile apparently forgot to link libspice-server
with -lm -lpthread, but it uses symbols from these libraries
directly. These libs are detected by configure and stored in
$(SPICE_NONPKGCONFIG_LIBS) make variable, but this variable
is never referenced at link time. Add it to server/Makefile.am,
to libspice_server_la_LIBADD variable.
Signed-off-By: Michael Tokarev <mjt@tls.msk.ru>
2013-01-08 Yonit Halperin <yhalperi@redhat.com>
red_worker.c: clearing the stream vis_region, after it has been detached
The stream vis_region should be cleared after the stream region was sent
to the client losslessly. Otherwise, we might send redundant stream upgrades
if we process more drawables that are dependent on the stream region.
red_worker.c: insert a drawable to its position in the current tree before calling red_detach_streams_behind
resolves: rhbz#891326
Starting from commit 81fe00b08ad4f, red_detach_streams_behind can
trigger modifications in the current tree (by update_area calls). Thus,
after calling red_detach_streams_behind it is not safe to access tree
entries that were calculated before the call.
This patch inserts the drawable to the tree before the call to
red_detach_streams_behind. This change also requires making sure
that rendering operations that can be triggered by
red_detach_streams_behind will not include this drawable (which is now part of the tree).
2013-01-01 Uri Lublin <uril@redhat.com>
server: guest_set_client_capabilities: protect against NULL worker->display_channel
Reported-by: Michal Luscon <mluscon@redhat.com>
Found by a Coverity scan:
in handle_dev_start -
Checking "worker->display_channel" implies that "worker->display_channel"
might be NULL.
Passing "worker" to function "guest_set_client_capabilities"
in guest_set_client_capabilities -
Directly dereferencing parameter "worker->display_channel"
2012-12-20 Hans de Goede <hdegoede@redhat.com>
Release 0.12.2
2012-12-20 Yonit Halperin <yhalperi@redhat.com>
red_parse_qxl: fix throwing away drawables that have masks
Non rgb bitmaps are allowed to not have a palette in case they
are masks (which are 1BIT bitmaps).
Related: rhbz#864982
2012-12-19 Hans de Goede <hdegoede@redhat.com>
spice-client: Add --hotkeys cmdline option
To allow using the existing mechanism to override the default hotkeys from
the cmdline.
2012-12-12 Christophe Fergeau <cfergeau@redhat.com>
reds: Use g_strlcpy instead of strncpy
reds.c is using strncpy with a length one byte less than the
destination buffer size, and is relying on the fact that the
destination buffers are static global variables.
Now that we depend on glib, we can use g_strlcpy instead, which
avoids relying on such a subtle trick to get a nul-terminated
string.
build: Use glib2
Now that QEMU depends on glib, it won't really hurt if we depend
on it as well, and we won't have to reinvent our own helpers.
Don't build client by default
It has been superseded by virt-viewer/remote-viewer
Fail reds_init_socket when getaddrinfo fails
We currently output a warning when getaddrinfo fails, but then
we go on trying to use the information it couldn't read. Make
sure we bail out of reds_init_socket if getaddrinfo fails.
Make sure strncpy'ed string are 0-terminated
spice_server_set_ticket and spice_server_set_addr get (library)
user-provided strings as arguments, and copy them to fixed-size
buffers using strncpy. However, if these strings are too long,
the copied string will not be 0-terminated, which will cause issues
later. This commit copies one byte less than the size of the
destination buffer. In both cases, this buffer is a static global
variable, so its memory will be set to 0.
2012-12-05 Yonit Halperin <yhalperi@redhat.com>
red_worker: revert 8855438a
red_proccess_commands calls were added after calling
guest_set_client_capabilities in order to cleanup the command ring from
old commands that the client might not be able to handle.
However, calling red_process_commands at this stage does send messages
to the client.
In addition, since setting the client capabilities at the guest is not
synchronized, emptying the command ring is not enough in order to make
sure the following commands will be supported by the client.
The call to red_proccess_commands before initializing the display
streams (the call to red_display_start_streams), caused inconsistencies
related to video streaming upon reconnecting (rhbz#883564).
I'm reverting this patch till another solution for the capabilities
mismatch is introduced.
Resolves: rhbz#883564
2012-12-05 Marc-André Lureau <marcandre.lureau@redhat.com>
server: add "port" channel support
A Spice port channel carry arbitrary data between the Spice client and
the Spice server. It may be used to provide additional services on top
of a Spice connection. For example, a channel can be associated with
the qemu monitor for the client to interact with it, just like any
qemu chardev. Or it may be used with various protocols, such as the
Spice Controller.
A port kind is identified simply by its fqdn, such as org.qemu.monitor,
org.spice.spicy.test or org.ovirt.controller...
The channel is based on Spicevmc which simply tunnels data between
client and server, with a few additional messages.
See the description of the channel protocol in spice-common history.
server: bump SPICE_SERVER_VERSION to 0.12.2
update spice-common
2012-11-30 Yonit Halperin <yhalperi@redhat.com>
agent: fix mishandling of agent data received from the client after agent disconnection
The server can receive from the client agent data even when the agent
is disconnected. This can happen if the client sends the agent data
before it receives the AGENT_DISCONNECTED msg. We should receive and handle such msgs, instead
of disconnecting the client.
This bug can also lead to a server crash if the agent gets reconnected
fast enough, and it receives an agent data msg from the client before MSGC_AGENT_START.
upstream bz#55726
rhbz#881980
2012-11-29 Yonit Halperin <yhalperi@redhat.com>
red_worker: no need to align the stride of internal images
Internal images are just read from the surface, compressed, and sent to the client.
Then, they are destroyed. I can't find any reason for aligning their memory.
2012-11-28 Yonit Halperin <yhalperi@redhat.com>
red_worker: fix sending internal images with stride > bpp*width to lz compression
rhbz#876685
The current lz implementation does not support such bitmaps.
The following patch will actually prevent allocating stride > bpp*width
for internal images.
2012-11-26 Yonit Halperin <yhalperi@redhat.com>
red_worker.c: fix memory corruption when data from client is bigger than 1024 bytes
Previously, there was no check for the size of the message received from
the client, and all messages were read into a buffer of size 1024.
However, migration data can be bigger than 1024. In such cases, memory
corruption occurred.
red_worker.c: fix not sending all pending messages when the device is stopped
red_wait_outgoing_item only waits till the currently outgoing msg is
completely sent.
red_wait_outgoing_items does the same for multi-clients. handle_dev_stop erroneously called
red_wait_outgoing_items, instead of waiting till all the items in the
pipes are sent.
This waiting is necessary because after drawables are sent to the client, we release them from the
device. The device might have been stopped due to moving to the non-live
phase of migration. Accessing the device memory during this phase can lead
to inconsistencies.
Also, MSG_MIGRATE should be the last message sent to the client, before
MSG_MIGRATE_DATA. Due to this bug, msgs were marshalled and sent after
handle_dev_stop and after handle_dev_display_migrate which sometimes led
to the release of surfaces, and inserting MSG_DISPLAY_DESTROY_SURFACE
after MSG_MIGRATE.
This patch also removes the calls to red_wait_outgoing_items, from
dev_flush_surfaces. They were unnecessary.
smartcard.c: avoid marshalling migration data with reference to a memory that might be released before send has completed
The current solution just copy the buffer. Currently data that is read
from the guest is always copied before sending it to the client. When we
will have ref count for these buffers, we can also use it for marshalling
the migration data.
red_worker.c: fix marshalling of migration data
fix calling spice_marhsaller_add_ref with memory on stack
reds.c: fix calls to spice_marshaller_add_ref with ptr to memory that might be released before sending
char_device.c: when the state is destroyed, also free the buffer that is being written to the device
char_device.c: add ref count for write-to-device buffers
The ref count is used in order to keep buffers that were in the write
queue and now are part of migration data, in case the char_device state
is destroyed before we complete sending the migration data.
2012-11-21 Yonit Halperin <yhalperi@redhat.com>
char_device.c: fix call to spice_marshaller_add_ref with memory on stack
rhbz#862352
2012-11-12 Yonit Halperin <yhalperi@redhat.com>
red_worker.c: fix calling set_client_capabilities when it is unsupported by qemu
The erroneous call was in handle_dev_start.
This patch also fixes not calling set_client_capabilities when the
qxl major_version is > 3.
display seamless migration: no need to trace the generation of the primary surface
We no longer process destroy_primary or destroy_surfaces while waiting
for migration data.
display seamless migration: don't process both cmd ring and dispatcher queue till migration data is received
fix: rhbz#866929
At migration destination side, we need to restore the client's surfaces
state, before sending surfaces related messages.
Before this patch, we stopped the processing of only the cmd ring, till migration data
arrived.
However, some QXL_IOs require reading and rendering the cmd ring (e.g.,
update_area). Moreover, when the device is reset, after destroying all
surfaces, we assert (in qemu) if the cmd ring is not empty (see
rhbz#866929).
This fix makes the red_worker thread wait till the migration data arrives
(or till a timeout), and not process any input from the device after the
vm is started.
2012-11-04 Alon Levy <alevy@redhat.com>
Revert "server: add websockets support via libwebsockets"
This reverts commit 63bb37276e028ab1b1c156c9e7907bf22b6d5952.
update spice-common (was broken)
2012-11-01 Alon Levy <alevy@redhat.com>
server/red_worker: don't call set_client_capabilities if vm is stopped
We try to inject an interrupt to the vm in this case, which we cannot do
if it is stopped. Instead log this and update when vm restarts.
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=870972
(that bz is on qemu, it will be cloned or just changed, not
sure yet)
2012-10-25 Alon Levy <alevy@redhat.com>
server/red_worker: wip: VALIDATE_SURFACE macros, remove asserts (but too late - should be done earlier)
release 0.12.1
server: add websockets support via libwebsockets
New API: spice_server_set_ws_ports
This adds an optional dependency on libwebsockets. You need to get my
patched 0.0.3 version here:
git://people.freedesktop.org/~alon/libwebsockets
There is no qemu patches yet, to test change in reds.c the default value
of spice_ws_port to 5959 (for the default of spice-html5).
For testing there is an online client at
http://spice-space.org/spice-html5/spice.html
Known issues:
1. The tester (server/tests/test_display_no_ssl) gets into dropping all
data after a few seconds, I think it's an issue with the implemented
watches, but haven't figured it out.
2. libwebsocket's read interface is inverted to what our code expects,
i.e. there is no libwebsocket_read, so there is an additional copy
involved (see RedsWebSocket). This can be fixed.
3. Listening on a separate port. Since the headers are different, we
could listen on the same port (first three bytes RED/GET). I don't know
if we want to?
Todos:
1. SSL not implemented yet. Needs some thought as to how.
2. Serve spice-html5 when accessed as a http server. Nice to have.
server/red_worker: stride > 0 is tested, remove abort
Tested using the wip driver and xf86-video-modesetting.
server/tests/test_display_base: fix segfault in test
server/reds.c: split off reds-private.h
configure.ac: add libcacard to SPICE_REQUIRES if built with smartcard support
update spice-common
2012-10-24 Uri Lublin <uril@redhat.com>
server: red_dispatcher: check major/minor of qxl for client_monitors_config
This solves a problem with new spice-server and old qemu-kvm, where spice thinks
qif->client_monitors_config exists, while it does not exist in qemu-kvm.
Also "major > required_major" was added to the condition.
Also only the specific RedDispatcher is checked (and not all dispatchers).
2012-10-19 Alon Levy <alevy@redhat.com>
add git-version-gen and gitlog-to-changelog
2012-10-18 Hans de Goede <hdegoede@redhat.com>
inputs_channel: Fix wrong handling of key up/down on big endian
The client will send 0x000000## codes for regular keys, and 0x0000##e0 codes
for extended keys. The current code which simply walks the uint32_t code in
memory order relies on the memory order being little endian, which will
clearly fail on big endian machines, this fixes this.
2012-10-11 Yonit Halperin <yhalperi@redhat.com>
snd channel: fix accessing freed memory
snd_channel_put freed "channel", and then channel->worker was accessed.
It caused segmentation faults during connections and disconnections of the client.
2012-10-01 Christophe Fergeau <cfergeau@redhat.com>
Fix PlaybackChannel forward declaration
This caused a jenkins build failure:
snd_worker.c:148: error: redefinition of typedef 'PlaybackChannel'
snd_worker.c:126: note: previous declaration of 'PlaybackChannel' was here
2012-10-01 Andrew Eikum <aeikum@codeweavers.com>
server: Access the correct SndChannel for a given AudioFrame
The client of _get_buffer() holds a ref to the SndChannel, and we
should access that SndChannel when _put_samples() is called, not the one
that happens to currently be attached to the Interface.
server: Don't release SndChannel twice from worker reference
When we release the SndChannel reference during
snd_disconnect_channel(), we need to set the pointer to NULL so it
doesn't get released again on client reconnect during
snd_set_playback_peer(). This can happen when a reference is held from
_playback_get_buffer().
2012-09-20 Christophe Fergeau <cfergeau@redhat.com>
reds: Report an error when reds_char_device_add_state fails
This used to abort with spice_error. The caller currently does
not check spice_server_char_device_add_interface return value, but
it's still cleaner to report an error in this case.
reds: Check errors returned from SSL_CTX_set_cipher_list
reds: Report errors from load_dh_params
reds: Check reds_init_ssl errors
Now that this function can fail, propagate any error up to the
caller. This allows qemu to fail when an SSL initialization error
occurred.
reds: report SSL initialization errors
Errors occurring in reds_init_ssl used to be fatal through the use
of spice_error, but this was downgraded to non-fatal spice_warning
calls recently. This means we no longer error out when invalid SSL
(certificates, ...) parameters are passed by the user.
This commit changes reds_init_ssl return value from void to int so
that errors can be reported to the caller.
reds_init_net: report errors on watch setup failures
We used to be aborting in such situations, but this was changed
during the big spice_error/printerr cleanup. We are currently
outputting a warning but not reporting the error with the caller
when reds_init_net fails to register listening watches with the
mainloop. As it's unlikely that things will work as expected in
such cases, better to error out of the function instead of pretending
everything is all right.
reds: Abort on BN-new failures
BN_new returns NULL on allocation failures. Given that we abort
on malloc allocation failures, we should also abort here. The
current code will segfault when BN_new fails as it immediatly tries
to use the NULL pointer.
2012-09-14 Alon Levy <alevy@redhat.com>
Release 0.12.0
2012-09-13 Alon Levy <alevy@redhat.com>
server/spice-server.syms: add missing global labels
Although global is the default, this makes the file more consistent.
server/Makefile.am: fix for make distcheck
Doesn't make sense to distribute test_spice_version.sh, so just
ensure the build passes if it doesn't exist.
spice-server 0.11.5
Added api:
QXL interface (3.2)
client_monitors_config
server/tests: agent mock, client_monitors_config
server: Filter VD_AGENT_MONITORS_CONFIG
If the guest supports client monitors config we pass it the
VDAgentMonitorsConfig message via the
QXLInterface::client_monitors_config api instead of via the vdagent.
server/reds: reuse already defined local
server/red_dispatcher: client_monitors_config support
Adds two functions:
- red_dispatcher_use_client_monitors_config:
check that QXLInterface supports client_monitors_config and that it's
functional.
- red_dispatcher_client_monitors_config:
send the client monitors configuration to the guest.
server: add QXLInterface::client_monitors_config
Used to implement guest monitor configuration change similarly to real
hardware in conjunction with the new qemu interrupt
QXL_INTERRUPT_CLIENT_MONITORS_CONFIG. client_monitors_config is also
used to probe the support by the interface. If it is not supported we
send the message to the guest agent.
This makes a linux qxl driver similar to existing kms drivers.
The logic is:
For every received VDAgentMonitorsConfig:
if client_monitors_config(NULL):
write client configuration to pci rom BAR.
send interrupt to guest
guest kernel reads configuration from rom BAR.
guest kernel issues event to user space
user space reads (libdrm) and reconfigures (libXRandr)
else: (current implementation)
write message to guest agent
guest agent issues reconfiguration via XRandr / windows Escape ioctl to kernel
update spice-common module
For qxl client_monitors_config support.
2012-09-12 Alon Levy <alevy@redhat.com>
server/red_dispatcher: change a printerr to debug
2012-09-11 Søren Sandmann Pedersen <ssp@redhat.com>
Bump SPICE_INTERFACE_QXL_VERSION_MINOR
Then check that we have the right version before accessing the
set_client_capabilities() function.
2012-09-11 Peter Robinson <pbrobinson@gmail.com>
Enable build on armv6+
The following patch enables it to build on ARM platforms that support
atomics. Tested on an armv7hl on an ARMv7 device running Fedora 18. Using
firefox connecting to a RHEV-M instance I could launch consoles in
spice-xpi and login so basic support works!
Resolves: rhbz#613529
2012-09-10 Christophe Fergeau <cfergeau@redhat.com>
Update spice-common to get A8 surface definitions
Latest spice needs these definitions from spice-protocol
2012-09-07 Søren Sandmann Pedersen <ssp@redhat.com>
Bump spice.h version number to 0.11.4
No new symbols are added, but there is an addition to QXLInterface:
void (*set_client_capabilities)(QXLInstance *qin,
uint8_t client_present,
uint8_t caps[58]);
Set a8 capability in the QXL device if supported by the client
Process outstanding commands in the ring after changing capability bits
When a new client connects, there may be commands in the ring that it
can't understand, so we need to process these before forwarding new
commands to the client. By doing this after changing the capability
bits we ensure that the new client will never see a command that it
doesn't understand (under the assumption that the guest will read and
obey the capability bits).
Acked-by: Alon Levy <alonl@redhat.com>
2012-09-06 Søren Sandmann Pedersen <ssp@redhat.com>
Add new set_client_capabilities() interface to QXLInstance
A new interface
set_client_capabilities (QXLInstance *qin,
uint8_t client_present,
uint8_t caps[58]);
is added to QXLInstance, and spice server is changed to call it
whenever a client connects or disconnects. The QXL device in response
is expected to update the client capability bits in the ROM of the
device and raise the QXL_INTERRUPT_CLIENT interrupt.
There is a potential race condition in the case where a client
disconnects and a new client with fewer capabilities connects. There
may be commands in the ring that the new client can't handle. This
case is handled by first changing the capability bits, then processing
all commands in the ring, and then start forwarding commands to the
new client. As long as the guest obeys the capability bits, the new
client will never see anything it doesn't understand.
client: Advertise A8_SURFACE capability
2012-09-05 Alon Levy <alevy@redhat.com>
server/red_parse_qxl: fix bitmap_consistent again
2012-09-05 Jeremy White <jwhite@codeweavers.com>
Implement spice_server_set_exit_on_disconnect to enable an option whereby the spice server shuts down on client disconnect.
2012-09-05 Alon Levy <alevy@redhat.com>
server/red_parse_qxl: fix wrong bitmap_consistent
The bit calculation was wrong for all the paletted types by a factor of
between 8 and 1 (SPICE_BITMAP_FMT_{1,4,8}BIT_PLT_{LE,BE})
2012-09-03 Alon Levy <alevy@redhat.com>
server/red_parse_qxl: add bitmap consistency check
Just checks stride vs width times bpp.
This fixes a potential abort on guest generated bad images in
glz_encoder.
Other files touched to move some consts to red_common, they are
static so no problem to be defined in both red_worker.c and
red_parse_qxl.c .
server/tests/test_display_base: fix update_area abort
Don't do zero area update_areas, server now aborts on those. This tester
is not supposed to test those aborts.
server: replace syntax-check reported tabs with spaces
server: add dist-hook to prevent spice version configure/spice.h difference
2012-09-02 Alon Levy <alevy@redhat.com>
0.11.3 release
No new api entries.
add server/tests/test_vdagent
server/tests/test_two_servers
server/tests: introduce Test struct
2012-08-30 Alon Levy <alevy@redhat.com>
server/red_worker: seamless: fix invalid memory reference
replace add_ref with add for stack allocated SpiceMigrateDataDisplay.
This fixes wrong MIGRATE_DATA message in display channel (symptom is
glz_encoder_max being way too big, and malloc failure at target) seen on
F18 with gcc-4.7.1-5.fc18.x86_64 and glibc-2.16-8.fc18.x86_64 (didn't
appear on RHEL 6).
server: freezed->froze, missing whitespace after declarations
server: s/max_encdoers/max_encoders/
2012-08-30 Yonit Halperin <yhalperi@redhat.com>
server/inputs_channel.c: whitespace fix
2012-08-30 Alon Levy <alevy@redhat.com>
server/red_tunnel_worker: remove unneeded expect_migrate_mark
2012-08-27 Alon Levy <alevy@redhat.com>
server/red_tunnel_worker.c: fix build
Only passes compile, not tested.
2012-08-27 Marc-André Lureau <marcandre.lureau@redhat.com>
inputs: handle SPICE_MSGC_INPUTS_KEY_SCANCODE
Handle SPICE_MSGC_INPUTS_KEY_SCANCODE message, allowing arbitrary
keyboard scancode sequence.
2012-08-27 Alon Levy <alevy@redhat.com>
support automake >= 1.12
Requires a single line (sans comments) change to configure.ac in
spice-common too, to define the new AM_PROG_AR.
server/red_worker: handle_dev_update_area: fail if invalid area
2012-08-27 Yann E. MORIN <yann.morin.1998@free.fr>
client: fix missing stdarg.h include
When the C library is uClibc, stdarg.h is required to get the
definition for va_list et al.
2012-08-27 Yonit Halperin <yhalperi@redhat.com>
enable seamless migration and set migration protocol version
inputs channel migration: don't send any msg after MSG_MIGRATE
Pending motion acks, and keyboard modifiers messages will be sent
by the destination after receiving the migration data.
inputs_channel: send and handle migration data
migration_protocol: add inputs channel migration data
Storing the motion count in uint16_t and not in uint32_t since
the exact count is not important, just its division in
SPICE_INPUT_MOTION_ACK_BUNCH (see the next 2 patches).
main_channel: don't expect init msg in a seamless migration destination
If the server is a destination of seamless migration, send msgs to the client,
even though an init msg has not been sent to the client.
red_channel: set send_data.last_sent_serial in red_channel_client_set_message_serial
red_channel_client_set_message_serial is called for setting
the serial of the display channel messages after migration (on the
destination side). The serial is retrieved from the migration data.
red_channel: remove unused migrate flag from RedChannel
The relevant flags reside in RedChannelClient and RedClient
snd_worker: handling migration
The playback and record channel send SPICE_MSG_MIGRATE to the client.
Both playback and record channel does not have a state to restore:
while in the legacy migration implementation the record channel
used to restore the mode and start time, it looks unnecessary since
the client receives from the src MSG_RECORD_STOP before the migration
completion notification (when the vm is stopped). Afterwards, when the vm
starts on the dest side, the client receives MSG_RECORD_START.
snd_channel: fix double release
Due to the fix in the previous patch, snd_disconnect_channel can be
called both when there is write/read error in the channel, or from
red_client_destroy (which calls client_cbs.disconnect).
Multiple calls to snd_disconnect_channel resulted in calling
channel->cleanup(channel) more than once (double release).
red_channel (dummy): fix not adding dummy RedChannelClient to the client
snd channel wasn't added to be part of the client's channels list.
As a result, when the client was destroyed, or migrated, snd channel
client wasn't destroy, or its migration callback wasn't called.
However, due to adding dummy channels to the client, we need special
handling for calls to disconnecting dummy channel clients.
TODO: we need to refactor snd_worker to use red_channel
display migration: restore destination state
Restoring display channel from migration data.
Not notifying client about changes that are artifacts of loading the vm.
Remove legacy migration code.
display migration: marshall migration data
display & cursor migration: send SPICE_MSG_MIGRATE
migration_protocol: add display channel migration data
inputs channel: use the default red_channel behaviour for client_cbs.migrate
The default callback sends SPICE_MSG_MIGRATE to the client.
inputs channel: fix using spice messages enums as pipe items type
A channel pipe item type must start from PIPE_ITEM_TYPE_CHANNEL_BASE.
SPICE_MSG_MIGRATE value eq. PIPE_ITEM_TYPE_SET_ACK. Setting a pipe item
type to SPICE_MSG_MIGRATE, leads to red_channel handling PIPE_ITEM_TYPE_SET_ACK.
char_device: don't connect a migrated client if the state of the device might have changed since it was created
If reading/writing from the device have occured before migration data
has arrived, the migration data might no longer be relvant, and we
disconnect the client.
main: restore state from migration data
Also removed old migration leftovers.
main: send migration data
Also removed some unused definitions from reds that used to belong to
old agent and migration code.
main: send MSG_MIGRATE upon vm migration completion
Before sending the above msg, if there is a pending partial msg that
has been read from the agent, we send it to the client. The alternative
was to keep the msg as part of the migration data, and then
to send it to the destination server via the client and to wait there
for the msg chunk completion, before sending it to the client. Of
course, the latter is less efficient.
reds: s/HADER/HEADER
migration_protocol: add migration data for the main channel (mainly for the agent)
main_channel: fix using spice messages enums as pipe items type
A channel pipe item type must start from PIPE_ITEM_TYPE_CHANNEL_BASE.
SPICE_MSG_MIGRATE value eq. PIPE_ITEM_TYPE_SET_ACK. Setting a pipe item
type to SPICE_MSG_MIGRATE, leads to red_channel handling PIPE_ITEM_TYPE_SET_ACK.
Also removed sending SPICE_MSG_MIGRATE. It will be handled in the next
patch.
red_channel: introduce PIPE_ITEM_TYPE_EMPTY_MSG
The pipe item is used for sending messages that don't have body.
smartcard: restore state after migration from migration data
smartcard migration: send migration data
migration_protocol: add migration data for smartcard
smartcard: send MSG_MIGRATE upon vm migration completion
The above is the default behaviour for red_channel_client, if
client_cbs.migrate is not registered as part of red_channel_register_client_cbs
smartcard: fix PIPE_ITEMs enum indexing
The enum should start from PIPE_ITEM_TYPE_CHANNEL_BASE, otherwise,
PIPE_ITEM_TYPE_ERROR is handled like PIPE_ITEM_TYPE_SET_ACK.
smartcard: change the timing of attaching a client to SpiceCharDeviceState
Attach/detach a client to a SpiceCharDeviceState upon its
connection/disconnection, instead of upon reader_add/remove messages.
When the client is removed from a SpiceCharDeviceState, all the
messages from this client are removed from the device write queue.
This shouldn't happen when we only receive reader_remove and the
client is still connected.
spicevmc migration: restore migration dest state from migration data
spicevmc migration: send migration data
spicevmc: send MSG_MIGRATE upon vm migration completion
The above is the default behaviour for red_channel_client, if
client_cbs.migrate is not registered as part of red_channel_register_client_cbs
migration_protocol: add migration data for spicevmc
char device migration: restore state at destination from migration data
char device migration: don't read or write from/to the device while waiting for migraion data
char device migration: marshall migration data
char_device: variable token price for write buffers
When restoring migration data, we also restore data that is addressed to
the device, and that might have been originated from more than 1
message. When the write buffer that is assoicated with this data is
released, we need to free all the relevant tokens.
migration_protocol: add migration data for char devices
replace some migration related spice_error calls with info/warning
seamless migration: migration completion on the destination side
Tracking the channels that wait for migration data. If there
is a new migration process pending, when all the channels have
restored their state, we begin the new migration.
red_channel: handle sending SPICE_MSG_MIGRATE
The relevant code is common to all channels.
The patch also contains a fix to the return value for
handle_migrate_data callback: s/uint64_t/int
red_channel: fix pipe item leak
seamleass migration: manage post migration phase in the src side
In semi-seamless, SPICE_MSG_MAIN_MIGRATE_END is sent.
In seamless, each channel migrates separately.
The src waits till all the clients are disconnected (or a timeout), and
then it notifies qemu that spice migration has completed.
The patch doesn't include the per-channel logic for seamless migration
(sending MSG_MIGRATE, MIGRATE_DATA, etc.).
seamless migration: pre migration phase on the destination side
- handle SPICE_MSGC_MAIN_MIGRATE_DST_DO_SEAMLESS
- reply with SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_ACK/NACK
- prepare the channels for migration according to the migration
type (semi/seamless)
see spice-protocol for more details:
commit 3838ad140a046c4ddf42fef58c9727ecfdc09f9f
seamless migration: pre migration phase on the src side
sending SPICE_MSG_MAIN_MIGRATE_BEGIN_SEAMLESS and handling
SPICE_MSGC_MAIN_MIGRATE_CONNECTED_SEAMLESS
The src side signals the client to establish a connection
to the destination.
In seamless migration, the client is also used to perform
a sort of handshake with the destination, for verifying
if seamless migration can be supported.
see spice-protocol for more details:
commit 3838ad140a046c4ddf42fef58c9727ecfdc09f9f
seamless-migration: update spice-common submodule
Also Update server and client according to the change of
SpiceMsgMainMigrationBegin: it now holds all the fields inside
SpiceMigrationDstInfo.
seamless-migration: add migration_protocol.h
The file will hold the declarations of the different migration
data messages (depending on the channel), that will be passed
from the src server to the dst server, via the client, using
SPICE_MSG_MIGRATE_DATA.
bump version to 0.11.2
New api entries:
spice_server_vm_start
spice_server_vm_stop
spice_server_set_seamless_migration
spice.h: add spice_server_set_seamless_migration
This new call is used in order to identify whether qemu, or
the management (e.g. libvirt), support seamless migration.
If it is supported, qemu spice cmd-line configuration should have
seamless-migration=on.
In addition, we disable seamless migration support if multiple clients
are allowed. Currently, only one client is supported.
spice_server_vm_start/stop: notify red_dispatcher on vm start/stop
Till now, red_worker was notfied about vm status changes via QXLWorker->start/stop
(or spice_qxl_start/stop).
Newer qemu, that supports calling spice_server_vm_start/stop, will call only
these routines, and won't call QXLWorker->start/stop.
spice.h: add entries for tracking vm state
When vm state changes (started/stopped), we notify all the
attached SpiceCharDeviceStates about the change. This is mainly required
for avoiding writing/reading to/from the device during the non-live
stage of migration.
spice version will be bumped in one of the following patches.
reds: add tracking for char devices
The list of attached char_devices will be used in the next patch
for notifying each instance of SpiceCharDeviceState when the vm
is started or stopped.
agent: don't attempt to read from the device if it was released
if vdi_port_read_buf_process failes, we detach the agent and also release
the read buffer. We shouldn't try reading from the device afterwards.
agent: reset client tokens when notifying on agent connection
send SPICE_MSG_MAIN_AGENT_CONNECTED_TOKENS
red_channel: add red_channel_test_remote_cap
for checking if all the channel clients connected support the cap
2012-08-24 Søren Sandmann Pedersen <ssp@redhat.com>
Add support for Composite command to the client
All the real work is being done in spice-common, so this patch is just
hooking up the virtual calls and adding the SPICE_DISPLAY_CAP_COMPOSITE
capability.
Add support for QXLComposite to spice server
In red-parse-qxl.c add support for parsing QXLComposite into
SpiceComposite. In red-worker.c add support for marshalling
SpiceComposite onto the wire.
Add support for LZ compression of A8 images
Graduality is irrelevant for A8 images, so instead of using RGB-ness
as a short-cut, add a new macro BITMAP_FMT_HAS_GRADUALITY() that
returns true for the existing RGB images, but false for A8.
2012-08-09 Marc-André Lureau <marcandre.lureau@redhat.com>
Update spice-common
2012-07-25 Yonit Halperin <yhalperi@redhat.com>
red_worker: Fix reference counting for the current frame (drawable) of a stream
After marshalling MSG_STREAM_CREATE, there is no need to ref and
unref stream->current before and after completing the sending of the
message (correspondingly). The referencing is unnecessary because all
the data that is required from the drawable (the clipping), is copied
during marshalling, and no field in the drawable is referenced (see
spice_marshall_msg_display_stream_create).
Moreover, the referencing was bugous:
While display_channel_hold_pipe_item and
display_channel_client_release_item_after_push referenced and
dereferenced, correspondingly, stream->current, stream->current might
have changed in between these calls, and then we ended up with one drawable
leaking, and one drawable released before its time has come (which
of course led to critical errors).
2012-07-23 Alon Levy <alevy@redhat.com>
bump version to 0.11.1 for new spice_qxl_monitors_config_async
bump current and age since only additions where done.
new server library is libspice-server.so.1.2.0 .
2012-07-22 Alon Levy <alevy@redhat.com>
server: add monitors_config support
a SpiceMsgDisplayMonitorsConfig is sent on two occasions:
* as a result of a spice_qxl_monitors_config_async
* whenever a client connects and there is a previously set monitors
config
Sending the new message is protected by a new cap,
SPICE_DISPLAY_CAP_MONITORS_CONFIG
More elaborately:
spice_qxl_monitors_config_async receives a QXLPHYSICAL address of a
QXLMonitorsConfig struct and reads it, caching it in the RedWorker, and
sending it to all clients. Whenever a new client connects it receives
a SpiceMsgDisplayMonitorsConfig message as well.
server/red_parse_qxl: red_get_image: fix leaks on bad image
server/red_worker: release bad drawables
server/red_parse_qxl: disallow zero area bitmaps
prevents division by zero later (SIGFPE, Arithmetic exception) in
spice-common code, at spice-common/common/canvas_base.c:646
for both client and server (server only upon rendering).
server/red_parse_qxl: get_path: remove return NULL
introduced by 2ec2dbc78a660ee4e3315f50c881d9e31a8e4fe2
server/reds: more fixes for wrong spice_error in d2c99b59
server: don't abort on guest images with missing palettes
server: factor out bitmap_fmt_is_rgb
2012-07-16 Marc-André Lureau <marcandre.lureau@redhat.com>
Update spice-common
tests: add missing file to .gitignore
TODO: some day, switch to git.mk
build-sys: remove cegui/slirp and mandatory client from dist-check
The spicec client is no longer actively maintained.
By removing cegui from distcheck, we can avoid extra build time and
dependencies (>150Mb extra cegui/boost on fedora)
Slirp is not available in most distributions, afaict, making it hard
to build consistantly accross various systems.
The client is still build if the dependencies are present.
build-sys: define GL flags if enabled
The server too can use opengl, independently from client.
2012-07-11 Alon Levy <alevy@redhat.com>
server/reds: fix wrong spice_error in d2c99b59
server/red_worker: fix wrong spice_error in commit 706232a8
2012-07-05 Alon Levy <alevy@redhat.com>
server/reds.c: spice_printerr cleanup
Rules for replacing spice_printerr:
* if it's a client drop / agent drop, spice_error
* if it's important, spice_warning
* else, spice_info.
The fourth rule is spice_debug if it's going to fill up the log, but
nothing of the sort here.
Other things this patch does:
* changed reds_show_new_channel to reds_info_new_channel in an attempt to
advertise it doesn't always show anything, unless SPICE_DEBUG_LOG_LEVEL
>= SPICE_DEVUG_LOG_INFO (==3)
* removes two lines of whitespace.
* added "crashy" to multiple client warning (only warning introduced,
the rest are errors).
server/red_worker: elevate some spice_debugs to spice_info
Specifically all those that the previous patch converted to spice_debug.
spice_debug contains very verbose stuff like update_area that drowns out
those relatively rare (client connect / disconnect generated) messages.
update spice-common for spice_info
server/red_worker: cleanup lines starting with 5 spaces
server/red_worker: death to spice_printerr, too verbose by far
Replaced mostly with spice_debug, but spice_warning & spice_error as
well where appropriate.
2012-07-04 Yonit Halperin <yhalperi@redhat.com>
smartcard: Remove redefinition of typedef 'SmartCardDeviceState'
2012-07-03 Yonit Halperin <yhalperi@redhat.com>
char_device.h: Remove redefinition of typedef 'SpiceCharDeviceState'
The original definition is in spice.h
char_device: move SpiceCharDeviceState from the header
In addition, I also removed the no longer used wakeup callback
smartcard: use SpiceCharDeviceState for writing to the guest device
With SpiceCharDeviceState, the smartcard code now supports partial writes,
and storing data that is received from the client after the device is
stopped, instead of attempting to write it to the guest.
smartcard: creating SmartCardChannelClient type
The lifetime of the channel is not necessarily correlated to the life
time of the device. In the next patch, we need to keep a reference
to SpiceCharDeviceWriteBuffer, which might be in use even if the
SpiceCharDeviceState is destroyed, but the channel is still connected.
The next patch keeps this reference inside SmartCardChannelClient.
This patch also removes the routine smartcard_readers_detach_all(rcc), which
is unnecessary since we don't support multiple readers; even when
we do support them, each channel client should be associated with only
one reader (i.e., we will have different channels for different
readers).
smartcard: use SpiceCharDeviceState for managing reading from the device
This patch and the following one do not introduce tokening to the smartcard
channel. But this can be done easily later, by setting the appropriate
variables in SpiceCharDeviceState (after adding the appropriate protocol messages,
and implementing this in the client side).
spicevmc: use SpiceCharDeviceState for writing to the guest device
With SpiceCharDeviceState, spicevmc now supports partial writes,
and storing data that is received from the client after the device is
stopped, instead of attempting to write it to the guest.
spicevmc: employ SpiceCharDeviceState for managing reading from the guest device
This patch and the following one do not introduce tokening to the
spicevmc channel. But this can be done easily later, by setting the appropriate
variables in SpiceCharDeviceState (after adding
the appropriate protocol messages, and implementing this in the client
side).
agent: employ SpiceCharDeviceState for writing to the device
agent: use SpiceCharDeviceWriteBuffer for agent data from the client
This is an intermediate patch. The next patch will actually
push the buffer to the device, instead of copying it.
agent: employ SpiceCharDeviceState for managing reading from the device
agent: remove save/restore migration data code
This code is never called, it was relevant for seamless migration.
Most of the data that needs to be migrated was moved to
SpiceCharDeviceState. When we implement seamless migration,
we will have routines in char_device.c for migrating the relevant data.
agent: Fix tokens handling in main_channel
- Allow sending tokens to a specific client.
- Do not ignore tokens that are sent from the client to the server.
The tokens support for multiple clients and for server side tokens
is still broken in reds. It will be fixed in following patches, when
the server-side agent code will use the SpiceCharDeviceState api.
Notice that ignoring the server-side tokens didn't introduce a problem
since both the client and the server set it to ~0.
char_device: Introducing shared flow control code for char devices.
SpiceCharDeviceState manages the (1) write-to-device queue
(2) wakeup and reading from the device (3) client tokens (4)
sending messages from the device to the client/s, considering the
available tokens.
SpiceCharDeviceState can be also stopped and started. When the device
is stopped, no reading or writing is done from/to the device. Messages
addressed from the client to the device are being queued.
Later, an api for stop/start will be added to spice.h and it should
be called from qemu.
This patch does not yet remove the wakeup callback from
SpiceCharDeviceState, but once all the char devices (agent/spicevmc/smartcard)
code will switch to the new implementation, SpiceCharDeviceState
will be moved to the c file and its reference to the wakeup callback will be removed.
smartcard: fix an error message
smartcard: fix calc of remaining data size when reading more than one msg from the device
2012-07-02 Alon Levy <alevy@redhat.com>
update spice-common
Includes using the same spice.proto as spice-gtk now, with smartcard
fixes, more verbose output when SSL verification fails, and some
warnings fixes. shortlog:
Alon Levy (6):
python_modules/ptypes.py/EnumBaseType.c_enumname: add missing return to fix broken enums generation
smartcard: build fixes for spice server
updated spice-protocol for smartcard enums non conflict with libcacard
Makefile.am: fix .gitignore not being generated in spice-protocol/spice
Makefile.am: now that spice_codegen.py is used add *.pyc to ignored files in root
update spice-protocol for smartcard enums fix
Christophe Fergeau (1):
ssl: more verbose output when SSL verification fails
Marc-André Lureau (3):
ssl-verify: add a bit of run-time checks
Fix invalid macro usage
Fix a gcc warning
2012-06-27 Alon Levy <alevy@redhat.com>
spice.h: bump SPICE_SERVER_VERSION for release 0.11.0 (cherry picked from commit dd5c995c32cf595d31e59975bd1b3216cf996656)
Revert "update spice-common for multiple monitor in single display channel support"
This reverts commit 3baf290be79cfb1872b90f7724efa50aa343d74b.
Revert "spice.h: bump SPICE_SERVER_VERSION for release 0.11.0"
This reverts commit dd5c995c32cf595d31e59975bd1b3216cf996656.
2012-06-21 Alon Levy <alevy@redhat.com>
spice.h: bump SPICE_SERVER_VERSION for release 0.11.0
update spice-common for multiple monitor in single display channel support
2012-06-19 Nikolay Orlyuk <virkony@gmail.com>
Added configure option --disable-xinerama
This parameter was added to be able to control dependency on
libXinerama. Which is really useful for package managers.
Fixes bug #51192
2012-06-12 Alon Levy <alevy@redhat.com>
Release 0.11.0
Current bumped and age bumped for new intefaces only (no backward
incompatible changes).
New libtool version is 2.0.1, using --version-info instead of
--version-name. Doing the version change and --version-name to
--version-info change here to avoid changing the libtool version twice.
Added interfaces:
spice_server_set_name
spice_server_set_uuid
spice_server_set_listen_socket_fd
spice_server_is_server_mouse
New library name in linux:
libspice-server.so.1.1.0
Old:
libspice-server.so.1.0.2
2012-06-07 Alon Levy <alevy@redhat.com>
server/red_channel: s/channle/channel
2012-06-06 Alon Levy <alevy@redhat.com>
m4/spice-compile-warnings: Squelch _FORTIFY_SOURCE when needed to avoid glibc #warnings.
Fix copied from libvirt, commit by Eric Blake.
glibc 2.15 (on Fedora 17) coupled with explicit disabling of
optimization during development dies a painful death:
/usr/include/features.h:314:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
Work around this by only conditionally defining _FORTIFY_SOURCE,
in the case where glibc can actually use it. The trick is using
AH_VERBATIM instead of AC_DEFINE.
2012-06-05 Alon Levy <alevy@redhat.com>
server/spice.h: s/Pleaes/Please/
2012-05-31 Yonit Halperin <yhalperi@redhat.com>
server/red_channel: do not attempt to write if the channel client is disconnected
The red_channel_client_event call to red_channel_client_receive might result
in a disconnected channel client. The following call to
red_channel_client_push may call to red_peer_handle_outgoing with a
disconnected socket.
server/red_channel: fix possible access to released channel clients
Added ref count for RedChannel and RedChannelClient.
red_channel.c/red_peer_handle_incoming call to
handler->cb->handle_message might lead to the release of the channel
client, and the following call to handler->cb->release_msg_buf will be
a violation.
This bug can be produced by causing main_channel_handle_parsed
call red_client_destory, e.g., by some violation in
reds_on_main_agent_data that will result in a call to reds_disconnect.
2012-05-24 Yonit Halperin <yhalperi@redhat.com>
server/red_worker: fix red_wait_pipe_item_sent
Resolves: rhbz#824384
red_wait_pipe_item_sent mistakingly returned without waiting for sending the given pipe item
when the channel wasn't blocked. As a result, we failed when we had to
destroy a surface (e.g., QXL_IO_DESTROY_ALL_SURFACES) and to release all
the drawables that are depended on it (by removing them or waiting they will be sent).
In addition, red_wait_pipe_item_sent increased and decreased the reference to the pipe item
using channel_cbs->hold_item, and channel_cbs->release_item. However,
these calls can be called only by red_channel, otherwise
display_channel_client_release_item_before_push is called twice and
leads to a double call to ring_remove(&dpi->base).
Instead ref/put_drawable_pipe_item should be called.
server/red_channel: remove red_channel_client_item_being_sent
The above routine was risky, since red_channel_client_init_send_data
can also be called with item==NULL. Thus, not all pipe items can be tracked.
The one call that was made for this routine was not necessary.
2012-05-21 Yonit Halperin <yhalperi@redhat.com>
server: handle red_channel_client_create returning NULL
server/red_channel: prevent creating more than one channel client with the same type+id
server/video: do not allow non-streamable drawables be stream candidates
Resolves: rhbz#820669
Fix a segfault caused by a call to __red_is_next_stream_frame made by
red_stream_maintenance, with a drawable that is not a DRAW_COPY one.
The segfault is a reault of __red_is_next_stream_frame accessing
red_drawable->u.copy.src_bitmap for a non DRAW_COPY drawable.
2012-05-16 Yonit Halperin <yhalperi@redhat.com>
server/tests: test_display_streaming - test wide sized frames
Before, we tested only higher frames, while wider frames would have
triggered a bug in mjpeg_encoder, when spice is linked with libjpeg and
not libjpeg-turbo.
server/mjpeg_encoder: realloc encoder->row, when a wider frame is given
Fix crashes when there are sized wider frames in the stream, and we are
linked with libjpeg.
Related : rhbz#813826
Resolves: rhbz#820669
2012-05-15 Alon Levy <alevy@redhat.com>
server: move self_bitmap_image to RedDrawable
Simplify keeping count of self_bitmap_image by putting it in
RedDrawable. It is allocated on reading from the command pipe and
deallocated when the last reference to the RedDrawable is dropped,
instead of keeping track of it in GlzDrawable and Drawable.
server/red_worker/put_red_drawable: s/drawable/red_drawable/
server/red_worker/red_handle_self_bitmap: add red_drawable local, one extra whitespace line removed
server/red_worker: rename SpiceImage *self_bitmap to self_bitmap_image
Revert "server/red_worker: fix possible leak of self_bitmap"
This reverts commit 35dbf3ccc4b852f9dbb29eb8a53c94f26d2e3a6e.
accidentally pushed v1 of patches, reverting in preperation of pushing
v2.
2012-05-14 Alon Levy <alevy@redhat.com>
server/red_worker: fix possible leak of self_bitmap
After the previous patch moving self_bitmap freeing inside red_drawable
ref count, we have a possible self_bitmap leak:
red_process_commands
red_get_drawable | red_drawable #1, red_drawable->self_bitmap == 1
red_process_drawable | rd #2, d #1, d->self_bitmap != NULL
release_drawable | rd #1, d# = 0, try to release self_bitmap, but
blocked by rd #1
put_red_drawable | rd #0
This patch moves the call to release_drawable after the call to
put_red_drawable, thereby fixing the above situation.
server/red_worker/red_process_commands: rename drawable to red_drawable (later add a local drawable)
server/red_worker: red_process_drawable: have single point of exit
2012-05-14 Yonit Halperin <yhalperi@redhat.com>
server/red_worker: don't release self_bitmap unless refcount is 0
RHBZ: 808936
2012-05-10 Yonit Halperin <yhalperi@redhat.com>
server/mjpeg_encoder: fix wrong size assigned to dest_len
It should have been the allocated size and not the occupied one.
This led to a lot of unnecessary allocations and deallocations.
server/mjpeg_encoder: Fix memory leak for the inital output buffer given for each frame
2012-05-07 Alon Levy <alevy@redhat.com>
server/reds: add "usbredir" to recognized channel names
RHBZ: 819484
2012-05-04 Nahum Shalman <nshalman@elys.com>
cleanup x11 library detection for building client
Consolidate two separate chunks of library hunting that depend on the
same check.
Check if we're actually building the client before looking for
client only libraries.
Hide some of the final output if we're not building the client.
2012-05-03 Yonit Halperin <yhalperi@redhat.com>
server/tests/test_display_streaming: include tests for clip and sized frames
CC: Alon Levy <alevy@redhat.com>
server/tests: use the correct dimensions in SIMPLE_UPDATE
server/tests: add SLEEP command to test_display_base
server/tests: add clip to SIMPLE_DRAW_BITMAP
2012-05-03 Alon Levy <alevy@redhat.com>
server/tests/test_display_streaming: update to create sized frames
server/tests: add SIMPLE_DRAW_SOLID and SIMPLE_DRAW_BITMAP
server/tests: refactor Command
server/tests: add test_get_width/test_get_height
server/tests: refactor test_display_base
2012-05-03 Yonit Halperin <yhalperi@redhat.com>
server/red_worker/video: don't override the clip in areas that belong only to sized frames
server/red_worker.c/video: add support for frames of different sizes
rhbz #813826
When playing a youtube video on Windows guest, the driver sometimes(**) sends
images which contain the video frames, but also other parts of the
screen (e.g., the youtube process bar). In order to prevent glitches, we send these
images as part of the stream, using SPICE_MSG_DISPLAY_STREAM_DATA_SIZED.
(**) It happens regularly with the you tube html5 player. With flash,
it occurs when moving the cursor in the player area.
Update the spice-common submodule
spice-common changes: STREAM_DATA_SIZED message was added in order to support
video streams with frames that their size is different from the initial size
that the stream was created with.
This patch also includes server and client adjustments to the new
SpiceMsgDisplayStreamData.
server/red_worker/video: don't detach a drawable from a stream due to it being rendered.
The previous patch took care that streams will be upgraded by a surface
screenshot and not the last frame, if necessary. Thus, there is no
more a reason for detaching drawables from streams when they are
rendered. Moreover, detaching such drawables can cause glitches, in
case they are still in the pipe, and red_update_area is called
frequently and leads to stream frames rendering.
server/red_worker/video: upgrade stream by a screenshot instead of the last frame, if needed
Upgrading a stream: When the stream's visible region is bigger than the one of the last
frame, we will send an updated screenshot of the visible region, instead
of sending the last frame losslessly.
server/red_worker/video: maintain visible region and clip region for streams
Differentiate between the clipping of the video stream, and the region
that currently displays fragments of the video stream (henceforth,
vis_region). The latter equals or contains the former one. For example,
let c1 be the clip area at time t1, and c2 be the clip area at time t2,
where t1 < t2. If c1 contains c2, and at least part of c1/c2, hasn't been
covered by a non-video images, vis_region will contain c2, and also the part
of c1/c2 that still displays fragments of the video.
When we consider if a stream should be "upgraded" (1), due to its area
being used by a rendering operation, or due to stopping the video, we
should take into account the vis_region, and not the clip region (next
patch: not upgrade by the last frame, but rather by vis_region).
This fix will be more necessary when sized frames are introduced (see the
following patches). Then, the vis_region might be larger
than the last frame, and contain it, more frequently than before.
(1) "upgrading a stream" stands for sending its last frame losslessly. Or more
precisely, lossless resending of all the currently displayed lossy areas, that were
sent as part of the stream.
server/red_worker: add get_stream_id
Update the spice-common submodule
We need some rect/region getters methods that were added
2012-04-27 Jeremy White <jwhite@codeweavers.com>
Force 64 bit multiplication on 32 bit systems; fixes a bug where the server times out the display channel freakily fast.
2012-04-26 Daniel P. Berrange <berrange@redhat.com>
Ensure __STDC_FORMAT_MACROS is always defined first
The client/common.h file defines __STDC_FORMAT_MACROS before
including inttypes.h so that the PRI* macros get defined in
C++. This is ignoring the possibility that other global
includes may have already pulled in inttypes.h
We need __STDC_FORMAT_MACROS to be defined before any header
files are included. Putting it in config.h satisfies this,
since config.h is always the first header
Disable -Waggregate-return if building with SLIRP
The API design of SLIRP means that it is not practical to use
the -Waggregate-return warning flag. Disable this flag in the
(unlikely) scenario where SLIRP is actually requested at build
time
2012-04-26 Alon Levy <alevy@redhat.com>
bump spice-common with SpiceClips fix
2012-04-25 Daniel P. Berrange <berrange@redhat.com>
Add some more 'noreturn' annotations
Methods which longjump, unconditionally raise an
exception, or call _exit() cannot return control
to the caller so should be annotated with 'noreturn'
Fix typo in is_equal_brush
The 3 part of the conditional in the is_equal_brush method
compared the b1->u.color field to itself, instead of b2->u.color
Fix printf format specifiers for i686 hosts
Add missing struct field initializers
Ensure config.h is the first include in the file
Add a few more syntax-check exemptions
Add recent new committers to AUTHORS file / mailmap
Enable many more compiler warnings
* m4/manywarnings.m4m, m4/warnings.m4: Import GNULIB warnings
modules
* m4/spice-compile-warnings.m4: Define SPICE_COMPILE_WARNINGS
* configure.ac: Replace compile warning check with a call to
SPICE_COMPILE_WARNINGS
* client/Makefile.am: Use WARN_CXXFLAGS instead of WARN_CFLAGS
Make some int->pointer casts explicit
Tell the compiler that was really do intend to cast from int
to pointer, to prevent warnings about implicit casts
* server/tests/test_display_base.c: Add explicit casts
Fix broken -I../common to be -I../spice-common in client
* Makefile.am: s/common/spice-common/
VSCMsgHeader.reader_id is unsigned, so don't check for >= 0
* server/smartcard.c: Fix assertion to not check for >= 0 on
unsigned variable
Avoid jumping across variables declarations with initializers
If a 'goto' statement jumps across a variable declaration
which also has an initializer, the variable is in an undefined
state. Splitting the the declaration & initialization doesn't
change that, but the compiler can at least now detect use of
the unintialized variable
Convert cases of () to (void)
* server/reds.c, server/smartcard.c: s/()/(void)
Remove 2 *MB* stack frame in red_worker_main
The red_worker_main method allocates a RedWorker struct instance
on the stack. This struct is a full 2 MB in size which is not
at all resonable to allocate on the stack.
* server/red_worker.c: Move RedWorker struct to the heap
Mark some variables as volatile
When using setjmp/longjmp the state of local variables can be
undefined in certain scenarios:
[quote man(longjmp)]
The values of automatic variables are unspecified after a
call to longjmp() if they meet all the following criteria:
· they are local to the function that made the correspond
ing setjmp(3) call;
· their values are changed between the calls to setjmp(3)
and longjmp(); and
· they are not declared as volatile.
[/quote]
* server/red_worker.c: Mark some vars as volatile
Mark functions which never return control
* client/red_channel.cpp: AbortTrigger::on_event can't return
given its current impl
* server/red_worker.c: red_worker_main can't return
Fix multiple printf format problems
All printf var-args style methods should be annotation with
their format. All format strings must be const strings.
* client/application.cpp, client/cmd_line_parser.cpp,
client/hot_keys.cpp: Avoid non-const format
* client/client_net_socket.cpp: Fix broken format specifier
* client/red_peer.cpp: Fix missing format specifier
* client/platform.h: Add SPICE_GNUC_PRINTF annotation to term_printf
* client/utils.h: Add SPICE_GNUC_PRINTF annotation to string_printf
* server/glz_encoder_config.h, server/red_worker.c: Add
SPICE_GNUC_PRINTF annotation to warning callbacks
Fix const-ness violations
* server/red_worker.c: Add missing const for return type
* server/reds.c: Static strings must be declared const
Don't do arithmetic on void * type, use uint8_t instead
Arithmetic on void * types is non-portable & trivially avoided
* server/dispatcher.c: Use uint8_t for arithmetic
2012-04-18 Alon Levy <alevy@redhat.com>
spice-common: update submodule to verify_subject MSVC++ fix
spice-common: update submodule
update spice-common for MSVC++ build fixes
2012-04-18 Aric Stewart <aric@codeweavers.com>
update visual studio project file
Note, there may be line-ending issues here is we are not careful. This file is a msdos formatted file.
There was some inconsistencies in those line-ending that I have normalized.
2012-04-18 Alon Levy <alevy@redhat.com>
client/windows/redc.vcproj: switch to unix EOL (dos2unix)
2012-04-18 Aric Stewart <aric@codeweavers.com>
Update win32 generate(1).bat files to match modern usage
This involves:
generating .c instead of .cpp files
Not including "common.h"
Standardizing some parameters
we do not need afxres.h included in redc.rc
It is not an MFC project so simply including windef.h is better and
allows for compiling with the Express editions of Visual Studio.
2012-04-18 Michael Tokarev <mjt@tls.msk.ru>
fix error-path return in snd_set_record_peer()
The error_{1,2} labels in this functions are backwards.
2012-04-17 Aric Stewart <aric@codeweavers.com>
Copy getopt.h from old common/win/my_getopt-1.5/my_getopt
This patch completes the copy from
4d8f39020ac83602c1647d4af04e8b19bf74ed6e which missed this file.
update windows client generate.bat and generate1.bat
the python script is now in spice-common and client_marshallers.h needs
to be included instead of marshallers.h
2012-04-05 Alon Levy <alevy@redhat.com>
server: allow failure in getvirt
This patch changed getvirt to continue working even if spice_critical
doesn't abort (i.e. SPICE_ABORT_LEVEL != -1). This is in preparation to
make getvirt not abort at all. The reason is that getvirt is run on
guest provided memory, so a bad driver can crash the vm.
2012-04-02 Christophe Fergeau <cfergeau@redhat.com>
Replace sprintf with snprintf use
The hotkey parser was generating a string with sprintf and data it got
from the controller socket (ie data which can have an arbitrary
length). Using sprintf there is a bad idea, replace it with snprintf.
2012-03-28 Marc-André Lureau <marcandre.lureau@redhat.com>
spice-common: update to fix quic-encode warnings
2012-03-26 Alon Levy <alevy@redhat.com>
server: export spice_server_is_server_mouse predicate
To be used by qemu query-spice / info spice commands.
2012-03-26 Marc-André Lureau <marcandre.lureau@redhat.com>
Remove files moved to spice-common
2012-03-25 Marc-André Lureau <marcandre.lureau@redhat.com>
Copy common/win/my_getopt-1.5/my_getopt client/windows
Use the spice-common logging functions
It will abort by default for critical level messages. That behaviour
can be tuned at runtime.
Use the spice-common submodule
This patch will replace the common/ directory with the spice-common
project. It is for now a simple project subdirectory shared with
spice-gtk, but the goal is to make it a proper library later on.
With this change, the spice-server build is broken. The following
commits fix the build, and have been seperated to ease the review.
v2
- moves all the generated marshallers to spice-common library
- don't attempt to fix windows VS build, which should somehow be
splitted with spice-common (or built from tarball only to avoid
generation tools/libs deps)
v3
- uses libspice-common-client
- fix a mutex.h inclusion reported by Alon
2012-03-23 Marc-André Lureau <marcandre.lureau@redhat.com>
sasl: small refactoring, check memcheck != NULL
Use spice_strdup() to avoid crashing on NULL
qemu can call spice_server_set_name(s, NULL) when the name is not
given. Let's not crash in this case
2012-03-22 Alon Levy <alevy@redhat.com>
server/tests: add resolution changes tester
server/tests/test_display_base: add Command
add parameters to the commands used for display tests.
2012-03-21 Alon Levy <alevy@redhat.com>
server/tests/test_display_base: remove 64bit arch assumptions
server/red_memslots: don't assume 64 bit environment
assumption that unsigned long == QXLPHYSICAL causes get_virt to compute
the wrong slot. Fix by replacing addr variables to be of type
QXLPHYSICAL.
server/red_worker: fix for case where ASSERT is compiled out
server/red_memslots: use QXLPHYSICAL for addresses
Cannot assume unsigned long == QXLPHYSICAL, not true for 32 bit
architectures.
server/red_memslots: drop two unused functions
cb_get_virt and cb_validate_virt have disappeared a long time ago,
not needed since:
commit 5ac88aa79fa6445f96e5419d8bf4fce81da63b90
Author: Gerd Hoffmann <kraxel@redhat.com>
Date: Thu Jul 1 17:55:33 2010 +0200
Properly parse QXLImage to the new-world SpiceImage
SpiceImage now replaces RedImage and has all image types in it.
All image data are now chunked (and as such not copied when demarshalling).
2012-03-20 Christophe Fergeau <cfergeau@redhat.com>
Don't truncate SPICE_FOREIGN_MENU_SOCKET
When we get the socket name for the foreign menu socket from
an environment variable, we cannot make assumptions about its length.
Currently, we are strncpying to a 50 byte buffer which is easily
too small.
Don't limit spice controller socket name to 50 chars
The spice controller socket name used to be hardcoded to
/tmp/SpiceController-%lu.uds and generated using snprintf. A 50 bytes
buffer was enough for that, but this was changed in commit 79fffbf95
because this was predictable and allowed other users on the system
to sniff the browser/client communication. spicec now uses the value
of the environment SPICE_XPI_SOCKET as the name of the socket to use.
However, since the name that is used is no longer generated by spicec,
no assumption can be made about its size. Currently, the socket is
created inside the user home directory, which means that if the
user name is too long, spicec will not be able to read the controller
socket name.
This commit directly uses the string from getenv as he name of the
controller socket (on Linux) instead of limiting its size to 50 characters,
which should fix this issue.
This fixes rhbz #804561
Remove unused Canvas members
The various Canvas have _max and _base variables which are not
used, better to remove them.
2012-03-20 Alon Levy <alevy@redhat.com>
server/red_worker: don't typedef SpiceWatch twice
First defined in spice.h, fixes build failure with gcc 4.4.6
2012-03-13 Hans de Goede <hdegoede@redhat.com>
red_worker: Check for NULL watches
If we run out of watches slots, we return NULL from watch_add, which
means that the other watch_foo functions may get called with a NULL
parameter, protect them against this.
2012-03-12 Nahum Shalman <nshalman@elys.com>
server: remove superfluous check
no need to duplicate the check that the fd isn't -1
server: listen on a pre-opened file descriptor
Allow applications to pre-open a file descriptor and have spice listen
on it.
Thanks to Daniel Berrange for his comments
server: don't fail on ENOPROTOOPT from setsockopt
If we allow listening on arbitrary sockets like unix sockets,
we can get ENOPROTOOPT errors from setsockopt calls that set TCP
specific options. This should be allowed to happen.
2012-03-12 Hans de Goede <hdegoede@redhat.com>
red_channel: remove pre_disconnect hook
Now that red_worker's EventListener is gone there are no more users of it.
red_worker: Rework poll code to use the watch interface
Commit 143a1df24e83e9c1e173c16aeb76d61ffdce9598 changed red_worker_main
from epoll to poll. But epoll has edge triggered semantics (when requested
and we requested them), where as poll is always level triggered. And
red_worker was relying on the edge triggered semantics, as it was always
polling for POLLOUT, which, when edge triggered, would only cause poll
to register an event after we had blocked on a write. But after the
switch to regular poll, with its level triggered semantics, the POLLOUT
condition would almost always be true, causing red_worker_main to not
block on the poll and burn CPU as fast as it can as soon as a client was
connected.
Luckily we already have a mechanism to switch from polling for read only
to polling for read+write and back again in the form of watches. So this
patch changes the red_worker dummy watch implementation into a proper watch
implementation, and drops the entire EventListener concept since that then is
no longer needed.
This fixes spice-server using 400% CPU on my quad core machine as soon as
a client was connected to a multi head vm, and as an added bonus is a nice
cleanup IMHO.
red_channel: Use the channel core to remove the stream watch on disconnect
We allow channels to have different core implementations, but we were
relying on reds_stream_free to remove the stream watch on disconnect,
and reds_stream_free always uses the qemu core implementation.
So far we were getting away with this since all the alternative core
implementations always return NULL from watch_add.
But:
1) The code before this patch clearly was not correct, since it was matching
a channel-core watch_add with a qemu-core watch_remove
2) I plan to move red_worker over to actually using an alternative watch
implementation at which point this becomes a real problem
2012-03-10 Hans de Goede <hdegoede@redhat.com>
red_worker: Remove ref counting from the EventListener struct
The red_worker EventListener struct is either embedded in one of:
1) DisplayChannelClient
2) CursorChannelClient
3) RedWorker
And as such gets destroyed when these get destroyed, in case 1 & 2 through
a call to red_channel_client_destroy().
So free-ing it when the ref-count becomes 0 is wrong, for cases:
1) and 2) this will lead to a double free;
3) this will lead to passing memory to free which was not returned by malloc.
This is not causing any issues as the ref-count never gets decremented, other
then in red_worker_main where it gets incremented before it gets decremented,
so it never becomes 0.
So we might just as well completely remove it.
Notes:
1) This is mainly a preparation patch for fixing issues introduced by
the move from epoll to poll
2) Since removing the ref-counting removes the one code path where listeners
would get set to NULL, this patch moves the setting of NULL to
pre_disconnect, where it should have been done in the first place since
red_client_destroy calls red_channel_client_disconnect
(through the dispatcher) followed by red_channel_client_destroy, so
after pre_disconnect the listener may be gone.
Ensure all members of ChannelCbs and ClientCbs are either assigned or NULL
While git-bisecting another issue I ended up hitting and not recognizing
the bug fixed by commit 7a079b452b026d6ce38f95dcc397fa64b059fffb.
While fixing this (again) I noticed that (even after the fix) not all
users of ChannelCbs first zero it. So this patch ensures that all users of
ChannelCbs first zero it, and does the same for ClientCbs while at it.
Since before this patch there were multiple zero-ing styles, some using
memset and other using a zero initializer this patch also unifies all
the zero-ing to use a NULL initializer for the first element.
2012-03-06 Alon Levy <alevy@redhat.com>
server/red_worker: fix use after free for listeners
This fixes a core dumped observed once by repeated migration. So far 100
migrations and no recurrence.
Core was generated by `/home/alon/spice/upstream/bin/qemu-system-x86_64 --enable-kvm -qmp unix:/tmp/mi'.
Program terminated with signal 11, Segmentation fault.
11197 if (evt_listener && evt_listener->refs > 1) {
Missing separate debuginfos, use: debuginfo-install bluez-libs-4.98-3.fc17.x86_64 brlapi-0.5.6-4.fc17.x86_64 bzip2-libs-1.0.6-4.fc17.x86_64 cryptopp-5.6.1-6.fc17.x86_64 keyutils-libs-1.5.5-2.fc17.x86_64 libssh2-1.4.0-1.fc17.x86_64 nss-softokn-freebl-3.13.1-20.fc17.x86_64 xen-libs-4.1.2-11.fc17.x86_64 xz-libs-5.1.1-2alpha.fc17.x86_64
(gdb) bt
(gdb) l
11192 for (i = 0; i < MAX_EVENT_SOURCES; i++) {
11193 struct pollfd *pfd = worker.poll_fds + i;
11194 if (pfd->revents) {
11195 EventListener *evt_listener = worker.listeners[i];
11196
11197 if (evt_listener && evt_listener->refs > 1) {
11198 evt_listener->action(evt_listener, pfd);
11199 if (--evt_listener->refs) {
11200 continue;
11201 }
(gdb) p evt_listener
$1 = (EventListener *) 0x7f15a9a5d1e0
(gdb) p *evt_listener
Cannot access memory at address 0x7f15a9a5d1e0
(gdb) p i
$2 = 2
(gdb) p worker.listeners
$3 = {0x7f15bc832520, 0x7f15a406e1a0, 0x7f15a9a5d1e0, 0x0 <repeats 17 times>}
2012-03-05 Marc-André Lureau <marcandre.lureau@redhat.com>
Use SPICE_FOREIGN_MENU_SOCKET if it's available
If specified, use SPICE_FOREIGN_MENU_SOCKET environment variable over
snprintf(pipe_name, PIPE_NAME_MAX_LEN, PIPE_NAME,
Platform::get_process_id()); since it's impossible to guess the client
pid when spice-xpi launches the client as a grand-child (via script
etc).
This is also more aligned with the way we handle SPICE_XPI_SOCKET
location.
Fix spice-protocol reference
Send name & uuid to capable clients
Add spice_server_set_name() and spice_server_set_uuid() that allows
the client to identify a Spice server (useful to associate settings
with a particular server)
The SPICE_MSG_MAIN_NAME and SPICE_MSG_MAIN_UUID messages are only sent
to capable clients, announcing SPICE_MAIN_CAP_NAME_AND_UUID.
demarshal: fixed-size array are missing __nelements
A message with a fixed-size array, such as uint8 uuid[16] will
generate an invalid code, missing the __nelements variable. Make sure
that variable is defined.
2012-03-05 Christophe Fergeau <cfergeau@redhat.com>
server: more logging about certificates used
This commit adds some log messages indicating which certificates
could be loaded (or not).
Fixes rhbz#787678
Add log for invalid/expired tickets
Currently, when a ticket has already expired, or is invalid, there is
no qemu log to tell what went wrong. This commit adds such a log.
Fixes rhbz#787669
2012-03-04 Christophe Fergeau <cfergeau@redhat.com>
mingw: workaround weird openssl build failure
If X509_NAME isn't undefined before including x509v3.h, very
weird compilation error occurs. It seems to be caused by duplicate
definitions for this symbols coming from wincrypto.h
mingw: don't try to redefine alloca
mingw already has a #define alloca __builtin_alloca so trying to
redefine it triggers a warning.
mingw: fix signed/unsigned comparison warnings
mingw: add workaround for _ftime_s issue on mingw
mingw has a _ftime_s prototype in its headers, but no corresponding
symbol available at link time. Workaround this issue for now by
#defining it to _ftime. This is untested on win64 where the workaround
may not be needed.
mingw: #ifdef unneeded #define in common.h
common.h has some #define when doing win32 build to workaround a few
missing functions on these systems. However, since mingw32 has some
of these, this causes either warnings about redefining preprocessor
symbols or wreak havoc in mingw headers trying to use these symbols.
This commit wraps these symbols in an #ifndef __MINGW32__ to avoid
using them on this platform.
mingw: use uintptr_t when converting a pointer to an int
win64 uses 32 bit long, so we cannot use a long to hold a 64 bit
pointer. Thankfully, there's a [u]intptr_t type available exactly
for these uses.
2012-03-01 Marc-André Lureau <marcandre.lureau@redhat.com>
build-sys: fix make distcheck
- Do not refer to .c files managed by another makefile (this will fail
make distclean)
- Do not refer to files by relative path (should use $top_srcdir for ex)
- Use LDADD for object linking instead of LDFLAGS, for linker flags
build-sys: cleanup server/tests/Makefile.am
build-sys: use spice-protocol as submodule
build-sys: cleanup, use autoreconf
2012-03-01 Arnon Gilboa <agilboa@redhat.com>
client/windows: fix SetClipboardViewer error handling rhbz#786554
MSDN says the following about SetClipboardViewer(): "If an error occurs or there
are no other windows in the clipboard viewer chain, the return value is NULL".
Seems like the buggy case was "no other windows in the clipboard viewer chain",
which explains the 3rd party clipboard manager workaround detailed in the bug
description.
It also seems like SetClipboardViewer() does not clear the error state on
succcess. Calling SetLastError(0) before SetClipboardViewer() seems to solves
this issue.
Since we could not reproduce the bug on our env, the customer has verified on
several of their systems that a private build resolved the issue.
2012-03-01 Yonit Halperin <yhalperi@redhat.com>
client X11: support volume keys when evdev is in use
Add support for sending volume keys scancodes to the guest
RHBZ #552539
client: keyboard - add mapping for volume keys
Add support for sending volume keys scancodes to the guest
RHBZ #552539
A good reference for mapping keymaps to scancodes can be found in
spice-gtk/gtk/keymaps.csv
2012-02-29 Christophe Fergeau <cfergeau@redhat.com>
Fix compilation when smartcard support is disabled
The addition of smartcard control to the controller doesn't handle
the case when smartcard support is disabled at compile time. When
this is the case, this causes compile errors.
2012-02-28 Alon Levy <alevy@redhat.com>
controller_test: add README
client controller_test: reorder parameters since pid isn't needed for linux client test
client: handle CONTROLLER_ENABLE_SMARTCARD (rhbz 641828)
controller_test: add ENABLE_SMARTCARD
2012-02-26 Alon Levy <alevy@redhat.com>
server: fix segfault on client disconnect
..as a result of missing initialization of newly introduced
pre_disconnect in main channel.
2012-02-26 Fabiano Fidêncio <fabiano@fidencio.org>
Enabling cursor in server/tests
Now, cursor is being shown in all tests as a white rectangle and is
running in the screen doing a diagonal movement. It's a very simple
way to test cursor commands and is sufficient for our tests.
2012-02-21 Dan McGee <dpmcgee@gmail.com>
Use standard IOV_MAX definition where applicable
This is provided by <limits.h> on all platforms as long as _XOPEN_SOURCE
is defined. On Linux, this is 1024, on Solaris, this is 16, and on any
other platform, we now respect the value supported by the OS.
Respect IOV_MAX if defined
Solaris has a pitiful maximum writev vector size of only 16, so the ping
request at initial startup destroyed this call and broke things
immediately. Reimplement stream_writev_cb() to respect IOV_MAX and break
the writev() calls into chunks as necessary. Care was taken to return
the correct values as necessary so the EAGAIN handling logic can
determine where to resume the writev call the next time around.
red_worker: reimplement event loop using poll()
This removes the epoll dependency we had in red_worker, which was the
last Linux-specific call we were using in the entire Spice server. Given
we never have more than 10 file descriptors involved, there is little
performance gain had here by using epoll() over poll().
The biggest change is introduction of a new pre_disconnect callback;
this is because poll, unlike epoll, cannot automatically remove file
descriptors as they are closed from the pollfd set. This cannot be done
in the existing on_disconnect callback; that is too late as the stream
has already been closed and the file descriptor lost. The on_disconnect
callback can not be moved before the close and other operations easily
because of some behavior that relies on client_num being set to a
certain value.
Use memcpy call in red_channel_create
Rather than assign the callbacks one-by-one, we can just memcpy the
struct into the one we have allocated in our RedChannel object, which is
much more efficient, not to mention future-proof when more callbacks are
added.
Cleanup definitions of disconnect methods
We had multiple stub methods that simply called other disconnect
methods, making my head hurt with the indirection. Call the right
methods at the right time and rip out the stub methods; if they are
truely needed later they can be added again.
red_worker: rename epoll_timeout to event_timeout
With future patches in mind that will allow for some other
non-Linux-specific event polling sytem to be used, rename this to a more
generic name. All of the select/poll/epoll/kqueue family of calls are
related to evented I/O, so 'event_' makes sense in this case.
Add configure-time check for -Wl, --version-script option
This is supported by the GNU linker, but not the Solaris linker, which
is used as the default on that platform even when compiling with GCC.
Omit passing the option to the linker on platforms that do not support
it.
2012-02-20 Hans de Goede <hdegoede@redhat.com>
server/spicevmc: Don't destroy the rcc twice
spicevmc calls red_channel_client_destroy() on the rcc when it disconnects
since we don't want to delay the destroy until the session gets closed as
spicevmc channels can be opened, closed and opened again during a single
session.
This causes red_channel_client_destroy() to get called twice, triggering
an assert, when a connected channel gets destroyed.
This was fixed with commit ffc4de01e6f9ea0676f17b10e45a137d7e15d6ac for
the case where: a spicevmc channel was open on client disconnected, and
the main channel disconnect gets handled first.
But the channel can also be destroyed when the chardev gets unregistered
with the spice-server. This path still triggers the assert.
This patch fixes this by adding a destroying flag to the rcc struct, and
also moves the previous fix over to the same, more clean, method of
detecting this special case.
2012-02-15 Alon Levy <alevy@redhat.com>
server/tests/basic_event_loop: print something on channel_event
server, separate SpiceChannelEventInfo from RedStream
fixes rhbz 790749 use after free of SpiceChannelEventInfo.
The lifetime of the SpiceChannelEventInfo was that of RedsStream, but it
is used by main_dispatcher_handle_channel_event after the RedsStream is
freed for the cursor and display channels. Making SCEI allocation be at
RedsStream allocation, and deallocation after the DESTROY event is
processed by core->channel_event, fixes use after free.
README: make a note of SPICE_DEBUG_ALLOW_MC
2012-02-14 Dan McGee <dpmcgee@gmail.com>
Remove all usages of bzero()
As recommended by modern C practice, we should just be using memset().
Remove extra '\n' from red_printf() calls
red_printf() takes care of adding a newline to all messages; remove the
extra newline from all messages and macros that were doubling them up.
2012-02-14 Alon Levy <alevy@redhat.com>
server/tests: use getopt_long
2012-02-14 Fabiano Fidêncio <fabiano@fidencio.org>
Adding image to be used as "correct" in regression tests
Adding support to automated tests
As suggested by Alon, a simple automated test to try to find
regressions in Spice code.
To use this, compile Spice with --enable-automated-tests and
run test_display_streaming passing --automated-tests as parameter.
2012-02-14 Dan McGee <dpmcgee@gmail.com>
Add casts for compatibility purposes
Some non-Linux platforms return a (caddr_t *) result for the return
value of mmap(), which is very unfortunate. Add a (void *) cast to
explicitly avoid the warning when compiling with -Werror.
For the IO vector related stuff, signed vs. unsigned comes into play so
adding a (void *) cast here is technically correct for all platforms.
2012-02-12 Yonit Halperin <yhalperi@redhat.com>
server: support IPV6 addresses in channel events sent to qemu
RHBZ #788444
CC: Gerd Hoffmann <kraxel@redhat.com>
2012-02-09 Erlon Cruz <erlon.cruz@br.flextronics.com>
Fix mandatory -Werror option
Compilation was breaking due to warning errors even when configuring with
--enable-werror=no. This patch fix this.
2012-02-03 Christophe Fergeau <cfergeau@redhat.com>
Handle Application::set_hotkeys failure
Application::set_hotkeys can throw an exception if it fails parsing
the string describing the hotkeys to set. Currently this exception
is uncaught which causes spicec to terminate when the controller
tries to set invalid hotkeys. Fall back to using the default
hotkeys when the controller sends an invalid hotkeys string.
2012-01-31 Christophe Fergeau <cfergeau@redhat.com>
Don't use "hw:0,0" for recording with alsa
We currently hardcode this device when spicec needs to record with
alsa. However, this doesn't interact well with PulseAudio, which
means that if something is already using the recording device, spicec
won't be able to open it again.
Using "default" as the device will let spicec use the PulseAudio
alsa support and will avoid this issue.
2012-01-23 Hans de Goede <hdegoede@redhat.com>
More comparison between signed and unsigned integer expressions warning fixes
Turns out that more recent snapshots of gcc-4.7 emit even more of these,
so the fixes which I've done before tagging the 0.10.1 release are not
enough to build warning free with the latest gcc-4.7 snapshot <sigh>.
This fixes this.
Release 0.10.1
Fix various comparison between signed and unsigned integer expressions warnings
These turn into errors because of our -Werror use, breaking the build.
2012-01-23 Alon Levy <alevy@redhat.com>
server/red_channel: red_peer_handle_incoming: comment on null check
server/tests/test_empty_success: fix warning on bzero
2012-01-23 Dan McGee <dpmcgee@gmail.com>
Use found python binary to check for pyparsing
This matches what we do in client/Makefile.am to actually run the
python scripts, which is to use the python binary we find first,
preferring 'python2' over 'python'. This makes the compile work on odd
systems such as Arch Linux where the python binary is actually python3.
Remove epoll headers from client code
There is no more usage of epoll on the client side, so no need to
include these header files.
2012-01-23 Nahum Shalman <nshalman-github@elys.com>
server: don't complain if setsockopt(SO_PRIORITY) call fails
dc7855967f4e did this for the TCP_NODELAY and IP_TOS calls; we should do
it for priority as well if necessary.
We also #ifdef the setting of the low-level socket priority based on
whether we have a definition of SO_PRIORITY available. This option is
not available on Illumos/Solaris platforms; however, since we set IP_TOS
anyway it is not a big deal to omit it here.
2012-01-23 Dan McGee <dpmcgee@gmail.com>
server/inputs_channel: don't set O_ASYNC option on socket
output to send a SIGIO signal to the running program. However, we don't
handle this signal anywhere in the code, so setting the option is
unnecessary.
Update .gitignore with a few more generated files
Fix git commit hook errors in red_worker
This ensures all line lengths are down below 100 characters as well as
removing some trailing spaces.
Fix line length errors in main_channel
These are all existing errors; fix them so they don't block future
commits in this file unnecessarily.
error (1): length @ server/main_channel.c +369
error (2): length @ server/main_channel.c +444
error (3): length @ server/main_channel.c +764
error (4): length @ server/main_channel.c +932
error (5): length @ server/main_channel.c +1044
2012-01-22 Alon Levy <alevy@redhat.com>
docs/Spice_for_newbies.odt: some updates - added copy paste and wan mention, removed vdi_port
server/red_channel: avoid segfault if stream == NULL
client/foreign_menu: arm build fix
import existing odt docs
2012-01-18 Hans de Goede <hdegoede@redhat.com>
server: Don't complain if setsockopt NODELAY fails on unix sockets
With Daniel P. Berrange's patches to allow use of pre-supplied fd's
as channels, we can no longer be sure that our connections are TCP
sockets, so it makes no sense to complain if a TCP/IP specific
setsockopt fails with an errno of ENOTSUP.
Note that this extends Daniel's commit 492ddb5d1d595e2d12208f4602b18e4432f4e6b4
which already added the same check to server/inputs_channel.c
2012-01-13 Daniel P. Berrange <berrange@redhat.com>
Add a 'syntax-check' make target
The 'make syntax-check' target is used to perform various code
style sanity checks, as well as to detect certain trivial error
patterns. The target is placed in GNUmakefile, instead of Makefile.am
since it relies on GNU specific make extensions.
The actual GNUmakefile and maint.mk files are taken from the
GNULIB project, unchanged
The cfg.mk file is used to configure which of the syntax checks
are activated, to allow addition of new project specific syntax
checks, and to blacklist certain files which should not be checked
* .mailmap: Add mapping for various broken email addrs in
commit log, to stop complaints about AUTHORS file missing
entries
* GNUmakefile: define the 'syntax-check' rule
* maint.mk: definition of standard syntax checks
* cfg.mk: configuration for checks
Remove trailing whitespace from end of lines
Replace test XXX -a YYY with test XXX && test YYY
The '-a' and '-o' operators to test are not portable. Always
combine two invocations of 'test' using || or && instead.
Add missing includes of config.h
Not all files were including config.h
Remove bogus include of strings.h
The tests include strings.h but don't need any of its functions
Remove unused backup file
The common/glc.c.save file appears to be a obsolete copy of
glc.c
Remove trailing blank lines
Remove any blank lines at the end of all source files
Remove 'the the' typos
Remove unused assert.h include
The assert.h include was never used in any code
Always quote first arg to AC_DEFINE
The first arg to AC_DEFINE should always be quoted
Fix up copyright decl to always use 'Copyright (C) Red Hat, Inc.'
A couple of files were missing '(C)' in the copyright header
Improve usefulness of README file
The COPYING file already contains the license text, so the README
file need not repeat it. Instead put in a description of what
SPICE is, simple install instructions & pointers to mailing lists
and bug trackers
Fill out the AUTHORS file with some content
The AUTHORS file is empty, fill it in with a list of present and
past maintainers, and email addresses of all people who have
contributed patches
Remove casts from void * with xrealloc() calls
The xrealloc() function returns void*, so the return value
never needs to be cast
Rewrite code to avoid triggering warning about casting param to free()
Since free() takes a void* parameters do not need to be cast.
The existing code here is actally fine, but it trips up the
syntax-check rule, so tweak it to an equivalent construct
which passes the syntax check
Remove useless if() before free()
The free() function allows NULL to be passed in, so any
code which puts a if() before free() is wasting time
Death to all TABs
Source files should all use spaces instead of tabs for
indentation. Update the few files not already in
compliance
2012-01-13 Alon Levy <alevy@redhat.com>
common/ssl_verify: special case to WIN32 that isn't MINGW32
common/bitops: mingw32: reorder so __GNUC__ define is checked first
common/backtrace: for mingw32 no pipe/wait_pid, just disable
client/windows: fix several assigned but not used errors
client/windows: arraysize(inf.bmiColors) == 1 in mingw32
client/windows: fix typo, make error messages unique
client/windows/main: mingw32 provides PACKAGE_VERSION
client/common: mingw32: workaround HAVE_STDLIB_H redefined in jconfig.h
client: mingw32 build needs the jpeg_boolean define
client/common.h: mingw32 fix
define PACKAGE_VERSION only ifndef __GNUC__
Since it is defined by autoconf and so it kinda comes with using the GNU
compilers.
client/Makefile.am: mingw32 fixes
* build resource file with windres
* include client/windows and not client/x11
* use CXIMAGE_CFLAGS (it's already set to -DDISABLE_CXIMAGE correctly)
client: log command line (rhbz 767581)
2012-01-13 Hans de Goede <hdegoede@redhat.com>
client-x11: Fix building with gcc-4.7
Without this change gcc says:
x11/res.cpp:31:1: error: narrowing conversion of (((unsigned int)_alt_image.<anonymous struct>::width) * 4u) from unsigned int to int inside { } is ill-formed in C++11 [-Werror=narrowing]
x11/res.cpp:61:1: error: narrowing conversion of _red_icon.<anonymous struct>::width from const uint32_t {aka const unsigned int} to int inside { } is ill-formed in C++11 [-Werror=narrowing]
x11/res.cpp:61:1: error: narrowing conversion of _red_icon.<anonymous struct>::height from const uint32_t {aka const unsigned int} to int inside { } is ill-formed in C++11 [-Werror=narrowing]
cc1plus: all warnings being treated as errors
smartcard handling: Fix compilation when ASSERT-s are turned on
2012-01-12 Yonit Halperin <yhalperi@redhat.com>
server: add support for SPICE_COMMON_CAP_MINI_HEADER
Support for a header without a serial and without sub list.
red_channel: Support the two types of headers.
Keep a consistent consecutive messages serial.
red_worker: use urgent marshaller instead of sub list.
snd_worker: Sound channels need special support since they still don't use
red_channel for sending & receiving.
configure: spice-protocol >= 0.10.1 (mini header support)
server: Limit the access to SpiceDataHeader of messages - only via red_channel.
server/red_worker: pass remote caps to display/cursor red_channel_client's
server/red_channel: introduce urgent marshaller
When red_channel::red_channel_client_begin_send_message is called,
the message that is pending in the urgent marshaller will be sent before
the one in the main channel.
The urgent marshaller should be used if in the middle of marshalling one message,
you find out you need to send another message before. This functionality
is equivalent to the sub_list messages. It will replace them in the following
patches, when sub_list is removed from Spice data header.
spice.proto: add SPICE_MSG_LIST to base channel
2012-01-12 Hans de Goede <hdegoede@redhat.com>
codegen: Fix enums.h generation
With the new usbredir code we have the new concept of the abstract /
generic spicevmc channel type (which just tunnels data from a qemu chardev),
and we've the usbredir channel, which is the only current user of this.
This was reflected in the protocols enum in spice-protocol.h by a manual
edit done by me, my bad. This patch teaches spice.proto about the relation
between the abstract spicevmc channel and the usbredir channel and
modifies codegen to deal with this.
2012-01-09 Daniel P. Berrange <berrange@redhat.com>
Do not assume that SPICE is using a TCP socket
If setting the TCP_NODELAY socket option fails with ENOTSUP,
then don't treat this is a fatal error. SPICE is likely just
running over a UNIX socket instead.
* server/inputs_channel.c: Ignore TCP_NODELAY socket opt fails
Allow auth to be skipped when attaching to pre-accepted clients
When an applications passes in a pre-accepted socket for a
client, they may well have already performed suitable authentication
out of band. They should thus have the option to request that any
spice authentication is skipped.
* server/reds.c, spice.h: Add flag for skipping auth
Add APIs for injecting a client connection socket
Allow applications to pass a pre-accepted client socket file
descriptor in. The new APIs are spice_server_add_ssl_client
and spice_server_add_client
* server/reds.c: Implement new APIs
* server/spice.h: Define new APIs
Move SSL setup out of reds_accept_ssl_connection
To allow setup of an SSL client, from a passed in client
socket, move all the SSL client initialization code out
of reds_accept_ssl_connection and into a new method called
reds_init_client_ssl_connection
* server/reds.c: Introduce reds_init_client_ssl_connection
Rename __reds_accept_connection into reds_init_client_connection
Remove the accept() call from __reds_accept_connection and
rename it to reds_init_client_connection. The caller is now
responsible for accepting the new socket. The method
reds_init_client_connection merely initializes it for
usage.
* server/reds.c: Add reds_init_client_connection
Merge reds_accept_connection into reds_accept
Neither reds_accept_connection or reds_accept are very long,
so the split is pointless & increases code size for no gain.
Merge them together to reduce code size
* server/reds.c: Merge reds_accept_connection into reds_accept
2011-12-22 Hans de Goede <hdegoede@redhat.com>
spicevmc: Set sockopt nodelay for usbredir channels
We want as little latency as possible with usb channels.
2011-12-22 Yonit Halperin <yhalperi@redhat.com>
server: don't reset the display channel when disconnecting all its clients ,FDBZ #43977
The display channel was unnecessarily set to NULL when we disconnect all the clients
(on flush display commands timeout).
As a result, we recreated the display channel when a new client was connected.
The display channel was created with default red_channel.client_cbs, while its
correct client_cbs are the ones that are set by the red_dispatcher when it creates
the first display_channel.
This fix enforces a single creation of the display channel (per qxl), via the red_dispatcher.
2011-12-22 Uri Lublin <uril@redhat.com>
client: screen: fix typo _forec_update_timer
sed -i 's/_forec_update_timer/_force_update_timer/' screen.cpp screen.h
client: RedScreen::RedScreen: fix initialization order of _menu_needs_update
Related to a91b0b3ff712eb2a7d91a951f2af7842495357c3
2011-12-20 Uri Lublin <uril@redhat.com>
client: foreign-menu: pass "active" param when creating a ForeignMenu (#769020)
The default stays the same -- false.
A race could prevent setting ForeignMenu::_active correctly.
That happened when Application::on_app_activated was called before
_foriegn_menu was created. When foriegn_menu was created its
_active defaults to false, and that has not changed, until focus
was taken out and back in spice-client window.
This caused usbrdr to sometimes not auto-share devices, unless
the user switched focus to a different application and back to
spicec.
The fix updates ForiegnMenu::_active upon creation.
client: update menu if needed when exiting full-screen mode (#758260)
client: menu: make RedWindow::set_menu() return an error-code (#758260)
RedWindow::set_menu() can fail (on Windows when in fullscreen mode).
For Windows spice-client, when in fullscreen mode, the system-menu
is NULL.
Returns 0 upon success, non-0 (currently only -1) upon failure.
client controller/foreign_menu: use memmove instead of memcpy in readers
When src/dst memory areas may overlap, it's safer to use memmove.
2011-12-18 Hans de Goede <hdegoede@redhat.com>
spicevmc: Fix assert when still connected on session disconnect (fdo#43903)
Currently when the main channel disconnects while a spicevmc channel
(such as a usbredir channel) is still connected, qemu will abort with the
following message:
ring_remove: ASSERT item->next != NULL && item->prev != NULL failed
This is caused by red_client_destroy() first calling:
rcc->channel->client_cbs.disconnect(rcc);
And then calling:
red_channel_client_destroy(rcc);
For each channel. This is fine, but the spicevmc disconnect code does a
red_channel_client_destroy(rcc) itself since as usb devices are added
/ removed, the channels carrying their traffic get connected / disconnected
and they get re-used for new devices, which won't work if the old channel is
still there when the new connection comes in.
This patch fixes the double destroy when there are still spicevmc channels
connected by not doing the red_channel_client_destroy from the spicevmc
disconnect code when not just the channel, but the entire client is
disconnecting.
2011-12-15 Marc-André Lureau <marcandre.lureau@redhat.com>
build: remove unused variable
2011-12-15 Hans de Goede <hdegoede@redhat.com>
server/red_parse_qxl.h: License should be LGPLv2+ rather then GPLv2+
Also fixup the header of server/red_parse_qxl.c, which still contained
some GPL (program rather then library) text in its header.
2011-12-14 Marc-André Lureau <marcandre.lureau@redhat.com>
spelling: s/cupture/capture
2011-11-28 Jürg Billeter <j@bitron.ch>
server: Move $(Z_LIBS) from INCLUDES to LIBADD in Makefile.am
This fixes undefined references to deflate* when building tests.
2011-11-24 Gal Hammer <ghammer@redhat.com>
client: handle the redundant right ctrl windows' message send when a alt-gr is pressed bz#709074
Hello,
The second patch check to see if Windows is sending a fake VK_CONTROL
message when the user pressed Alt-Gr when using a non-US keyboard layout
(German, Czech, etc...).
If the function is_fake_ctrl return true and key event is translated to
a REDKEY_INVALID and the event is discarded.
Gal.
client: handle the redundant right ctrl windows' message send when a alt-gr is pressed bz#709074
Hello,
I first updated the translate_key function. It now requires the windows
message as parameter (will be used later). It also use the raw wparam
and lparam parameters in order to remove the code duplication when
calling the function.
Gal.
2011-11-14 Arnon Gilboa <agilboa@redhat.com>
client: add xinerama support
RHEL-6 Bugzilla: 695323
cherry-picked from qspice commit
003667ac99beeec9b330a07bc3569c59a96d4588
which fixes RHEL-5 541566
with merge of the one line qspice fix to SPICE_REQUIRES:
9f3fe4755f11044a45c4b21148466a997fcbf735
spice: fixed reference to xinerama pkg config file
(Xinerama.pc=>xinerama.pc)
Author: Yonit Halperin <yhalperi@redhat.com>
2011-11-10 Alon Levy <alevy@redhat.com>
Release 0.10.0
Update NEWS for 0.10.0 release
server/mjpeg_encoder: use size_t * consistently
fix another 64 bit-ism. unsigned long != size_t in general.
server/main_channel: fix pointer-to-int-cast error
64 bit-ism removed.
server/main_channel: use PRIu64 where needed
2011-11-08 Alon Levy <alevy@redhat.com>
server/spice-server.syms: fix 0.8 compatibility
spice_server_migrate_connect is in 0.8.3 in the released 0.8 branch,
and so should not be changed in 0.10. This doesn't break the 0.9.1
release which didn't contain this symbol at all, only 0.9.2 release
that hopefully no one actually packaged.
server/red_worker: reuse dispatcher
This patch reuses Dispatcher in RedDispatcher. It adds two helpers
to red_worker to keep RedWorker opaque to the outside. The dispatcher is
abused in three places that use the underlying socket directly:
once sending a READY after red_init completes
once for each channel creation, replying with the RedChannel instance
for cursor and display.
FDO Bugzilla: 42463
rfc->v1:
* move callbacks to red_worker.c including registration (Yonit)
* rename dispatcher to red_dispatcher in red_worker.c and red_dispatcher.c
* add accessor red_dispatcher_get_dispatcher
* s/dispatcher_handle_recv/dispatcher_handle_recv_read/ and change sig to
just Dispatcher *dispatcher (was the SpiceCoreInterface one)
* remove SpiceCoreInterface parameter from dispatcher_init (Yonit)
* main_dispatcher needed it for channel_event so it has it in
struct MainDispatcher
* add dispatcher_get_recv_fd for red_worker
server/dispatcher: add dispatcher_register_async_done_callback
introduce DISPATCHER_{NONE,ACK,ASYNC}
server: introduce dispatcher
used for main_dispatcher only in this patch.
Dispatcher is meant to be used for Main<->any low frequency messages.
It's interface is meant to include the red_dispatcher usage:
fixed size messages per message type
some messages require an ack
Some methods are added to be used by RedDispatcher later:
dispatcher_handle_read - to be called directly by RedDispatcher epoll
based loop
dispatcher_set_opaque - to be set from red_worker pthread
dispatcher_init - allow NULL core as used by red_worker
Read and Write behavior:
Sender: blocking write, blocking read for ack (if any).
Reader: poll for any data, if such then blocking read for a
message_type and following message. repeat until poll returns
with no pending data to read.
FDO Bugzilla: 42463
2011-11-07 Alon Levy <alevy@redhat.com>
server/red_dispatcher: remove semicolon from DBG_ASYNC
server: add prefix argument to red_printf_debug
printed before function name. No central location for prefixes.
Adding "WORKER", "ASYNC", "MAIN" since those were the current users.
server/red_dispatcher: support concurrent asyncs
This is part of the dispatcher update, extracting the dispatcher routine
from red_dispatcher and main_dispatcher into dispatcher.
Supporting multiple async operations will make it natural to support
async monitor commands and async guest io requests that could overlap in
time.
Use a Ring for AsyncCommands.
Free Desktop Bugzilla: 42463
Related FD: 41622
common/spice_common.h: red_printf_debug: fix wrong sign
2011-11-02 Yonit Halperin <yhalperi@redhat.com>
Release 0.9.2
client: support semi-seamless migration between spice servers with different protocols.
It can't actually happen right now, since switch-host migration scheme will take
place if the src/target server has protocol 1.
(cherry picked from commit 4b2bf4d88c253502003aa5e4b93a045742eec9b4 branch 0.8)
client: display channel - destroy all surfaces on disconnect
Fix not destroying surfaces and other data (e.g., streams) upon disconnection.
(cherry picked from commit 010b22cd771b7e81363b4b6521e4265b093fcd25 branch 0.8)
client: display channel migration (cherry picked from commit cad3c585444f940f60c12789f4174f2d32bec70f branch 0.8)
Conflicts:
client/display_channel.cpp
client: playback/record channels: implement on_disconnect (cherry picked from commit d3ed9d5e9d52ddcadcb3c8c77dd827b50071d813 branch 0.8)
client: main channel migration: do partial cleanup when switching hosts
Implement on_disconnect_mig_src and on_connect_mig_target in order to avoid
unnecessary cleanups done in on_(disconnet|connect).
In addition, do not request guest display settings changes after migration.
(cherry picked from commit f91d202eb3bf631cf5e70277d1aabffec7da9393 branch 0.8)
client: handle SPICE_MSG_MAIN_MIGRATE_END
(1) disconnect all channels from the migration src
(2) after all channels are disconnected, clean global resources
(3) send SPICE_MSGC_MAIN_MIGRATE_END to migration target
(4) wait for SPICE_MSG_MAIN_INIT
(4) switch all channels to migration target
(cherry picked from commit 510a4ff7c4f188fe6d0fb12198b8f9fdb74b9a2d branch 0.8)
Conflicts:
client/red_channel.h
client: handle SpiceMsgMainMigrationBegin (semi-seamless migration)
RHBZ 725009, 738270
(cherry picked from commit 31ed2519a752b7332ed40d0d7ab02e938c0e65cb branch 0.8)
Conflicts:
client/red_client.cpp
client: rewrite surfaces cache
use std::map instead of a specific template (CHash).
There is no need for special template. Moreover, using
std::map will allow easy iteration over the surfaces.
(cherry picked from commit fcb3b4ce5231218bcf949da4270bd85a2cfb3535 branch 0.8)
Conflicts:
client/display_channel.cpp
server: turn spice_server_migrate_start into a valid call
We will add a qemu call to spice_server_migrate_start when migration starts.
For now, it does nothing, but we may need this notification in the future.
(cherry picked from commit b8213167717979e6f2fb52646e43eb458634e6a1 branch 0.8)
server: handling semi-seamless migration in the target side
(1) not sending anything to a migrated client till we recieve SPICE_MSGC_MIGRATE_END
(2) start a new client migration (handle client_migrate_info) only after SPICE_MSGC_MIGRATE_END
from the previous migration was received for this client
(3) use the correct ticket
Note: we assume the same channles are linked before and ater migration. i.e.,
SPICE_MSGC_MAIN_ATTACH_CHANNELS is not sent from the clients.
server: move the linking of channels to a separate routine
server: handle spice_server_migrate_end
If the migration has completed successfully:
(1) send MSG_MAIN_MIGRATE_END to the clients that are connected to the target
(2) send MSG_MAIN_SWITCH_HOST to all the other clients
If the migration failed, send MSG_MAIN_MIGRATE_CANCEL to clients that are
connected to the target.
(cherry picked from commit 4b82580fc36228af13db4ac3c403753d6b5c40b5 branch 0.8;
Was modified to support multiple clients, and the separation of main_channel from reds)
Conflicts:
server/reds.c
spice.proto: add SPICE_MSG_MAIN_MIGRATE_END & SPICE_MSGC_MAIN_MIGRATE_END
(cherry picked from commit cfbd07710562e522179ae5a7085a789489a821bb branch 0.8)
server,proto: tell the clients to connect to the migration target before migraton starts
(1) send SPICE_MSG_MAIN_MIGRATE_BEGIN upon spice_server_migrate_connect
(to all the clients that support it)
(2) wait for SPICE_MSGC_MAIN_MIGRATE_(CONNECTED|CONNECT_ERROR) from all the relevant clients,
or a timeout, in order to complete client_migrate_info monitor command
(cherry picked from commit 5560c56ef05c74da5e0e0825dc1f134019593cad branch 0.8;
Was modified to support the separation of main channel from reds, and multiple clients)
Conflicts:
server/reds.c
configure: spice-protocol >= 0.9.1 (semi-seamless migration protocol) (cherry picked from commit 55ccc022ec9829523ebe36fdf0ec7c593ce76c22 branch 0.8)
Conflicts:
configure.ac
server: handle migration interface addition
(cherry picked from commit 3ac0075cdac8fa42de47a7882022795e96cb1fee branch 0.8)
Conflicts:
server/reds.h
server/spice.h: semi-seamless migration interface, RHBZ #738266
semi-seamless migration details:
migration source side
---------------------
(1) spice_server_migrate_connect (*): tell client to link
to the target side - send SPICE_MSG_MAIN_MIGRATE_BEGIN.
This should be called upon client_migrate_info cmd.
client_migrate_info is asynchronous.
(2) Complete spice_server_migrate_connect only when the client has been connected
to the target - wait for SPICE_MSGC_MAIN_MIGRATE_(CONNECTED|CONNECT_ERROR) or a timeout.
(3) spice_server_migrate_end: tell client migration it can switch to the target - send
SPICE_MSG_MAIN_MIGRATE_END.
(4) client cleans up all data related to the connection to the source and switches to the target.
It sends SPICE_MSGC_MAIN_MIGRATE_END.
migration target side
---------------------
(1) the server identifies itself as a migraiton target since the client is linked with (connection_id != 0)
(2) server doesn't start the channels' logic (channel->link) till it receives SPICE_MSGC_MAIN_MIGRATE_END
from the client.
* After migration starts, the target qemu is blocked and cannot accept new spice client
connections. Thus, we trigger the connection to the target upon client_migrate_info
command.
(cherry picked from commit 6e56bea67c5648b0c81990171d4bc0cf1a402043 branch 0.8)
Conflicts:
server/spice.h
server: set & test channel capabilities in red_channel
The code for setting and testing channel capabilities was
unnecessarily duplicated. Now it is in red_channel.
RedsChannel was dropped from Reds; It was used only for holding
the channels common capabilities, which are now held in RedChannel.
2011-10-31 Alon Levy <alevy@redhat.com>
[0.8 branch] server: add main_dispatcher
add main_dispatcher, a message passing mechanism for sending messages to
the main thread. The main thread is the thread that implements
SpiceCoreInterface, which is assumed to be a single thread.
Similar to the async operation of red_worker, a socket pair is created
and used to pass messages. The messages are a fixed size to ease
parsing. A single message is defined to pass a channel_event.
RHBZ: 746950
FDBZ: 41858
This patch is 0.8 branch only, for the master branch there should be a
better approach to share code with red_dispatcher and ready the way for
later adding more threads.
cherry-pick from 0.8 80caf07e09efe14c67f89a3c01501a6a39681167
Conflicts:
server/reds.c
2011-10-23 Liang Guo <bluestonechina@gmail.com>
spice-server.pc.in: move Requires to Requires.private
When using pkg-config, Requires and Requires.private field list
packages required by this package, but packages listed under
Requires.private are not taken into account when a flag list is
computed for dynamically linked executable. In the situation
where each .pc file corresponds to a library, Requires.private
shall be used exclusively to specify the dependencies between
the libraries.
2011-10-18 Yonit Halperin <yhalperi@redhat.com>
server/red_worker: fix placing of ASSERT(red_channel_client_no_item_being_sent) (fdbz #41523)
Call ASSERT(red_channel_client_no_item_being_sent) only if
red_wait_outgoing_item/s did not timeout.
2011-10-05 Christophe Fergeau <cfergeau@redhat.com>
client/x11: reset screen positions in XMonitor::do_restore
XMonitor::do_restore (called for example when going out of
fullscreen) restore the screen resolution to its previous state,
but it doesn't take care of repositioning the screen to their
previous position, which is one of the advantages of using randr
1.2.
Since MultyMonScreen::restore handles all of this for us, just call
it to restore the monitor position/resolutions to their previous
settings. Before doing any changes, MultyMonScreen::restore checks
if there's something to do, so calling it once per monitor won't be
an issue, the resolution/position will only be set the first time.
This has the side-effect of fixing bug #693431. This bug occurs when
closing the client after the client went in and out of fullscreen.
MultyMonScreen::~MultyMonScreen calls MultyMonScreen::restore, which
decides to change the screen positions since they were lost when going
to fullscreen because XMonitor::restore didn't restore the positions.
After this change, the positions will be properly restored and
MultyMonScreen::restore won't be needlessly called upon client
shutdown.
client/x11: fix mode setting in MultyMonScreen::restore
MultyMonScreen::restore changes the X11 Screen resolution, but it
doesn't use MultyMonScreen::set_size. This means
MultyMonScreen::_width and MultyMonScreen::_height don't get
updated to reflect the new resolution settings, which could cause
issues later on. Until now this was safe since the only caller of
MultyMonScreen::restore was MultyMonScreen destructor.
client/x11: fix typos (finde => find)
2011-09-20 Christophe Fergeau <cfergeau@redhat.com>
client: fix typo commnad=>command
2011-09-19 Christophe Fergeau <cfergeau@redhat.com>
client: don't crash when booting a Xinerama setup
In a Xinerama setup, when X starts up and creates one of the
secondary screens, first a non-primary surface is created on the
secondary screen, and then the primary surface for this screen is
created.
This causes a crash when the guest uses Xinerama and the client
is attached to the VM before X starts (ie while the guest is
booting).
This happens because DisplayChannel::create_canvas (which is called
when creating a non-primary surface) assumes a screen has already been
set for the DisplayChannel while this only happens upon primary surface
creation. However, it uses the screen for non important stuff, so we
can test if screen() is non NULL before using it. This is what is done
in other parts of this file.
Fixes rhbz #732423
replace warning with comment in glz_usr_free_image
When running some xinerama tests, I got several
glz_usr_free_image: error
messages. Looking at the code, this error is reported when this
function is called from a different DisplayChannelClient than the
one which created the glz compressed image.
When this happens, the backtrace is
at glz_encoder_dictionary.c:362
0x7fff940b6670) at glz_encoder_dictionary.c:449
image_type=LZ_IMAGE_TYPE_RGB32, image_width=512, image_height=256, image_stride=2048, first_lines=0x0,
num_first_lines=0, usr_image_context=0x7fff7420da40, image_head_dist=0x7fff9b2a3194)
at glz_encoder_dictionary.c:570
top_down=4, lines=0x0, num_lines=0, stride=2048, io_ptr=0x7fff740ea7c0 " ZL", num_io_bytes=65536, usr_context=
0x7fff7420da40, o_enc_dict_context=0x7fff7420da60) at glz_encoder.c:255
drawable=0x7fff9b46bc08, o_comp_data=0x7fff9b2a3350) at red_worker.c:5753
0x7fff9b46bc08, can_lossy=0, o_comp_data=0x7fff9b2a3350) at red_worker.c:6211
0x7fff9b46bc08, can_lossy=0) at red_worker.c:6344
0x7fff74085c50, dpi=0x7fff7445b890, src_allowed_lossy=0) at red_worker.c:7046
0x7fff7445b890) at red_worker.c:7720
at red_worker.c:7964
at red_worker.c:8431
Since the glz dictionary is shared between all the
DisplayChannelClient instances that belong to the same client, it can
happen that the glz dictionary code decides to free an image from one
thread while it was added from another thread (thread ==
DisplayChannelClient), so the error message that is printed is not an
actual error. This commit removes this message and adds a comment
explaining what's going on.
2011-09-15 Christophe Fergeau <cfergeau@redhat.com>
fix typos
applicaion => application
Attache => Attach
Detache => Detach
_layes => _layers
2011-09-05 Christophe Fergeau <cfergeau@redhat.com>
server: fix function prototypes
Several functions in server/ were not specifying an argument list,
ie they were declared as void foo(); When compiling with
-Wstrict-prototypes, this leads to:
test_playback.c:93:5: erreur: function declaration isnt a prototype
[-Werror=strict-prototypes]
2011-09-01 Marc-André Lureau <marcandre.lureau@redhat.com>
fix bug #692833
2011-09-01 Christophe Fergeau <cfergeau@redhat.com>
add C++ guards to backtrace.h
Without these, spice_backtrace() can't be used from the C++ client
code.
server: init all fields on SpiceMsgDisplayStreamCreate
red_display_marshall_stream_start initializes a
SpiceMsgDisplayStreamCreate structure before marshalling it and
sending it on the wire. However, it never fills
SpiceMsgDisplayStreamCreate::stamp which then causes a complaint
from valgrind. This patch sets this value to 0, it's not used
by the client so the value shouldn't matter.
fix valgrind warning in test_display__stream
create_test_primary_surface::test_display_base.c creates a
QXLDevSurfaceCreate structure and initialize it, but doesn't set
the position field. Moreover, this structure has 4 bytes of padding
to the end (as shown by pahole from dwarves), so initialize the whole
structure to 0 before using it.
2011-08-25 Hans de Goede <hdegoede@redhat.com>
Fixup NEWS entry for multiclient
Release 0.9.1
fix more inverted memset parameters
2011-08-25 Christophe Fergeau <cfergeau@redhat.com>
fix leak in do_jpeg_encode
Issue found by the Coverity scanner.
HDG: Fixup don't free RGB24_line if it was not allocated by do_jpeg_encode
fix memory leak in error path
Issue found by the Coverity scanner
fix inverted memset parameters
Issue found by the Coverity scanner.
2011-08-25 Hans de Goede <hdegoede@redhat.com>
Rename usbredir channel code to spicevmc
While discussing various things with Alon in Vancouver, it came up that
having a channel which simply passes through data coming out of a qemu
chardev frontend unmodified, like the usbredir channel does, can be used
for a lot of other cases too. To facilitate this the usbredir channel code
will be turned into a generic spicevmc channel, which is just a passthrough
to the client, from the spicevmc chardev.
This patch renames usbredir.c to spicevmc.c and changes the prefix of all
functions / structs to match. This should make clear that the code is not
usbredir specific.
Some examples of why having a generic spicevmc pass through is good:
1) We could add a monitor channel, allowing access to the qemu monitor from
the spice client, since the monitor is a chardev frontend we could re-use
the generic spicevmc channel server code, so all that is needed to add this
(server side) would be reserving a new channel id for this.
2) We could allow users to come up with new channels of their own, without
requiring qemu or server modification. The idea is to allow doing something
like this on the qemu startup cmdline:
-chardev spicevmc,name=generic,channelid=128
To ensure these new "generic" channels cannot conflict with newly added
official types, they must start at the SPICE_CHANNEL_USER_DEFINED_START value
(128).
These new user defined channels could then either be used with a special
modified client, with client plugins (if we add support for those), or
by exporting them on the client side for use by an external ap, see below.
3) We could also add support to the client to make user-defined channels
end in a unix socket / pipe, allowing handling of the data by an external app,
we could for example have a new spice client cmdline argument like this:
--custom-channel unixsocket=/tmp/mysocket,channelid=128
This would allow for something like:
$random app on guest -> virtio-serial -> spicevmc chardev ->
-> spicevmc channel -> unix socket -> $random app on client
4) On hind sight this could also have been used for the smartcard stuff,
with a 1 channel / reader model, rather then the current multiplexing code
where we've our own multiplexing protocol wrapper over the libcacard
smartcard protocol.
usbredir: Merge UsbRedirState and UsbRedirChannel
Now that the Channel struct is gone and the RedChannel has the same lifetime
as the chardev interface there is no need to have these 2 separate.
usbredir: Fix crash caused by MC changes
usbredir: Ensure that our msg_rcv_buf is not used re-entrantly
red_channel: Fix msg buf memleak on parser error
2011-08-25 Yonit Halperin <yhalperi@redhat.com>
client: setting monitors resolution before resizing screens, RHBZ #728252
fix for "client: fix endless recursion in rearrange_monitors, RHBZ #692976"
2011-08-23 Alon Levy <alevy@redhat.com>
server: add tester and todo for multiple client support
server/snd_worker.c: add reference counting to SndChannel
Fixes a valgrind discovered possible bug in spice-server - valgrind on
test_playback saw it, didn't see it happen with qemu.
The problem is that the frames buffers returned by spice_server_playback_get_buffer
are part of the malloc'ed SndChannel, whose lifetime is smaller then that of SndWorker.
As a result a pointer to a previously returned spice_server_playback_get_buffer could
remain and be used after SndChannel has been freed because the client disconnected.
server/reds: reds_client_disconnect: remove wrong check for reds_main_channel_connected
The "channel->disconnecting" parameter already protects against recursion.
Removed fixed TODOs.
server/reds: fix reds_main_channel_connected
instead of checking just for reds->main_channel check that there is at least
one client as well.
server: add public spice_server_get_num_clients
server/snd_worker.c: add red_channel_client_destroy_dummy
server/red_channel: release channel allocated message buffer
handler->cb->release_msg_buf was not being called except in the error path,
causing a memory leak.
server/main_channel: reduce verbose agent data command
by using the new SPICE_DEBUG_LEVEL.
2011-08-23 Yonit Halperin <yhalperi@redhat.com>
drawables count for debug
server: registering RedChannel in reds, instead of Channel
Merging the functionality of reds::channel, into RedChannel.
In addition, cleanup and fix disconnection code: before this patch,
red_dispatcher_disconnect_display_client
could have been called from the red_worker thread
(and it must be called only from the io thread).
RedChannel holds only connected channel clients. RedClient holds all the
channel clients that were created till it is destroyed
(and then it destroys them as well).
Note: snd_channel still doesn't use red_channel, however it
creates dummy channel and channel clients, in order to register itself
in reds.
server/red_channel.c: a channel is connected if it holds at least one channel client
Previously I changed RedChannel to hold only connected channel clients and
RedClient, to hold all the channel clients as long as it is not destroyed.
usbredir: multichannel has not been tested, it just compiles.
server/red_channel.c inroducing client_cbs
client_cbs are supposed to be called from client context (reds). This patch will be used
in future patches for relacing reds::Channel with RedChannel in order to eliminate redundancy.
server/red_channel.c: pack all channel callbacks to ChannelCbs
2011-08-23 Alon Levy <alevy@redhat.com>
server/red_worker: add ref counting to RedDrawable
introduces ref_red_drawable and put_red_drawable (rename from free_red_drawable)
RedDrawable is already references by Drawable and RedGlzDrawable, with
a hack to NULL the drawable field in RedGlzDrawable to indicate RedGlzDrawable
is the last reference holder. Using an explicit reference count instead.
server/red_worker: add stream_count (for debug purposes)
server/red_worker: validate_surface: print paniced surface_id
server/red_worker: no panic on double destroy primary
server/red_worker: DEBUG_CURSORS
Add cursor allocation debugging code that is turned off as long as
DEBUG_CURSORS is not defined.
server/red_worker: on_new_display_channel_client: push ack, cleanup
small cleanup patch, only functional change is sending a set ack message.
server/red_worker: add cursor_channel_client_disconnect
makes RED_WORKER_MESSAGE_CURSOR_DISCONNECT_CLIENT disconnect only a
single client.
server/red_worker: remove forced disconnect on connect
2011-08-23 Yonit Halperin <yhalperi@redhat.com>
server/red_worker.c: fix CursorPipeItem leak
CursorPipeItems and their corresponding cursor_item were not
freed when they were removed from the pipe without sending them.
In addition cursor_channel_hold_pipe_item used wrong conversion
to (CursorItem*) for a (CursorPipeItem*).
2011-08-23 Alon Levy <alevy@redhat.com>
server/red_worker: split cursor pipe item from cursor item
Required to support multiple clients.
Also changes somewhat the way we produce PIPE_ITEM_TYPE_LOCAL_CURSOR. Btw,
I haven't managed to see when we actually produce such an item during my
tests.
Previously we had a single pipe item per CursorItem, this is impossible
with two pipes, which happens when we have two clients.
server/red_worker: whitespace fixes
server/reds: add RedsState.allow_multiple_clients
Currently set by environment variable SPICE_DEBUG_ALLOW_MC (any value means
to allow multiple connections). Later will be set by spice api from qemu.
server/red_channel: introduce client ring in RedChannel
Also adds Drawable pipes and glz rings.
main_channel and red_worker had several locations that still accessed rcc
directly, so they had to be touched too, but the changes are minimal.
Most changes are in red_channel: drop the single client reference in RedChannel
and add a ring of channels.
Things missing / not done right in red_worker:
* StreamAgents are in DCC - right/wrong?
* GlzDict is multiplied - multiple compressions.
We still are missing:
* remove the disconnect calls on new connections
server/red_channel: add pipe_size helpers
server/red_worker: remove more direct access to RedChannelClient.rcc
2011-08-23 Yonit Halperin <yhalperi@redhat.com>
server/red_worker.c: make dictionary and cache different per client
There is no inter-client shared dictionary and cache yet.
At this point the display channel can be used by multiple clients.
You can still crash on lack of Drawables or CursorItems due to the slower
clients pipe growing uncontrollably.
2011-08-23 Alon Levy <alevy@redhat.com>
server/red_worker: multiple client support - base split
This patch compiles but breaks spice.
Split both display and cursor channels to a client part and channel part.
Introduce DisplayChannelClient, CursorChannelClient, CommonChannelClient.
don't disconnect channel on client disconnect.
Move all caches to the ChannelClient's.
Remove reference counting of the channel.
No new functionality introduced.
NOTE: Introduces a crash in disconnections, a regression, resulting from
incorrect thread access, that is fixed in the patch titled:
"server: registering RedChannel in reds, instead of Channel"
server/red_worker: cleanup
server/smartcard: support multiple clients
each client supplying a smartcard channel gets it's own smartcard. If
there are not enough smartcards provided by the server (read: qemu)
then it will be as though there are none.
currently disabled - later patches that enable smartcard don't make
this channel available to any but the first client.
server/red_tunnel_worker: trivial multi client support
s/TunnelChannel/TunnelChannelClient/
That's about it. this is probably the wrong way to do it. Not tested
at all. What do we want, a separate interface per client? same interface
for all clients? probably the later. This doesn't do that. Not tested,
so probably doesn't even work.
changes red_channel_pipe_item_is_linked to red_channel_client_pipe_item_is_linked,
since tunnel channel is the only user, must be done in patch to not break compilation.
server/inputs_channel: support multiple clients
from server events are broadcast - leds change. The rest is client
to server, so it is just passed on.
server/main_channel: support multiple clients
The main channel deals with connecting new clients, announcing mouse mode
changes, and the agent channel. The implementation is currently done without
any changes to the protocol, so everything has to be either broadcast or
to a specific client.
channels list - specific client
mouse mode - broadcast
agent - broadcast
notify - broadcast (should have two modes, and use the appropriate)
Notable TODOs:
* migration testing
* agent tokens are wrongly sent (or did I fix that? check)
server/red_channel: introduce pipes functions
Introduce functions to add (via producer method) the same item to multiple
pipes, all for the same channel.
Note: Right now there is only a single channel, but the next patches will do the
per-channel breakdown to channel and channel_client before actually introducing
a ring in RedChannel, this makes it easier to make smaller changes - the
channel->rcc link will exist until removed in the ring introducing patch.
server/red_channel: ignore error if already shutdown
on red_channel_peer_on_incoming_error, if we are already shutdown, do not
call the channel's error handler. Since the channel has been shutdown, we
assume this is a second or later error, and handling has already occured.
server/main_channel: move connection_id from reds
Expose additional api to find a client given a connection_id. The connection_id
is first set when the first channel connects, which is the main channel.
It could also be kept in the RedClient instead, not sure.
TODO:
multiple todo's added for multiclient handling. I don't remember why
I wrote them exactly, and besides if I did any migration tests. So: TODO.
server/main_channel: move ping here from reds.
cleanup only. Note that the ping function is half used since the opt parameter
stopped being called with anything but NULL, should be returned at some point,
specifically when we drop the 250kbyte ping on start and do a continuous check
for latency and bandwidth.
See:
81945d897 - server: add new vd interface QTerm2Interface, Yaniv Kamay
introducing the usage of ping with a non NULL opt
3f7ea8e7a - zap qterm interfaces, Gerd Hoffman
removing it
server/main_channel: move latency and bitrate to channel client
They were globals before. This introduces api for other channels
to query the low bandwidth status. The queries themselves are still done
from the wrong context (channel and not channel client) but that's because
the decoupling of channel and channel client will be done in the following
patches.
Note that snd_worker.c got two copied function declarations that belong to
main_channel.h but can't be easily dragged into snd_worker.c since it still
uses it's own RedChannel struct.
server/reds: add concept of secondary channels
Secondary channels are those that don't support multiple clients. The
support added in this patch just doesn't let the second or more connected
client receive the unsupported channels in the channels list sent by the
server to the client. This doesn't handle the situation where:
client A connects (gets all channels)
client B connects (gets supported multiple client channels)
client A disconnects (Suboptimal 1: B doesn't get new channels at this point)
client C connects (Suboptimal 2: C doesn't get the full list of channels, but
the partial one)
Specifically the channels that only support a single client are:
sound (both playback and record channels)
smartcard
tunnel
server: Add RedClient
That means RedClient tracks a ring of channels. Right now there will be only
a single client because of the disconnection mechanism - whenever a new
client comes we disconnect all existing clients. But this patch adds already
a ring of clients to reds.c (stored in RedServer).
There is a known problem handling many connections and disconnections at the
same time, trigerrable easily by the following script:
export NEW_DISPLAY=:3.0
Xephyr $NEW_DISPLAY -noreset &
for ((i = 0 ; i < 5; ++i)); do
for ((j = 0 ; j < 10; ++j)); do
DISPLAY=$NEW_DISPLAY c_win7x86_qxl_tests &
done
sleep 2;
done
I fixed a few of the problems resulting from this in the same patch. This
required already introducing a few other changes:
* make sure all removal of channels happens in the main thread, for that
two additional dispatcher calls are added to remove a specific channel
client (RED_WORKER_MESSAGE_CURSOR_DISCONNECT_CLIENT and
RED_WORKER_MESSAGE_DISPLAY_DISCONNECT_CLIENT).
* change some asserts in input channel.
* make main channel disconnect not recursive
* introduce disconnect call back to red_channel_create_parser
The remaining abort is from a double free in the main channel, still can't
find it (doesn't happen when running under valgrind - probably due to the
slowness resulting from that), but is easy to see when running under gdb.
server/main_channel+reds: make main_channel_init return MainChannelClient
This makes it easier to introduce RedClient in the next patch.
server/red_worker: release PIPE_ITEM_TYPE_VERB in display channel
We send a SPICE_MSG_DISPLAY_MARK verb.
server/red_client: clear pipe on disconnect
server/red_channel: workaround for fast client disconnect bug (TODO - real fix)
server/main_channel: use MainChannel in sig
use MainChannel* instead of Channel* for a many functions in main_channel.h
(affects main_channel.c and reds.c).
some one liner fixes are hidden in here too.
server: move pipe from RedChannel to RedChannelClient
Another cleanup patch, no change to behavior (still one client, and it
disconnects previous client if any).
The implementation for multiple client is straightforward: the pipe
remains per (channel,client) pair, so it needs to move from the RedChannel
that to RedChannelClient. Implementation using a single pipe with multiple
consumers (to reflect different latencies) doesn't fit well with pipe rewriting
that is used by the display channel. Additionally this approach is much simpler
to verify. Lastly it doesn't add considerable overhead (but see the display
channel changes in a later patch for a real place to rethink).
This patch is just technical, changing signatures to reflect the first
argument (oop style) so red_channel becomes red_channel_client. Some places
may seem odd but they should be fixed with later comits where the channels
grow to support multiple clients.
Sound (playback/record) channels are the only ones not touched - this is
consistent with previous patches, since they have been left out of the
RedChannel refactoring. That is left as future work. (note that they don't use
a pipe, which was the reason for not refactoring).
server/red_worker: introduce {display,cursor}_is_connected
Instead of checking for worker->{display,cursor}_channel directly.
server/red_channel (all): introduce RedChannelClient
This commit adds a RedChannelClient that now owns the stream connection,
but still doesn't own the pipe. There is only a single RCC per RC
right now (and RC still means RedChannel, RedClient will be introduced
later). All internal api changes are in server/red_channel.h, hence
the need to update all channels. red_worker.c is affected the most because
it makes use of direct access to some of RedChannel still.
API changes:
1. red_channel_client_create added.
rec_channel_create -> (red_channel_create, red_channel_client_create)
2. two way connection: rcc->channel, channel->rcc (later channel will
hold a list, and there will be a RedClient to hold the list of channels
per client)
3. seperation of channel disconnect and channel_client_disconnect
TODO:
usbredir added untested.
server/red_worker: drop red_pipe_add_tail, use red_channel_pipe_add_tail
The only difference between them being that the later also does a push.
I don't believe that to be a problem, but if it does I can always introduce
a push'less version.
server/red_channel: renames to use _proc postfix consistently
rename types - we use _proc suffix mostly to indicate function pointer types,
use it for some function pointers that were missing it.
s/channel_handle_migrate_flush_mark/channel_handle_migrate_flush_mark_proc/
s/channel_handle_migrate_data_get_serial/channel_handle_migrate_data_get_serial_proc/
s/channel_handle_migrate_data/channel_handle_migrate_data_proc/
spice.proto: add comment for origin of STYLED and START_WITH_GAP
server/red_worker: explicitly include unistd and errno
common: introduce red_printf_debug
server/tests/test_playback: correctly use spice_server_playback_get_buffer
and spice_server_playback_put_samples. The former retrieves a buffer from a free
list with spice_server_playback_get_buffer, and should be used once via
spice_server_playback_put_samples. The tester previously reused the same buffer
a number of times.
server/tests/basic_event_loop: multiple fixes
reuse common/ring.h
ignore SIGPIPE
fix handling of removed watches
tests/migrate.py: add --vdagent
Adds the required options to provide a vdagent to the guest in both source and target qemu
instances.
This will be the last update of the in spice git tests directory, I've moved those tests
to the repository spice-tests. The longer term goal remains autotest integration, but since
this test (and some minor others for qemu) need a home it is:
http://cgit.freedesktop.org/~alon/spice-tests/
(I'm reluctant to put it under spice/ because of my wish to go to autotest, but still, there
they are. Nothing as permanent as the temporary).
Independent (of external modules, i.e. qemu) tests (server/tests) should remain in tree.
2011-08-23 Yonit Halperin <yhalperi@redhat.com>
server/red_worker.c: fix - locking the wrong mutex when releasing glz dict
2011-08-23 Alon Levy <alevy@redhat.com>
server/tests/test_display_base: fix compile
common/ring: RING_FOREACH_SAFE: use shorter version from qemu
server/reds.h: explicitly include config.h
server/tests/migrate.py: make executable
2011-08-17 Christophe Fergeau <cfergeau@redhat.com>
use Xkb to get keyboard modifier mask
To be able to enable/disable keyboard leds on X11, we need to query
the X server for which mask correspond to which led (NumLock,
CapsLock). So far this was done using XKeysymToKeycode and iterating
over X modifier mapping.
Xkb provides XkbKeysymToModifiers for this purpose, and since
we're using Xkb anyway, it makes more sense to use it.
At some point, on my Fedora 15 box, XKeysymToKeycode was returning
NoSymbol for CapsLock and NumLock leading to spicec not being able
to change the keyboard leds when qemu tells it to. However, I couldn't
reproduce this when I tried again :-/
fix harmless typo in InputsChannel::handle_modifiers
InputsChannel::handle_modifiers converts _modifiers which is a
bitflag of SPICE_KEYBOARD_MODIFIER_FLAGS_* to a Platform::*_MODIFIER
bitflag, which is what Platform::set_keyboard_lock_modifiers expects.
However, it's called with _modifiers, and the bitflag that this
function computes is never used. Pass the computed bitflag to
::set_keyboard_lock_modifiers since _modifiers format is meaningless
for ::set_keyboard_lock_modifiers.
This bug was harmless because the two different set of modifier
flags actually use the same values, so _modifiers and modifiers could
be used interchangeably. However it's more future-proof to use the
right format here.
2011-08-15 Christophe Fergeau <cfergeau@redhat.com>
fix 2 X11 related leaks
channel: fix EVP_PKEY leak
always set VDAgentDisplayConfig::depth
Even if VDAgentDisplayConfig::depth will be unused if the
VD_AGENT_DISPLAY_CONFIG_FLAG_SET_COLOR_DEPTH isn't set, it's
better to initialize it anyway to avoid warnings from valgrind.
2011-08-10 Hans de Goede <hdegoede@redhat.com>
server: Add a usbredir channel
2011-08-03 Alon Levy <alevy@redhat.com>
client/red_client: fix broken switch host migration (RHBZ 727969)
3f8d7e59dbd94b1837503f37b5065698df3ffbc7 introduced a regression, after
sending one attach_channels message we never send another one.
Fix by resetting on disconnect.
2011-08-02 Christophe Fergeau <cfergeau@redhat.com>
mjpeg: add missing SPICE_BITMAP_FMT_RGBA
I forgot to handle SPICE_BITMAP_FMT_RGBA when mapping from
spice image formats to libjpeg-turbo colorspaces.
2011-08-02 Liang Guo <bluestonechina@gmail.com>
Fix typo: treshold -> threshold
Fix typo: seperator -> separator
2011-08-01 Christophe Fergeau <cfergeau@redhat.com>
mjpeg: fix libjpeg assertion
After the changes to add libjpeg-turbo support to spice-server mjpeg
compression code, it's relatively easy to hit an assertion from
libjpeg in spice-server about "too few scanlines transferred" when
the mjpeg streaming code triggers. This assertion brings down qemu,
which is bad :)
This is because when we first initialize the mjpeg encoder, we do:
stream_width = SPICE_ALIGN(src_rect->right - src_rect->left, 2);
stream_height = SPICE_ALIGN(src_rect->bottom - src_rect->top, 2);
stream->mjpeg_encoder = mjpeg_encoder_new(stream_width, stream_height);
and then when we iterate over the image scanlines to feed them to
libjpeg, we do:
const int image_height = src->bottom - src->top;
const int image_width = src->right - src->left;
for (i = 0; i < image_height; i++) {
mjpeg_encoder_encode_scanline(...);
}
mjpeg_encoder_end_frame(...);
When stream_height is odd, the mjpeg_encoder will be created with
an height that is 1 more than the number of lines we encode. Then
libjpeg asserts when we tell it we're done with the compression
while it's still waiting for one more scanline.
Looking through git history, this rounding seems to be an artifact
from when we were using ffmpeg for the mjpeg encoding. Since
spicec and spicy (the latter needs a few fixes) can handle streams
with odd height/width, the best way to solve this issue is to stop
rounding up the height and width of the streams we create. This
even saves some bandwidth :)
2011-07-31 Alon Levy <alevy@redhat.com>
server/red_dispatcher: fix wrong resolution set for tablet
when changing resolutions due to the new async code paths the surface
creation command was kept by reference, and later, when the red_worker
signaled completion by calling async_complete the mouse mode was updated
using the reference. This caused the wrong values to be read resulting in wrong
resolutions set and a non working mouse pointer. Fix this by keeping a copy of
the surface creation command instead of a reference.
No bz. Found in testing.
2011-07-31 Christophe Fergeau <cfergeau@redhat.com>
client: fix 30s timeout regression
Changelog from Arnon Gilboa, patch from me:
Commit eb6f55409412 caused the following regression:
When client runs without the auto-conf or disable-effects options
(either from CLI or controller), which is the case when using Spice
from Admin Portal, the client will unecessarily wait for 30sec before
connecting to a Windows guest with an agent running (this won't happen
with linux guests or without an agent running).
The mentioned patch assumed that on_agent_reply() of
VD_AGENT_DISPLAY_CONFIG will call send_main_attach_channels() and
connect. However, when auto-conf or disable-effects are not used,
on_agent_reply() will ignore the reply and not call
send_main_attach_channels(). Therefore, send_main_attach_channels()
will only be called on agent timeout.
The solution is to activate agent timer only if auto-conf or
disable-effects. Otherwise, simply call send_main_attach_channels().
Fixes rhbz #726441
2011-07-31 Alon Levy <alevy@redhat.com>
common/backtrace.h: disable for WIN32
This also catches mingw32 which is probably fine, but at least it fixes
the build on visual studio.
2011-07-28 Christophe Fergeau <cfergeau@redhat.com>
fix integer marshalling helpers on big endian
They were trying to convert the destination pointer to an integer before
trying to dereference it. The initial conversion was meant to be a cast
to a pointer of the right size, not to an integer.
fix typo in big endian code path
uint63_t should be uint64_t
2011-07-26 Hans de Goede <hdegoede@redhat.com>
Bump version in server/spice,h to 0.9.1
It is a bit early to bump, since a 0.9.1 release is not happening yet,
but this allows me to test if the vdagent SpiceCharInterface state callback
fixes are present or not in qemu code, and thus disabling the ugly vdagent
specific workaround from spice-qemu-char.c when compiling against a new
enough spice-server.
2011-07-25 Hans de Goede <hdegoede@redhat.com>
server: Don't call vdagent chardev state callback on client (dis)connect
See this long mail for the rationale for this:
http://lists.freedesktop.org/archives/spice-devel/2011-July/004837.html
2011-07-23 Alon Levy <alevy@redhat.com>
Release 0.9.0
2011-07-22 Alon Levy <alevy@redhat.com>
server/smartcard: fix smartcard_channel_send_error
It was sending the wrong data, the memory right after the VCSMsgHeader
which was actually not where the data was.
Fixed by having the header and data (VSCError, 4 bytes of the error code)
embedded in the ErrorItem pipe item.
2011-07-22 Christophe Fergeau <cfergeau@redhat.com>
mjpeg: rename jpeg_mem_dest
jpeg_mem_dest is a public symbol in libjpeg8 so using it with
no prefix will cause symbol clashes. Rename it to spice_jpeg_mem_dest.
mjpeg_encoder: allocate "row" on demand
It's not used when we use jpeg-turbo colorspaces, so it's better
to allocate it when we know we'll need it rather than always
allocating it even if it won't be used.
mjpeg_encoder: remove unused functions
After the refactoring to optionally use libjpeg-turbo, some
of the functions that mjpeg-encoder used to provide are now no
longer used. This commit removes them.
mjpeg_encoder: use libjpeg-turbo extra colorspaces
When libjpeg-turbo is available, we can use the BGR and BGRX
colorspaces that it provides to avoid extra conversions of the
data we want to compress to mjpeg
red_worker: use new mjpeg_encoder_encode_scanline API
The main point is to move the pixel conversion code into
the MjpegEncoder class to be able to make use libjpeg-turbo
additional pixel formats without the reds_worker code noticing.
mjpeg_encoder: add mjpeg_encoder_get_bytes_per_pixel
Returns the number of bytes per pixel corresponding to the input
data format.
mjpeg_encoder: add mjpeg_encoder_encode_scanline
This API is meant to allow us to move the pixel format conversion
into MjpegEncoder. This will allow us to be able to use the
additional pixel formats from libjpeg-turbo when available.
red_worker: simplify red_rgb_to_24bpp prototype
It takes a lot of arguments, "id" is unused, "frame" and
"frame_size" can be obtained from the "stream" argument, so
can get rid of 3 arguments to make things more readable.
mjpeg_encoder: rework output buffer allocation
When encoding a frame, red_worker passes an allocated buffer to
libjpeg where it should encode the frame. When it fails, a new
bigger buffer is allocated and the encoding is restarted from
scratch. However, it's possible to use libjpeg to realloc this
buffer if it gets too small during the encoding process. Make use
of this feature, especially since it will make it easier to encore
one line at a time instead of a full frame in subsequent commits.
red_worker: factor pixel conversion code
When encoding to mjpeg, the on screen data have to be converted
to 24bpp RGB since that's the format that libjpeg expects. Factor
as much code as possible for the 3 formats we handle.
set version number to 0.9.0
fix make distcheck
configure.ac: fix pyparsing check
2>&1 was typo'ed 2&>1 which caused an empty '1' file to be created
when running this test.
add SASL and smartcard to distcheck flags
client: don't die if initial agent timeout triggers
When the client connects to a spice VM, if an agent is detected,
there will be a few messages exchanged to exchange capabilities,
display resolutions, ... This exchange has a timeout in case
something goes wrong. However, when it fires, the client dies.
This commit changes this and lets the client connects to the
guest when the timeout happens.
rhbz #673973
client: only send one SPICE_MSGC_MAIN_ATTACH_CHANNELS messages
492f7a9b fixed unwanted timeouts during initial client startup,
but it also caused a bad regression when connecting to
RHEL6+agent guests: the SPICE_MSGS_MAIN_ATTACH_CHANNELS message
was sent multiple times, once in RedClient::handle_init, then
once again in RedClient::on_agent_announce_capabilities (which
can even be triggered multiple times). Sending this message multiple
times is a big NO and causes the server to close the client connection,
and the client to die. Add a _msg_attach_message_sent boolean to
make sure we only send this message once.
rhbz #712938
client: split overlong option descriptions
2011-07-21 Hans de Goede <hdegoede@redhat.com>
server: make sure we clear vdagent and update mouse mode on agent disconnect
The check this patch removes causes us to not set vdagent to NULL, nor
update the mouse mode when the guest agent disconnects when no client is
attached. Which leads to a non working mouse, and on agent reconnect a
"spice_server_char_device_add_interface: vdagent already attached" message
instead of a successful re-add of the agent interface .
hansg: Note this is commit 443994ba from the 0.8 branch, which I did
not forward port back then because it seemed unnecessary on master, but it
turns out that the (wrong) check was just hidden in another place on master.
2011-07-21 Yonit Halperin <yhalperi@redhat.com>
client: fix endless recursion in rearrange_monitors, RHBZ #692976
The endless recursion happens due to Application::prepare_monitors calling RedScreen::resize
calling Application::rearrange_monitors calling Application::prepare_monitors
I changed RedScreen::resize not to call rearrange_monitors. Instead,
the monitor should be configured correctly from Application, before
calling resize.
In addition, I made some cleanups to allow reusing rearrange_monitors code.
2011-07-21 Hans de Goede <hdegoede@redhat.com>
spicec: Make loglevel configurable through the environment
Having a loglevel variable is much more useful if we can actually change
its value without a recompile. Use a SPICEC_LOG_LEVEL environment variable so
we can do this from the spice xpi / activex too (by setting the environment
variable before starting the browser).
2011-07-20 Yonit Halperin <yhalperi@redhat.com>
server/red_worker: send surface images to client on-demand after S3/4 wakeup
When surfaces are being reloaded to the worker, we
will send them to the client only if and when it needs them.
2011-07-20 Alon Levy <alevy@redhat.com>
server/spice.h: bump QXL_MINOR because of QXLWorker and QXLInterface changes
server: add QXLWorker.flush_surfaces_async for S3/S4 support
This does the following, all to remove any referenced memory on the pci bars:
flush_all_qxl_commands(worker);
flush_all_surfaces(worker);
red_wait_outgoing_item((RedChannel *)worker->display_channel);
red_wait_outgoing_item((RedChannel *)worker->cursor_channel);
The added api is specifically async, i.e. it calls async_complete
when done.
server: add QXLInterface::update_area_complete callback
when update_area_async is called update_area_complete will be called with
the surfaces dirty rectangle list.
server/red_worker: handle_dev_input: reuse write_ready introduced for async
server: add async io support
The new _ASYNC io's in qxl_dev listed at the end get six new api
functions, and an additional callback function "async_complete". When
the async version of a specific io is used, completion is notified by
calling async_complete, and no READY message is written or expected by
the dispatcher.
update_area has been changed to push QXLRects to the worker thread, where
the conversion to SpiceRect takes place.
A cookie has been added to each async call to QXLWorker, and is passed back via
async_complete.
Added api:
QXLWorker:
update_area_async
add_memslot_async
destroy_surfaces_async
destroy_primary_surface_async
create_primary_surface_async
destroy_surface_wait_async
QXLInterface:
async_complete
bump required spice-protocol to 0.8.1 for qxl_dev async and s3 updates
server: api: add spice_qxl_* calls based on QXLWorker contents
For each callback in QXLWorker, for example QXLWorker::update_area, add
a direct call named spice_qxl_update_area.
This will (a) remove the pointless indirection and (b) make shared
library versioning alot easier as we'll get new linker symbols which
we can tag with the version they appeared in the shared library.
server: spice-server.syms: move sasl symbols to 0.8.2
server/red_worker: remove print on handle_dev_destroy_surfaces
server/red_worker: *_release_item: less frequent debug messages
server/tests: test_util.h: fix double ASSERT definition
2011-07-19 Alon Levy <alevy@redhat.com>
common: add backtrace via gstack or glibc backtrace
Add a backtrace printing function copied from xserver os/backtrace.c
that uses gstack, and if that isn't found then glibc's backtrace.
Used in ASSERT, tested on F15.
2011-07-19 Gerd Hoffmann <kraxel@redhat.com>
server: add symbol versioning to the spice server shared library.
This patch adds symbol versions to the spice server library. Each
symbol which is exported by libspice-server gets tagged with the
(stable) version where it appeared first. This way the linker and rpm
are able to figure which version of the spice-server libary is required
by a particular qemu binary/package.
2011-07-19 Christophe Fergeau <cfergeau@redhat.com>
remove unused function
client: add missing "," in option list
In commit 44073d1b38e2 - client: improve WAN option description
one "," was missing at the end of the line. Since the next argument
was a string too, gcc silently concatenated them, and thanks to C++
polymorphic functions, the compiler didn't complain about the
missing argument, so it went unnoticed.
The effects are pretty bad though, since it prevents spicec from
running because it thinks command line parsing fails.
2011-07-18 Christophe Fergeau <cfergeau@redhat.com>
Fix spice-server/qemu channel version checks
When qemu creates a channel, reds.c contains code to check the
minor/major channel versions known to QEMU (ie the ones that were
current in spice-server when QEMU was compiled) and to compare these
versions against the current ones the currently installed spice-server
version.
According to kraxel [1], the rules for these interface numbers are:
"The purpose of the versions is exactly to avoid the need for a new
soname. The rules are basically:
(1) You add stuff to the interface, strictly append-only to not break
binary compatibility.
(2) You bump the minor version of the interface.
(3) You check the minor version at runtime to figure whenever the
added fields contain valid stuff or not.
An example is here (core interface, minor goes from 2 to 3, new
channel_event callback):
http://cgit.freedesktop.org/spice/spice/commit/?id=97f33fa86aa6edd25111b173dc0d9599ac29f879
"
The code currently refuses to create a channel if QEMU minor version is
less than the current spice-server version. This does not correspond
to the intended behaviour, this patch changes to fail is qemu was compiled
with a spice-server that is *newer* than the one currently installed. This
case is something we cannot support nicely.
[1] http://lists.freedesktop.org/archives/spice-devel/2011-July/004440.html
2011-07-18 Uri Lublin <uril@redhat.com>
client: rename connect_unsecure to connect_to_peer
Both connect_secure() and connect_unsecure() call connect_to_peer().
Prior to this commit spicec.log reported all connections as unsecure,
as connect_secure() called connect_unsecure() to make the connection.
This fixes RH bug #653545
2011-07-18 Christophe Fergeau <cfergeau@redhat.com>
client: don't crash when agent is missing WAN support
If you try to connect to a linux guest with WAN options, SPICE window opens up
and is blank - it then fails with vdagent timeout message. It should give a
warning that this is only applicable for windows guest and still connect to
guest.
It all starts in RedClient::handle_init
This function checks whether we have an agent or not, because if we have an
agent, there will be some kind of handshake to check both sides capabilities
before all the spice channels are created.
When there is no agent running, the startup process goes on with
SPICE_MSGC_MAIN_ATTACH_CHANNELS
When there is a windows agent running, VD_AGENT_ANNOUNCE_CAPABILITIES and
VD_AGENT_DISPLAY_CONFIG messages are sent to the agent, and when processing the
agent answer to the VD_AGENT_DISPLAY_CONFIG message,
SPICE_MSGC_MAIN_ATTACH_CHANNELS will be sent and the startup process will go
on.
However, when there is no agent running but --color-depth was used, handle_init
won't send the SPICE_MSGC_MAIN_ATTACH_CHANNELS message but will wait for the
agent handshake to proceed to its end, which won't happen, so it will timeout
waiting for agent answers.
Similarly, the linux agent handles VD_AGENT_ANNOUNCE_CAPABILITIES messages, but
it doesn't handle VD_AGENT_DISPLAY_CONFIG messages, so we'll never reach the
point where a SPICE_MSGC_MAIN_ATTACH_CHANNELS will be sent.
This commit fixes this in 2 places:
- unconditionnally send SPICE_MSGC_ATTACH_CHANNELS when no agent is running in
handle_init
- send SPICE_MSGC_MAIN_ATTACH_CHANNELS in
RedClient::on_agent_announce_capabilities if the agent doesn't have the
VD_AGENT_CAP_DISPLAY_CONFIG capability
This fixes RH bug #712938
client: improve WAN option description
The WAN options (--color-depth and --disable-effects) need
support from the guest agent to be working. Currently they are
only supported on Windows. While I don't want to explicitly
mention Windows in --help output, we can hint that it won't
work with all guests in --help. This fixes RH bug #712941
x11: don't return freed memory from get_clipboard
There is a double free in client/x11/platform.cpp.
In get_selection(), in the exit: case with ret_val == -1 and data != NULL,
*data_ret (which is returned to the caller) has already been
assigned "data", so it will be pointing to freed memory when "data" is
XFree'd'. Then in handle_selection_notify, get_selection_free is called on
this pointer, which causes a double free.
When the length of the read data = 0, set the returned value to NULL,
this way subsequent free attempts will be a noop.
Fixes RH bug #710461
client: match delete[] with new[]
vinfo in x11/platform.cpp is allocated using new[] so it needs to
be freed with delete[]
client: s/recive/receive
2011-07-12 Yonit Halperin <yhalperi@redhat.com>
server: add missing calls to red_handle_drawable_surfaces_client_synced
red_handle_drawable_surfaces_client_synced was called only from red_pipe_add_drawable, while it
should also be called from red_pipe_add_drawable_after. Otherwise, the client
might receive a command with a reference to a surface it doesn't hold and crash.
server: fix access to a released drawable. RHBZ #713474
red_pipe_add_drawable can lead to removal of drawables from current tree
(since it calls red_handle_drawable_surfaces_client_synced), which can
also lead to releasing these drawables.
Before the fix, red_current_add_equal, called red_pipe_add_drawable,
without assuring afterwards that the drawables it refers to are still alive or
still in the current tree.
2011-07-06 Alon Levy <alevy@redhat.com>
server: fix segfault if no migrate_info provided
qemu calls spice_server_migrate_switch even if it didn't do a
spice_server_migrate_info first. Fix the resulting error by not pushing
a switch host tag to the pipe in this case, and add a check anyway in the
marshalling code just in case.
2011-07-05 Yonit Halperin <yhalperi@redhat.com>
server: cursor_channel: releasing pipe items resources when the pipe is cleared (on disconnect)
same as commit 74a9d10af96f4d7c8c1b1d7fca124a8df9180787 for cursor channel
server: display_channel: releasing pipe items resources when the pipe is cleared (on disconnect)
fixes "display_channel_release_item: panic: invalid item type"
Before changing the red_worker to use the red_channel interface, there
was a devoted red_pipe_clear routine for the display channel and cursor channel.
However, clearing the pipe in red_channel, uses the release_item callback
the worker provided. This callback has handled only resources that need to be released
after the pipe item was enqueued from the pipe, and only for pipe items that were set in
red_channel_init_send_data.
This fix changes the display channel release_item callback to handle all types of
pipe items, and also handles differently pushed and non-pushed pipe items.
server: not reading command rings before RED_WORKER_MESSAGE_START, RHBZ #718713
On migration, destroy_surfaces is called from qxl (qxl_hard_reset), before the device was loaded (on destination).
handle_dev_destroy_surfaces led to red_process_commands, which read the qxl command ring
(which appeared to be not empty), and then when processing the command
it accessed unmapped memory.
server: replace redundant code with red_cursor_reset
In addition (1) make handle_dev_destroy_surfaces call red_release_cursor
(2) call red_wait_outgoing_item(cursor_channel) only after adding msgs to pipe
server: removing local cursor, this solves RHBZ #714801
When the worker was stoped, the cursor was copied from guest ram to the host ram,
and its corresponding qxl command was released.
This is unecessary, since the qxl ram still exists (we keep references
to the surfaces in the same manner).
It also led to BSOD on guest upon migration: the device tracks cursor set commands and it stores
a reference to the last one. Then, it replays it to the destination server when migrating to it.
However, the command the qxl replayed has already been released from the pci by the original
worker, upon STOP.
2011-07-05 Alon Levy <alevy@redhat.com>
tests/migrate: update to use argparse and run spicy by default
Most helpful change is that it prints help if you do --help.
It can take --image parameter, and --client parameter, defaults to spicy.
Incidentally, spicy switch host seems broken - if you run with --client spicec
(assuming spicec is in the PATH), it works fine, but using the default spicy (or
--client spicy) it fails after a single switch.
server/tests/basic_event_loop: strange assert failure; fix
server/smartcard: register channel only when hardware is available
2011-06-29 Alon Levy <alevy@redhat.com>
Revert "server/smartcard: don't register the channel if no hardware emulated"
This reverts commit 456ff9f8d5d27ac763e89e67a100661084695dc5.
That patch just disabled the smartcard channel completely because
the check was done *before* the initialization of the qemu smartcard
devices, not after.
2011-06-28 Christophe Fergeau <cfergeau@redhat.com>
red_worker: remove 2 empty functions
red_worker was using some share/unshare stream_buf functions whose
body is empty. This commit removes them and their use.
2011-06-23 Alon Levy <alevy@redhat.com>
server/smartcard: don't register the channel if no hardware emulated
server/smartcard: handle BaseChannel messages
According to spice.proto the smartcard channel can receive acks and any
other message defined in BaseChannel. While the spicec implementation didn't
send an ACK spice-gtk does, so handle it.
2011-06-22 Christophe Fergeau <cfergeau@redhat.com>
don't #include config.h in generated header files
7e30572ab adds a #include <config.h> to the beginning of generated
files. It also does this for generated headers and enums files,
which is not wanted, especially if it's an installed file. This
commit only adds this include for the non-header non-enum case
(hopefully, enums are only generated for use in a .h file).
s/__visible__/SPICE_GNUC_VISIBLE
The C specification reserves use of identifiers starting with __
to the compiler so we shouldn't use one such symbol.
add check for pyparsing
Check both in configure.ac (after checking if we need to rebuild
the marshalling files) and in the python script using pyparsing
(for people modifying .proto files in tarballs)
2011-06-22 Marc-André Lureau <marcandre.lureau@redhat.com>
sndworker: check the caps before sending volume messages
sndworker: add AudioVolume/AudioMute messages
These messages allow the guest to send the audio device volume to the
client. It uses an arbitrary scale of 16bits, which works good enough
for now.
Save VolumeState in {Playback,Record}State, so that we can send the
current volume on channel connection.
Note about future improvements:
- add exact dB support
- add client to guest volume change
Updated since v2:
- bumped record and playback interface minor version to allow
conditional compilation
Updated since v1:
- sync record volume on connection too
2011-06-21 Marc-André Lureau <marcandre.lureau@redhat.com>
python: remove c-ism trailing ;
codegen: typedef the protocol enums
Commit 9d5ef9beeca722b2ceff7d15aaa3aaaaf07ecfbf in spice-protocol
introduced a typedef manually in the generated enums.h header.
This patch adds them automatically to all enums during enums.h generation.
2011-06-14 Yonit Halperin <yhalperi@redhat.com>
client: fix for redundant shift+f11 RHBZ #674532
After shift+F11, both in Windows 7 and xp clients, WM_KEYUP events were missing for
SHIFT and F11. For F11 it was less important since unpress_all was preformed for all keys.
However, we perform sync for all the keyboard modifiers and the GetKeyboardState returns "down" for shift.
In windows7 client, we sometimes received afterwards a F11 KEYDOWN event repetition, and this caused SHIFT+F11 to be called again.
Not performing hiding of the windows while changing client resolutions, solved the problem of missing events, and I don't see any difference
in how spice looks while toggling to full screen.
Using GetAsyncKeyState, returns "UP" for shift in windows 7, and helps avoid performing shift+f11 again, if there is an F11 repetition
before we receive the KEYUP event for shift.
2011-05-30 Arnon Gilboa <agilboa@redhat.com>
client/windows: enable image randomization (ASLR) rhbz#701111
Enable image randomized base address, hindering some types of
security attacks by making it more difficult for an attacker
to predict target addresses.
client/windows: remove slash from x64 build dir
otherwise x64 is built in root if REDC_BUILD_DIR is not defined
2011-05-24 Alon Levy <alevy@redhat.com>
server/smartcard: fix use after free
2011-05-22 Arnon Gilboa <agilboa@redhat.com>
client/windows: remove precompiled header for common.h (fix broken windows debug build)
-Release currently doesn't use precompiled headers at all
-Debug is broken since common/*.c files don't include common.h
-PCH can be enabled for all but specifically-chosen c-files
common: add WIN64 ifdef for spice_bit_find_msb (fix broken windows x64 build)
inline __asm is not supported in x64, so use the naive implementation
until x64 asm implemented.
2011-05-19 Yonit Halperin <yhalperi@redhat.com>
client: fix flipped video in Linux guest on windows client, RHBZ #667689
Video streams from Linux guests are oriented top-down, where gdi_canvas_put_image always
received display context for down-top oriented bitmap. I fixed create_bitmap
to consider the stream orientation.
2011-05-12 Arnon Gilboa <agilboa@redhat.com>
common: use INLINE instead of inline
needed for spice/common files used by the client, server & qxl driver.
in windows _inline works for both c/c++, while inline is c++ only.
compiling the client with mixed c/c++ code required this define.
client/windows: undef SIZE_MAX in stdint.h
eliminating redefinition warning
common: fix ssl_verify windows build errors
client/windows: add common\ssl_verify.c/h to project
disable WarnAsError, due to c/c++ warnings
client/windows: inc version to 0,9,0,0
client/windows: init PACKAGE_VERSION
in windows, we set PACKAGE_VERSION to the binary version
since we don't have config.h as generated by linux configure
2011-05-12 Alon Levy <alevy@redhat.com>
client: fix return code when missing host
2011-05-09 Alon Levy <alevy@redhat.com>
server/red_worker: stat_now cleanup
static, remove inline, add (void), and empty line after function variables.
server/red_worker: fix typo (lats_send_time)
server/tests: show port to connect to
2011-05-08 Marc-André Lureau <marcandre.lureau@redhat.com>
server: bump SPICE_SERVER_VERSION to 0.9.0
SASL functions will be released with 0.9.0
2011-05-05 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
server: Unset executable bit of red_tunnel_worker.h
2011-05-03 Marc-André Lureau <marcandre.lureau@redhat.com>
build: fix gettimeofday warning
CC test_playback.o
test_playback.c: In function playback_timer_cb:
test_playback.c:56:5: warning: implicit declaration of function gettimeofday
client: make use of ssl_verify.c
Fixed since v1:
- don't include C code, rather use the common lib
- add missing spice_openssl_verify_free() call
- keep the extra-parsing of subject for error reporting
common: add ssl_verify.c common code
Code adapter from RedPeer::ssl_verify_callback() and used by
spice-gtk.
Since v1:
- fixed Makefile.am
- added config.h include
- autoconf alloca added in patch series
- moved int escape inside for loop
- added a failed case when missing assignment
- replaced strlen () by -1
- skip spaces after comma
- c++ guards
I didn't use bool, because openSSL uses int, and it is more future
proof for error reporting.
common: add ring_get_length() for debugging purposes
Please notice it has a "static" modifier, like the rest of the inlined
functions in ring.h, so it won't warn if it isn't used.
common: mem.h add alloca definition
We don't support the autoconf ALLOCA/C_ALLOC fallback. If one day,
someone cares for a weird platform, he can fix it.
common: spice_memdup could accept NULL
(this patch is not to solve a crash fix, but to align with glib API)
common: add windows.h where required, make gdi_handlers static
This patch has not been verified with VS/brew. It should be safe
hopefully. Compilation is fine with mingw32/spice-gtk.
build: require c99
Because we use c99: stdbool.h, inttypes.h, bool, variadic macros, // comments, ...
2011-05-03 Christophe Fergeau <cfergeau@redhat.com>
move get_time_stamp to main_channel.c
There is only one user of get_time_stamp from spice_common.h so
it's not really useful to keep it there.
use standard do { } while (0) for spice_common.h macros
move WARN and WARN_ONCE to spice_common.h
common: use PANIC from spice_common.h
common,server: use ASSERT from spice_common.h
spice_common.h provides an ASSERT macro, no need to duplicate it
in many places. For now client/debug.h keeps its own copy since
debug.h and spice_common.h have clashes on other macros which are
trickier to unify.
server: use gcc builtin for atomic get/set bit
client: remove unused mb() macro
common: don't duplicate find_msb implementation
remove void * arithmetic
With -Wpointer-arith, gcc complains about void pointer arithmetic.
This is not a big deal with gcc, but could be with other compilers,
so it's better to cast to char */uint8_t * before doing the
arithmetic on such pointers.
add missing static
configure.ac: remove setting default C(XX)FLAGS
automake/autoconf already set them for us to -g -O2 if there are
no flags defined.
win32: remove obsolete preprocessor #defines
SW_CANVAS_NO_CHUNKS isn't used anywhere but in this file.
SW_CANVAS_CACHE is now defined directly in the files where it's
needed so we no longer need it in the .vcproj file.
add comment to beginning of autogenerated files
s/USE_OGL/USE_OPENGL
This is more explicit about what it does, and not much longer
use AC_DEFINE instead of hardcoding preprocessor flags
Now that all source files include config.h, we can use AC_DEFINE
to enable/disable optional features (opengl, cegui). This is
cleaner than directly appending -Dxxx directives to the preprocessor
flags. This also guarantees that everything will be appropriately
rebuilt when using the same source tree to build first with opengl
support and then without (the config.h timestamp will change,
triggering a rebuild of the files including it)
add config.h to autogenerated files too
Modify the python (de)marshaller generator to add #include
<config.h> at the beginning of the C files it generates
add #include <config.h> to all source files
When using config.h, it must be the very first include in all source
files since it contains #define that may change the compilation process
(eg libc structure layout changes when it's used to enable large file
support on 32 bit x86 archs). This commit adds it at the beginning
of all .c and .cpp files
autotools: correctly build canvas-related code
spice client and spice server shares code from
common/{gdi,gl,sw}_canvas.[ch]. However, while most of the code is
shared, the server code wants a canvas compiled with
SW_CANVAS_IMAGE_CACHE defined while the client code wants a canvas
compiled with SW_CANVAS_CACHE.
The initial autotools refactoring didn't take that into account,
this is now fixed by this commit. After this commit, the canvas
files from common/ are no longer compiled as part of the
libspice-common.la convenience library. Instead, there are "proxy"
canvas source files in client/ and server/ which #include the
appropriate C files after defining the relevant #define for the
binary that is being built.
To prevent misuse of the canvas c files and headers in common/,
SPICE_CANVAS_INTERNAL must be set when including the canvas headers
from common/ or when building the c files from common/ otherwise
the build will error out.
configure.ac: remove unused AC_SUBST
autotools: refactor the whole build machinery
spice Makefile.am setup is a bit confusing, with source file
names being listed several times in different Makefile.am
(generally, once in EXTRA_DIST and another time in another
Makefile.am in _SOURCES). The client binaries are built
by client/x11/Makefile.am, which means recursing into client,
then into x11 to finally build spicec. This Makefile.am is
also referencing files from common/ and client/, which is
a bit unusual with autotools.
This patch attempts to simplify the build process to get
something more usual from an autotools point of view.
The source from common/ are compiled into a libtool convenience
library, which the server and the client links against which avoids
referencing source files from common/ when building the server and
the client. The client is built in client/Makefile.am and directly
builds files from x11/ windows/ and gui/ if needed (without
recursing in these subdirectories).
This makes the build simpler to understand, and also makes it
possible to list source files once, which avoids potential
make distcheck breakage when adding new files.
There is a regression in this patch with respect to
sw_canvas/gl_canvas/gdi_canvas. They should be built with
different preprocessor #defines resulting in different behaviour
of the canvas for the client and the server. However, this is not
currently the case, both the client and the server will use the same
code for now (which probably means one of them is broken). This will
be fixed in a subsequent commit.
make distcheck passes, but compilation on windows using the
autotools build system hasn't been tested, which means it's likely
to be broken. It shouldn't be too hard ot fix it though, just let
me know of any issues with this.
2011-05-02 Christophe Fergeau <cfergeau@redhat.com>
add missing "LGPLv2.1 or later" header to source files
common: don't try to redefine PANIC if it already exists
canvas_base.c tries to define PANIC, but it might already be set
if eg client/debug.h has been included before. All the other
macros in this file are guarded by #ifndef, this commit adds
the missing #ifndef to PANIC. Note that this is just a bandaid,
ideally common/ would contain a logging frameword, and these
macros would only be defined once instead of being defined in
several places.
server: s/desable/disable
This fixes a typo in some function names, there should be no
functional change.
use foo(void) instead of foo() in prototypes
In C, the latter isn't a prototype for a function with no arg,
but declares a function with an undefined number of args.
server: remove extra arg in reds_on_main_agent_start call
client: remove c++ wrappers
client/ contains several .cpp file which only #include a .c file
of the same name. This is unusual and seems to only be done to
get C++ name mangling on the symbols defined in the C file.
Now that all headers files in common/ use extern "C", these
wrappers are no longer useful.
common: add missing header guards to gl_canvas.h
common: add extern "C" guards to headers
Since some spice C++ code is using code from common/, the C
functions need to be marked as such for the C++ compiler, otherwise
we'll get linkage issues.
client: make building client optional
configure.ac: replace tab with spaces
This makes the "C++ Compiler: ...." status output nicely
aligned with the other messages.
configure.ac: remove unused dynamic linkage flag
configure.ac defines a SPICEC_STATIC_LINKAGE_BDYNAMIC variable
when --enable-static-linkage is not set, but it's never used.
SPICEC_STATIC_LINKAGE_BSTATIC is used in client/, but since we
are using libtool, it might be more appropriate to use
'make LDFLAGS="-all-static"' to achieve static link.
configure.ac: fix use of AC_ARG_ENABLE
Most uses of AC_ARG_ENABLE were buggy:
- when passing --disable-xxx, configure.ac would behave as if it
was passed --enable-xxx
- passing --enable-xxx=foo would "leak" into the summary, ie the
summary (at the end of configure) would say "xxx: foo" instead
of "xxx: yes"
This patch fixes these 2 issues.
configure.ac: fix make dist
server: use is_primary_surface
red_worker.c has an is_primary_surface helper function, but there
were some places in the file not using it. This patch fixes that
2011-04-26 Alon Levy <alevy@redhat.com>
spice.proto: Fill.rop_descriptor type s/uint16/ropd (10x atiti)
2011-04-18 Christophe Fergeau <cfergeau@redhat.com>
client: skip spaces in --host-subject
This fixes fdo bug #32896:
"Subject in certificates is stored in following format (values separated by
comma and space):
grep Subject: server-cert.pem | awk -F": " '{print $2}'
O=REDHAT, CN=10.34.58.2
While spicec expects that values in host subject are separated only by comma:
spicec --host-subject "O=REDHAT,CN=10.34.58.2"
"
In this case, ignoring spaces make it much easier to directly copy and paste
the subject line from certificates.
draw: remove SPICE_ADDRESS
This commit removes the typedef for SPICE_ADDRESS which was no
longer used. This is the last thing that was missing to close
fdo bug #28984
client: add --version cmdline option to spicec
This fixes freedesktop bug #33907
client: s/reqired/required in CmdLineParser
client: s/AVAILIBLE/AVAILABLE in CmdLineParser
It was mispelt in a CmdLineParser enum.
2011-04-08 Christophe Fergeau <cfergeau@gmail.com>
server/tests remove useless assignment
This was detected by clang-static-analyzer.
common/pixman: remove dead assignments
They were detected using clang-static-analyzer. Don't initialize
the variable to a value to override it with a different value
a few lines after.
tests: fix compilation with -Wall -Werror
When compiling spice with make CFLAGS="-g3 -ggdb3 -O0 -Wall -Werror",
the build broken because of a few unused variables/missing returns.
This patch fixes these warnings.
2011-04-08 Christophe Fergeau <cfergeau@redhat.com>
gl: remove unused variables
gcc 4.6 warned about these.
gl: use correct pixman accessor for image data
Commit 774e5bd36f4 changed
- dest->source.pixmap.x_image->data +
+ (uint8_t *)pixman_image_get_stride(dest->source.pixmap.pixman_image) +
The correct accessor to use is pixman_image_get_data. Thanks to gcc
4.6 for warning about a "different size" int to pointer conversion.
client: use silent generation rules in Makefile.am
The server Makefile.am rules for marshallers generation are
prefixed with AM_V_SILENT to integrate nicely with automake silent
rules. The same AM_V_SILENT prefix isn't used in client/Makefile.am
resulting in verbose output even when automake silent mode is
enabled. This commit removes this verbosity.
2011-04-04 Christophe Fergeau <cfergeau@gmail.com>
configure.ac: remove detection of WARN_UNUSED_RESULT
spice configure.ac has some code to detect if the compiler has
a special attribute to tag some functions so that they generate a
warning when their return value isn't checked. However, this test
is broken (the gcc attribute name is "warn_unused_result", not
"__warn_unused_result__" and WARN_UNUSED_RESULT is unused anyway
since spice-protocol provides SPICE_GNUC_WARN_UNUSED_RESULT. Thus
we can just drop that block of code from configure.ac
2011-04-04 Christophe Fergeau <cfergeau@redhat.com>
remove duplicated macro
MIN() is already defined in spice-protocol/spice/macros.h
2011-04-04 Hans de Goede <hdegoede@redhat.com>
server: make sure we clear vdagent and update mouse mode on agent disconnect
The check this patch removes causes us to not set vdagent to NULL, nor
update the mouse mode when the guest agent disconnects when no client is
attached. Which leads to a non working mouse, and on agent reconnect a
"spice_server_char_device_add_interface: vdagent already attached" message
instead of a successful re-add of the agent interface .
server: ignore SPICE_MSGC_MAIN_AGENT_START messages when there is no agent
This can happen for example when a SPICE_MSGC_MAIN_AGENT_START message
from the client and the vdagent disconnecting race.
server: hookup agent-msg-filter discard-all functionality
This ensures that if the client or agent connects to the client-agent
"tunnel" while the other side is halfway through sending a multi part
message, the rest of the message gets discarded, and the connecting
party starts getting data at the beginning of the next message.
server: add discard all option to agent message filter
server: filter all data from client
Filter all data from client, even when there is no agent connected
to keep filter state correct.
server: reset read/write filter on agent/client disconnect
The agent message filter keeps track of messages as they are being send
reset the relevant filter to its initial state when one of the 2 ends
of the agent<->client "tunnel" disconnects.
server: break read_from_vdi_port loop if the guest gets disconnected
read_from_vdi_port calls dispatch_vdi_port data, which will disconnect
the guest agent if it sends invalid data. It would then try to read more
data from the disconnected guest agent resulting in a NULL ptr dereference,
this patch fixes this.
server: Don't stop writing agent data to the guest when the client disconnects
write_to_vdi_port() was checking for reds->agent_state.connected to determine
wether it could write queued data. But agent_state.connected reflects if
*both* ends are connected. If the client has disconnected, but the guest agent
is still connected and some data is still pending (like a final clipboard
release from the client), then this data should be written to the guest agent.
server: Don't reset agent state when the client disconnects
We were calling reds_reset_vdp on client disconnect, which is not a good
idea. reds_reset_vdp does 3 things:
1) It resets the state related to reading chunks from the spicevmc virtio
port. If the client disconnects while the guest agent is in the middle
of sending a chunk, this will lead to an inconsistent state, and lots
of printing of "dispatch_vdi_port_data: invalid port" messages caused
by this inconsistent state sometimes followed by a segfault.
This can be triggered by copy and pasting something large (say
a screenshot) from the guest to the spice-gtk client, as the spice-gtk
client currently has a bug causing it to crash when receiving a multi
chunk vdagent messages. Without this patch (and with the spice-gtk bug
present) I can consistently reproduce this.
2) It clears any buffered writes from the client to the guest still pending
because the virtio port cannot consume data fast enough. Since the agent
itself is still running fine, throwing away writes for it because the
client has disconnected makes no sense. Esp, since on clean exit the
client may very well send a clipboard release message directly
before closing the connection, and this may get lost this way.
3) It sets client_agent_started to false, this is the only thing which
actually makes sense to do on client disconnect.
Note that since we no longer reset the vdp state on client disconnect, we
must now reset it on agent disconnect even if we don't have a client. So
the reds_reset_vdp call in reds_agent_remove() gets moved to the top,
above both the agent_state.connected and reds->peer checks which will
both fail in the no client case.
2011-03-24 Hans de Goede <hdegoede@redhat.com>
server: avoid unneeded recursion in dispatch_vdi_port_data
dispatch_vdi_port_data, was calling vdi_read_buf_release when no client
is connected to free the passed in buf. The only difference between
vdi_read_buf_release and directly adding the buffer back to the ring
with ring_add, is that vdi_read_buf_release calls read_from_vdi_port
after adding the buffer back. But dispatch_vdi_port_data only gets called
from read_from_vdi_port itself, thus this would lead to recursing into
read_from_vdi_port. read_from_vdi_port is protected against recursion and
will immediately return if called recursively. Thus calling
vdi_read_buf_release from dispatch_vdi_port_data is pointless, instead
simply putting the buffer back in the ring suffices.
server: Make copy paste support configurable
Also bump SPICE_SERVER_VERSION to 0x000801 as 0.8.1 will be the
first version with the new API for this, and we need to be able to
detect the presence of this API in qemu.
spice-server: Add the ability to filter agent messages
2011-03-23 Hans de Goede <hdegoede@redhat.com>
spicec-x11: Work around a bug in xsel
Although ICCCM 2.2. Responsibilities of the Selection Owner:
http://tronche.com/gui/x/icccm/sec-2.html#s-2.2
Clearly states (about selection notify events):
The owner should set the specified selection, target, time, and property
arguments to the values received in the SelectionRequest event.
xsel sets the selection notify event target member to the incr atom when it
is going to send the clipboard data incremental, rather then setting it to
the UTF8_STRING atom (which was the target of the SelectionRequest).
Work around this (esp as it is likely other programs may get this wrong too)
and accept the incr atom as a valid target in a selection notify event.
This fixes Alon's test with running:
python -c "print list(range(1000))" | xsel -i -b
on the client.
spicec-x11: Don't crash on apps sending bad atoms as TARGETS
Some apps (bad xsel, bad!) send invalid Atoms in their TARGETS property,
causing spicec to exit because of an XError. This patch makes spicec survive
this scenario.
For more info on the xsel bug, see:
https://bugzilla.redhat.com/show_bug.cgi?id=690214
2011-03-23 Christophe Fergeau <cfergeau@gmail.com>
common/gl: remove unused variable
clang static analyzer warned that 'len' was computed but never
used in glc_vertex2d. glc_stroke_line_dash has side effects so
we have to call it, but we don't need to save its return value
since it's not used.
opengl: fix compilation
When OpenGL is enabled, build fails in DisplayChannel::create_surface
because Canvas *canvas is declared twice. Remove the first
declaration to fix compilation.
2011-03-22 Alon Levy <alevy@redhat.com>
server/tests: add test_playback
configure.ac: fix message when missing SASL lib
server: use -std=c99
Finds some bugs.
python_modules/codegen.py: fix indent error in an unused function
client/smartcard: use proper include delemiters
2011-03-11 Hans de Goede <hdegoede@redhat.com>
client: Don't handle hotkeys while sticky alt is active
In some cases rhev-m changes the hotkey for releasing the mouse grab
to ctrl + alt. This makes it impossible to send ctrl + alt + other-key
to the guest, even when using sticky alt.
What happens is:
-press alt until sticky alt activates
-release alt (but recorded state stays pressed due to sticky alt)
-press ctrl
-hotkey code sees ctrl+alt pressed, releases mouse grab
-mouse grab release code does an unpress all -> end of sticky state.
This patch makes it possible to atleast send ctrl + alt + del (or other key)
using sticky alt. Note: even with this patch it is still a bad idea to
use ctrl + alt as hotkey combi.
2011-03-08 Alon Levy <alevy@redhat.com>
server/reds: allow call to reds_agent_remove even if it is gone
The current assert(reds->agent_state.connected) tiggers if when
the agent disconnected there was still data waiting to be sent (for
instance if there is a bug in the client handling clipboard and it
is killed while a large clipboard transfer is in progress). So first
call to reds_agent_remove happens from spice_server_char_device_remove_interface,
and then it is called again (triggering the assert) from free_item_data
from read_from_vdi_port because of the channel destruction.
Other option would be to not call it from one of the paths - but that
is suboptimal:
* if there is no data in the pipe, the second call never happens.
* the second call has to be there anyway, because it may fail during
parsing data from the agent.
This patch fixes a segfault on this assert when a client starts passing
from guest agent to client a large clipboard and dies in the middle. There
is still another assert happening occasionally at marshaller which I don't
have a fix for (but it doesn't seem to be related).
client/smartcard: handle the --smartcard-db option
2011-03-08 Arnon Gilboa <agilboa@redhat.com>
client/windows: cleanup vcproj based on updated libs
using updated windows libraries:
http://www.spice-space.org/download/stable/wspice-x86_08032011.zip
http://www.spice-space.org/download/stable/wspice-x64_08032011.zip
-remove IgnoreDefaultLibraryNames="MSVCRT.lib", since pixman is now compiled
using MT threading model similar to other libraries. It used to be mistakenly
compiled with MD.
-downgrade freetype lib to 2.3.11-7, which is the one used/tested with
CEGUI 0.6.2
-pthread lib patched (InterlockedCompareExchange), so x64 client will no
longer crash on SelectClipRgn, BitBlt etc.
2011-03-03 Marc-André Lureau <marcandre.lureau@redhat.com>
server/input: avoid double free() of RedChannel on disconnect
Current master is calling red_channel_destroy() on incoming error, but
reds Channels still references it, which causes a double free() later
on (see valgrind report below).
Instead, on error condition, do like the rest of the channels and call
reds_disconnect(), which remove the references and call shutdown(),
which then call red_channel_destroy() and finally free the channel
with red_channel_destroy().
Note: the previous code intention was certainly to be able to keep the
rest of the channels connected when input channel has errors. This is
not addressed by this patch.
red_channel_shutdown:
==29792== Invalid read of size 8
==29792== at 0x4C6F063: red_channel_shutdown (red_channel.c:460)
==29792== by 0x4C51EFA: inputs_shutdown (inputs_channel.c:463)
==29792== by 0x4C48445: reds_shatdown_channels (reds.c:539)
==29792== by 0x4C4868A: reds_disconnect (reds.c:603)
==29792== by 0x4C519E9: main_channel_on_error (main_channel.c:765)
==29792== by 0x4C6E80A: red_channel_peer_on_incoming_error (red_channel.c:215)
==29792== by 0x4C6E22D: red_peer_handle_incoming (red_channel.c:87)
==29792== by 0x4C6E551: red_channel_receive (red_channel.c:154)
==29792== by 0x4C6F329: red_channel_event (red_channel.c:531)
==29792== by 0x41CB8C: main_loop_wait (vl.c:1365)
==29792== by 0x437CDE: kvm_main_loop (qemu-kvm.c:1589)
==29792== by 0x41FE9A: main (vl.c:1411)
==29792== Address 0x30b0f6d0 is 0 bytes inside a block of size 28,648 free'd
==29792== at 0x4A05372: free (vg_replace_malloc.c:366)
==29792== by 0x4C6F032: red_channel_destroy (red_channel.c:454)
==29792== by 0x4C6E80A: red_channel_peer_on_incoming_error (red_channel.c:215)
==29792== by 0x4C6E22D: red_peer_handle_incoming (red_channel.c:87)
==29792== by 0x4C6E551: red_channel_receive (red_channel.c:154)
==29792== by 0x4C6F329: red_channel_event (red_channel.c:531)
==29792== by 0x41CB8C: main_loop_wait (vl.c:1365)
==29792== by 0x437CDE: kvm_main_loop (qemu-kvm.c:1589)
==29792== by 0x41FE9A: main (vl.c:1411)
https://bugs.freedesktop.org/show_bug.cgi?id=34971
Revert "server/red_channel: red_channel_event: push on blocked"
This reverts commit 5062433d8af45822371b6487a8d7baea23071d18.
red_channel_receive() can call red_channel_destroy() which frees
channel.
The condition bellow is then checked, which can access a freed
channel:
if (event & SPICE_WATCH_EVENT_WRITE || channel->send_data.blocked)
Reverting this commit solves the issue without any apparent
bugs/drawbacks, which kind of clears out the weird TODO.
handle_dev_input: cursor connect
==11826== Invalid read of size 4
==11826== at 0x4C6F83C: red_channel_event (red_channel.c:535)
==11826== by 0x41CB8C: main_loop_wait (vl.c:1365)
==11826== by 0x437CDE: kvm_main_loop (qemu-kvm.c:1589)
==11826== by 0x41FE9A: main (vl.c:1411)
==11826== Address 0x31fb00f0 is 96 bytes inside a block of size 28,648 free'd
==11826== at 0x4A05372: free (vg_replace_malloc.c:366)
==11826== by 0x4C6F536: red_channel_destroy (red_channel.c:453)
==11826== by 0x4C52B5D: inputs_channel_on_incoming_error (inputs_channel.c:449)
==11826== by 0x4C6ED0E: red_channel_peer_on_incoming_error (red_channel.c:215)
==11826== by 0x4C6E731: red_peer_handle_incoming (red_channel.c:87)
==11826== by 0x4C6EA55: red_channel_receive (red_channel.c:154)
==11826== by 0x4C6F82D: red_channel_event (red_channel.c:530)
==11826== by 0x41CB8C: main_loop_wait (vl.c:1365)
==11826== by 0x437CDE: kvm_main_loop (qemu-kvm.c:1589)
==11826== by 0x41FE9A: main (vl.c:1411)
==11826==
https://bugs.freedesktop.org/show_bug.cgi?id=34971
2011-03-02 Alon Levy <alevy@redhat.com>
server/red_worker: use red_channel_pipe_item_init
replaces in file red_pipe_item_init.
server/red_channel: move out_bytes_counter from Outgoing to RedChannel
server/red_channel: split Incoming/Outgoing to callback and state
This allows later to have the callback table under RedChannel when
the callbacks actually get used by RedChannelClient. Since the cb's
are identical for different clients of the same channel it makes sense
to store the callback pointers in one place per channel. The rest of
the incoming and outgoing struct just gets moved to RedChannelClient.
server/red_channel: no opaque in red_channel_peer_on_*_error
server/red_worker: use red_channel_is_connected
server/red_channel: add red_channel_disconnect, use in red_worker
replace channel_release_res in red_worker with red_channel_disconnect.
server/red_channel: reset send_data.item to NULL after release
server/red_worker: remove RedChannel argument from add_buf_from_info
It was unused.
server/red_channel: add red_channel_{,no_}item_being_sent
server/red_worker: complete removal of send_data.marshaller use
server/red_worker: replace _send_ functions by _marshall_
Changes in display channel for a code size win.
A note about this and the previous cursor change: it will appear that we are
now (with these changes) releasing resources too early. This is not so - send
always has the option of blocking, which means after send you can not release
resources anyway, that's what the release_item callback is for. So both the
code before and now are doing the same accounting.
server/red_channel: add red_channel_send_message_pending
server/red_channel: add red_channel_all_blocked
server/red_worker: cursor channel: replace _send_ with _marshall_
server/red_channel (all): add red_channel_get_header
This is useful during the channel specific channel_send_pipe_item_proc
callback, it allows altering or reader the header being sent.
server/red_channel: add red_channel_get_first_socket
Use in main_channel. This is just for backward portability later
when multiple clients are introduced - needs to be considered (which
sockets do we want to export from libspiceserver?)
server/red_channel (+): remove red_channel_add_buf
server/tunnel: pass SpiceMarshaller reference from send
Introduce SpiceMarshaller param to all send's that do add_buf
Next patch will use marshaller in all functions that currently don't by
replacing red_channel_add_buf with marshaller add_ref. Note - currently
tunnel is broken due to wrong size in messages.
server/red_channel (all): add red_channel_get_stream
use in config_socket, this makes the stream internal to the RedChannel
implementation that will change later for multiple client support.
ring: add RING_FOREACH{,_SAFE,_REVERSED}
server/common: introduce common/spice_common.h
move all the ASSERT/PANIC/PANIC_ON/red_error/red_printf* macros
to a common file to be used with ring.h that is going to be used externally
(by spice-gtk).
server/red_channel (all): handle MIGRATE_DATA and MIGRATE_FLUSH_DATA
Handling done in red_channel instead of per channel, using call backs
for the channel specific part.
Intended to reduce furthur reliance of channels on RedChannel struct.
The commit makes the code harder to understand because of the artificial
get_serial stuff, should later be fixed by having a joint migration
header with the serial (since all channels pass it).
server/red_channel (all): add red_channel_get_marshaller
For ussage in the send_item callback. It's only valid during this
time anyway (should make it return NULL in other occasions?)
No more direct usage of RedChannel.send_data.marshaller by channels.
server/red_worker: use red_channel_destroy
server/inputs_channel: s/PIPE_ITEM_INIT/PIPE_ITEM_INPUTS_INIT/
server/red_channel: move SET_ACK to red_channel
server/red_channel: add more ack api
server: use red_channel_get_message_serial
server/red_channel (all): makes red_channel_reset_send_data private
ready the way for handling ack messages in RedChannel.
server/red_worker: use red_channel
server/red_channe: make hold_item take a channel arg
server/red_worker: introduce red_peer_handle_outgoing and OutgoingHandler
From red_channel.
server/red_worker: introduce common_channel_config_socket
server/red_worker: line width fix
server/red_worker: don't push to NULL channel (called from device input)
server/red_worker: introduce red_channel_pipe_clear
No more common_release_pipe_item
server/red_worker: add red_channel_push
server/red_worker: add send_item
server/red_worker: red_channel renames
The renames are part of refactoring red_worker's RedChannel to reuse
red_channel.h's RedChannel at the end.
s/red_send_data/red_channel_send/
s/red_pipe_get/red_channel_pipe_get/
s/recive_data/incoming/
s/red_receive/red_channel_receive/
s/channel_handle_message/red_channel_handle_message/
s/channel_is_connected/red_channel_is_connected/
s/red_pipe_add_type/red_channel_pipe_add_type/
server/red_tunnel_worker: use message_serial setter and getter
fixes breakage in --enable-tunnel compilation.
2011-03-01 Hans de Goede <hdegoede@redhat.com>
x11: Use _exit rather then exit on X errors (rhbz#680763)
This avoids us trying to restore the original resolution when we're fullscreen
and an X error happens. As restoring fullscreen is a bad idea then as this
involves making more X calls, which can get us stuck (in side an XLockDisplay
call for example).
2011-03-01 Uri Lublin <uril@redhat.com>
client: exit nicely for --controller with no SPICE_XPI_SOCKET (rhbz#644292)
When starting spicec with --controller, SPICE_XPI_SOCKET environment
variable must be defined so spicec and the controller can be connected.
2011-03-01 Hans de Goede <hdegoede@redhat.com>
Fix keyb modifiers not syncing from client to client os (rhbz#679467)
2011-02-28 Marc-André Lureau <marcandre.lureau@redhat.com>
server: add SASL support
We introduce 2 public functions to integrate with the library user.
spice_server_set_sasl() - turn on SASL
spice_server_set_sasl_appname() - specify the name of the app (It is
used for where to find the default configuration file)
The patch for QEMU is on its way.
https://bugs.freedesktop.org/show_bug.cgi?id=34795
server: add auth mechanism selection
https://bugs.freedesktop.org/show_bug.cgi?id=34795
server: add reds_channel_dispose()
Try to have a common base dispose() method for channels. For now, it
just free the caps.
Make use of it in snd_worker, and in sync_write() - sync_write() is
going to have default caps later on.
https://bugs.freedesktop.org/show_bug.cgi?id=34795
server: simplify and constify sync_write()
+ symplify, improving style of code using it.
https://bugs.freedesktop.org/show_bug.cgi?id=34795
server: pull out reds_handle_link(), for future reuse
+ a couple of indent, style change
https://bugs.freedesktop.org/show_bug.cgi?id=34795
build: add --with-sasl
Using cyrus SASL library (same as gtk-vnc/qemu).
https://bugs.freedesktop.org/show_bug.cgi?id=34795
common: add SpiceBuffer - based on qemu-vnc Buffer
https://bugs.freedesktop.org/show_bug.cgi?id=34795
server/reds: make writev fallback more generic
We are going to reuse it for SASL/SSF encode write().
https://bugs.freedesktop.org/show_bug.cgi?id=34795
server: rename s/peer/stream
This is stylish change again. We are talking about a RedStream object,
so let's just name the variable "stream" everywhere, to avoid
confusion with a non existent RedPeer object.
https://bugs.freedesktop.org/show_bug.cgi?id=34795
server/reds: remove the void* ctx field
https://bugs.freedesktop.org/show_bug.cgi?id=34795
server: use the new reds_stream_{read,write}
https://bugs.freedesktop.org/show_bug.cgi?id=34795
2011-02-27 Marc-André Lureau <marcandre.lureau@redhat.com>
server: remove cb_free, not needed anymore
https://bugs.freedesktop.org/show_bug.cgi?id=34795
server: use reds_{link,stream}_free()
Be carefull removing the watch before, like __release_link
https://bugs.freedesktop.org/show_bug.cgi?id=34795
server: use reds_stream_remove_watch() helper
https://bugs.freedesktop.org/show_bug.cgi?id=34795
server: add reds_stream_{read,write,free,remove_watch}()
https://bugs.freedesktop.org/show_bug.cgi?id=34795
server: s/RedsStreamContext/RedsStream
https://bugs.freedesktop.org/show_bug.cgi?id=34795
server/reds: remove unused readv
Let's not bother with it since nobody uses it, and it's not implemented for SSL anyway
https://bugs.freedesktop.org/show_bug.cgi?id=34795
build: make it silent
This patch make it easier to spot warnings in compilation. It should
work with older versions of automake that don't support silent rules.
If you want verbose build, make V=1.
https://bugs.freedesktop.org/show_bug.cgi?id=34795
2011-02-13 Arnon Gilboa <agilboa@redhat.com>
client/windows: use SPICE_PROTOCOL_DIR in project include dirs
instead of ..\..\..\spice-protocol. Relative path to another git tree is a bit
ugly, since it requires spice-protocol to be in a specific location.
SPICE_PROTOCOL_DIR should also be used in windows qxl and vdagent instead of
SPICE_COMMON_DIR, which is an old and confusing name, due to the common
directory in spice git repo.
2011-02-11 Alon Levy <alevy@redhat.com>
server/tests/basic_event_loop: fix bzero warning
tests/migrate.py: refactor to allow importing for later use
2011-02-11 Hans de Goede <hdegoede@redhat.com>
Drop static_title.bmp from windows/Makefile.am
2011-02-11 Alon Levy <alevy@redhat.com>
server/red_worker: cursor_channel_send_item: don't downcast
server/red_worker: match channel_release_pipe_item_proc to red_channel
server/red_worker: introduce an outgoing struct around out_bytes_counter
server/red_worker: renames to add channel_ prefix and consistent sig
s/disconnect_channel_proc/channel_disconnect_proc/
s/release_item_proc/channel_release_pipe_item_proc/
s/handle_message_proc/channel_handle_parsed_proc/
Adds RedChannel* channel as first parameter to hold_pipe_item_proc
server/red_worker: split cursor_channel_send_item
Split from cursor_channel_push
server/red_worker: use red_channel begin_send_message
s/red_begin_send_message/red_channel_begin_send_message/
server/red_worker: add red_channel_init_send_data
Changes semantics of send to always hold/release regardless of block, like
red_channel. A hold is just a reference count increment or nop.
server/red_worker: split display_channel_send_item
Split it out of display_channel_push.
server/red_worker: extract common_release_pipe_item from red_pipe_clear
server/red_worker: use red_channel pipe add versions
s/red_pipe_add/red_channel_pipe_add/
s/red_pipe_add_after/red_channel_pipe_add_after/
server/red_worker: shorten some lines using alias variables
server/red_worker: introduce CommonChannel
with everything (almost) not in red_channel's RedChannel
As a result of CommonChannel a free cb is added to EventHandler,
to take care of non zero offset for embedded EventHandler.
server/red_worker: use ack_data struct
start of move to red_channel based channels
server/red_worker: change hold_item sig, drop the void*
changed to PipeItem *
2011-02-09 Alon Levy <alevy@redhat.com>
update required minimal libcacard to 0.1.2
client/smartcard: libcacard dropped ReaderAddResponse
uses VSC_Error with code==VSC_SUCCESS instead. This means that the VSC_Error
message is overloaded. Instead of the other option of adding a message id,
since the connection is TCP so no messages may be dropped or reordered, by
having each message followed by a response there is no ambiguity. Still
this commit adds a queue for messages that we only have one of which outstanding
at a time, i.e. send, wait for response, send the next, etc. This further
simplifies the logic, while not adding much overhead since only when spicec
starts up it has a situation where it needs to send two events (ReaderAdd
and ATR for Card Insert).
server/smartcard: don't push our own error on reader add
The device already sends one. There are actually two connections going
on:
server to client - this is the smartcard channel, it reuses the VSC protocol.
server to device - this is an internal connection using VSC too.
We generally just passthrough all messages from the client to the device,
and from the device to the client. We only rewrite the reader_id because
the device knows about a single id (it is actually a card id), and we
may manage more then one in the future.
Bottom line is that there was an extra VSC_Error message reaching the client.
2011-02-07 Alon Levy <alevy@redhat.com>
client/smartcard: ignore VSC_Init
server/smartcard: ignore VSC_Init from client
server/smartcard: print instead of assert on bad reader_id in smartcard_char_device_on_message_from_device
server/smartcard: libcacard uses network byte order, so we must too
client/smartcard: s/reader_id_t/uint32_t/ (libcacard changed)
server/smartcard: libcacard removed ReaderAddResponse
server/smartcard: s/reader_id_t/uint32_t/ (libcacard changed)
server/red_channel: style fix in red_channel_init_send_data
server/red_channel: red_channel_pipe_clear: assert on NULL channel
server/red_channel: add TODO
server/red_channel: export red_channel_send
server/red_channel: add red_channel_waiting_for_ack
small inline function to have the ack window logic.
server/red_channel: protect red_channel_push from NULL
server/red_channel: reset pipe_size on clear (from red_worker)
server/red_channel: red_channel_event: push on blocked
try to push either on signal (write available) or when blocked
and read signaled. From red_worker, copied for compatibility when
switching later to RedChannel in red_worker. Doesn't make a lot of
sense (but works), see comment in patch.
server/red_channel: use red_channel_receive
server/red_channel: add empty handle of SPICE_MSGC_DISCONNECTING
Simply ignored in red_channel_handle_message
server/red_channel: add red_channel_receive (for red_worker)
server/red_channel: unstatic red_channel_pipe_clear (for red_worker)
server/red_channel: unstatic red_channel_push (for red_worker)
server/red_channel: two 80 column fixes
server/red_channel: add public red_channel_default_peer_on_error
for later use in red_worker
server/red_channel: add red_channel_pipe_add_after (from red_worker)
server/red_channel: make client ack window configurable
from red_worker
server/red_channel (tunnel): change sig of red_channel_handle_message
for later usage with red_worker
server/red_channel: make MAX_SEND_VEC 100
MAX_SEND_VEC was 100 for DisplayChannel's RedChannel implementation which is being replaced
with RedChannel in red_channel. So changing from 50 to 100 in red_channel
(make this configurble?) - effectively increased memory usage by:
(100-50)*sizeof(iovec)*(num_of_channels-2) ==(arch 64bit) 50*16*6 ~ 5k
Not terrible.
server/red_channel: reflect SpiceDataHeader fields in handle_parsed_proc
server/red_channel: add red_channel_pipe_add_push
server/red_channel: add hold_item (from red_worker)
hold_item called on init_send_data, matching release.
This is not the behavior of red_worker - we ref++ (==hold_item) when
sending the item, and --refs when releasing it, instead of only holding
if the send is blocked.
Note 1: Naming: hold_pipe_item is the proc name, the variable is called
hold_item, this is similar to release_item/release_pipe_item naming.
Note 2: All channels have empty implementation, we later use this when
red_worker get's RedChannelized.
server/red_channel: add out_bytes_counter (unused)
client: log subject-host mismatch, and raise ssl warnings to errors
configure.ac: use AC_LANG_SOURCE in AC_COMPILE_IFELSE, silence remaining warnings
server/red_worker: fix used but uninitialized warning (gcc 4.6.0)
2011-01-27 Uri Lublin <uril@redhat.com>
spice-client migration: fix minor for old migration support.
For not too old spice-migration, minor is 1.
For older (ancient) spice-migration, minor is 0.
Affects only VM migration while a spice client is connected.
2011-01-27 Alon Levy <alevy@redhat.com>
client/windows: don't allocate console unless required
client: fix broken vs2008 build
client: --help should not need platform initialization
separate initialization into before command line parsing and after,
call later only if command line parsing succeeds (in particular, it
"fails" if --help is given).
2011-01-25 Alon Levy <alevy@redhat.com>
demarshaller/marshaller fix gcc 4.6.0
python_modules/demarshal.py and marshal.py fixes for gcc 4.6.0
warning about set but unused variables. The fixes disable creating
of variables mem_size when they are not used (demarshall) and
declaring a src variable when the message doesn't use it (marshal).
You need to touch *.proto after applying this (should add a Makefile
dependency).
codegen: avoid creating out if not used (fix gcc 4.6.0 warning)
client: gcc 4.6.0: two more unused variable fixes
client/cegui: cegui 0.6.0 gcc 4.6.0 related fix
cegui doesn't include stddef required for ptrdiff_t type, we
include it for it.
client/glz_decoder.cpp: gcc 4.6.0 unused fixes
client/display_channel: gcc 4.6.0 unused fixes
common/sw_canvas: remove unused error val
This is the only unused var change I'll want to revisit eventually,
I'm submitting anyway since it doesn't change current behavior. I'm
talking about ignoring the return value from canvas creation. Adding
a print is possible but I didn't test (may be too verbose, also
preferable to be a debug print if so, and we don't have that option
in the code atm - probably an environment variable will do, or adding
some spice_server_set_logging_level api, maybe even
spice_server_set_logging_fd?)
common/canvas_base.c: remove unused variables
client/server: warning fixes (gcc 4.6.0)
gcc 4.6.0 added "[-Werror=unused-but-set-variable]", this and the next
few fixes tend to that. Mostly harmless.
client/server: add missing USE_TUNNEL
disable some code that only makes sense when USE_TUNNEL is defined
in client and server channel security level setting.
client/server: add missing smartchannel channel security handling
The name to channel id mapping for the smartcard channel is missing,
add it in client and server.
2011-01-21 Hans de Goede <hdegoede@redhat.com>
Update license header for server/red_parse_qxl.c
This one mistakenly had a GPL header rather then an LGPL header.
Drop unnecessary X11 and alsa requires from spice-server.pc
2011-01-19 Hans de Goede <hdegoede@redhat.com>
server: remove dep on CEGUI
2011-01-16 Alon Levy <alevy@redhat.com>
server/red_channel: fix segfault on red_channel_destroy if peer already removed
server/inputs_channel: use outgoing marshaller in red_channel/RedChannel
2011-01-15 Alon Levy <alevy@redhat.com>
tests/migrate.py: add a migration test
server/main_channel: use red_channel (most code is pipe send/marshall separation)
server/red_channel: no need for extra loop
2011-01-13 Alon Levy <alevy@redhat.com>
server/red_channel: go marshaller for outgoing (copied from red_worker)
server/reds: don't remove agent if it's not connected
server/reds: protect reds_update_mouse_mode when main_channel is disconnected
server/reds: don't call close on NULL channel on atexit callback
server/reds: fix possible segfault when accessing vdagent from reds_update_mouse_mode after vdagent set to NULL
server/reds: s/reds_push_migrate_data_item/reds_marshall_migrate_data_item/
server: split main_channel from reds
2011-01-11 Alon Levy <alevy@redhat.com>
server: remove dep on libcacard
Only the client needs this, and erronously using SPICE_REQUIRES
results in libcacard dep in spice-server.pc, which is then dragged
into qemu when linking, beeing used instead of the builtin libcacard.
2011-01-10 Alon Levy <alevy@redhat.com>
server/tests: split test_display_no_ssl to test_display_base, add streaming test
server/tests/test_display_no_ssl: add update_area, COPY_BITS to tested functions, make a queue of QXLCommandExt waiting (cursor still with production at get_command)
server/tests/test_display_no_ssl: add surface create/destroy test (commented out), and square mode (default)
server/tests: fix timer reset to allow setting next call during callback
server/tests/test_display_no_ssl: change color every circle
server/tests/test_display_no_ssl: restart notify timer
server/tests: basic_event_loop: reset timer after firing it
server/tests/test_display_no_ssl: disable cursor test until it works correctly
server/test/test_display_no_ssl: add beginning of basic cursor item test. doesn't actually show anything on client. also, leaks.
server/tests/test_display_no_ssl: make window 320x320, two colored updates, one in notify batch
2011-01-07 Alon Levy <alevy@redhat.com>
server/red_worker: use 1, not 4 when lz_encoding a top down image
2011-01-06 Alon Levy <alevy@redhat.com>
client/cmd_line_parser: fix wrong reporting of bad argument in --bla=val case
We use get_opt_long, which allows non ambiguous abbreviations, but
since we didn't like that we have code that checks for abbreviations and
issues an error. But that code only handled separate argument and key like:
--bla value
and didn't handle them in the same arguemnts, like:
--bla=value
This patch fixes that, and gives a slightly better error report (it still
contains the =value part though)
2011-01-05 Alon Levy <alevy@redhat.com>
common, canvas_get_jpeg_alpha: let top_down be any value
Allow top_down flag to have any value, only ASSERT it is positive
when needs to be positive and zero otherwise. Allows older server
bug of sending 4 instead of 1 in top down flag to not affect newer
clients (previous patch fixes server).
client: CEGUI: search for CEGUI-0.6 to work in F15 (rawhide)
2011-01-05 Thomas Tyminski <thomast@cs.tu-berlin.de>
Fixes compilation error of Spice Client (Linux/X11) with OpenGL enabled modified: client/x11/red_window.cpp
2010-12-30 Alon Levy <alevy@redhat.com>
mingw32: refix to build on mingw..
2010-12-30 Marc-André Lureau <marcandre.lureau@redhat.com>
client inputs: stop blinking keyboard when out of focus
We could introduce another boolean to prevent changes, or just reuse
_active_modifiers_event = true to prevent further update.
Additionaly this patch restore the keyboard state when focusing out,
which is fine when dealing with full remote desktop, but should be
reconsidered if/when SPICE supports remote windows managed by client
window manager for instance, imho.
2010-12-30 Tiziano Mueller <dev-zero@gentoo.org>
jpeg_boolean is a mingw32-libjpeg specific thing. Use a define check rather than a version check.
2010-12-17 Hans de Goede <hdegoede@redhat.com>
server: Update SPICE_SERVER_VERSION
Makefiles: fix server/tests/test_util.h not being included in make dist
server: Update SPICE_SERVER_VERSION
2010-12-16 Hans de Goede <hdegoede@redhat.com>
spicec: Remove spice-client watermark (rhbz#662450)
This patch stops us from drawing the spice client watermark at the top of
the virtual machine view. We have had requests through several channels to
remove this as it has little added value, and is seen as annoying by some.
Given that we now also have a bugzilla for this I think it is time we really
remove it.
spicec-x11: Let the window manager place our window the 1st time (rhbz#662407)
The problem is that RedWindow::show calls the XLib MoveWindow function
on the window after it has been mapped, moving it to the location in
_show_pos. This is seen by the window manager as the application saying
I know exactly where I want my window to be placed, don't do placing for
me. Which causes the client window to always be shown at pos 0x0, even
though that may not be the best location.
What this patch does is:
1) It makes RedWindow::show not call MoveWindow when a window is
first created normally and then shown
2) It makes RedWindow::show still call MoveWindow when:
-when the window has been shown before, and was hidden for some
reason (controller interface), and is now being re-shown
so that it ends up being re-shown at its old position
-when the window is a fullscreen window (screen.cpp always
calls move on the window before showing it to set its position)
-when the user switch from windowed mode -> fullscreen ->
windowed mode again, to make sure that the windowed mode window
is shown in the same position as before switching to fullscreen
mode
spicec-x11: Add a class hint to our window managet hints
This helps people who want to tell their windowmanager to do something special
with spicec, like make it sticky, or whatever, see:
https://bugzilla.redhat.com/show_bug.cgi?id=662452#c4
spicec: Add a --title cmdline option (rhbz#662452)
2010-12-16 Gerd Hoffmann <kraxel@redhat.com>
move chardevs out of experimental
While we are at it: There is no reason for chardev
support to stay in the experimental area, so move it out.
qemu should not need the "spice-experimental.h" file.
move switch-host migration out of experimental
seamless stays in the experimental area.
comments updates too.
client migration: switch host
Implement server-side support for switch-host client migration. Client
side support is present already in the tree.
Setting the migration information is done using the existing
spice_server_migrate_info() function. A new
spice_server_migrate_switch() function has been added which triggers
sending out the switch-host message.
Seamless migration functions are left there for now.
spice_server_migrate_start() has been chamnged to just fail
unconditionally though as seamless migration is broken anyway.
2010-12-15 Alon Levy <alevy@redhat.com>
server/red_worker: fix worker->drawable_count
drawable_count was becoming negative. It tracks the number of
items in the worker->current_list ring. It was decremented correctly,
but incremented only in several cases. The cases it wasn't incremented
where:
red_current_add_equal found an equivalent drawable
by moving the increment to where the item is added to current_list, in
__current_add_drawable, the accounting remains correct.
This has no affect other then correct accounting, as drawable_count isn't
used for anything.
2010-12-11 Alon Levy <alevy@redhat.com>
client/smartcard: external cac card library name and version changed
2010-12-09 Gerd Hoffmann <kraxel@redhat.com>
server: improve error handling
We should pass up errors instead of aborting. Do that at least
for bind() failures which actually happen in real live due to the
tcp port being busy.
2010-12-08 Alon Levy <alevy@redhat.com>
server/tests: fix for AM_LDFLAGS introduction
2010-12-08 Gerd Hoffmann <kraxel@redhat.com>
mingw32 build: disable -fvisibility test for unsupported mingw32 target
v2: only disable for os_win32 (Hans)
2010-12-08 Alon Levy <alevy@redhat.com>
mingw32 build: check for CXImage, disable if not found (only on mingw32)
v2:
+ simplify (Hans)
+ also report presence of cximage for mingw32 target
mingw32 build: use PRIu64 instead of ll
mingw32 build: python_modules/marshal: use unsigned for for_loop index variable
mingw32 build: various fixes
mingw32 build: fix two functions
mingw32 build: add missing switch flags (nop)
mingw32 build: eol fixes
mingw32 build: windows/Makefile.am: double NULL definition
mingw32 build: missing linked files for spicec.exe
mingw32 build: remove unused, initialize uninitialized, reorder constructor initializers
mingw32 build: fix assignement as condition warning
mingw32 build: fixed using -1 as uninitialized value for unsigned variables
mingw32 build: fix signed/unsigned warnings as errors
mingw32 build: fix configure.ac typo
mingw32 build: fix various warnings
2010-12-08 Gerd Hoffmann <kraxel@redhat.com>
mingw32 build: fix build errors
mingw32 build: disable ms compiler pragmas for gcc
2010-12-07 Gerd Hoffmann <kraxel@redhat.com>
mingw32 build: add client/windows/Makefile, tweak configure
build: s/HUGE/INFINITY/
build: use jpeg_boolean with more recent libjpeg versions.
build: only check for x11 extensions when building for x11 platform.
build: alsa is needed on linux only.
2010-12-07 Alon Levy <alevy@redhat.com>
server/tests: Makefile.am: use AM_LDFLAGS instead of LDFLAGS
server/inputs: return NULL on alloc_buf request for too large message
server/red_channel: error channel if alloc_msg_buf fails (returns NULL)
server/inputs_channel: better protection from channel disconnection on keyboard modifiers callback
server/red_channel: add red_channel_is_connected
server/inputs_channel: remove unused declaration in inputs_channel.h
server/inputs_channel: s/inputs_channel/g_inputs_channel/
server/inputs_channel: initialize inputs_channel to NULL
server: reds/inputs_channel: move some structs to inputs_channel
server: inputs_channel: use red_channel
server: red_channel: add optional parser and separate incoming/outgoing error handlers for later inputs/main channel usage
server: inputs_channel: s/inputs_state/inputs_channel/
server: introduce inputs_channel, split from reds.c
server/reds: fix typo
2010-12-07 Arnon Gilboa <agilboa@redhat.com>
spicec: do not call connect_secure when connect_unsecure fails due to protocol version mismatch (v2)
If connect_unsecure failed due to protocol version mismatch, don't try to
connect_secure with the same version, but retry (connect_secure or
connect_unsecure) with older version. catch (...) is handled by caller
at RedChannel::run().
This solves the following bug: when "new" Spice client (protocol version 2)
with given secure_port connects to "old" server which is not using the same
secure_port (or not using a secure_port at all), the client exits immediately.
In this scenario, the client first tries to use Spice protocol version 2 to
connect the unsecure port, and altough this fails due to version mismatch, it
tries to connect to the secure port with the same protocol version 2, which is
a wrong behavior, fails due to socket error 10061 (WSAECONNREFUSED -
Connection refused) and handled mistakenly by immediate exit, instead of
retrying with protocol version 1.
2010-12-07 Alon Levy <alevy@redhat.com>
client/smartcard: add files to Makefile.am for make dist
smartcard: configure option --enable-smartcard
smartcard: server side (not enabled yet)
smartcard: client: add keyboard shortcuts for remove/insert virtual card
smartcard: client side (not enabled yet)
smartcard: add to spice.proto
server: add spice_server_char_device_remove_interface
2010-12-06 Alon Levy <alevy@redhat.com>
server: print subtype when adding CHAR_DEVICE interfaces
server: add static to spice_server_char_device_add_interface
spice codegen: fix copy-o, no such variable value
server: fix print text on vdagent interface addition
server: add char_device.h header, use in reds.c
spice-experimental.h: add multiple include protection
server/vdi_port (virtserial): always read data
We erronously ignored data from guest on the serial channel if no client is
connected. This leads to an assert when the guest writes a second time, since
there is still data unconsumed by us (the host).
Fix by reading data anyway, and discarding it after parsing (and reading) whole
messages from the guest.
Net affect is that any messages the agent sends while no client is connected
get discarded, but only full messages are discarded.
This fixes an abort if booting a winxp guest with vdagent without a connected
client.
2010-12-02 Alon Levy <alevy@redhat.com>
server: add char_device.h to Makefile.am for make dist
2010-11-30 Alon Levy <alevy@redhat.com>
server/tests: add test_display_no_ssl
updates taken from spice vga mode updates, i.e. non cacheable, glz compressed
(depends on whatever settings you apply to the server) opaque draw operations.
+ completed the SpiceCoreInterface implementation (timers)
v1->v2:
removed test_util.c (Hans)
replaced mallocz with calloc (Hans)
server/tests: Makefile.am fixes
* don't install tests on make install
* don't forget anything for make dist tarball
add .gitignore for tests
2010-11-25 Hans de Goede <hdegoede@redhat.com>
spicec: Don't show a white screen if guest resolution does not fit fullscreen
Currently when going / starting fullscreen if the guest resolution for one of
the monitors is higher then that monitor on the client can handle, we show a
white screen. Leaving the user stuck (unless they know the fullscreen key
switch combi) with a white screen when starting the client fullscreen from
the XPI.
This patch changes the client to fall back to windowed mode in this case
instead.
2010-11-24 Arnon Gilboa <agilboa@redhat.com>
spicec: fix ASSERT to accept size == 0
which is useful when calling RedClient::on_clipboard_notify(VD_AGENT_CLIPBOARD_NONE, NULL, 0);
spicec-win: add image copy-paste support
-currently png & bmp
-using wspice libs cximage.lib & png.lib
-jpg & tiff will follow
2010-11-23 Hans de Goede <hdegoede@redhat.com>
spicec-x11: Fix unhandled exception: no window proc crash (rhbz#655836)
When XIM + ibus is in use XIM creates an invisible window for its own
purposes, we sometimes get a _GTK_LOAD_ICONTHEMES ClientMessage event on
this window. Since this window was not explicitly created by spicec, it
does not have a Window Context (with the event handling function for the
window in question) set. This would cause spicec to throw an unhandled
exception and exit.
This patch replaces the exception throwing with silently ignoring
ClientMessage events on Windows without a Context and logging a warning
for other event types.
2010-11-22 Hans de Goede <hdegoede@redhat.com>
spicec-x11: Fix modifier keys getting stuck (rhbz#655048)
Currently modifier keys (ctrl, alt) can get stuck when using the x11 client.
To reproduce under gnome:
-focus the client window without causing it to grab the keyborad (click on
the title bar not the window)
-press crlt + alt + right arrow to switch virtual desktop
-press crlt + alt + left arrow to switch back
-notice ctrl + alt are stuck pressed
What is happening here is:
-We get a focus out event, caused by the hotkey combi key grab, focus event
notify mode == NotifyGrab, and release all keys -> good
-We get another focus out event, as we really loose the focus.
notify mode == NotifyWhileGrabbed, which we ignore as we already lost
focus before
-We get a focus in event, as the focus is returning to us, but we don't
really have the focus yet, as the hotkey combi key grab is still active
(ie ctrl + alt are still pressed).
We now sync the vm's modifier key state with the current X-server state,
telling the vm ctrl + alt are pressed. Note we do this by directly reading
the X-server keyboard status, we are not getting any key press events from the
X-server -> bad
-We get another focus in event, as we really get the focus back,
notify mode == NotifyUngrab. We ignore this one as already have gained the
focus before. If we were to sync the vm modifier state here, all would be
well we would no longer see the modifier keys pressed, or if we would we
would get a release event when they get released (testing has shown both).
The solution here is to ignore the first focus in event, and do the modifier
sync on the second focus in event, or more in general to ignore focus events
where notify mode == NotifyWhileGrabbed.
2010-11-17 Hans de Goede <hdegoede@redhat.com>
spicec-x11: Add a few missing XLockDisplay calls (rhbz#654265)
The XIM functions end up waiting for a reply from the server, so they
need locking around them. Idem for the XLookupString call.
2010-11-09 Hans de Goede <hdegoede@redhat.com>
spicec: Don't show gui when connection info is specified on the cmdline
Currently when compiled with the gui enabled if you specify a host to connect
to on the cmdline the gui flashes by (show_gui gets called, then the connect
handler calls hide_gui as soon as the connection is made).
This patch removes this ugly flashing by of the gui.
spicec: Remove empty show / hide gui functions
When compiling without gui support just don't call show / hide
gui, rather then making them stubs, this makes it easier to follow what is
going on.
spicec: Fix info layer sometimes not showing
Currently we are calling show_info_layer from hide_gui in application.cpp, but
there are 2 cases where this does not happen:
1) When compiled without gui support hide_gui is a complete nop, so we never
show the info layer when compiled without gui support
2) When run with --controller we never show the gui, and hide_gui
checks if there is a gui to hide as the first thing and if not returns
resulting in show_info_layer not being called, and thus the info layer
not showing when launched from the xpi
This patch fixes both by adding a call to show_info_layer from
on_visibility_start note that on_visibility_start also calls hide_gui,
so in some cases show_info_layer may be called twice, this is not a
problem as show_info_layer is protected against this.
2010-11-08 Alon Levy <alevy@redhat.com>
server/reds: zap unsetting of QEMU_AUDIO_DRV
gitignore: add generated_*, vim temps, pyc
reds: remove needless buffer in InputsState
server: tests: add basic tests with working do nothing server
2010-11-08 Arnon Gilboa <agilboa@redhat.com>
spicec-win: ignore MSVCRT.lib in x86 build
Same as in x64 build, for using the updated wspice-0.6.3
2010-11-05 Hans de Goede <hdegoede@redhat.com>
spicec: Make cegui log to <app_data_dir>/cegui.log
This stops the client from dropping CEGUI.log files into the cwd all
the time, and stops it from crashing when the cwd is not writable
(rhbz#650253).
2010-10-28 Hans de Goede <hdegoede@redhat.com>
spicec-x11: Listen for selection owner window destroy / close events too
These rarely happen as most apps have the decency to do a SetSelectionOwner
None before exiting. But some do not, so listen for these too.
2010-10-25 Alon Levy <alevy@redhat.com>
client: add verbose link error messages
2010-10-25 Arnon Gilboa <agilboa@redhat.com>
spicec-tests: add controller_test (v2)
use chars for title & menu instead of wchars
spicec-win: remove redundent strdup & buggy free
text refered a substr of item_dup and was used after free(item_dup).
no need to strdup, we can destroy the resource string.
2010-10-25 Hans de Goede <hdegoede@redhat.com>
controller: Make menu text utf-8
We are making all text send over the controller socket utf-8, rather then
having somethings as 8 bit (hostname) and others (title, menu) unicode16,
this patch completes this change by converting the menu handling.
spicec-x11: Do not set _NET_WM_USER_TIME to 0 on startup
Setting _NET_WM_USER_TIME to 0 means we do not want focus, not good.
2010-10-25 Arnon Gilboa <agilboa@redhat.com>
spicec-win: add x64 to vcproj & sln (v2)
use CEGUI for x64 as well, no need for the SUPPORT_GUI hack
spicec-win: map title string from utf8 to utf16
Fix win client broken by the utf8 patch.
2010-10-24 Arnon Gilboa <agilboa@redhat.com>
spicec-win: add #ifndef _WIN64 for u/intptr_t typedefs
spicec-win: Replace Set/GetWindowLong to LongPtr for x64 competability
2010-10-21 Hans de Goede <hdegoede@redhat.com>
Remove no longer used wstring_printf functions
client: Interpret the title control message as utf8 instead of unicode16
The activex browser plugin is sending unicode16 text, where as the
xpi one is sending utf8 text. After discussing this on irc we've decided
that utf8 is what we want to use. So the client (this patch), and the
activex will be changed to expect resp. send utf8 text as the title.
spicec-x11: Change source of controller socket name, fixing CVE-2010-2792
The socket name used to communicate between the xpi browser plugin and the
spicec was predictable allowing a non priviliged user on the same system
to create the socket before spicec does and thus intercept the messages from
the xpi to the client, including login credentials. This security vulnerability
has been registred with mitre as CVE-2010-2792:
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-2792
This patch changes the controller code to instead read the socket name
from an environment variable which gets set by the xpi before executing
the spicec, making the socketname private between the client and the xpi.
Note that this means that the controller will only work with an xpi which
has matching changes, the changes are present in the latest version of the
xpi as available as update for / with RHEL-5.5 and RHEL-6.0 .
2010-10-18 Hans de Goede <hdegoede@redhat.com>
Release 0.6.3
Make the gui use Application::hide_gui rather then hide_me
Now that Application::hide_me actually does what the name suggests
(hide the entire client, ie all client windows), the gui using it to
not show the gui layer leads to the entire client disappearing when
one presses close in the GUI or dismisses a GUI dialog. This patch makes
the GUI code call hide_gui instead of hide_me, fixing this.
Bump version to 0.6.2
Update NEWS for 0.6.2 release
spicec-x11: Fix window management under KDE
There were 2 issues with window management under KDE
1) When an app does its own focus management like we do, kwin expects
an explicit raise for the app to get to the top, so we did have focus,
but would have other windows (partially) covering the client window
-> do a raise after setting focus to ourselves
2) When switching from fullscreen <-> window, we unmap and remap our
window, then set focus to ourselves. kwin thinks this means we're trying
to steal the focus without the user asking for it. This patch makes us
set the _NET_WM_USER_TIME property on our window, this helps kwin's
focus stealing code to see that we are really not stealing the focus,
just responding to a user event.
client: change monitor mode setting <-> fullscreen window mode setting order
1) Make the order when starting up in fullscreen mode the same as when
switching from window -> fullscreen:
First set the mode, then make the window fullscreen
2) Change the order when leaving fullscreen mode, first restore the original
monitor mode, then make the window non fullscreen. Changing the monitor
mode in X11 causes the window manager to re-arrange windows, and if this
happens while compiz is busy mapping the window it gets confused and
maps the window with a maxmimized size.
spicec-x11: Change WmSizeHints in fullscreen mode
Some window managers will ignore the fullscreen hint, unless WmSizeHints
allow them to resize the window so that they can give it the size of
the roo-window. This fixes fullscreen mode in compiz.
spicec-x11: Add missing XLockDisplay around XRRSet* calls
XRRSet* calls wait for a XReply, so add a missing XLockDisplay,
this fixes a hang (due to a race so not always) when switching between
windowed and fullscreen mode.
client: Do not try to send display_config until we've received the agent caps
Currenty, we check the agent caps in RedClient::handle_agent_connected
for VD_AGENT_CAP_DISPLAY_CONFIG and if present send display_config, but at
this time we have not received the caps yet, so remove this.
Also the send_agent_display_config call in on_agent_announce_capabilities
lacks a check for _agent_disp_config_sent, and we send the display config
before announcing that we may do so by sending our own caps, which seems
inpolite.
2010-10-18 Arnon Gilboa <agilboa@redhat.com>
spicec: add controller
Spice client controller enables external control (e.g., by XPI or ActiveX) of
the client functionality.
The controller protocol enables setting parameters (host, port, sport, pwd,
secure channels, disabled channels, title, menus, hotkeys etc.), connecting
the server, showing and hiding the client etc.
The controller is based on the cross-platform named pipe.
spicec: add foreign menu
Spice foreign menu enables external control of the client menu.
The foreignmenu protocol enables an external application to:
add a submenu, set its title, clear it, add/modify/remove an item etc.
Foreign menu is based on the cross-platform named pipe.
2010-10-17 Arnon Gilboa <agilboa@redhat.com>
spicec-win: move named_pipe defines
spicec-win: fix menu id push to free_sys_menu_id
spicec: enable multiple CmdLineParser instantiations
Used by controller. One instance at a time, not thread-safe.
Add basename() for win32.
spicec: name host param
spicec: add ProcessLoop::on_start_running()
spicec: extract RedScreen::update_menu()
spicec: add menu id & find_sub()
2010-10-16 Hans de Goede <hdegoede@redhat.com>
server: remove useless agent send_tokens
We are keeping track of tokens for sending agent data to the client, but
the client send an initial value of ~0, and never gives us new send tokens
so this is all rather useless -> remove it.
Note that it is kept in the migration data struct for compatibility reasons.
2010-10-15 Hans de Goede <hdegoede@redhat.com>
Call read_from_vdi_port() from vdi_read_buf_release()
read_from_vdi_port(), called from vdagent_char_device_wakeup() may
fail to consume all data because no buffers are available in the
read_bufs ring. When this happens we would fail to ever read more data
from the agent on the guest as the port is throttled and stays throttled
until we've consumed all data from the current buffer.
This patch re-enables the call to read_from_vdi_port() from
vdi_read_buf_release(), so that we will try the read again when space
becomes available in the read_bufs ring.
Together with another nasty hack in the linux guest virtio_console
driver, where it waits for a write to be acked by the host before
continuing with the next one, this can lead to a linux guest
getting stuck / hang (until the write is read by the spice-server
which never happens becaus of the above issues).
Note that even with this patch, the guest will still gets stuck due to
a bug in watch_update_mask in spice-core in qemu, which causes writing
to the client to never resume once it blocked. A patch for this has been
submitted to qemu.
server: always call read_from_vdi_port() in a while loop
read_from_vdi_port() MUST always be called in a while loop until it returns 0.
This is needed because it can cause new data available events and its
recursion protection causes those to get lost. Calling it until it returns 0
ensures that all data has been consumed.
Example scenario where we can fail to read the available data otherwise:
- server/reds.c: vdagent_char_device_wakeup get called
by hw/spice-vmc.c because data has arrived from the guest,
- hw/spice-vmc.c: vmc_read get calls
- If the vmc_read call depletes the current buffer it calls
virtio_serial_throttle_port(&svc->port, false)
- This causes vmc_have_data to get called, which if in the
mean time another buffer has arrived causes
vdagent_char_device_wakeup to gets called again
(so recursively)
- vdagent_char_device_wakeup is protected against recursive
calling and ignores the second call (a nasty hack)
- if no other data arrives, the arrived data will not get read
Don't crash when a client disconnects while there were pending writes
spicec-x11: add support for image copy and paste
2010-10-12 Alexander Larsson <alexl@redhat.com>
Replace epoll with select in X client
The use of epoll in the client is totally overkill in terms of
scalability, and its a problem for portability. The OSX port converts
this to use select, but keeps some of the old complexities in the code.
This new patch makes it simpler and look much more like the windows
code.
2010-10-12 Gerd Hoffmann <kraxel@redhat.com>
server: add channel notifications.
This patch adds a channel event callback to the spice core interface.
This new callback will be called for three events:
(1) A new connection has been established.
(2) The channel is ready (i.e. authentication is done,
link message verification passed all tests, channel
is ready to use).
(3) Channel was disconnected.
Qemu will use this to send notifications to the management app.
2010-10-11 Hans de Goede <hdegoede@redhat.com>
spicec-x11: Put locks around xlib calls which wait for a reply
Since libX11-1.3.4 the multi-threading handling code of libX11 has been
changed, see:
http://cgit.freedesktop.org/xorg/lib/libX11/commit/?id=933aee1d5c53b0cc7d608011a29188b594c8d70b
This causes several issues. One of them is the display inside the
client not getting updated when there are no XEvents being generated,
this is caused by the following part of the referenced commit message:
Caveats:
- If one thread is waiting for events and another thread tries to read a reply,
both will hang until an event arrives. Previously, if this happened it might
work sometimes, but otherwise would trigger either an assertion failure or
a permanent hang.
We were depending on the otherwise behavior and apparently were lucky.
This can be seen by starting F14 in runlevel 3 and then doing startx
and not touching the mouse / keyb afterwards. Once you move the mouse
(generate an event you see the UI contents being updated but not before.
Another thing both I and Alon (iirc) have seen are hangs where 2
threads are stuck in XSync waiting for a reply simultaneously. This might
be related to libxcb version, according to the libX11 commit a libxcb
newer then 1.6 was needed, and my system had 1.5 at the time I saw this
after updating to libxcb 1.7 I can no longer reproduce.
This patch tackles both problems (and is needed for the 1st one
indepently of the 2nd one possibly being fixed) by adding XLockDisplay
calls around all libX11 calls which wait for a reply or an event.
2010-10-11 Arnon Gilboa <agilboa@redhat.com>
spice-win: handle multiple types on clipboard grab send & receive
spice-win: remove clipboard_changer hack
Instead of keeping a flag, we simply check wether the new owner is us or not
spice-win: handle type VD_AGENT_CLIPBOARD_NONE in Platform::on_clipboard_notify()
spice-win: remove windows-specific bitmap cut & paste support
will wait until png comes in
2010-10-09 Hans de Goede <hdegoede@redhat.com>
spicec: Do not try to do accounting of pci memory
Without this patch spicec reproducely hangs in
GlzDecoderWindow::pre_decode_update_window().
When GlzDecoderWindow::will_overflow() returns true,
GlzDecoderWindow::pre_decode_update_window(),
waits for a call to GlzDecoderWindow::post_decode()
to free up some memory
This happens even though there still is pci memory
available (otherwise the driver would not have
been able to send an image to decode in the first
place).
The GlzDecoderWindow::post_decode() call never happens
as the server is waiting for a reply to the decode
of the hanging image, causing the client to hang
for ever.
This patch fixes this by simply removing the
"attempted" pci memory accounting. As there is no
need for that, as the driver already must keep
track of pci memory usage.
I've verified that both the old and new Xorg drivers
take care of not overusing the pci memory themselves
I would expect the same to be true for the windows
driver.
Note the calculating of the glz_window_size in
red_client.cpp cannot be removed as the calculated
value is send as part of the SpiceMsgcDisplayInit on
connect.
2010-10-06 Hans de Goede <hdegoede@redhat.com>
spicec: only send display-config if the agent can handle it
spicec-x11: Drop annoying useless warning
Every time an events comes past where the Window is None (which happens
about once every 5 minutes or so), this annoying "invalid window" message
gets printed. Remove it!
spicec: don't send agent messages directly from ClipboardListener callbacks
ClipboardListener callbacks can run from another thread then the
main channel loop thread, where agent messages are normally dispatched from.
So they may not send agent messages directly, instead they should post
events to the main channel loop.
spicec-x11: Remove a race window in selection ownership release code
Well almost remove it, it was possible that another x11 app would acquire
selection ownership, and we would receive a release message from the
agent before having processed the xselection ownership change event.
Then we would set the selection owner to none, overriding the new owner.
As the comment in the patch indicates there still is a minute window left
where something similar can happen after this patch. Nothing we can do
about that (I blame the libX11 selection API).
spicec: Move setting of clipboard_owner to guest to platform code
Atleast under x11 there is a race condition when setting the clipboard
owner to guest from the RedClient code rather then doing it in Platform.
After the XSetSelectionOwner() in Platform::on_clipboard_grab(), which runs
from the main message loop thread, the x11 event thread can receive a
SelectionRequest event from another x11 app, before the RedClient code
has set the clipboard owner, which will trigger the owner != guest
check in the SelectionRequest event handling code.
By moving the setting of the owner in to Platform::on_clipboard_grab() it
gets protected by the clipboard lock, which closes this tiny race.
2010-10-04 Hans de Goede <hdegoede@redhat.com>
spicec-x11: make get_clipboard_type handle the None Atom
spicec-x11: protect against recursive incr properties
spicec-x11: If the clipboard was large return the memory to the system
spicec-x11: use malloc / free / realloc for clipboard data
As we need a realloc function it is better to use malloc / free /
realloc then to diy, esp. as realloc can grow the buffer without
needing a memcpy.
spicec-x11: Use a queue for XSelectionRequest events
XSelectionRequest events must be answered in the order they were
received. But for TARGETS request we can answer directly, where as
other requests need to go through the agent. This causes us to handle
things out of order, and this can cause us to have more then one
requets outstanding with the agent, which is also not what we want.
So this patch introduces a queue for XSelectionRequest events, causing
us to handle them 1 at a time and always in order.
spicec-x11: handle multiple types per grab
And also handle many x11 targets (ie utf8 variants) to a single agent
type mapping.
spicec-x11: Add XFlush calls were needed
Since we do not always "pump" libX11's event loop by calling
XPending (we only call XPending when there is data to read from the
display fd), we must always explictly flush any outstanding requests.
This patch adds a whole bunch of missing XFlush calls.
spicec-x11: Force processing of ownerchange event when releasing the cb
Make sure we process the XFixesSetSelectionOwnerNotify event caused by
us setting the clipboard owner to none, directly after setting the owner
to none. Otherwise we may end up changing the clipboard owner to none, after
it has already been re-owned because the XFixesSetSelectionOwnerNotify event
to owner none is event is still pending when we set the new owner, and
then changes the owner back to none once processed messing up our clipboard
ownership state tracking.
I saw this happening when doing copy twice in succession inside the guest.
spicec-x11: Request targets from new clipboard owner
Request targets from new clipboard owner, rather then assuming UTF-8
(not entirely complete yet, the last pieces will be in another patch).
Atleast as important this code unifies the selection getting code
for incr and non incr getting of selection data so that it can be
used for both getting regular selection data and for getting targets
selection data.
This also fixes a big bug in the (I believe untested sofar) incr support
code which was interpreting the contents of PropertyNotify events as
XSelectionEvents rather then as XpropertyEvents which are completely
differen structs!
2010-10-03 Hans de Goede <hdegoede@redhat.com>
spicec-x11: remove clipboard_changer hack
Instead of keeping a flag, we can and should simply check wether the
new owner reported in the event it us or not. Also check for the
new owner being none and send a clipboard_release when that is the
case (through set_clipboard_owner(owner_none)).
2010-10-02 Hans de Goede <hdegoede@redhat.com>
Keep track of clipboard ownership
Given that all clipboard handling is async, it is possible to for
example receive a request for clipboard data from the agent
while the client no longer owns the clipboard (ie a
VD_AGENT_CLIPBOARD_RELEASE message is in transit to the agent).
Thus it is necessary to keep track of our notion of clipboard ownership
and check received clipboard messages (both from other apps on the client
machine and from the agent) to see if they match our notion and if not
drop, or in case were a counter message is expected nack the clipboard
message.
Rename platform clipboard handling functions
Rename the 4 platform clipboard functions which get called
upon receival of an agent clipboard message to on_clipboard_*
The old set_clipboard_* names were confusing as they suggest being
a class property setter (like set_event_listener) rather then
event handler, and set_clipboard_owner was causing a name conflict
with the next patch in this series.
Move checking for on demand clipboard cap closer to sending of agent messages
This way the events will always get generated and other things
(such as clipboard ownership administration, see the next patches)
can be done in repsonse to the events, even though no message will be send.
This patch also removes the !_agent_caps check from the capability
checks, this is not needed as VD_AGENT_HAS_CAPABILITY checks _agent_caps_size
which will be 0 when _agent_caps is NULL.
2010-10-01 Hans de Goede <hdegoede@redhat.com>
Respond to clipb request with an unsupported type with data with a none type
Currently we send a VD_AGENT_CLIPBOARD_RELEASE when we receive a
VD_AGENT_CLIPBOARD_REQUEST with a type which we do not support. This is not
correct, as this means given up clipboard ownership while we may be able
to answer requests with different types. The correct response is to
nack the request by sending a VD_AGENT_CLIPBOARD (data) message with a type
of VD_AGENT_CLIPBOARD_NONE.
Change VD_AGENT_CLIPBOARD_GRAB to an array of types
A clipboard owner can indicate that it can supply the data the clipboard
owns in multiple formats, so make the data passed with a
VD_AGENT_CLIPBOARD_GRAB message an array of types rather then a single
type.
Call intern_atoms() earlier
We call XFixesSelectSelectionInput with the clipboard_atom, so we musr
initialize the atoms before calling XFixesSelectSelectionInput.
Set clipboard_event before calling send_selection_notify
send_selection_notify used the clipboard_event, so set it before calling
send_selection_notify.
wrap XGetAtomName
XGetAtomName() throws X11 errors when called on a None atom, so wrap
it catching the None case.
2010-10-01 Arnon Gilboa <agilboa@redhat.com>
client: support clipboard/selection-owner model (v2)
-includes most of Hans' review fixes (up to the SelectionRequest comment [4]) & X11 wips sent by Hans (10x!)
-use the VD_AGENT_CLIPBOARD_* types in the platform code
-add ifs for VD_AGENT_CAP_CLIPBOARD_BY_DEMAND in both sides
-support the GRAB/REQUEST/DATA/RELEASE verbs in both ways
-pasting clipboard data is now "only-by-demand" from both sides (client and agent), whose behavior is symmetric
-client and agent don't read or send the contents of the clipboard unnecessarily (e.g. copy, internal paste, repeating paste, focus change)
-set client as clipboard listener instead of application
-add atexit(cleanup) in win platform
linux:
-instead of clipboard atom selection instead of XA_PRIMARY
-enable USE_XRANDR_1_2 and support clipboard in MultyMonScreen
-send utf8 with no null termination, remove ++size
-add xfixes in configure.ac & Makefile.am
windows:
-bonus: support image cut & paste, currently only on windows
not done yet:
-clipboards formats are still uint32_t, not mime types stores as strings
-platform_win is still used, not the root window
-not replaced the ugly windows CF_DIB in agent/winclient
2010-09-29 Alexander Larsson <alexl@redhat.com>
Bump version to 0.6.1
Update NEWS for release
client: Avoid crash if platform_win is NULL
This is a temporary fix as this will be fixed for real when
the cut and paste patches land.
client: Re-enable USE_XRANDR_1_2
This was disabled by mistake before.
client: Don't hardcode -lrt
-lrt is already included in SPICE_NONPKGCONFIG_LIBS if needed so no
need to add it to the command line manually.
client: Fall back to gettimeofday if clock_gettime not found
client: Include config.h from common.h
config.h should be availible everywhere, so move its inclusion
to the top of common.h.
client: Check for pthread yield function using autoconf
Initialize variable to avoid compiler warning
Seems the OSX gcc warns on saveRight not being initialzied.
client: Include stdint.h for uint32_t
client: Don't use basename for argv[0] in --help output
This isn't what other apps do, and it had issues in the OSX port,
so just remove this.
Fix warning from OSX compiler
The OSX compiler warns about uninitialized variable, so we change
a bit how size is initialized.
2010-09-22 Alexander Larsson <alexl@redhat.com>
Handle surface images in DrawOpaque
2010-09-21 Alexander Larsson <alexl@redhat.com>
server: Handle self_image in localize_bitmap
When drawing a drawable with a NULL src bitmap that means we should
be using the previously generated self_bitmap. Not doing this causes
a segfault due to accessing the NULL.
server: Handle NULL image in red_update_streamable
A NULL src bitmap means self_bitmap, which is not a stream, so abort.
server: Use the right image size for self_bitmap
The self_bitmap is the size of self_bitmap_area, not the bbox.
This is especially important since we later copy the self_bitmap_area
into the new bitmap, and if that is larger than bbox then we will
overwrite random memory.
server: Don't leak QUIC image chunks
red_put_image() needs to free the chunks for QUIC images, as we
allocate these when creating the image.
Fix crash when resetting pixman image transform
Resetting the transform is done by setting it to the identity
transform, not passing in NULL. Passing in NULL causes a crash.
2010-09-20 Alexander Larsson <alexl@redhat.com>
server: Ensure we flush the release pipe after an oom
We really need to flush the ring to ensure that we push something on the
release ring. If we don't do this and the ring is not pushed for other
reasons we will timeout in the guest driver waiting for the ring.
Release more drawables on OOM
We've changed how resources are released so they are now being
freed continuosly, rather than on OOM, since we want to free as early
possible to avoid fragmentation. So, OOM situations should be a bit
less common now and signify a real memory shortage, so we should try
to free up more resources.
2010-09-14 Gerd Hoffmann <kraxel@redhat.com>
fix palette handling for 0.4 compat
spice 0.4 guests pass 16bpp palette colors when running in
a 16bpp video mode. Convert them to 32bpp.
fix brush handling for 0.4 compat
spice 0.4 guests pass 16bpp colors for brushes when running in
a 16bpp video mode. Convert them to 32bpp.
move command flags handling to the qxl parser
Pass through command flags to the qxl parser, so we can hide all
compat bits for spice 0.4 within the qxl parser.
2010-09-09 Hans de Goede <hdegoede@redhat.com>
spicec-x11: Fix going into a never ending loop upon xrandr event (#628573) (v2)
When handling an xrandr event the event_listener->on_monitors_change()
callback destroys and re-creates the monitor object(s) which results
in the DynamicScreen or MultyMonconstructor being called, which triggers
more xrandr events. This causes a never ending event handling loop making
spicec hang, and eventually making the X-server crash as a backlog
of events builds up and it oom's.
This patches this by explictly processing the xrandr event caused
by the constructor inside the constructor surrounded by the already
present guard code against recursive xrandr events.
2010-09-02 Yonit Halperin <yhalperi@redhat.com>
server: avoid creating a stream from traces more than once for the same drawable
could have caused ASSERT(!drawable->stream) in red_create_stream
2010-09-02 Alexander Larsson <alexl@redhat.com>
Add API to turn on backwards compatibility mode
When upgrading a cluster of machines you typically do this by
upgrading a set of machines at a time, making the new machines run
the new software version, but in a fashion compatible with the old
versions (in terms of e.g. migration). Then when all machines are
upgrades, any new features in the new version can be enabled.
This API allows qemu to limit the set of features that spice uses to
those compatible with an older version, in order to do an upgrade like
this. Right now it doesn't really do much, since we don't keep compat
with 0.4.0 atm (although that may be added later).
There is no guarantee that any future version of spice support
being compatible with any previous version. However, we will always
support compatibility with the previous major version so that clusters
can be upgraded step by step.
2010-08-31 Alexander Larsson <alexl@redhat.com>
Bump version to 0.6.0
Require spice-protocol 0.6.0
Update NEWS for release
Fix scaling with large magnification
When scaling part of an image we need to specify the source
coordinates in transformed coordinates. For large magnifications this
means we will get pretty large values.
Now, if e.g. src_x * transform is larger than 32765, then the
coordinate ends up outside the pixman 16bit image size, so the
rendering will not work.
The fix is to make the src_x/y offset part of the transformation.
This means its automatically transformed by the correct scaling, and
the coordinates passed into pixman are not (typically) over 16bit.
Revert "Fix scaling with large magnification"
This reverts commit e13be77f33609cb3fdae354ce1f2686ae865f9e0.
2010-08-31 Alon Levy <alevy@redhat.com>
client: add default agent capabilities
2010-08-31 Gerd Hoffmann <kraxel@redhat.com>
qxl parser: complete parsing of QXLCompatDrawable structs
2010-08-31 Yonit Halperin <yhalperi@redhat.com>
server: red_current_add_equal - don't push a drawable to the middle of the pipe if it depends on surfaces.
This will prevent: 1) rendering problems (commands sent to the client in the wrong order)
2) sending commands for surfaces that haven't been created yet on the client side.
2010-08-31 Alon Levy <alevy@redhat.com>
server: when woken up by data ready to be read, don't call write.
This used to be a callback for the vdi_port "data ready" interrupt,
which did indicate either data ready to read or data ready to write, but
this is no longer the case now that virtio-serial is used.
This seemingly simple fix prevents a race that needs to be fixed with
another patch, see freedesktop bz #29903
server: retry mouse send on queue full
server: bugfix - make vdi_port_write_retry reiterate if write_queue still not empty
The vdi_port_write_timer_started flag was not being reset, which prevented
another vdi_port_write_timer_start from actually starting the timer. Fix
is to change order of lines. This happens in the callback of the timer, so
no chance of double timer set.
client: add announce_capabilities
server: add subtype to SpiceCharDeviceInterface, use for vdagent
server: rename SpiceVDIPort* to SpiceCharDevice*
2010-08-30 Yonit Halperin <yhalperi@redhat.com>
server: fix red_current_flush to flush only the surface that was given as parameter
A side effect of the previous red_current_flush, which flushed all the surfaces, and was called on a new display channel connection, was
that red_handle_drawable_surfaces_client_synced sent the most updated surfaces images when needed. However, now, it should
explicitly call red_current_flush.
Moreover, since red_current_flush was called on a new display channel connection only if there was a primary surface,
if the connection of the display channel occurred at the moment of no primary surface, red_handle_drawable_surfaces_client_synced was buggy.
2010-08-30 Alexander Larsson <alexl@redhat.com>
Fix scaling with large magnification
When scaling part of an image we need to specify the source coordinates
in transformed coordinates. For large magnifications this means
we will get pretty large values.
Now, if e.g. src_x * transform is larger than 32765, then the coordinate
ends up outside the pixman 16bit image size, so the rendering
will not work.
In order to work around this we generate a "sub-image" of the pixman
image such that the src_x/y values we have to specify are zero (or near
zero).
2010-08-30 Gerd Hoffmann <kraxel@redhat.com>
Bump versions.
Update #define in server/spice.h in preparation for the 0.6.0 release.
We also got some new functions, thus we have to increate the shared
lib minor number for spice-server.
Add config functions.
A bunch of configuration functions where never ported forward from
rhel-6 to upstream. Add them so we can add qemu config options for
these settings.
2010-08-30 Alon Levy <alevy@redhat.com>
Merge commit 'ea298a14e1cde8b811baf6bd187287f18dde0dee'
server: moved agent pipe headers to spice-protocol
2010-08-30 Yonit Halperin <yhalperi@redhat.com>
server: cleanups in destorying surfaces code
server: really wait for a surface to be destroyed, when calling destroy_surface_wait
Waiting till all the pipe items that are dependent on the surface will be sent.
This was probably the cause for freedesktop bug #29750.
server: consider also PIPE_ITEM_UPGRADE when searching for drawables in red_clear_surface_drawables_from_pipe
2010-08-27 Alexander Larsson <alexl@redhat.com>
canvas: Better coordinate rounding in scaling
When scaling in pixman you give the source coordinates in transformed
space rather than in the source coordinates. This is a bit problematic
when both source and destination coordinates are at integer positions, but
the scaling factor is not an exact 16.16 fixed point value. We used
to calculate the transformed source based on the floating point
transformation, which gave the wrong answer sometimes. Now we do the
calculations based on the fixed point transform that we give pixman.
However, even with this patch I can still sometimes see issues related
to this, although they are less bad.
server: red_send_image() - append image data to right marshaller
The actual bitmap data was added to the main marshaller rather than
the submarshaller that pointed to the SpiceImage part. This made us
send too short messages failing demarshalling in the client.
server: red_send_image() initialize bitmap.flags
We're currently sending this to the network based on random memory.
2010-08-27 Gerd Hoffmann <kraxel@redhat.com>
zap more unused bits.
BufDescriptor isn't used at all.
Two AddBufInfo fields (slot_id and group_id) are not used any more.
red_get_cursor: avoid extra copy
2010-08-26 Gerd Hoffmann <kraxel@redhat.com>
fix red_cursur_flush segfault
zap dead typedefs
zap dead qxl chunk code
qxl parser: add cursor parsing
qxl parser: complete QXL_SURFACE_CMD_CREATE parsing
2010-08-26 Alexander Larsson <alexl@redhat.com>
server: Fix alloc_lz_image_surface stride allocations
All lz surfaces are not 4 bytes per pixel, calculate the right stride
based on the pixman format.
2010-08-25 Yonit Halperin <yhalperi@redhat.com>
server: clean glz drawables when reseting qxl
When the we reset qxl, we destroy all srufaces. Since surfaces and glz
drawables are no longer dependent, we need to call red_display_clear_glz_drawables explicitly
in order to clear all our drawables references in the server.
2010-08-25 Alexander Larsson <alexl@redhat.com>
server: Add missing break in switch case
client: Handle async errors from xshm setup
XShmAttach can fail asynchronously, so we need to check the
errors in the x error handler during the XSync.
2010-08-24 Alexander Larsson <alexl@redhat.com>
client: Don't leak xshm segments
Don't try xshm any more if it fails for a permanent reason
This is copied from how Gtk+ detects Xshm failures.
2010-08-24 Yonit Halperin <yhalperi@yhalperi.tlv.redhat.com>
server: remove the no longer used glz drawables list that was maintained for each surface.
server: remove unnecessary dependency between surfaces and Glz drawables
Fixes freedesktop bug #28568
2010-08-23 Alexander Larsson <alexl@redhat.com>
Fix mismerge in last commit
Remove USE_EXCLUDE_RGN define and !USE_EXCLUDE_RGN code
Remove STREAM_TRACE define and !STREAM_TRACE code
2010-08-23 Yonit Halperin <yhalperi@redhat.com>
Limiting video streaming to the primary surface. freedesktop bug #28088.
client: Fix for clipboard sending; It wasn't thread safe.
client: fix - exit on bad display-effect argument
2010-08-18 Alexander Larsson <alexl@redhat.com>
Stride can be negative, so don't use size_t for it
2010-08-17 Alon Levy <alevy@redhat.com>
support python 2.5.4+ for marshaller/demarshallers
Patch adds a "from __future__" import that doesn't affect newer python's but
allows python 2.5.4 to run the code (tested under scratchbox, n900 build environment)
2010-07-29 Alon Levy <alevy@redhat.com>
client: Application::get_screen: fix double SpicePoint size, second hiding the first
add arm and armv7 to configurable 32 bit variants in configure.ac (n900 and pc-z1 tested respectively)
add eol after #ifdef in jpeg_encoder.h for n900 scratchbox compiler
2010-07-22 Alon Levy <alevy@redhat.com>
server: add vdi_port write retry timer. RHBZ 616772
2010-07-21 Alexander Larsson <alexl@redhat.com>
Don't do manual marshalling for input channel
Fix typo in NEWS
2010-07-20 Alexander Larsson <alexl@redhat.com>
Update NEWS for 0.5.3
Require spice-protocol 0.5.3 or later
Bump version to 0.5.3
server: Properly order rgb for 24bit bitmaps when sending to libjpeg
SPICE_BITMAP_FMT_24BIT order is bgr, libjpeg wants rgb.
This fixes freedesktop bug #28089
Swap red and blue when decoding 0.4 mjpeg streams
There was an error in how this was encoded in 0.4, which we need
to handle. There is still some issues with the old streams as
the luminocity handling in 0.4 was not correct.
demarshaller: Fix palette marshalling
It turns out that using base + sizeof(struct) is not a good way to
access an array at the end of a struct. For SpicePalette sizeof is 16, but
offset of ents is 12. Using this calculation in the demarshaller breaks
things badly, so now we use the actual array member.
Don't send padding over the network with video data
2010-07-19 Alexander Larsson <alexl@redhat.com>
Fix uninitialized variable warnings
Don't send CursorHeader if cursor_flags is NONE
Send Clip.rects inline rather than using a pointer
codegen: Allow @to_ptr to make inline structs demarshal as pointers
codegen: Various cleanups
Remove all uses of @end in the marshaller, instead just using
the C struct array-at-end-of-struct. To make this work we also remove
all use of @end for switches (making them C unions).
We drop the zero member of the notify message so that we can avoid this
use of @end for a primitive in the marshaller (plus its useless to send
over the wire).
We change the offsets and stuff in the migration messages to real pointers.
codegen: Pass member to SubMarshallingSource rather than name
This way we can check attributes on the member.
codegen: Remove unused methos has_pointer()
2010-07-19 Alon Levy <alevy@redhat.com>
server vdi port: prevent recursive calls to read_from_vdi_port (required for spice-vmc)
2010-07-19 Arnon Gilboa <agilboa@redhat.com>
client: add clipboard support
* windows - untested
* linux - small strings both ways, large implemented differently:
* client to guest - support INCR
* guest to client - we supply a single possibly very large property
* requires server changes in next patch to work with spice-vmc
2010-07-19 Alon Levy <alevy@redhat.com>
fix typo DisplayModeListner -> DisplayModeListener
2010-07-19 Yonit Halperin <yhalperi@redhat.com>
client: command line arguments for setting windows guest monitors' color depth and disabling some display options (helpful on WAN)
2010-07-15 Yonit Halperin <yhalperi@redhat.com>
canvas_base jpeg_alpha: supply the correct size to jpeg_decoder
Merge branch 'master' of git://git.freedesktop.org/git/spice/spice into spice_image
2010-07-14 Gerd Hoffmann <kraxel@redhat.com>
add SPICE_SERVER_VERSION
Allow to ifdef features which depend on a certain libspice-server release.
update shlib minor
commit c90183da944001e466f60acb58a5052c353995ca added two new functions,
update shared lib minor version for that.
2010-07-14 Yonit Halperin <yhalperi@redhat.com>
server: enabling/disabling jpeg and zlib-over-glz via spice command line args
2010-07-13 Gerd Hoffmann <kraxel@redhat.com>
red_glz_compress_image: lines isn't needed any more
2010-07-12 Yonit Halperin <yhalperi@redhat.com>
server: enabling/disabling jpeg and zlib-over-glz via spice command line args
2010-07-09 Alexander Larsson <alexl@redhat.com>
Don't marshall bitmap data as pointer, instead send inline
Add --enable-werror and make it the default only for git builds
Its not generally a good idea to have released tarballs build with
-Werror, as later compilers may add warnings breaking old releases, etc.
Use the right enum types for bitmap_data.type comparisons
Add files i forgot to commit
2010-07-08 Alexander Larsson <alexl@redhat.com>
Update NEWS for release
Disable tunnel by default on windows
Make tunnel support optional in client too
Make distcheck work
Missed some misspelling fixes
Fix various misspellings
letancy -> latency
compund -> compound
SpicedSubMessage -> SpiceSubMessage
modifaiers -> modifiers
massage -> message
outgoiong -> outgoing
AlphaBlnd -> AlphaBlend
remoth -> remote
modifires -> modifiers
secore -> secure
Fix sign warnings from win32 compiler
Fix inclusion of common files, no need for common/ part
server: Remove unnecessary pci id/rev checks
There is no need to check the pci ids or revisions. Thats a contract
between qemu and the driver, and spice need not care, as long as
we get the right data from qemu.
Simplify spice_pixman_region32_init_rects with new types
Don't manually of SpiceRects to pixman_box32_t now that they are compatible
and SpiceRect is internal.
Make all internal structures not be packed
Remove unused method declarations
Move SpiceChunks to mem.h
Move in spice/draw.h from spice-protocol to common/
Handle the new QXLCursorHeader type
Use QXLPHYSICAL, not SPICE_ADDRESS in qxl parser
codegen: No SPICE_ADDRESS types left, drop @c_ptr
Properly parse QXLLineAttrs.style
2010-07-08 Gerd Hoffmann <kraxel@redhat.com>
remove QXLInterface->has_command()
Not used any more, zap it before rolling up a release tarball.
2010-07-08 Uri Lublin <uril@redhat.com>
server: add missing ifdef USE_OGL (red_worker.c)
2010-07-07 Gerd Hoffmann <kraxel@redhat.com>
Properly parse QXLImage to the new-world SpiceImage
SpiceImage now replaces RedImage and has all image types in it.
All image data are now chunked (and as such not copied when demarshalling).
2010-07-07 Alexander Larsson <alexl@redhat.com>
codegen: support @chunk on non-pointer arrays
This is similar to @as_ptr, but generates a single chunk of data.
Add support for @chunk
marshaller: Make get_nw_offset() handle deep member references
Add spice_marshaller_add_ref_chunks
Add spice_chunks_* helpers
2010-07-05 Alexander Larsson <alexl@redhat.com>
Convert SpicePath.segments to a pointer array
Handle extra size for switch and array the right way
Even for is_extra_size() we should calculate the mem_size for
arrays, its just that the parent type (in this case switch) should
request mem_size if the type is_extra_size.
marshaller: Add some docs describing the types of sizes
marshaller: Make @nonnull a propagated attribute
This cleans up some stuff
marshaller: Make @c_ptr a propagated attribute
This simplifies some code
marshaller: Add generic way to handle propagating attributes
Also switches @ptr_array to use this
2010-07-02 Gerd Hoffmann <kraxel@redhat.com>
Properly parse and marshall SpiceString
2010-07-01 Alexander Larsson <alexl@redhat.com>
Fix build on win32
Fix 32bit failure in demarshaller
Due to a typo we always read offsets as pointers, never as SPICE_ADDRESS.
Update for the SpicePath.segments type change
2010-07-01 Alon Levy <alevy@redhat.com>
Make CEGUI optional
This makes the CEGUI dependency optional and off by default. Restoring
previous behaviour of exiting on disconnect if disabled.
2010-07-01 Alexander Larsson <alexl@redhat.com>
client: Use ASSERT, not assert
2010-07-01 Alon Levy <alevy@redhat.com>
- fix for noopengl patch for server
I still don't have commit access (can't ssh to anarchy) so if someone could commit this (alex) thanks,
Alon
Fix for no opengl patch - required to compile the server (fixes missing symbol gl_canvas_init).
2010-07-01 Yonit Halperin <yhalperi@redhat.com>
fix for not clearing the cursor ring when the primary surface is destroyed
fixes a crash in qxl_soft_reset
2010-06-30 Alexander Larsson <alexl@redhat.com>
Simplify SpiceLineAttr by removing unsed stuff
Also in new protocol don't send style data if not needed.
Automatically marshall SpiceClipRects
Automatically marshall SpicePath
Support @marshall to automatically marshall pointers
Store SpicePath segment count rather than size
Internally and in the network protocol (for the new version) we
now store the actual number of segments rather than the size of the
full segments array in bytes. This change consists of multiple changes
to handle this:
* Make the qxl parser calculate num_segments
* Make the canvas stroke code handle the new SpicePath layout.
* Fix up is_equal_path in red_worker.c for the new layout
* replace multiple calls to spice_marshall_PathSegment with a single
spice_marshall_Path call
* Make the byte_size() array size handling do the conversion from
network size to number of elements when marshalling/demarshalling.
* Update the current spice protocol to send the segment count rather than
the size
* Update the old spice protocol to use the new byte_size functionallity
to calculate the size sent and the number of elements recieved
Add spice_marshaller_set_uint32
With this function you can update an added uint32 after it being added.
To make this possible all the spice_marshaller_add_add_foo functions
now return a pointer that can be used as a reference when later
setting a value.
Update client and protocol to support the new SpiceClipRects
demarshaller: Support @c_ptr attributes for pointers
A @c_ptr pointer is stored in memory as a real pointer rather than a
SPICE_ADDRESS. This is a temporary thing that will be removed again
when all SPICE_ADDRESSes have been converted to real pointer.
demarshaller: Don't parse @zero members
These just write zeros at the right place in the network protocol
typically for old back-compat things. We don't want to read these
back in.
2010-06-30 Gerd Hoffmann <kraxel@redhat.com>
qxl-abi: handle clip rect and path references.
red_parse_qxl.c starts to follow QXLPHYSICAL references and build up
data structures. Can zap a bunch of get_virt calls in red_worker.c,
followed by cleanups.
(de-) marshaller needs updates to deal with that. Also I suspect with
the get_virt() calls being gone we can offload more work to generated
marshaller code.
client doesn't build.
add qxl chunk parser
2010-06-29 Alexander Larsson <alexl@redhat.com>
server: Don't call opengl if not enabled
If USE_OGL is not defined, really don't call or link in the opengl
backend.
2010-06-29 Yonit Halperin <yhalperi@redhat.com>
client: add --include "common.h" for generated marshallers
fixed unhandled destroy screen in Application:restore_screens_size
detaching the screen when the primary surface is destoryed and closing the window if the primary surface is not recreated (the monitor has been detached).
remove unnecessary send of SPICE_MSG_DISPLAY_RESET
when SPICE_MSG_DISPLAY_RESET was sent, SPICE_MSG_DISPLAY_SURFACE_DESTROY had already
been sent for all surfaces.
It also caused a client crash since DisplayChannel::handle_reset assumes that screen
exists.
2010-06-29 Gerd Hoffmann <kraxel@redhat.com>
qxl abi: parse QXLRect.
qxl abi: parse QXLPoint & friends.
qxl abi: parse QXLCursorCmd.
qxl abi: parse QXLSurfaceCmd.
qxl abi: parse QXLMessage.
qxl abi: parse QXLUpdateCmd.
qxl abi: parse QXLClip.
qxl abi: parse QXLLineAttr.
qxl abi: parse QXLPattern.
qxl abi: parse QXLBrush.
qxl abi: parse QXLQMask.
qxl abi: parse QXLBlackness+QXLInvers+QXLWhiteness.
qxl abi: parse QXLText.
qxl abi: parse QXLStroke.
qxl abi: parse QXLRop3.
qxl abi: parse QXLTransparent.
qxl abi: parse QXLCopy + QXLBlend.
Also adapt to tyops fix (s/rop_decriptor/rop_descriptor/).
qxl abi: add missing QXLCopyBits
qxl abi: parse QXLOpaque.
Also adapt to tyops fix (s/rop_decriptor/rop_descriptor/).
qxl abi: parse QXLFill.
Also adapt to tyops fix (s/rop_decriptor/rop_descriptor/).
qxl abi: parse QXLAlphaBlnd (+Compat)
qxl abi: parse QXLCompatDrawable.
qxl abi: parse QXLDrawable.
improve memory slot error logging.
2010-06-28 Alexander Larsson <alexl@redhat.com>
Replace log4cpp with custom log function
Also prints a simpler error to stderr for WARN or above so that
we print something on the commandline if something go wrong.
Fix build error due to member "SpiceMsgEmpty" same name as type
2010-06-24 Alexander Larsson <alexl@redhat.com>
spice.proto: surface_create.format is of type surface_fmt
Use smaller size for enums and flags on the network
This makes the protocol more compact. This was mainly done for the commonly
used types. Some seldom used ones are still 32bit for future compatibility.
Remove support for clip by path
This is not supported currently anyway and was not generated before.
2010-06-23 Alexander Larsson <alexl@redhat.com>
spice.proto: No need for @ptr32 as that is now the default
spice.proto: Don't use @fixedsize for Brush
There is no reason to send the maximum size on the network, that is just
a waste of space most of the time.
Don't send zero data item for clips with no data
Make pointers 32bit in new protocol format
marshaller: Correctly determine if switches are fixed size
Switches are fixed size only if all cases have the same size *and*
it has a default case or all the valid cases are listed.
Fix handling of @ptr32 network size
Remove minor markup in unstable protocol as we're resetting minor to 0
2010-06-23 Gerd Hoffmann <kraxel@redhat.com>
fix use-after-free in spice_marshaller_reset
drop bogous get_virt_delta calls
2010-06-23 Alexander Larsson <alexl@redhat.com>
Fix version mismatch error on connect
Protocol is 0 (auto), 1 (old), or 2 (new). This is (apart from 0) the
same as the major number for the stable protocol. However, the current major
is ~(-1) to signify it being unstable, so don't use the major number as source
for setting or comparing protocol.
Fix screen resolution changes on old servers
* Correctly check for existing canvas 0
* Don't try to unlock the screen size if there is no active screen
2010-06-22 Alexander Larsson <alexl@redhat.com>
client: Support connecting to a major==1 server
Implement display_mode message needed for backwards compat
Generate marshaller/demarshallers for old protocol
Add spice1.proto describing the 0.4 version of the network protocolx
Add support for @virtual markup in spice protocol
This means the member is not sent on the network at all.
Instead its initialized to the attribute argument when demarshalled.
This is useful for backwards compatibility support.
Make internal generated marshaller functions static
Support extra prefix in code generators
This is require when we add a new spice.proto for the old (major 1)
protocol description.
Add more emacs mode headers
Convert client to use indirect calls for message marshalling
This is required to support multiple versions
Support creating marshallers that are called indirectly
This is needed if we want to switch marshallers depending on what
major version the remote side has.
Add destructor for demarshalled messages
This is required because we don't want to free messages that just
refer to the unparsed message (like SpiceMsgData).
Also, in the future we might need it for more complex demarshalling.
2010-06-21 Yonit Halperin <yhalperi@redhat.com>
fix for not reseting client palette caches on migration
Lossy compression of RGBA images (on WAN connection)
The RGB channels are compressed using JPEG.
The alpha channel is compressed using LZ.
applying zlib compression over glz on WAN connection
2010-06-21 Alexander Larsson <alexl@redhat.com>
Make opengl optional, disabled by default
The OpenGL renderer isn't really useful right now, its not quite up
to date, its not really faster than software and it only supports a limited
subset of drivers. So, lets disable it for now.
Long term opengl rendering of the 2d part of spice is important if we want
to combine 2d and 3d rendering (say if spice adds opengl support in the
protocol). But until then this is isn't useful for normal use.
2010-06-18 Alexander Larsson <alexl@redhat.com>
Make generated marshallers build on win32
Add server/demarshaller.h
Make sound data @as_ptr to avoid copying data
Make ping data @as_ptr to avoid copying data
Make cursor data @as_ptr to avoid copying data
Support @as_ptr in demarshaller to avoid copying data unnecessary
Make pointer types in messages be 64bit in memory
Right now we always assume pointers are stored as SPICE_ADDRESS,
i.e. 64bit, independent on the size sent on the network.
This is required for 64bit architectures of course, but slightly overkill
on 32bit architectures, so needs fixing when all SPICE_ADDRESS elements
can be made internal.
Don't pack the message structures
Make all message structs internal to spice
We move all message structs from spice-protocol to spice as
we want to be able to change these as needed internally. The
on-network format is no longer defined by these structures anyway,
but rather by the spice protocol description.
Allow multiple --include args
Use generated demarshallers in server
Generate demarshallers on server side
Make tunnel_service_add members be of cstring array size
Switch client to use generated marshallers
Generate and link marshallers into client
Re-enable cache freeing
I don't know why this was disabled but it seems like a bad idea
Convert reds.c to use SpiceMarshaller
Convert snd_worker.c to use SpiceMarshaller and generated marshallers
Convert red_worker.c to use SpiceMarshaller for marshalling
Generate marshallers in server
Use @ptr32 for 32bit offsets in spice.proto
Add @nomarshal in a few places where we're marshalling manually
spice.proto: add @outvar markup
With this we can reference pointer member with no naming conflicts
Add support for generating message and structure marshallers
Add SpiceMarshaller for easy marshalling
Generate demarshalling code on win32 too
Client: Use the autogenerated demarshallers
When a message has been read from the network we now pass it into
the generated demarshaller for the channel. The demarshaller converts
the network data to in-memory structures that is passed on to the
spice internals.
Additionally it also:
* Converts endianness
* Validates sizes of message and any pointers in it
* Localizes offsets (converts them to pointers)
* Checks for zero offsets in messages where they are not supported
Some of this was previously done using custom code in the client, this
is now removed.
Generate demarshallers in client
Add python code to automake system
Initial import of spice protocol description and demarshall generator
The "spice.proto" file describes in detail the networking prototcol
that spice uses and spice_codegen.py can parse this and generate
demarshallers for such network messages.
Use the correctly spelled enum values from the new generated enums
Use the new enums for keyboard modifier flags
2010-06-17 Alexander Larsson <alexl@redhat.com>
There are multiple line attribute flags enums, use only one
Add spice_strnlen
2010-06-09 Yonit Halperin <yhalperi@redhat.com>
server: optimize red_pipe_replace_rendered_drawables_with_images (lossy bitmaps support related)
init/destroy lossy surface region
enabling jpeg on low bandwidth connection
not using jpeg when sending a surface to the client (the whole surface)
When a surface is sent to the client using red_send_surface_image, operations were already
performed on it. Thus it may combine, especially if it is a primary surface, both "picture-like" areas
and areas that are more "artificial". In order to avoid noticeable artifacts, such surface will be sent lossless.
send qxl commands to client: support for resending lossy components when jpeg compression is enabled
infrastructure routines for resending to the client part of surfaces that have been sent lossy.
The code also handles cases in which the server doesn't hold anymore these surfaces parts, i.e., when
it holds a more updated version of them. This scenario is handled by replacing commands that were rendered, with images.
introducing lossy and lz compression in red_send_image
lossy surface regions in the client: infrastructure for tracking and updating
support for lossy images in the pixmap cache and fill bits
1) add an option to determine if a bitmap can be sent lossy to the client
2) when required, replacing lossy cache items with their correspending
lossless bitmaps
JPEG support: introducing jpeg encoding for spice bitmaps
server: fix bitmap flags assignment in red_send_image
2010-06-09 Alexander Larsson <alexl@redhat.com>
client: Only invalidate on screen if drawing to the primary surface
2010-05-26 Gerd Hoffmann <kraxel@redhat.com>
sound: code style fixups
2010-05-21 Alexander Larsson <alexl@redhat.com>
Fix some misspelled identifiers
severty -> severity
SpiceResorceID -> SpiceResourceID
SpiceResorceList -> SpiceResourceList
resorces -> resources
ped_size -> pad_size
postition -> position
RedWorkeMessage -> RedWorkerMessage
Fix spelling errors in comments and strings
2010-05-21 Gerd Hoffmann <kraxel@redhat.com>
sound channels: restart audio on client reconnect.
2010-05-19 Alexander Larsson <alexl@redhat.com>
Use the new byteswap macros from spice-protocol
Change leftover VD_INTERFACE_RECORD to SPICE_INTERFACE_RECORD
Add missing backslash continuation in makefile
2010-05-19 Gerd Hoffmann <kraxel@redhat.com>
Revert "[debug] migration troubleshooting"
This reverts commit 08927fabe57c17086fe3bce3a9ca166e2309349e.
complete NetWireInterface redesign, make red_tunnel_worker.c build.
add spice-experimental.h
Supposed to be used for work-in-progress bits,
where interfaces are not finalized yet.
Moved over vdi port interface, tunnel interface
and spice client migration functions.
zap vd_interface.h
move over content to spice.h
vd_interface.h cleanups.
Drop leftover bits which are not used any more.
Rename DrawArea to QXLDrawArea.
NetWireInterface: redesign
zap MigrationInterface
Remove remaining MigrationInterface bits.
migration: new api
Add new API for migration, based on what RHEL-6 has.
[debug] migration troubleshooting
zap migration code
Drop all code which depends on accessing the migration file handle.
replace worker load/save with loadvm_commands, allow keeping surface content
Add worker->loadvm_commands. qemu will uses this to send a series of
commands needed to restore state after savevm/loadvm and migration.
That will be one create-surface command per surface and one cursor-set
command for the local pointer.
The worker->save/load functions are not needed any more.
Likewise the interface->{get,set}_save_data callbacks.
Surfaces created via loadvm_commands *will* not be cleared. Also
primary surfaces are not cleared any more (unconditionally, although
we could do that conditionally on loadvm using the flags field in
QXLSurfaceCreate).
surface: keep metadata (aka create command) in device memory.
With this patch applied the spice server will not release surface create
commands for the whole lifecycle of the surface. When the surface is
destroyed both create and destroy commands are released.
This has the effect that the surface metadata (size, depth, ...) is kept
in qxl device memory. This in turn makes it alot easier for qemu to
handle savevm/loadvm. It just needs to do some minimal command parsing
and maintain pointers to the create commands for the active surfaces.
kill spice_server_set_mouse_absolute
Not needed. Just register/unregister the tablet interface instead.
vdi port: redesign.
Pretty straight forward.
One thing we should think about is if and how we are going to deal
with multiple ports here?
With vdi port using virtio-serial as communication channel to the guest
it is easy to have multiple ports, i.e. we might want to use a second
instance for clipboard data. That implies that we need support for
multiple channels all the way through the stack ...
constify SpiceBaseInterface
SoundInterfaces: redesign
TabletInterface: redesign
QXL: redesign.
MouseInterface: redesign
KeyboardInterface: redesign.
This is the direction I wanna take with all interfaces: Clearly
separate interface (aka version information and function pointers)
and state information. SpiceKbdInterface defines the interface,
SpiceKbdInstance maintains per-instance state information. Keyboard
hasn't much beside a pointer to SpiceKbdInterface, for other
interfaces this very likely will be different.
s/CoreInterface/SpiceCoreInterface/
VDInterface: redesign.
VDInterface has been renamed to SpiceBaseInterface. Dropped base_version
element, shlib versioning should be used instead. Dropped id element,
it is passed to spice_server_add_interface() instead. Now
SpiceBaseInterface has static information only, multiple interface
instances can share it.
Added SpiceBaseInstance struct for maintaining per-instance state
information. Adapted spice_server_{add,remove}_interface() functions
to the new world.
shlib major
minor timer interface cleanups.
Make the timer interface largely look like the watch interface.
Simliar naming convention for the functions (timer_*) and a
opaque SpiceTimer type.
new watch api: kill old api
new watch api: switch channels
new watch api: switch sound
new watch api: switch migration
new watch api: switch inputs
new watch api: switch ssl accept
new watch api: switch main channel
new watch api: switch liasync read
new watch api: switch listening sockets
introduce new watch api
This patch adds a new file handle watch interface to libspice, featuring
three callbacks:
(1) watch_add() -- create a new file watch.
(2) watch_update_mask() -- change event mask. spice frequently
enables/disables write notification.
(3) watch_remove() -- remove a file watch.
libspice users must implement these functions to allow libspice
monitoring file handles.
The old interface (set_file_handlers) doesn't explicitly express the
lifecycle of a watch. Also it maps 1:1 to a qemu-internal function.
In case the way qemu implements file watches changes (someone sayed
QemuIONotifier?) this will break horribly. Beside that it is very
bad style.
Follwing patches will switch over users one by one to the new interface
and finally zap the old one.
fix visibility
zap CoreInterface->{term_printf,log}
Was used to print stuff to the qemu monitor.
Fundamentally incompatible with QMP. Remove.
zap qterm interfaces
old way to handle monitor, obsolete.
zap CoreInterface->(un)register_change_notifiers()
spice_server_add_interface() and spice_server_remove_interface()
can be used instead.
zap CoreInterface->next()
Interfaces must be registered after spice_server_init().
The "next" callback is used to discover interfaces
registered before spice_server_init(). Which is a empty
list and thus pretty pointless. Remove it.
channel security cleanup
- drop spice_channel_name_t enum, use spice-protocol defines instead.
- switch spice_server_set_channel_security() channel parameter from
enum to string.
- drop spice_server_set_default_channel_security(), use
spice_server_set_channel_security with channel == NULL instead.
zap spice_parse_args + spice_usage_str
First step to throw out the old interface.
2010-05-19 Alexander Larsson <alexl@redhat.com>
Minor whitespace cleanup
Make it --enable-tunnel work
2010-05-03 Yonit Halperin <yhalperi@redhat.com>
server: fix invalid self loop in surfaces dependencies.
Cyclic dependencies between surfaces mustn't occur. They can cause invalid rendering -
recent drawables might be rendered before older ones.
2010-05-03 Dan Kenigsberg <danken@redhat.com>
spice server: fix typo in private key error message
2010-05-03 Gerd Hoffmann <kraxel@redhat.com>
Add C version of find_msb()
This patch allows people to build the spice-client on any 32bit/64bit
architecture.
by Bryan Stillwell <bryan@bokeoa.com>
2010-05-03 Alexander Larsson <alexl@redhat.com>
Remove all mentions of "cairo" from the code
The command line option is renamed from "cairo" to "sw", and
similarly all filenames and types from Cairo to Sw (and similar).
2010-04-30 Alexander Larsson <alexl@redhat.com>
Don't send alpha bytes for primary surface
The framebuffer is not used as a source for alpha blends, so we never
need to scan it for alpha bytes.
2010-04-29 Gerd Hoffmann <kraxel@redhat.com>
iovec: add sanity check
Adds sanity check to iovec setup. In theory this should never ever
trigger. In practice guest driver bugs can make it trigger. This
patch avoids qemu burning cpu in a endless loop, instead we'll print a
message and abort. Not sure whenever there is a more graceful way to
handle the situation ...
fix worker->stop surface cleanup
2010-04-29 Alexander Larsson <alexl@redhat.com>
client: Report window format right for win32
client: Support 16bpp pixmaps on win32
win32 client: Remove unnecessary GDIImage type
We just use pixman_image_t as the "information about image data" structure.
2010-04-28 Alexander Larsson <alexl@redhat.com>
Add support for SPICE_IMAGE_FLAGS_HIGH_BITS_SET
Clear alpha in xRGB destination to avoid pixman setting it to 0xff
Pixman sometimes sets the ignored high byte to 0xff during alpha
blending. This is correct according to pixman specs, as the high
byte is ignored. However its not what windows expects, and it causes
unnecessary regions with non-zero high byte, causing us to
send rgba data instead of rgb which compresses worse.
So, we detect this and clear the high byte.
Fix line lengths and tabs
2010-04-26 Gerd Hoffmann <kraxel@redhat.com>
fix two warnings
2010-04-23 Alexander Larsson <alexl@redhat.com>
Remove surface format workaround now that win32 driver is fixed
The win32 driver makes all 32bit surfaces be xRGB now, so we
can remove this old workaround.
Fix up win32 client with recent changes
Win32 canvas fixes
If we have alpha in a 32bit rgb surface, ensure we send that
If we don't then alpha is lost which is problematic if the surface
is later used as with alpha_blend and SRC_SURFACE_HAS_ALPHA.
Support alpha surface sources and destinations
Localize palettes for LZ PLT format
This is needed since they always decode to 32bit mode.
Server: Use the right image format when updating from a surface
Make each surface its own depth/format
Surface creation now specifies the exact format, not only the bit depth
of each surface which is used for rendering.
Additionally we now actually store the surfaces in that format, instead
of converting everything to 32bpp when drawing or e.g. handling palettes.
Client: Support pixmap format conversion in copy_pixels
In order to be able to support 16bit canvases on 32bit screens and 32bit
canvases on 16bit screens we need to handle format conversion when drawing
RedPixmaps.
The way this works now for X11 is that we only have one PIXELS_SOURCE_TYPE
for pixmaps, which always has a pixman_image_t for the data, but additionally
it has an XImage (shared mem or not) if the screen the pixmap was created
for (i.e. an explicit one or the default screen) has the same format as
the pixmap.
When we draw a pixmap on a drawable we have two variants. If the pixmap
has a XImage and it matches the format of the target drawable then we
just X(Shm)PutImage it to the drawable. If the formats differ, then we
create a temporary XImage and convert into that before drawing it to
the screen.
Right now this is a bit inefficient, because we always allocate a new
temporary image when converting. We want to add some caching here, but
at least this lets things work again.
X11 client: Add helper for XImage construction
Add utility functions to create XShm images
Create screen composit area in same format as window
This way we don't have to convert when drawing to it, or drawing it to
the dc.
Add helper to compare RedDrawable::Formats for copy compabible
Being copy compatible means the format are identical except
that some bits in the source may be ignored in the destination.
Add RedDrawable::Format get_format()
This is useful because we can e.g. create pixmaps in the same format as
a window.
Add XPlatform::get_screen_format for X11
Move RedPixmap::Format to RedDrawable::Format
We need to know the format for other drawables too (like for instance
the native format of a window), so we're pushing this down.
This changes a bunch of references to be RedDrawable::, but not all.
The the old RedPixmap:: references still work, but will be phased out.
Make client canvas and pixmaps handle more formats and simplify
We now support 16bit format pixmaps as well as the old ones. Including
both 555 and 565 modes.
We drop the palette argument for pixmap construction as it was only
used for black/white anyway.
Canvas creation is simplified so that there is no separate set_mode
state. Canvases are already created in the right mode and never change.
common: Add lookaside storage for pixman image format
Ideally we should just read this from the pixman image, but
there is no API to do so in stable pixman, so we store it.
Add pixman utilities for bitmap to pixman_image_t conversion
Add support for 16bit rop3
Add emacs modelines to more files
Remove unused method canvas_surf_to_invers
Make client start if screen is 16bpp
The current glx code is looking for a rgb32 visual and always failing
if there is none. This means not even software rendering starts up
on e.g. 16bit visuals. This commit makes it pick software fallbacks
on 16bit visuals.
Long term we need to fix the gl implementation to do 16bpp too.
Client: Don't die if XIM not availible
Detect XShm extension sanely
The previous way XShm detection worked failed at least for me, and is
not the standard way. We now just use XShmQueryExtension and
XShmQueryVersion.
Detect big endian systems
Fix warnings breaking win32 build
2010-04-14 Izik Eidus <ieidus@redhat.com>
Merge branch 'master' of ssh://git.freedesktop.org/git/spice/spice
spice: server: change update_area command
The new command return dirty area to be used
by users that want spice to render localy or
into some framebuffer (sdl / vnc)
2010-04-14 Alexander Larsson <alexl@redhat.com>
Avoid unncessary buffer management in mjpeg decoder if possible
2010-04-13 Alexander Larsson <alexl@redhat.com>
Relicense everything from GPL to LGPL 2.1+
Fix A1 handling in RedDrawable combine_pixels.
The previous code was just busted, as apparent on e.g. the cursor
in MS Paint.
2010-04-12 Alexander Larsson <alexl@redhat.com>
Use upstream name for pthreads lib and new freetype version
Fixed vs2008 warning
Fix win32 build with pixman 0.18.0
Use fast DCT method for better jpeg compression performance
2010-04-12 Izik Eidus <ieidus@redhat.com>
spice server: fix validate_chunk
fix 16bpp support on cairo_canvas
2010-04-12 Alexander Larsson <alexl@redhat.com>
Always tread depth 24 (i.e. non alpha) as depth 32 when blitting
When blitting we don't really care about alpha mismatches, we just copy bits
anyway.
2010-04-09 Izik Eidus <ieidus@redhat.com>
take the right lock when freeing glz stuff of surfaces
this was noticed by Yonit.
2010-04-09 Alexander Larsson <alexl@redhat.com>
Split out the memslot stuff from red_worker.c to its own files
This is required so that we can have code in other files that does address
validation.
2010-04-09 Yonit Halperin <yhalperi@redhat.com>
server: fix race condition in lz global dictionary, in its image segments list
2010-04-09 Izik Eidus <ieidus@redhat.com>
spice: win32 client: fix gdi locking
While the fix could have been more effective,
it seems like this patch stream better with the coding
logic that was there..., maybe later we will want to change
the locking into more effective way.
(There is just the primary surface to protect in reiality)
2010-04-08 Alexander Larsson <alexl@redhat.com>
Remove leftover AutoVStreamInit class
Initialize _kill_mark so we don't get spurious valgrind warnings
Free the jpeg decoder with the stream
Use libjpeg to decode mjpegs, not ffmpeg
This is pretty straightforward, although there are two weird issues.
The current encoder has two bugs in the yuv conversion. First of all
it switches red and blue, due to something of an endianness issue. We
keep this behavior by switching red and blue. Maybe we want to
change this in the new protocol version since switching this may
cause jpeg compression to be worse.
Secondly, the old coder/decoder did rgb to/from yuv420 wrongly for
jpeg, not using the "full scale" version of Y that is used in jpeg,
but the other one where y goes from 16 to 235. (See jpeg/jfif
reference on http://en.wikipedia.org/wiki/YCbCr for details.)
The new decoder uses the full range in order to get better quality,
which means old encoders will show slightly darker images.
This completely removes all ffmpeg usage in the client
Update project file to visual studio 2008
2010-04-08 Izik Eidus <ieidus@redhat.com>
spice server: fix not sent depth size for surfaces
2010-04-07 Alexander Larsson <alexl@redhat.com>
Remove non-used lookup3.[ch]
2010-04-06 Yonit Halperin <yhalperi@redhat.com>
server configuration: make network redirection support optional
By default it is disabled. To enable: configure --enable-tunnel.
When active, requires libslirp.
client: handling SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST
disconnecting from the current host and connecting to the target host.
client: fix unsafe access to an event member
2010-04-06 Izik Eidus <ieidus@redhat.com>
spice server: try to be less brutal when changing res or when flushing the tree
The idea is that we can try to defer some stuff to be later
send in the pipe if the pipe is not fulled yet, moreover
we will then walk on the pipe using:
red_clear_surface_drawables_from_pipe() and will try to
remove the uneeded objects of this surface
Still some room to improvment but later...
spice server: remove surface_id and surfaces_dest[3] from guest mem
Validate the surface_ids just once and keep them in safe
memory area
Make things simpler
2010-04-05 Izik Eidus <ieidus@redhat.com>
spice: common: gdi_canvas fix gdi objects leak
BitmapMask was used by the draw_text function as well
therefore we need to mark from_surface = 0 if we want
it to release the boject...
(Was evil, took me few hours to understand from where
the leak come...)
spice-server: when destroying a surface don`t send uneeded items
Just skip the items of destroyed surface that are found in the pipe
before we skip them, we check if they are needed by other users...
spice-server: remove glz objects related to surface when destroying a surface
make the surface released faster in the release ring
as well as clean unneeded reference into the glz
spice: reds: fix uninitlized pointer
2010-04-03 Yonit Halperin <yhalperi@redhat.com>
client: x11: fix a crash caused by a call to a destroyed window.
Happens when a focused window is destroyed without a focus out event,
and a focus-in event occurs on another window.
2010-04-03 Izik Eidus <ieidus@redhat.com>
libspice: add off screens support
spice server: surface create/destroy protocol support
Now we can send commands from the server to the client
to destroy surfaces (right now just the primary surface)
Needed for offscreens support)
Another patch`s on the way.
2010-03-24 Alexander Larsson <alexl@redhat.com>
Rename .so spice-server.so
Also change include dir to "spice-server" for consistency.
libspice.so conflicted with the tclspice package, and its also
a clarification for when we create a spice client library.
Add spice_strndup
Also, make str(n)dup handle NULL correctly
Get rid of more out-of-memory checks
We already check this in spice_malloc now
2010-03-24 Yonit Halperin <yhalperi@redhat.com>
spice: server: Being more permissive in video identification
In 'filter' video streaming mode, use a more permissive threshold for distinguishing
'realistic' streams from 'textaul'/'artificial' streams. The previous threshold classified
streams that were scaled on the guest as artificial and thus they were not recoginized as videos.
2010-03-24 Alon Levy <alevy@redhat.com>
spice: client: fix handling of top down images in video streams
Top down streams arrive from x11-qxl driver.
2010-03-24 Yonit Halperin <yhalperi@redhat.com>
spice: server: avoid video streaming of small images
I added a lower limit to the size of images that are being streamed.
The limit is only active in "filter" video streaming mode.
This will prevent blurry animated icons.
2010-03-24 Alexander Larsson <alexl@redhat.com>
rename spice.pc to spice-server.pc
configure.ac: client: replace $(top_srcdir) in x11/Makefile.am (subdir config)
Replace all "$(top_srcdir)/common" with "$(SPICE_COMMON_DIR)"
and all "$(top_srcdir)/client" with custom "$(CLIENTDIR)"
This would (after following patches) enables building the client from
either spice/ (top directory) or spice/client.
2010-03-24 Uri Lublin <uril@redhat.com>
configure.ac: define SPICE_COMMON_SRCDIR, to be used by Makefile.am (subdir config)
Note that SPICE_COMMON_SRCDIR may be overwritten by configure.ac.shared
autogen: exit upon errors (subdir config)
autogen: add possibly missing AUTOMAKE definition (subdir config)
autogen: remove copied code - srcdir and ORIGDIR (subdir config)
2010-03-18 Alexander Larsson <alexl@redhat.com>
Fix uninitilized memory read in stroke_fill_spans()
y2 was not initialized
2010-03-18 Gerd Hoffmann <kraxel@redhat.com>
new libspice api: spice_server_add_get_{sock, peer}_info()
new libspice api: spice_server_add_renderer()
2010-03-18 Yonit Halperin <yhalperi@redhat.com>
client: add command line support for ciphers, ca file, and host certificate subject
2010-03-17 Alexander Larsson <alexl@redhat.com>
Default opt flags to -O2
gcc -O3 has some code generation failures due to a combination of
unaligned (packed) structs and vectorization that can cause
a crash in canvas_localize_palette().
And its just safer to use -O2, which is the standard "trusted"
optimization flags.
Use nearest scaling for DRAW_ALPHA_BLEND since this is what win32 needs
DrvAlphaBlend is the only current user of DRAW_ALPHA_BLEND, and its
defined to do nearest (COLORONCOLOR) scaling, not bilinear.
Fix up empty region checks in canvas operations
We rely on not passing on empty rects to the drawing operations by
checking for empty regions and exiting early. However the checks
were wrongly using pixman_region32_n_rects(region) == 0, whereas
we should be using pixman_region32_not_empty().
2010-03-11 Søren Sandmann Pedersen <ssp@redhat.com>
Explicitly depend on various X libraries, and -pthread
In Fedora 13, the linker doesn't pull in DT_NEEDED libraries anymore,
so we have to list the things that we depend on explicitly.
This affects several X extension libraries, and also the pthread
library.
2010-03-11 Alexander Larsson <alexl@redhat.com>
Use spice allocator in server/
Use the spice allocator in common/
New memory allocators that exit on OOM and handle multiplication overflow
Every place that does a regular malloc/calloc and aborts on failure
should use spice_malloc/spice_mallo0 instead, which is leaner and cleaner.
Allocations of dynamically sized arrays can use g_malloc_n or g_new etc
which correctly handle multiplication overflow if some of the arguments
are not trusted.
2010-03-10 Alexander Larsson <alexl@redhat.com>
Define __STDC_LIMIT_MACROS for c++ code to get SIZE_MAX
We need SIZE_MAX for the malloc overflow code, and its not defined
in C++ unless __STDC_LIMIT_MACROS is defined.
Define GL_GLEXT_PROTOTYPES in CFLAGS not in random places in the source
Revert "Fix possible quic_usr_more_lines_unstable() crash"
This reverts commit 34e6a0a0d539fb49a03ec01bf11be505c88fcaa1.
Turns out this wasn't needed and the crash was due to other changes.
2010-03-09 Alexander Larsson <alexl@redhat.com>
Update gdi canvas wrt latest changes
ALIGN -> SPICE_ALIGN
2010-03-09 Gerd Hoffmann <kraxel@redhat.com>
new libspice api: add spice_server_set_mouse_absolute()
new libspice api: add spice_server_set_channel_security()
new libspice api: make spice_channel_name_t part of the public api.
new libspice api: add spice_server_{get, set}_image_compression()
new libspice api: make image_compression_t part of the public api.
new libspice api: configure listen addr, add ipv6 suppor
new libspice api: configure tls
new libspice api: zap function pointer indirection.
Make register_*_notifier calls optional, long term they should go away
entriely. Add direct library calls as replacement.
new libspice api: configure port + ticket
Add new functions to configure spice port and ticketing. Yes, this is
incomplete, it includes just the most important bits to get something
up'n'running.
These functions are supposed to replace both spice_parse_args() and
the monitor interaction via qterm interface.
new libspice api: alloc, initi and free spice server instances.
The implementation can't handle multiple spice server instances at the
same time right now. The API allows this though, so if we fixup the
implementation some day we don't have to change the API.
Fix possible quic_usr_more_lines_unstable() crash
quic_usr_more_lines_unstable() assumes it can allways copy a complete
scanline. Well, it can't. In case the screen rectangle which needs
updating has an x-offset greater than zero *and* includes the last
scanline of the screen it will overflow the source buffer by
x-offset * bytes-per-pixel bytes.
2010-03-09 Alexander Larsson <alexl@redhat.com>
Use macros from <spice/macros.h> rather than duplicate them
2010-03-08 Alexander Larsson <alexl@redhat.com>
Move draw_rop3 to canvas_base
Move canvas_draw_stroke to canvas_base
Move most of the shared draw_xyz() methods from CairoCanvas to CanvasBase
This adds a set of virtual methods for low-level operations. A subclass
can choose to implement those and let the default CanvasBase implementations
handle the highlevel stuff.
Move canvas_region and group_start/end to canvas_base
Move virtualization of canvas drawing into common/canvas_base
Instead of having two virtualizations of the canvas we push the
virtualization into the canvas code itself. This not only avoids
the duplication of this code, it also makes the exposed API for the
canvas much smaller (in terms of exported API).
It also lets us use the virtualization to implement basic support
for operations in canvas_base which is then overridden by each canvas
implementation.
Make virt mapping an interface
Make glz_decoder non-optional canvas_base in canvas constructors
It can still be NULL, but we simplify the headers by always including it.
There is no practical performance difference here.
Make canvas Glz decoder integration nicer
We use a dynamic interface similar to e.g. SpiceImageCache instead
of passing both function and opaque
Fix colorkeying in pixman_utils.c
We were masking out the alpha bit in the key color not int
the source pixel, so colorkeying didn't work when the high byte
was != 0. For instance in the shutdown dialog in XP.
2010-03-05 Alexander Larsson <alexl@redhat.com>
Fix up win32 build reference to pixman_utils.cpp
It was pointing to the wrong directory for pixman_utils.cpp
2010-03-03 Alexander Larsson <alexl@redhat.com>
Only use AI_ADDRCONF if availible
AI_ADDRCONF not availible on winXP, so this fixes windows build.
2010-03-01 Larsson@.(none) <Larsson@.(none)>
Update visual studio project for pixman changes
Make gdi canvas build in the new pixman world
Always include spice/types.h before pixman so standard int types exist
Fix warnings from visual studio compiler
Have only one copy of ROUND macro and cast to int explicitly
2010-02-27 Gerd Hoffmann <kraxel@redhat.com>
spice client: add ipv6 support.
spice client: fix dns lookup
ignore lookup results which are not ipv4
2010-02-23 Alexander Larsson <alexl@redhat.com>
Remove qcairo dependency, only use pixman
Remove cairo use in client
Remove no longer needed CAIRO_CANVAS_CACH_IS_SHARED define and code
Remove last cairo use from canvas_base
Remove cairo_t from cairo canvas
Covert cairo canvas put_image() to pixman
Replace custom region implementation with pixman_region32_t
pixman_region32_t is an efficient well tested region implementation (its
the one used in X) that we already depend on via pixman and use in
some places. No need to have a custom region implementation.
Convert cairo canvas clear() to pixman
Convert cairo canvas group_start/end to pixman
Convert cairo canvas read_bits() to pixman
Remove unused cairo helper functions
Convert cairo canvas to use pixman for draw_stroke
Convert cairo canvas draw_transparent to use pixman
Convert cairo canvas draw_rop3 to using pixman
Convert draw_blackness/whiteness/invers to using pixman
Convert cairo canvas alpha_blend to using pixman
Convert cairo canvas draw_text to using pixman
Convert cairo canvas copy bits to pixman
Convert cairo canvas draw_copy() to using pixman
This is just identical to draw_blend().
Convert cairo canvas draw_blend() to using pixman
Convert cairo canvas draw_opaque() to using pixman
Convert cairo canvas draw_fill() to using pixman
Add possibility to not invert bitmask in canvas_get_mask()
This allows the pixman implementation to instead invert the (generally
smaller) region instead of duplicating the bitmap to invert it.
Use pixman_image_t instead of cairo_surface_t as the generic pixman container
This allows us to use the simpler dependency of pixman outside of the
cairo backend, and it later lets us move the cairo backend to using
pixman only.
Turn image and palette cache into c style dynamic interface
Instead of passing a bunch of function pointer and an opaque
pointer we make a real type and add a vtable pointer to it.
This means we can simplify all the canvas constructors, etc.
Add optional templated base class to Cache and SharedCache
We want this for integration with C-style classes.
Add pixman_image_t referencing the cairo_canvas bits
This references the same data as the cairo surface and can be used
for drawing to the surface using direct pixman calls instead.
Add line rasterizer
Add pixman utilities
This includes:
* pixman region from SpiceRects
* rop2 enum
* solid fill
* solid fill with rop
* tiled fill
* tiled fill with rop
* blit
* blit with rop
* copy rect
Add emacs settings for indent according to spice styleguide
2010-02-10 Alexander Larsson <alexl@redhat.com>
Fix delete vs delete[] mismatches
This fixes a bunch of valgrind warnings.
2010-02-04 Alexander Larsson <alexl@redhat.com>
Use standard int types and <spice/types.h>
Revert automatic renames that were wrong
Seems my rename script didn't handle C++ namespaces that well.
Use the new header names
I just ran:
find -name "*.[ch]" | xargs sed -i -f ../spice-protocol/includes.sed
find -name "*.cpp" | xargs sed -i -f ../spice-protocol/includes.sed
Rename symbols that were changed in spice-protocol
This is an automatic change using:
$ find -name "*.[ch]" | xargs ../spice-protocol/rename-identifiers.sh ../spice-protocol/renames
$ find -name "*.cpp" | xargs ../spice-protocol/rename-identifiers.sh ../spice-protocol/renames
Remove headers that were moved to spice-protocol
Depend on spice-protocol module
This doesn't actually use the new module, just sets it up for use.
Filter out XIM X events
XIM ClientMessage events to an XIM internal window was triggering
the check for a window message procs. We need to properly filter
events with XFilterEvent to avoid this happening.
2010-01-28 Izik Eidus <ieidus@redhat.com>
libspice: add surface 0 support
This include alot of infestracture for off screens.
2010-01-11 Yaniv Kamay <ykamay@redhat.com>
client: change rerror code to be positive
client: add Platform::term_printf
Platform::term_printf is a variant of printf that
on windows dynamically opens console in order to
have visible output during command line processing.
client: fix logger init mix-up
client: move log file to spicec appdata dir
2010-01-11 Yonit Halperin <yhalperi@redhat.com>
server,client: server authentication for secured channels.
3 available mechanisms: by public key, by host name, and by certificate subject name.
In the former method, chain of trust verification is not performed.
The CA certificate files are looked for under <spice-config-dir>/spice_truststore.pem
windows <spice-config-dir>=%APPDATA%\spicec\
linux <spice-config-dir>=$HOME/.spicec/
2010-01-07 Arnon Gilboa <agilboa@redhat.com>
spice: menu additons
-functions: set_name, remove_command, remove_sub, clear
-item state & enum
-add state support in RedWindow insert_command & insert_menu
2010-01-06 Yaniv Kamay <ykamay@redhat.com>
server: add new vd interface QTerm2Interface
2010-01-06 Arnon Gilboa <agilboa@redhat.com>
spice: add missing break
2010-01-04 Yaniv Kamay <ykamay@redhat.com>
client: use spice icon instead-of solidice icon
2009-12-30 Arnon Gilboa <agilboa@redhat.com>
spice: PKG_CHECK_MODULES: CEGUI version
spice: position mouse in primary monitor center after full screen toggle
-move _focused & _pointer_in_window from RedWindow to RedWindow_p's
-move shadow focus & cursor handling to sync()
-add reset_cursor_pos() to Platform
-Monitor set_mode()/restore() use virtual do_set_mode()/do_restore()
spice: on_activate_screen generates on_key_down for any modifier pressed
-call SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc...) only once, in RedWindow::init()
-add Application::cleanup_globals() & RedWindow::cleanup()
-cleanup LowLevelKeyboardProc()
2009-12-28 Yaniv Kamay <ykamay@redhat.com>
client: let PreLoginDialog save and restore LoginDialog
client: remove splash image
client: add GUI infrastructure + functional login dialog
client: add gui res files
client: add soft renderer and cegui
client: smiplify DisconnectedEvent
client: move visibility change logic from screen to app
client: wait for disconnect state in RedClient::connect()
client: improve screen resizing
Screen now have to modes locked and unlocked.
In unlocked mode, the application can change screen size and so
reduce resolution changing. The application can also choose to
change window size while not in full screen mode.
In locked mode the application must ewtain locker screen size
setting.
client: restore mouse capture state after screen resizing
use spaces instead of tabs in bitmap_to_c and icon_to_c output
2009-12-23 Yaniv Kamay <ykamay@redhat.com>
win client: change avcodec version to 51
2009-12-23 Izik Eidus <ieidus@redhat.com>
spice: fix server crush in case connecting without qxl device
spice client: fix wrong gdi-canvas handling of blend_alpha
2009-12-23 Yaniv Kamay <ykamay@redhat.com>
client: new static title image
2009-12-22 Izik Eidus <ieidus@redhat.com>
spice: fix ssl compiling errors
(openssl api was changed, so lets have ifdef to compile in all cases)
spice: client: add checks to see if it is safe to use XShem.
Beacuse that XShem internal checks wont fail when using the spice client
from remote, we are adding check on the socket family to see if it is
unix domain socket and fail in case it is not.
2009-12-21 Yaniv Kamay <ykamay@redhat.com>
spice: sever: increase client timeout
Increase client timeout in order to prevent unnecessary
disconnecting of client while the connection is over WAN.
Tested by changing WinXP resolution (with desktop background) while
connecting over WAN (1.5Mbit 150Kbit)
spice: sever: remove assert on nop copy bits
2009-11-30 Yonit Halperin <yhalperi@redhat.com>
spice server: heuristic for distinguishing between "real" videos and textual streams
2009-11-30 Yaniv Kamay <ykamay@redhat.com>
client: KeyHandler now receive unicode char event in addition to RedKey events
client: move scan code translation to InputsChannel
remove unuse Application::is_cad_pressed()
client: split inputs handler
client: interactive screen layer
2009-11-23 Izik Eidus <ieidus@redhat.com>
spice: server: add memslots support.
2009-11-18 Yaniv Kamay <ykamay@redhat.com>
add missing alt_image.c to Makefile.am
2009-11-18 Arnon Gilboa <agilboa@redhat.com>
spice: pass modifiers stroke events down the hook chain
spice: add [pid:tid] to log lines
spice: on toggle_full_screen, generate on_key_down if shift is still pressed
2009-11-17 Arnon Gilboa <agilboa@agilboa.usersys.redhat.com>
spice: show splash screen on disconnect only on debug
2009-11-15 Yaniv Kamay <ykamay@redhat.com>
client: change jitter buffer size to 300ms
2009-11-15 Yonit Halperin <yhalperi@redhat.com>
spice client: sticky Alt activation when holding an Alt key: bug #505912.
Additional changes that were required for the feature:
1) focusing on the pointed window in full screen mode
2) In X11 - handling events that occur during keyboard ungrabbing
3) In X11 - handling Leave/Enter Notify events that occur during keyboard grabbing/ungrabbing
4) In X11 - fix for focus events that are handled in the wrong order (happens when
focus events occur during grabbing the keyboard)
5) In X11 - ignoring key release events during key holding
6) In Windows - synchronizing keyboard release events that occured during a modal loop
2009-11-09 Izik Eidus <ieidus@redhat.com>
spice: client: gl: fix glx support.
Just move around touch_context and untouch_context to be at the right
places.
client: fix colormap handling.
2009-11-09 Yonit Halperin <yhalperi@redhat.com>
spice client: tunnel channel - checking that the configuration pipe listener was created before deleting it
spice client: calling the timers during modal loop in Windows
spice client: fixed missing AutoRef
spice client: remove timer interface from platform - use Application (via ProcessLoop interface).
2009-11-09 Izik Eidus <ieidus@redhat.com>
spice server: fix gl
red_worker: put invalidate at the right places
2009-11-09 Yonit Halperin <yhalperi@redhat.com>
spice client: cosmetic changes
spice client: Transfer all channels run loop from EventsLoop class to ProcessLoop class
spice client: creating a general process loop.
The process loop is responsible for: 1) waiting for events 2) timers 3) events queue for
actions that should be performed in the context of the thread and are pushed from other threads.
The benefits:
1) remove duplicity: till now, there was one implementaion of events loop for the channels and
another one for the main thread.
2) timers can be executed on each thread and not only on the main thread.
3) events can be pushed to each thread and not only to the main thread.
In this commit, only the main thread was modified to use the new process loop.
2009-10-27 Yaniv Kamay <ykamay@redhat.com>
fix win client copyright string
2009-10-26 Yaniv Kamay <ykamay@redhat.com>
fix bad initialization of XDisplay in case crt have more then one output
fix build on Debian
2009-10-25 Izik Eidus <ieidus@redhat.com>
spice: move create and destroy of the canvas to new place
work around for xlib threaded bugs
spice xclient: move xsync() to be at the right place.
2009-10-18 Yonit Halperin <yhalperi@redhat.com>
tunnel
2009-10-14 Yaniv Kamay <ykamay@redhat.com>
change development version to 0.5.0
fresh start