2017-10-11  Christophe Fergeau  <cfergeau@redhat.com>

	spice-server 0.14.0 release

2017-10-10  Christophe Fergeau  <cfergeau@redhat.com>

	dcc: Fix seamless migration
	Since commit ef4b1bdb "red-channel-client: Prevent too tight loop
	waiting for ACKs", after seamless migration, the display is no longer
	updated on the client-side, even though the VM is functional (responds
	to keyboard input, reconnecting the client restores the display
	functionality, ...).

	This is mainly caused because after migration,
	red_channel_client_waiting_for_ack() will be true until
	red_channel_client_ack_zero_messages_window() is called.

	What happens is the following:
	The dcc is created, and dcc_start() pushes a RED_PIPE_ITEM_TYPE_SET_ACK
	message.
	This calls prepare_pipe_add(), which will enable write event on the dcc
	watch. red_channel_client_event() will be called, which will trigger a
	red_channel_client_push(). Since red_channel_client_waiting_for_ack()
	returns true, we won't get any item to push, and (because of commit
	ef4b1bdb), we will disable write notifications on the watch.
	At this point, rcc->priv->pipe is no longer empty, so prepare_pipe_add()
	is not going to reenable the write notifications.

	Then red_channel_client_ack_zero_messages_window() is finally called as
	part of dcc_handle_migrate_data(), so from this point on,
	red_channel_client_waiting_for_ack() is no longer true.

	However, nothing ever reenables WRITE events, nor empties
	rcc->priv->pipe, so nothing ever gets pushed, causing no display updates
	at all after a migration, even if the VM is functional (input, ...)
	apart from that.

	This commit reenables WRITE events in
	red_channel_client_ack_zero_messages_window() if we were waiting for
	ack.

2017-10-04  Jonathon Jongsma  <jjongsma@redhat.com>

	Mention vmport in user manual
	For server mode mouse to work properly with spice, vmport must be
	disabled in qemu. To do this, we need to pass vmport=off to the -machine
	option.

2017-10-04  Frediano Ziglio  <fziglio@redhat.com>

	gl: fix client mouse mode
	Since 2.8, QEMU no longer creates QXL primary surfaces when using GL.
	This change broke client-side mouse mode, because Spice server relies on
	having a primary surface.

	When GL is enabled, use GL scanout informations.
	Mouse mode is always client when GL surfaces are used.

	This patch and most of the message are based on a patch from
	Marc-André Lureau, just moving responsibility from reds to RedQxl.

	Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
	Acked-by: Christophe de Dinechin <dinechin@redhat.com>

2017-09-25  Christophe Fergeau  <cfergeau@redhat.com>

	build: Update spice-common submodule
	Frediano Ziglio (1):
	      quic: avoid crash on specific images

	build: Prepare for 0.13.91 release
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-09-21  Christophe Fergeau  <cfergeau@redhat.com>

	tests: Automatically determine free port to use
	Currently, the port used by most tests is hardcoded to 5912. However,
	the test suite can be run in parallel, so if 2 tests run in parallel,
	the 2nd one is not going to be able to bind to port 5912 and will fail.

	After this commit, test_new() will try to find a free port between 5912
	and 5922 and will abort if it can't find any.

	The issue can be reproduced by adding a usleep(1000000) to the beginning
	of test_destroy().

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-09-19  Frediano Ziglio  <fziglio@redhat.com>

	Use GLib memory functions for RedsMigSpice::cert_subject
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	reds: Use GLib memory functions for RedServerConfig
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	reds: Use GLib memory functions for RedServerConfig::mig_spice
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Use GLib memory functions for RedsMigSpice::host
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	reds: Use GLib memory functions for migration data
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	reds: Use GLib memory functions for link
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	reds: Start using GLib memory functions
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	sound: Use GLib memory functions
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	image-encoders: Use GLib memory functions
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Start using GLib memory allocation
	Start reducing the usage of spice_new*/spice_malloc allocations.
	They were designed in a similar way to GLib ones.
	Now that we use GLib make sense to remove them.
	However the versions we support for GLib can use different memory
	allocators so we have to match g_free with GLib allocations
	and spice_* ones (which uses always malloc allocator) with free().
	This patch remove some easy ones.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	tests: Add a test to check tight loop during ack waiting
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Introduce a macro to help declaring new GObject
	The macro will implement most of the boilerplate needed to declare an
	object.
	Its usage is similar to GLib G_DECLARE_*_TYPE macros.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-channel-client: Prevent too tight loop waiting for ACKs
	RedChannelClient has a "handle-acks" feature.
	If this feature is enabled, after the configured number of messages it
	waits for an ACK from the client.
	If is waiting for an ACK it stops sending messages.
	However the write notification was not disabled, causing the loop event
	to always trigger, as the socket in this case is ready to accept data.
	Specifically red_channel_client_event is continuously called.
	This is noticeable using slow network environments and having
	some additional loop instrumentation.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-channel-client: Introduce a helper to update watch event mask
	This helper will be reused by following patch.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-09-18  Frediano Ziglio  <fziglio@redhat.com>

	red-qxl: Reuse red_qxl_async_complete
	Now that the function is a wrapper reuse it.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-qxl: Remove AsyncCommand
	This structure was used to store the cookie for the async
	reply and the message for the generic async callback.
	Most async messages do not require extra action beside sending back the
	cookie for the reply so instead of having a switch on the message type
	in red_qxl_async_complete, this commit moves the message-specific
	behaviour to the callers, which allows us to store the cookie directly
	in RedWorkerMessageAsync rather than needing an intermediate
	AsyncCommand structure.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	channel-client: Remove red_channel_client_pipe_add_tail_push
	Now the push is done automatically when a PipeItem is added
	(cfr commit 5c460de1a3972b7cf2b9b2944d0b500c3affc363
	"worker: push data when clients can receive them"),
	forcing a push cause only network fragmentation and is required only if
	you are handling data in a polling loop (and thus, you are preventing
	the default event loop from running).

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-09-18  Christophe Fergeau  <cfergeau@redhat.com>

	channel: Fix leak in red_channel_remove_client
	It was using g_list_remove_link() to remove an element from the
	RedChannel::clients list while it really meant to be using
	g_list_delete_link() which frees the memory associated with the link.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-09-18  Frediano Ziglio  <fziglio@redhat.com>

	tests: Rename stat-main.c to test-stat.c
	All main test module have this test-XXXX.c naming, make
	test-stat coherent.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	tests: Separate Makefile.am in sections
	Put non-trivial programs in separate sections, which makes it easier to
	understand the relationship between macros.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	tests: Ignore test output results
	New automake test harness produce *.log and *.trs files for
	each test.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	smartcard: Fix typo in comment
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-09-14  Frediano Ziglio  <fziglio@redhat.com>

	reds_stat: Show single spice file if only one is present
	Simple usage improvement.
	If only one process using spice is present allow to call
	reds_stat not passing any pid.

	Acked-by: Christophe de Dinechin <cdupontd@redhat.com>

2017-09-13  Frediano Ziglio  <fziglio@redhat.com>

	stream: Simplify FOREACH_STREAMS macro
	This macro is exactly doing what RING_FOREACH just passing streams
	ring.

	Acked-by: Christophe de Dinechin <cdupontd@redhat.com>

2017-09-12  Christophe Fergeau  <cfergeau@redhat.com>

	channel: Remove no longer used red_channel_apply_clients{_data,}
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	channel: Remove red_channel_client_disconnect_if_pending_send()
	There is exactly one user in RedChannel, and this can be reimplemented
	using already public RedChannelClient API. No need for an extra
	function very specialized function with a not great name.

	This commit thus removes one method from RedChannelClient public API,
	and replaces it with an equivalent private helper in RedChannel.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	channel: Call red_channel_disconnect_if_pending_send() from red_channel_wait_all_sent()
	red_channel_disconnect_if_pending_send() and red_channel_wait_all_sent() are
	always called together, we can remove one of the 2 methods.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-09-12  Frediano Ziglio  <fziglio@redhat.com>

	tests: Avoid to disable all deprecation warnings just for expect functions
	In case GLib don't provide these functions we use replacements so
	there's no need to have a warning if these functions are called.
	This potentially capture other compatibility issues in the tests
	that would be ignored having all deprecation warnings disabled.
	Tested with GLib 2.28 and 2.52.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-worker: Start processing commands as soon as possible
	When the worker is started it could take a while to start processing
	commands.
	The reason is that the dispatcher handler is called after the worker
	so GLib will receive a FALSE answer to both prepare and check
	callbacks of the RedWorkerSource causing GLib to wait till another
	event is received.
	This is a regression since the introduction of GLib event loop, before
	the command processing was always attempted after any events.
	Commands (from QXL interface for cursor and display) are processed
	during the RedWorkerSource dispatch so if they are not processed just
	when the VM is started they will be processed on next event which
	could be from dispatcher (main thread requests), from existing
	connections or from pending timers. However in the case there are no
	clients connected and no other requests from main thread the worker
	thread won't process them.
	Setting the event_timeout to 0 cause the prepare callback to return
	TRUE so GLib will dispatch the RedWorkerSource.
	This was discovered attempting to use the tests in server/tests
	directory to reproduce a leak in RedWorker.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	test-gst: Free pipelines
	Pipelines are never freed.
	These are detected as leaks by leak detector tools like address sanitizer.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	test-gst: Remove options parsing leaks
	Command line options are not freed at the end of the program.
	These are detected as leaks by leak detector tools like address sanitizer.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	test-gst: Remove useless check
	encoder_name is never NULL as already initialized with "mjpeg" value.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	reds: Fix leaks if reds_init_client_ssl_connection fails
	If a client is unable to complete the TLS handshake phase
	reds_init_client_ssl_connection leaked some memory as the stream is not
	correctly freed.
	This also causes the stream to send the SPICE_CHANNEL_EVENT_DISCONNECTED
	event. Otherwise only SPICE_CHANNEL_EVENT_CONNECTED was sent.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	tests: Check leaks in spice_server_add_ssl_client
	Currently is possible to trigger a leak by passing an invalid
	connection.
	This can happen if the client opens a connection and then closes it
	without writing or reading any data.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-channel-client: Early check for valid stream
	The code tests for the presence of RedChannelClient::stream while
	initializing RedChannelClient.
	However, the check was done too late, and a
	RedChannelClient::config_socket implementation (for example
	snd_channel_client_config_socket) could have tried to use it before the
	check that it's not NULL.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-09-11  Frediano Ziglio  <fziglio@redhat.com>

	mjpeg: Reuse realloc instead of implementing it manually
	This potentially can also save the copy if there is enough
	space to resize the buffer in place.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	reds-stream: Remove shutdown field
	This field was used only by RedChannelClient to mark when the socket
	was shutdown. This condition can simply be tested by RedChannelClient
	checking if there's a watch as is the only condition (beside object
	destroying/disconnecting) where the watch is removed.
	In any case the shutdown was used to understand if there were possible
	data still to read.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	docs: Add some documentation on spice threading model
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-09-08  Frediano Ziglio  <fziglio@redhat.com>

	red-qxl: Remove unused includes
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-qxl: Move private declarations to red-worker.h
	RedQxl and RedWorker are quite bound together running
	CursorChannel and DisplayChannel in a separate thread
	marshalling (RedQxl) and unmarshalling and executing
	(RedWorker) requests.
	Make the communication between them private trying
	to facilitate maintaining these two files.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-09-08  Jonathon Jongsma  <jjongsma@redhat.com>

	RedChannel: Remove obsolete TODO comment
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-09-07  Jonathon Jongsma  <jjongsma@redhat.com>

	Add documentation for Dispatcher

	MainDispatcher: use correct argument type
	For dispatcher_register_handler(), use 'false' instead of 0 since the
	last argument is a bool type now.

	Dispatcher: remove async_done callback
	This callback was only executed for message types that were registered
	with DISPATCHER_ASYNC ack type. However, the async_done handler was
	called immediately after the message-specific handler and was called in
	the same thread, so the async_done stuff can just as easily be done from
	within the message-specific handler. This allows to simplify the
	dispatcher_register_handler() method to simply require a boolean
	argument for whether the message type requires an ACK or not.

2017-09-07  Frediano Ziglio  <fziglio@redhat.com>

	main-dispatcher: Avoid type conversion in dispatcher_handle_read
	Pass proper type to callback to avoid having to convert to
	the right type for each call.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	dispatcher: Remove "opaque" property
	Is supposed to be used during initialization but is never
	used.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-qxl: Avoid to use AsyncCommand for GL_DRAW_ASYNC message
	AsyncCommand is used to handle asynchronous messages from the
	dispatcher.
	GL_DRAW_ASYNC is mainly using it to store the cookie.

	The value of GL_DRAW_COOKIE_INVALID was choosen to allow implementing
	cookies (which basically are handles) either using indexes (where 0 is
	valid) or pointers (where 0 is invalid). Currently Qemu uses pointers.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	spice-qxl: Add version information
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-qxl: Move QXLInterface wrappers together
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-qxl: Unify red_qxl_use_client_monitors_config and red_qxl_client_monitors_config
	These 2 functions were doing the same stuff, calling
	client_monitors_config callback in QXLInterface.
	The only difference was that red_qxl_use_client_monitors_config
	used a NULL value.
	Added the check for proper version, QXLInstance before 3.3
	did not have this callback.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-09-07  Christophe Fergeau  <cfergeau@redhat.com>

	channel: Remove unused red_channel_min_pipe_size
	This could have been removed as part of 6e6126e024.

	Frediano Ziglio <fziglio@redhat.com>

2017-09-07  Frediano Ziglio  <fziglio@redhat.com>

	Fix crash attempting to connect duplicate channels
	You could easily trigger this issue using multiple monitors and a
	modified spice-gtk client with this patch:

	  --- a/src/channel-main.c
	  +++ b/src/channel-main.c
	  @@ -1699,6 +1699,7 @@ static gboolean _channel_new(channel_new_t *c)
	   {
	       g_return_val_if_fail(c != NULL, FALSE);

	  +    if (c->type == SPICE_CHANNEL_DISPLAY) c->id = 0;
	       spice_channel_new(c->session, c->type, c->id);

	       g_object_unref(c->session);

	which cause a crash like

	(process:28742): Spice-WARNING **: Failed to create channel client: Client 0x40246f5d0: duplicate channel type 2 id 0
	2017-08-24 09:36:57.451+0000: shutting down, reason=crashed

	RedChannelClient is an GInitable type, which means that the object is
	constructed, and then the _init() function is called, which can fail.
	If the _init() fails, the newly-created object will be destroyed. As
	part of _init(), we add a new watch for the stream using the core
	interface that is associated with the channel. After adding the watch,
	our rcc creation fails (due to duplicate ID), and the rcc object is
	unreffed. This results in a call to reds_stream_free() (since the rcc
	now owns the stream). But in reds_stream_free, we were trying to remove
	the watch from the core interface associated with the RedsState. For
	most channels, these two core interfaces are equivalent. But for the
	Display and Cursor channels, it is the core Glib-based interface
	associated with the RedWorker.

	The watch in RedsStream by default is bound to the Qemu provided
	SpiceCoreInterface while RedChannelClient bound it to Glib one causing
	the crash when the watch is deleted from RedsStream. Change the bound
	interface.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	reds-stream: Allows to change core interface
	When a stream is moved from the main thread to a
	secondary one the events are potentially registered
	using a different core interface. This cause memory
	corruption accessing the watch registered in RedsStream.
	This patch allows to always use the right interface.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	dcc: Make dcc_stop static
	Just used by dcc_on_disconnect.

	Acked-by: Uri Lublin <uril@redhat.com>

	tests: Make test-two-servers work
	This test runs 2 spice server in one program.
	Use two different tcp port to be able to connect to both servers.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	tests: Make test-empty-success automated
	Add some check that something happened during creation/destruction.
	Set as running on "make check".

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	tests: Make test-fail-on-null-core-interface an automated test
	Update to Glib style to catch warning.
	Initialize properly the structure (invalid) provided.
	Check results of spice_server_init.
	Remove leaks.
	Enable as check.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	tests: Update README
	Update tests names.
	Remove tetris comments, never available and not planned.
	Update some notes.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	test-display-base: Always compile with AUTOMATED_TESTS enabled
	There's no need to not compile this feature, it just enable
	a parameters which must be passed in order to change test
	behaviour.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	tests: Allow to quit the message loop
	This allows to end the loop to end some tests.
	Currently different tests enter the loop but never exit from
	them.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	test-display-base: Do not assume LP64 architecture on 64 bit
	In C the sizeof(long) can be different than sizeof(void*),
	use proper type.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	test-display-base: Use spice allocation helpers
	Do not use calloc and malloc directly without checking
	the result. Use instead spice functions to get a nice
	error in case of allocation failures.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	test-display-base: Avoid cursor move command leaks
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	test-display-base: Avoid global buffer overflow
	For some reasons (documented in cursor_init) the function
	uses 128 extra bytes of data causing a reading buffer overflow.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	test-display-base: Protect the wake up timer start with a mutex
	Timers in spice server are supposed to be used in a single thread
	context. To avoid problems, protect the usage from multiple
	thread with a mutex.
	This sometimes caused a crash.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	test-display-base: Avoid usage after free when the wakeup timer is freed
	The wakeup timer is used by the worker thread and by the
	main thread.
	Destroying the object before destroying the worker thread
	can lead to use after free.
	Destroying the worker thread first makes sure we don't race.
	This is detected easily when compiling the test with address sanitizer.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	test-display-base: Protect command ring with a mutex
	The ring is accessed by multiple thread.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	test-display-base: Use unsigned numbers for command ring indexes
	As the indexes are used to compute the index inside an array
	using modulo operation when a signed value overflows, the
	modulo becames negative, causing a buffer underflow.
	Unlikely to happens (take lot of time) but is safer that way.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	common-graphics-channel: Move "qxl" property to DisplayChannel
	Only DisplayChannel uses this property.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	cursor-channel: Remove dependency from QXL
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	cursor-channel: Removed unused qxl field from RedCursorPipeItem
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Release cursor as soon as possible
	Cursor resources (basically the shape of it) was retained till
	it was used however it was copied so there were no reason to not release
	this resource.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-09-06  Frediano Ziglio  <fziglio@redhat.com>

	dcc: Fix NULL pointer dereference attempting to connect duplicate channels
	You could easily trigger this issue using multiple monitors and
	a modified spice-gtk client with this patch:

	--- a/src/channel-main.c
	+++ b/src/channel-main.c
	@@ -1699,6 +1699,7 @@ static gboolean _channel_new(channel_new_t *c)
	 {
	     g_return_val_if_fail(c != NULL, FALSE);

	+    if (c->type == SPICE_CHANNEL_DISPLAY) c->id = 0;
	     spice_channel_new(c->session, c->type, c->id);

	     g_object_unref(c->session);

	This as g_initable_new in this case returns NULL (dcc.c).

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-09-06  Jonathon Jongsma  <jjongsma@redhat.com>

	Dispatcher: validate received message types
	Although dispatcher_send_message() does not allow you to send a message
	type that is invalid for a dispatcher, it still makes sense to verify
	that the type is valid in the receiver. This should only be possible in
	the case of some severe problem such as memory corruption, so if it is
	invalid, we simply abort.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-09-06  Frediano Ziglio  <fziglio@redhat.com>

	red-worker: Fix leak processing update commands
	Is possible to have a leak processing update commands if
	the update command is synchronous and the rectangle list
	is empty. Note that Qemu always pass an empty list.

	If the list is empty display_channel_update fill the list.
	This is used to send back the list in case of asynchronous
	requests. But in handle_dev_update_async (the callback that
	handle the asynchronous case) the list is correctly freed.

	This was discovered by accident looking at the code.

	Reproduced with a Windows recording file using GCC address
	sanitizer and this patch to spice-server-replay:

	  --- a/server/red-replay-qxl.c
	  +++ b/server/red-replay-qxl.c
	  @@ -1280,7 +1280,13 @@ static void replay_handle_dev_input(QXLWorker *worker, SpiceReplay *replay,
	           replay->created_primary = FALSE;
	           worker->destroy_surfaces(worker);
	           break;
	  -    case RED_WORKER_MESSAGE_UPDATE:
	  +    case RED_WORKER_MESSAGE_UPDATE: {
	  +        static uint8_t count = 0;
	  +        QXLRect dummy;
	  +        QXLRect update = { 0, 0, 100, 100 };
	  +        count ^= 1;
	  +        worker->update_area(worker, 0, &update, count ? &dummy : NULL, count ? 1 : 0, 0);
	  +        } break;
	           // XXX do anything? we record the correct bitmaps already.
	       case RED_WORKER_MESSAGE_DISPLAY_CONNECT:
	           // we want to ignore this one - it is sent on client connection, we

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	cursor-channel: Use a single RedCursorPipeItem to hold the cursor
	RedPipeItem already implements reference counting so
	this avoid duplicating code to handle a object with reference
	counting that points to another object with reference counting
	that holds a RedCursorCmd.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-channel: Do not push data calling red_channel_pipes_new_add_push
	Now the push is done automatically when a PipeItem is added
	(cfr commit 5c460de1a3972b7cf2b9b2944d0b500c3affc363
	"worker: push data when clients can receive them"),
	forcing a push cause only network fragmentation and is required
	only if you are handling data in a loop instead of using the
	default loop.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-channel: Reuse red_channel_pipes_add
	Implements red_channel_pipes_add_type and
	red_channel_pipes_add_empty_msg using red_channel_pipes_add.
	This avoid duplicating items for each client.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Use new red_channel_pipes_add instead of red_channel_pipes_new_add
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-channel: Add red_channel_pipes_add function
	Considering that now RedPipeItem have reference counting
	and that lot of items are just used to store constant
	data to send, using reference counting instead of creating
	different items for each client is easier to do.
	So this new red_channel_pipes_add allows to add a single item
	to all clients.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-channel-client: Remove push call where not necessary
	Now the push is done automatically when a PipeItem is added
	(cfr commit 5c460de1a3972b7cf2b9b2944d0b500c3affc363
	"worker: push data when clients can receive them"),
	forcing a push cause only network fragmentation and is required only if
	you are handling data in a polling loop (and thus, you are preventing
	the default event loop from running).

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-09-05  Jonathon Jongsma  <jjongsma@redhat.com>

	Move DispatcherMessage to source file
	This is an internal implementation detail

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-09-02  Frediano Ziglio  <fziglio@redhat.com>

	display-channel: Make some declarations private
	display-channel.h contains lots of information used by different
	DisplayChannel components.
	In the past all RedWorker, CursorChannel and DisplayChannel code was in
	a single file. Since lots of code to handle DisplayChannel is still in
	RedWorker, display-channel.h contains a lot of declarations so that they
	can be accessed from RedWorker.
	Moving declarations that are not needed by RedWorker and other external
	class components helps to reduce dependencies between RedWorker and
	DisplayChannel.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Avoid using global variable for channel IDs
	This patch allocates VMC IDs by finding the first ID not used
	instead of using a global variable and incrementing the value
	for each channel created.
	This solves some potential issues:
	- remove the global state potentially making possible
	  to use multiple SpiceServer on the same process;
	- don't potentially overflow the variable. This can happen if
	  channels are allocated/deallocated multiple times
	  (currently not done by Qemu).

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-09-02  Jonathon Jongsma  <jjongsma@redhat.com>

	tests: destroy test object
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-09-02  Frediano Ziglio  <fziglio@redhat.com>

	tests: Make variables static where possible
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	tests: Remove unused declarations
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	tests: Avoid leaking list of commands
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	tests: Pass command list as constant
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	tests: Reuse G_N_ELEMENTS instead of COUNT
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-09-01  Frediano Ziglio  <fziglio@redhat.com>

	build-sys: Fix syntax-check
	This error was reported

	configure.ac:119:if test "x$have_gstreamer_0_10" = "xyes" -o "x$have_gstreamer_1_0" = "xyes"; then
	maint.mk: use "test C1 && test C2", not "test C1 -a C2"; use "test C1 || test C2", not "test C1 -o C2"

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	ci: Fix build on gitlab
	The build dependencies are installed based on spice package which does
	not still contains orc-devel package needed by ORC check (cfr commit
	"gstreamer: Check if ORC library can work", 14aee7cd745cbb6d2f3d520).

	Acked-by: Christophe de Dinechin <dinechin@redhat.com>

2017-08-31  Frediano Ziglio  <fziglio@redhat.com>

	red-client: Prevent RedChannelClient creation when the RedClient is being destroyed
	This can happen as the connection is asynchronous so (MT main thread,
	CT channel thread):
	- MT you get a new connection;
	- MT a connection is sent to CT;
	- MT you get a disconnection of main channel;
	- MT red_client_destroy is called;
	- CT you attempt to add the RCC to RedClient.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-qxl: Remove redundant checks
	A RedChannelClient is always attached to a valid RedChannel.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-worker: Set thread name if possible
	Name will be visible in debugger and /proc filesystem

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-qxl: Update header guard names
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-qxl: Reference RCC pointer in migration request
	The message is asynchronous so to avoid the object to potentially
	been released before being processed keep a strong reference to
	it.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-08-31  Christophe Fergeau  <cfergeau@redhat.com>

	worker: Fix 'immediatly' typo in comment

	worker: Simplify flush_commands()
	red_disconnect_display() is duplicating what red_channel_disconnect()
	already does, so red_disconnect_display() and red_disconnect_cursor()
	are actually identical code-wise. We can directly call
	red_channel_disconnect() from flush_commands() rather than passing a
	'red_disconnect_t disconnect' argument to that function.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	cursor: Remove cursor_channel_disconnect()
	cursor_channel_disconnect() calls
	cursor_channel_client_reset_cursor_cache() on all CursorChannelClient
	associated with the current CursorChannel before calling
	red_channel_disconnect().

	red_channel_disconnect() will iterate over all CursorChannelClient
	calling red_channel_client_disconnect(), which will eventually call
	CursorChannelClient::on_disconnect. This will in turn
	cursor_channel_client_reset_cursor_cache(), so calling it in
	cursor_channel_disconnect() before calling red_channel_disconnect() is
	redundant.

	cursor_channel_disconnect() can thus be replaced by a direct call to
	red_channel_disconnect().

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	channel: Allow NULL RedChannelClient::on_disconnect()
	SoundChannelClient has a stub implementation of
	RedChannelClient::on_disconnect(), this commit removes the need for it.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	channel: Move RedChannel::on_disconnect to RedChannelClient
	This vfunc only has a RedChannelClient * argument, and most of the time,
	it operates on RedChannelClient, not on RedChannel. Moreover, the only
	time it's used is from RedChannelClient. This commit moves the vfunc to
	RedChannelClient, which seems like a better fit for it.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-08-30  Frediano Ziglio  <fziglio@redhat.com>

	gstreamer: Check if ORC library can work
	ORC library is used internally by GStreamer to generate code
	dynamically.
	If ORC cannot allocate executable memory, the failure causes
	an abort(3) to be called.
	This happens on some SELinux configurations that disable executable
	memory allocation (execmem boolean).
	Check that ORC could work before attempting to use GStreamer to
	avoid crashes.
	While this check is done, the ORC library outputs an error which will
	be well visible in Qemu output.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Avoid to access data before a NULL check
	If you are testing for NULL data this means that variable could be
	NULL so avoid to access before the check to make sure the check is hit.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-08-29  Frediano Ziglio  <fziglio@redhat.com>

	main-channel: Fix multimedia time argument type
	The multimedia time is defined as uint32_t.
	Use the proper type instead of int.
	Currently no arithmetic is done on this value but
	just copies so considering that on the architectures
	we support sizeof(int) == sizeof(uint32_t) there's
	no change in the resulting machine code.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	red-qxl: Avoid using dangling pointers to RedClient
	A RedClient can be freed from the main thread following a main channel
	disconnection (reds_client_disconnect). This can happen while another
	thread is allocating a new channel client for that client.
	To prevent the usage of a pointer which can be invalid
	take ownership of the pointer.
	Note that we don't need this when disconnecting as disconnection is
	done synchronously (the dispatch messages are registered with
	DISPATCH_ACK).

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	worker: Add some loop statistics
	Trace the number of loops done processing display commands
	and the number of loops in which the queue was full.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-08-25  Frediano Ziglio  <fziglio@redhat.com>

	red-worker: Remove small memory leak
	If a DisplayChannelClient cannot be instantiated capabilities
	are not released correctly.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	dcc: Reuse display variable
	display variable already contains the DCC_TO_DC(dcc) value so
	reuse it.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-08-25  Christophe Fergeau  <cfergeau@redhat.com>

	RedChannelClient: Mark some private data as bool
	Some RedChannelClient data members were marked as int when they only
	hold booleans.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-08-25  Frediano Ziglio  <fziglio@redhat.com>

	reds: Inline very simple function
	reds_get_n_clients is a single line and is used only by
	spice_server_get_num_clients.
	The 2 functions have very similar names so inlining
	reds_get_n_clients does not make code less readable.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	display-channel: Check that all structure are destroyed during finalize
	The leak detector we use currently is not enough to detect
	some kind of leak in DisplayChannel so manually test.
	These tests are enabled only when --enable-extra-checks is passed
	to configure.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-08-23  Frediano Ziglio  <fziglio@redhat.com>

	red-channel: unregister channel in red_channel_destroy
	Mostly of red_channel_destroy calls were preceded by
	a call to unregister the channel.
	The only exception was the main channel as this channel is
	always present and its initialisation is a bit different.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	display-channel: push monitor configuration
	RedWorker should not handle directly to client but
	defer the job to DisplayChannel.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	reds: use SpiceMouseMode for RedsState::mouse_mode
	Make easier to understant the value to use in the code.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	char-device: Allows to handle port events from any char device
	From spice_server_port_event API you can send port events to
	any char device. Although currently this is used only for "port"
	devices implemented in spicevmc.c this will allow to support
	such events using different objects.

	This will be used for instance for a streaming device which
	will be a specific SpicePort implementation.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-08-23  Jonathon Jongsma  <jjongsma@redhat.com>

	Avoid leaking memory on invalid cursor commands
	When a RedCursorCmd is passed to cursor_channel_process_cmd(), it
	constructs a new CursorItem which takes ownership of that command. If
	the cursor_cmd->type falls through to the default case of the switch
	statement, we will print a warning and return without freeing the
	CursorItem (and thus the RedCursorCmd).

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-08-21  Frediano Ziglio  <fziglio@redhat.com>

	Remove iterator from list iteration macros
	Avoid to have to declare iterator and pass as an argument.

	Acked-by: Uri Lublin <uril@redhat.com>

	red-client: Do not compute channel if client is not connected
	Acked-by: Uri Lublin <uril@redhat.com>

	red-client: Minor space fixes
	Acked-by: Uri Lublin <uril@redhat.com>

2017-08-15  Frediano Ziglio  <fziglio@redhat.com>

	Remove call to red_channel_client_push outside RedChannel
	Now the push is done automatically when a PipeItem is added
	(cfr commit 5c460de1a3972b7cf2b9b2944d0b500c3affc363
	"worker: push data when clients can receive them"),
	forcing a push cause only network fragmentation and is required
	only if you are handling data in a loop instead of using the
	default loop.

	Acked-by: Victor Toso <victortoso@redhat.com>

2017-08-12  Frediano Ziglio  <fziglio@redhat.com>

	build: Update spice-common
	This include some Quic changes, particularly a compile fix
	if no optimizations (-O0) are used.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-07-28  Frediano Ziglio  <fziglio@redhat.com>

	ci: Fix recent GitLab failures
	Recent GitLab CI jobs are failing to run valgrind checks
	(like https://gitlab.com/spice/spice/-/jobs/25220999).

	This as recent distro changes cause valgrind not to find some
	symbols required to detect some GLib suppression errors.

	Adding debugging information for GLib solve the problem.

	Acked-by: Victor Toso <victortoso@redhat.com>

	README: Add missing optional dependencies
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	README: Fix minor dependency
	Cyrus-SASL is not mandatory

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	README: Remove OpenGL dependency
	OpenGL dependency was removed by Marc-André Lureau in 2015
	(0dc98956).

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	README: Remove obsolete GUI dependencies
	Remove old dependencies used by obsolete client code.
	This code was removed from the git repository by
	Christophe Fergeau in 2014 (18769714).

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	README: Update link to GIT
	Really minor change, just use canonical URL using secure
	HTTP instead of normal one.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	README: Update required protocol version
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	README: Fix typo (dependancies -> dependencies)
	Acked by: Christophe de Dinechin <dinechin@redhat.com>

2017-07-26  Christophe Fergeau  <cfergeau@redhat.com>

	Prepare for 0.13.90 release
	Update NEWS and soname.

	build: Update spice-common
	Christophe Fergeau (3):
	      log: Follow spice style guidelines for #include in log.h
	      log: Define G_LOG_DOMAIN as early as possible
	      canvas: Don't try to unref NULL pixman_image_t

	Christophe de Dinechin (3):
	      Style adjustment - Making code match surrounding style
	      Use space and not colon to separate log domains
	      Avoid clang warnings on casts with stricter alignment requirements

	Frediano Ziglio (14):
	      codegen: Allows to specify license of generated files
	      codegen: Fix license name
	      log: Do not check impossible function return
	      log: Optimise glib_debug_level check
	      log: Check log level from spice_logv
	      fix indentation on previous patch
	      log: Use GLib logging levels directly
	      Use SPICE_ATTR_PACKED instead of custom ATTR_PACKED
	      canvas-base: Do not attempt useless cast on stride adjustment
	      quic: constantify some variable
	      log: remove spice_static_assert macro
	      quic: Fix typo in function names
	      log: Forbid the usage of obsolete SPICE_LOG_DOMAIN
	      log: Force format in log macro to be a string

2017-07-19  Uri Lublin  <uril@redhat.com>

	init ssl connection: return quickly if link is null
	Under error: 'link' fields are being accessed, so it's
	wrong to goto error with link == NULL.

	Instead, return immediately.

	Found by coverity.

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

	red_replay_image_free: do not free QUIC qxl twice
	If qxl->descriptor.type is QUIC, red_replay_data_chunks_free
	frees qxl (data), so no need to free it again at the bottom
	of the function.

	Found by coverity.

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

2017-07-11  Frediano Ziglio  <fziglio@redhat.com>

	reds: Avoid buffer overflows handling monitor configuration
	It was also possible for a malicious client to set
	VDAgentMonitorsConfig::num_of_monitors to a number larger
	than the actual size of VDAgentMOnitorsConfig::monitors.
	This would lead to buffer overflows, which could allow the guest to
	read part of the host memory. This might cause write overflows in the
	host as well, but controlling the content of such buffers seems
	complicated.

	reds: Avoid integer overflows handling monitor configuration
	Avoid VDAgentMessage::size integer overflows.

	reds: Disconnect when receiving overly big ClientMonitorsConfig
	Total message size received from the client was unlimited. There is
	a 2kiB size check on individual agent messages, but the MonitorsConfig
	message can be split in multiple chunks, and the size of the
	non-chunked MonitorsConfig message was never checked. This could easily
	lead to memory exhaustion on the host.

2017-07-07  Christophe Fergeau  <cfergeau@redhat.com>

	build-sys: Improve portability of appending to COMMON_CFLAGS
	This is currently done through += in configure.ac, this commit switches
	to using COMMON_CFLAGS="$COMMON_CFLAGS ..." for better portability.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-06-30  Victor Toso  <me@victortoso.com>

	display-channel: introduce display_channel_get_nth_stream()
	To help avoid stream.c and dcc.c to access display-channel private
	structure to get the nth Stream structure pointer.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	stream: use display_channel_get_stream_id()
	As we have a function for that, don't do the math elsewhere.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-06-23  Michal Privoznik  <mprivozn@redhat.com>

	tests: Initialize all members of SpiceBaseInterface struct
	When compiling, -Werror=missing-field-initializers is enabled.
	However, some gcc versions (like Gentoo 4.9.4 one) fail to see
	that all the members of the SpiceBaseInterface struct are
	initialized:

	test-display-base.c:844:5: error: missing initializer for field
	'description' of 'SpiceBaseInterface'
	[-Werror=missing-field-initializers] .base.description   = "test
	spice virtual channel char device",

	The solution is to initialize .base member as a structure at once
	instead of multiple times per each member.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-06-20  Frediano Ziglio  <fziglio@redhat.com>

	gitignore: Reduce html files exclusion
	Limit html files ignored only to autogenerated ones.
	Can happen that you are working on some html files on your main
	spice-server directory and it's not desirable to ignore them.
	For instance this can happen if you download a patch from patchwork.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-06-18  Frediano Ziglio  <fziglio@redhat.com>

	log: Do not print function name twice during logging
	spice_error/spice_warning already print location information
	so don't print them twice.

	Acked-by: Jonathon Jongmsa <jjongsma@redhat.com>

2017-06-16  Frediano Ziglio  <fziglio@redhat.com>

	log: remove not widely used logging domain usage
	As discussed recently the usage of domain for logging has
	different issues (they are not filtered and handled coherently)
	and are not widely used in the code.

	Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-06-15  Christophe Fergeau  <cfergeau@redhat.com>

	reds: Free client_monitors_config in spice_server_destroy()
	This was not done until now, and it's only going to be needed if we receive
	a partial ClientMonitorsConfig message.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	reds: Remove redundant __func in debug log
	The function name is always prepended by the spice_log macro, so we
	don't need to explicitly add it in debug messages.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	reds: Replace RedsClientMonitorsConfig with SpiceBuffer
	RedsClientMonitorsConfig duplicates what SpiceBuffer does,
	so using we can replace it with SpiceBuffer and make
	reds_on_main_agent_monitors_config() simpler.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Remove use of spice_debug(NULL)
	This is causing issues with potential improvements to the logging
	system, and I've always found this usage a bit odd anyway.
	Using spice_debug(""); was not possible as this triggers
	-Wformat-zero-length warnings from our use of -Wall.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-06-08  Frediano Ziglio  <fziglio@redhat.com>

	cursor-channel: Remove obsolete size check
	In the past CursorItem structure was stored in
	RedCursorCmd::device_data field so the check was there to check if the
	structure fit into that field.
	Since 2ba69f9f8819daaa3d166c4c1c7e03b121b88a95
	("libspice: add surface 0 support") the structure is no more stored in
	the field so there's no reason for this check causing only confusion.

	Acked-by: Victor Toso <victortoso@redhat.com>

2017-06-06  Frediano Ziglio  <fziglio@redhat.com>

	dcc: Use more portable mnemonic
	The maximum value for a 32 bit variable is UINT32_MAX and not
	UINT_MAX. Currently all supported platforms have these two
	constants having the same value so this patch don't change
	nothing in the generated code but potentially this could
	change in a future.

	Acked-by: Victor Toso <victortoso@redhat.com>

2017-06-06  Pavel Grunt  <pgrunt@redhat.com>

	reds: Adjust agent capabilites to disabled features
	File transfer and Copy & Paste can be disabled on the server even when
	they're supported by the guest agent. Tell it the client by adjusting
	the agent capabilities.

	Related: rhbz#1373725

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-06-02  Pavel Grunt  <pgrunt@redhat.com>

	reds: Constantify agent message parameter
	Make clear that the function is not changing it

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-05-25  Jonathon Jongsma  <jjongsma@redhat.com>

	Don't close all but one display during reboot.
	When a guest is rebooted, the QXL driver gets unloaded at some point in
	the reboot process. When the driver is unloaded, the spice server sets a
	single flag to FALSE: RedWorker::driver_cap_monitors_config. This flag
	indicates whether the driver is capable of sending its own monitors config
	messages to the client.

	The only place this flag is used is when a new primary surface is created. If
	this flag is true, the server assumes that the driver will send its own
	monitors config very soon after the surface is created. If it's false, the
	server directly sends its own temporary monitors config message to the client
	based on the size of the just-created primary surface. This temporary monitors
	config message always has a maximum monitor count of 1.

	This flag is set to false at startup so that in early boot (e.g. vga text
	mode), the server will send out these 'temporary' monitor config messages to
	the client whenever the primary surface is destroyed and re-created. This
	causes the client to resize its window to match the size of the guest. When the
	QXL driver is loaded and starts taking over the monitors config
	responsibilities, we set this flag to true and the server stops sending
	monitors config messages out on its own.

	If we reboot and set this flag to false, it will result in the server sending a
	monitors config message to the client indicating that the guest now supports a
	maximum of 1 monitor. If the guest happens to have more than one display window
	open, it will destroy those extra windows because they exceed the maximum
	allowed number of monitors. This means that if you reboot a guest with 4
	monitors, after reboot it will only have 1 monitor.

	To avoid this, we assume that if we had the ability to support multiple
	monitors at some point, that will return at some point. So when the server
	constructs its own monitors config message to send to the client (when the
	driver_cap_monitors_config flag is false), we send the previous maximum monitor
	count instead of always sending a maximum of 1.

	Resolves: rhbz#1274447
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-05-22  Frediano Ziglio  <fziglio@redhat.com>

	cursor-channel: Change cursor_visible type to bool
	The variable is used to store a boolean type.
	Update style for this boolean variable.

	Acked-by: Pavel Grunt <pgrunt@redhat.com>
	Acked-by: Victor Toso <victortoso@redhat.com>

2017-05-18  Jonathon Jongsma  <jjongsma@redhat.com>

	inputs: add SCAN_CODE_RELEASE define
	Use a #define rather than a magic number to make the code a bit more
	readable.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-05-18  Frediano Ziglio  <fziglio@redhat.com>

	reds: Remove only assigned 'mcc' field
	This field was never actually used, only changed.

	Acked-by: Victor Toso <victortoso@redhat.com>

2017-05-16  Pavel Grunt  <pgrunt@redhat.com>

	Add "fall through" comments where necessary
	Make gcc 7.0.1 happy

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-05-03  Frediano Ziglio  <fziglio@redhat.com>

	spicevmc: Remove useless check
	rcc is already deferenced in red_channel_client_get_client so
	checking for NULL after that is uselss.

	Also this call is generated from red_channel_client_disconnect
	which requires the rcc pointer to be valid.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-05-02  Jonathon Jongsma  <jjongsma@redhat.com>

	sound: don't store client in SndChannel
	The base RedChannel already keeps a list of channel clients, so there's
	no need for the SndChannel to also keep track of the client itself.

	Since the SndChannel only supports a single client (whereas other
	channels may have some partial support for multiple clients), I've
	provided a convenience function for getting the client and warning if
	there is more than one.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	sound: Change snd_playback_start/snd_record_start
	The content of these functions almost exclusively deals with channel
	client functionality except one line where the channel's active state is
	set to TRUE.

	These functions are called in two different places.

	The first place is from the public API spice_server_record_start() and
	spice_server_playback_start(). These functions should alter the
	channel's active state, and then set the associated channel client to
	active.

	The second place is when a new channel client is created. In this
	case, it is only called if the channel is already active, so it doesn't
	make much sense to set the channel's active state inside of the
	function.

	To simplify things (and enable some future refactoring), this function
	now only deals with the SndChannelClient. The functions have also been
	renamed to reflect this fact. The SndChannel's active state is now only
	modified from the public API functions.

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

	sound: use GList for global list of sound channels
	Instead of putting a 'next' link within the channel structure itself,
	just use a generic GList structure to keep a list of active sound
	channels.

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

	sound: Remove dead code in client constructors
	When a new PlaybackChannelClient or RecordChannelClient is created,
	there are several places where we make decisions based on whether the
	client is active or not. But these checks are done before the 'active'
	flag is ever set, so this code is effectively dead. This has been the
	case since commit 6fdcb931 and d351bb35, so this code has not been
	executed for approximately 7 years now.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	sound: Remove on_new_record_channel_client()
	It is only called from the constructor, so move all of the code into
	that function.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	sound: Remove on_new_playback_channel_client()
	This function is only called from the constructor, so move all of that
	code into the constructor.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-05-02  Frediano Ziglio  <fziglio@redhat.com>

	red-parse-qxl: s/true/false
	Reverse return values of the various bool methods so that 'true' means
	success, and 'false' failure rather than the opposite.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-05-02  Christophe Fergeau  <cfergeau@redhat.com>

	red-parse-qxl: Change int/1/0 to bool/true/false
	The red_get_* methods in red-parse-qxl.c return a boolean, even though
	their return type is an int, and they return 1/0. This commit changes
	this to the more explicit bool/true/false.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	red-parse-qxl: Use true/false rather than TRUE/FALSE
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-04-28  Christophe Fergeau  <cfergeau@redhat.com>

	Introduce WriteBufferOrigin enum typedef
	This use to be an anonymous enum, used as an int in
	RedCharDeviceWriteBufferPrivate::origin.
	Introducing a typedef clarifies what kind of value it's holding.

	Make RedCharDeviceWriteBuffer::refs private

	Make RedCharDeviceWriteBuffer::token_price private

	Make RedCharDeviceWriteBuffer::client private

	Make RedCharDeviceWriteBuffer::origin private

	Add RedCharDeviceWriteBufferPrivate
	This is intended to hold the fields that only char-device.c has a use
	for, but for now this only adds the boilerplate for it, the next commit
	will move the relevant field there.

	Remove redundant code from red_channel_client_msg_sent()
	red_channel_client_clear_sent_item() will clear send_data.blocked, so no
	need to do it in red_channel_client_msg_sent() as well.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Use red_channel_client_set_blocked() helper
	Now that red_channel_client_set_blocked() is no longer changing the
	events we are watching for, we can call it from
	red_channel_client_push().

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Don't modify watch when network queue is full
	Since 5c460d, we need to watch for WATCH_EVENT_WRITE as long as there are
	items queued waiting to be sent, this does not need to be done only when
	the network queue is full.

	When red_channel_client_set_blocked() is called, as a message is being
	sent, WATCH_EVENT_WRITE will already be set, so it does not need to set
	it again.
	red_channel_client_msg_sent() removes WATCH_EVENT_WRITE, but this will
	be done later anyway by red_channel_client_push() if needed.

	Since it's redundant, we can remove this.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Remove unneeded red_channel_client_is_blocked() call
	red_channel_client_msg_sent() calls red_channel_client_clear_sent_item()
	which will clear the rcc->priv->send_data.blocked flag. Later on, it
	contains a check for !red_channel_client_is_blocked(), which will always
	be true as nothing in between could have set it again. This commit
	removes this unneeded check.

	This check was already redundant when it was introduced in
	9a62a9a809eaf0

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Remove unneeded rcc->priv->latency_monitor.timer checks
	Before this commit, red_channel_client_start_ping_timer() and
	red_channel_client_cancel_ping_timer() had checks to be no-ops when
	rcc->priv->latency_monitor.timer is NULL.

	This commit adds a similar check to
	red_channel_client_restart_ping_timer(), and removes explicit NULL
	checks before calls to red_channel_client_{cancel,restart,start}_ping_timer()

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-04-28  Frediano Ziglio  <fziglio@redhat.com>

	Remove useless check
	rcc is just used on the next line so cannot be NULL.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-04-26  Christophe Fergeau  <cfergeau@redhat.com>

	Use enum rather than int in MainChannelClientPrivate::net_test_stage
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-04-22  Frediano Ziglio  <fziglio@redhat.com>

	build-sys: Do not abort on warnings
	This causes some tests to fail when run on Valgrind.
	In the code warnings are not supposed to cause crashes.
	This change avoid overriding entirely G_DEBUG definition but
	just append gc-friendly which make Valgrind more effective.

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

2017-04-21  Pavel Grunt  <pgrunt@redhat.com>

	configure: Check for vp9enc presence
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	display-channel: Remove extra 'the' in comment
	Fixes `make syntax-check`

	https://gitlab.com/spice/spice/builds/14346626

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-04-20  Frediano Ziglio  <fziglio@redhat.com>

	sound: Use bool type coherently
	Many function already used bool as boolean type.
	Change last gboolean occurrencies and values.

	Acked-by: Victor Toso <victortoso@redhat.com>

2017-04-19  Christophe Fergeau  <cfergeau@redhat.com>

	playback: Don't lose client connection after migration
	Commit 590acf3c556 introduced a regression after migration:
	PlaybackChannel::connection is never set even if a client is connected,
	which means the playback channel is non-functional until a client
	reconnects as all the snd_channel_set_xxx() method checks for a non-NULL
	PlaybackChannel::connection before sending data to the client.

	This commit slightly changes the code flow in
	on_new_playback_channel_client()/playback_channel_client_constructed()
	so that PlaybackChannel::connection is set regardless of what
	red_client_during_migrate_at_target() returns. This is what was done
	prior to 590acf3c556.

	This resolves https://bugs.freedesktop.org/show_bug.cgi?id=100136

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-04-13  Jonathon Jongsma  <jjongsma@redhat.com>

	DisplayChannel: document exclude_region() functions
	This is a particularly opaque part of the code for managing pending
	Drawable operations. This patch adds documentation atempting to explain
	these functions.

2017-04-11  Jonathon Jongsma  <jjongsma@redhat.com>

	Add debug output identifying audio codec
	It can be useful for debug to know what the codec of the playback and
	record channels are, so add a debug-level print statement indicating
	this.

	Resolves: rhbz#1436251

	Acked-by: Pavel Grunt <pgrunt@redhat.com>
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-04-11  Christophe Fergeau  <cfergeau@redhat.com>

	main-channel-client: Remove unused statistics code
	Main-channel-client.c has code to send pings when the statistics code is
	enabled. This is done through a timer calling a ping_timer_cb callback.
	However, this timer is created but never started, so this code is
	actually dead-code.

	Since this code does not seem to be doing much apart from sending the
	pings (which can be achieved by simply setting monitor-latency to TRUE
	in main_channel_client_create()), this commit removes it.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Use red_channel_client_is_blocked
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Use bool in RedChannelClientLatencyMonitor
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Use enum rather than int in RedChannelClient{Latency,Connectivity}Monitor
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Use bool in ConnectivityMonitor
	Their uint32_t value is never used, all that matters is whether we
	received data or not.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove one more unused "monitor_latency" arguments
	This was missed in commit db9dcd9.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-04-07  Jonathon Jongsma  <jjongsma@redhat.com>

	Test client caps separately
	in main_channel_push_agent_connected(), it used the convenience function
	red_channel_test_remote_cap() to determine whether to send the
	AGENT_CONNECTED_TOKENS message, or the AGENT_CONNECTED message. However,
	this function returns false if *any* one client doesn't support the
	capability. We should instead check each individual client separately to
	see if they support the capability.

	Remove unused red_channel_test_remote_common_cap()
	This was a convenience function around
	red_channel_client_test_remote_common_cap() that simply iterated over
	each client (currently we only really support a single client anyway)
	and returned TRUE only if all clients supported the capability. But
	nobody ever called this wrapper function.

	Remove extra space between "!" and variable name

	snd_desired_audio_mode: change arguments to bool
	client_can_celt and client_can_opus are true/false values, so use
	'bool' type instead of 'int.

	red_channel_client_test_remote_cap() returns bool
	Both _test_remote_cap() and _test_remote_common_cap() are used as
	boolean values, so change the return type from int to bool to follow our
	coding standard.

	Change playback_compression to bool type
	This is a setting for determining whether to compress the audio playback
	channel or not. It is variously typed as int or uint32_t. Convert it to
	a 'bool' to make it more clear that it is a true/false value rather than
	an enumeration or something like that.

2017-04-07  Frediano Ziglio  <fziglio@redhat.com>

	test: Add vp9 support to GStreamer test
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Attempt to create bitmap debug directory
	The DUMP_BITMAP compile option enable some debugging code to
	output image bitmaps in a subdirectory of /tmp.
	However if this directory does not exists the server will crash
	as not able to create a file in it.
	Try to create directory before creating the file.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	gstreamer: Remove some leaks if pipeline cannot be created
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2017-04-07  Pavel Grunt  <pgrunt@redhat.com>

	manual: Remove outdated GL acceleration info
	No need to reference a copr. Everything has been merged and relevant
	component versions are mentioned.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	manual: Update folder sharing instruction
	Link to the folder with latest releases and remove outdate info about
	the service registration.

	Acked-by: Victor Toso <victortoso@redhat.com>

2017-04-05  Christophe Fergeau  <cfergeau@redhat.com>

	Make various functions static
	- glz_enc_dictionary_reset
	- monitors_config_new
	- red_channel_any_blocked
	- red_channel_no_item_being_sent
	- red_client_get_channel

	are only used in the file where they are defined, so they can as well be
	static.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-03-31  Christophe Fergeau  <cfergeau@redhat.com>

	build-sys: Add configure check for TCP_KEEPIDLE
	This is only available in newer FreeBSD releases (9.1 and later), and
	will cause build errors or older versions

	This fixes https://bugs.freedesktop.org/show_bug.cgi?id=99213

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	reds-stream: Introduce reds_stream_get_no_delay() helper
	This new function removes one place outside of RedsStream which needs to
	access RedsStream::socket

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	net: Introduce red_socket_set_keepalive() helper
	This allows to move some low-level code out of reds.c

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	net: Introduce red_socket_set_non_blocking() helper
	This allows to move some low-level code out of reds.c

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	reds-stream: Introduce reds_stream_set_no_delay() helper
	The code to enable/disable on a TCP socket is duplicated in multiple
	places in the code base, this commit replaces this duplicated code with
	a helper in RedsStream.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	common: Update spice-common submodule
	This brings in these changes:

	Christophe Fergeau (1):
	      log: Add missing stdio.h include

	Frediano Ziglio (2):
	      protocol: Add support for VP9 video codec
	      region: Avoid possible memory corruption

	Jonathon Jongsma (1):
	      Document REGION_TEST_* bitmasks

	Marc-André Lureau (1):
	      build-sys: don't dist spice-protocol.html

	Sebastian Andrzej Siewior (1):
	      ssl: Use ASN1_STRING_get0_data instead of ASN1_STRING_data

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-03-31  Frediano Ziglio  <fziglio@redhat.com>

	red-channel: Initialize statistic node correctly
	Doing a memset(0) on a SpiceStatNode does not create an empty/unattached
	node, but instead creates a node '0'. This node could be non-existing,
	or totally unrelated.
	This patch creates a default '0' node as soon as the file is created.
	This will make the behaviour of 0-filled nodes more in line with what
	one would expect.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-03-30  Christophe Fergeau  <cfergeau@redhat.com>

	Unify header guards
	This changes the header guards in all .h files to follow this format:

	/*
	 * Licensing block
	 */

	/* ... */

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove unused red_channel_client_new()
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Don't set RedChannelClient::monitor-latency to FALSE
	This is the default value, and the property is marked as
	_CONSTRUCT_ONLY, so we don't need to explicitly force the default when
	instantiating a RedChannelClient.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Remove unused "monitor_latency" arguments
	InputsChannelClient::new and SmartcardChannelClient::new both accept a
	"monitor_latency" argument, which is always FALSE. It can be removed.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-03-30  Frediano Ziglio  <fziglio@redhat.com>

	Initialize earlier GLib type system if necessary
	Before GLib 2.36 you should call g_type_init before attempting
	any GLib type usage.
	As constructor function are called before even main we need
	to call g_type_init much before do_spice_init.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Fix minor incompatibilities with RHEL6
	Include missing pthread header.
	Avoid undeclared functions in test-glib-compat.c including
	proper/correct header.
	Define missing g_assert_true and g_assert_false.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-03-27  Christophe Fergeau  <cfergeau@redhat.com>

	build-sys: Alphabetically order source file list
	The list of source files to build was in a random order, this commit
	orders them alphabetically.

2017-03-24  Frediano Ziglio  <fziglio@redhat.com>

	test-leaks: Document test program
	This test needs some additional setup to do its job.

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

2017-03-23  Frediano Ziglio  <fziglio@redhat.com>

	ci: Make possible to execute additional expensive checks on GitLab
	Install missing GStreamer plugins and enable these checks.
	Currently the checks are enabled if valgrind is used.
	This as the main "makecheck" job uses address sanitizer which
	detects some leaks due to some Glib usage. Valgrind checks uses
	some suppression for some Glib leaks so they will work correctly.

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

	Some automatic check on video encoders
	Stress a bit video encoders.
	This check different combination of
	- encoder type;
	- image formats;
	- image clipping (encoding partial frames);
	- handling frames split into chunks.

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

	build-sys: Add option to enable additional checks
	This to enable extra test.
	This option is used also in different projects.

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

	reds-stream: Small syscall optimisation
	Handle single chunk writev as normal write.
	From some test more than 60% of the times writev is called with 1 as
	counter. We can easily and very cheaply turn this call to a simpler
	write avoiding the need to pass the array to the kernel.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-03-23  Christophe Fergeau  <cfergeau@redhat.com>

	tests/pki: Use CA/certificate valid until 2048
	As pointed out by danpb, tests/pki/server-cert.pem is only valid until
	Fri Nov 29 15:51:44 UTC 2019

	This changes tests/pki/server-cert.pem and tests/pki/ca-cert.pem to be
	valid until 2048. These certificates were generated using the
	instructions on https://www.spice-space.org/page/SSLConnection
	The -subj args were omitted, and the defaults suggested by openssl used.
	The -days parameter was changed to -days 10950.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	build-sys: Add tests/pki to EXTRA_DIST
	This fixes make distcheck

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-03-22  Pavel Grunt  <pgrunt@redhat.com>

	ci: Add valgrind check
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-03-22  Frediano Ziglio  <fziglio@redhat.com>

	Fix GStreamer encoding if stride is not 4 bytes aligned
	This is required by GStreamer.

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

2017-03-22  Christophe Fergeau  <cfergeau@redhat.com>

	build-sys: Update to latest ax_valgrind_check.m4
	This allows to remove a small hack in server/Makefile.am where we were
	using make check-valgrind-memcheck rather than make check-valgrind to
	make sure we get a non-0 exit code on failures.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-03-21  Christophe Fergeau  <cfergeau@redhat.com>

	build-sys: Add make check-valgrind target
	This allows to run automatically our test-suite with valgrind to test
	for memory leaks.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	tests: Port test-qxl-parsing to GTest
	test-qxl-parsing is really a series of several tests. Porting it to
	GTest makes this more obvious. This also has the side-effect of making
	it more friendly to 'make check-valgrind' (which would fail on SIGALRM,
	and on unexpected g_warning()).

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	reds-stream: Don't use sendmsg with uninitialized memory
	On my 64 bit Fedora 25, CMSG_SPACE() adds 4 bytes of padding after the
	file descriptor in the control data. This causes warnings when ran under
	valgrind as we set msg_controllen to CMSG_SPACE().

	This commit fills the control data to 0 to avoid these warnings.

	==30301== Syscall param sendmsg(msg.msg_control) points to uninitialised byte(s)
	==30301==    at 0x8127367: sendmsg (sendmsg.c:28)
	==30301==    by 0x41880B: reds_stream_send_msgfd (reds-stream.c:295)
	==30301==    by 0x40953F: main (test-stream.c:121)
	==30301==  Address 0xffefff1b4 is on thread 1's stack
	==30301==  in frame #1, created by reds_stream_send_msgfd (reds-stream.c:263)

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

2017-03-17  Frediano Ziglio  <fziglio@redhat.com>

	build: Fix some indentation issue on Makefile.am
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-03-16  Frediano Ziglio  <fziglio@redhat.com>

	Revert "gstreamer: Avoid memory copy if strides are different"
	This reverts commit c3d237075b994fe67edddd58f2b3164cb579e6f4.

	When you call gst_buffer_add_video_meta_full GStreamer assumes that
	buffer is contiguous. Specifically GStreamer assumes that the first
	chunk is big enough to hold a whole frame. This results usually in
	some pixel shifts in the video. The pixel shifts you can see are
	artifacts due to how the guest sends the frames.

	Assuming you allocate the 2 chunks with 2 malloc:

	   p1 = malloc(size);
	   ...
	   p2 = malloc(size);

	Usually the memory allocator tend to allocate linearly if there are
	space adding a prefix to describe next block leading to a memory
	arrangement as:

	   +-------------------+
	   | p1 prefix         |
	   +-------------------+
	   | p1 buffer         |
	   +-------------------+
	   | p2 prefix         |
	   +-------------------+
	   | p2 buffer         |
	   +-------------------+

	now if you take p1 pointer and you assume it points to a 2 * size
	buffer you will get p2 prefix in the middle, this prefix is the pixel
	shifts.

	Problems happens specifically in gst_video_frame_map_id.
	This bug is reported in https://bugzilla.gnome.org/show_bug.cgi?id=779524.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-03-14  Christophe Fergeau  <cfergeau@redhat.com>

	Add missing chainups to parent class
	A few dispose/finalize implementations were not chaining up to their
	parent classes, causing memory leaks.

	This fixes leaks like the following:

	==16240== Memcheck, a memory error detector
	==16240== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
	==16240== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
	==16240== Command: ./test-leaks
	==16240==
	==16240==
	==16240== HEAP SUMMARY:
	==16240==     in use at exit: 245,490 bytes in 3,638 blocks
	==16240==   total heap usage: 5,418 allocs, 1,780 frees, 17,676,968 bytes allocated
	==16240==
	==16240== 16 bytes in 1 blocks are definitely lost in loss record 203 of 771
	==16240==    at 0x4C2DADE: malloc (vg_replace_malloc.c:298)
	==16240==    by 0x4C2FC91: realloc (vg_replace_malloc.c:785)
	==16240==    by 0x52864E: dispatcher_register_handler (dispatcher.c:374)
	==16240==    by 0x5293E0: main_dispatcher_constructed (main-dispatcher.c:315)
	==16240==    by 0x7F873DB: g_object_new_internal (gobject.c:1823)
	==16240==    by 0x7F87EE4: g_object_new_valist (gobject.c:2042)
	==16240==    by 0x7F86E90: g_object_new (gobject.c:1626)
	==16240==    by 0x5292A5: main_dispatcher_new (main-dispatcher.c:295)
	==16240==    by 0x429A0A: do_spice_init (reds.c:3416)
	==16240==    by 0x42A3F5: spice_server_init (reds.c:3663)
	==16240==    by 0x4095B1: server_leaks (test-leaks.c:45)
	==16240==    by 0x844C60A: test_case_run (gtestutils.c:2161)
	==16240==    by 0x844C9CA: g_test_run_suite_internal (gtestutils.c:2244)
	==16240==    by 0x844CA73: g_test_run_suite_internal (gtestutils.c:2256)
	==16240==    by 0x844CC8A: g_test_run_suite (gtestutils.c:2332)
	==16240==    by 0x844B92C: g_test_run (gtestutils.c:1599)
	==16240==    by 0x409A0B: main (test-leaks.c:126)
	==16240==
	==16240== 16 bytes in 1 blocks are definitely lost in loss record 204 of 771
	==16240==    at 0x4C2DADE: malloc (vg_replace_malloc.c:298)
	==16240==    by 0x4C2FC91: realloc (vg_replace_malloc.c:785)
	==16240==    by 0x52864E: dispatcher_register_handler (dispatcher.c:374)
	==16240==    by 0x5293E0: main_dispatcher_constructed (main-dispatcher.c:315)
	==16240==    by 0x7F873DB: g_object_new_internal (gobject.c:1823)
	==16240==    by 0x7F87EE4: g_object_new_valist (gobject.c:2042)
	==16240==    by 0x7F86E90: g_object_new (gobject.c:1626)
	==16240==    by 0x5292A5: main_dispatcher_new (main-dispatcher.c:295)
	==16240==    by 0x429A0A: do_spice_init (reds.c:3416)
	==16240==    by 0x42A3F5: spice_server_init (reds.c:3663)
	==16240==    by 0x40BFD4: test_new (test-display-base.c:902)
	==16240==    by 0x40979D: vmc_leaks (test-leaks.c:92)
	==16240==    by 0x844C60A: test_case_run (gtestutils.c:2161)
	==16240==    by 0x844C9CA: g_test_run_suite_internal (gtestutils.c:2244)
	==16240==    by 0x844CA73: g_test_run_suite_internal (gtestutils.c:2256)
	==16240==    by 0x844CC8A: g_test_run_suite (gtestutils.c:2332)
	==16240==    by 0x844B92C: g_test_run (gtestutils.c:1599)
	==16240==    by 0x409A0B: main (test-leaks.c:126)
	==16240==
	==16240== 96 bytes in 1 blocks are definitely lost in loss record 638 of 771
	==16240==    at 0x4C2FA50: calloc (vg_replace_malloc.c:711)
	==16240==    by 0x8427D3C: g_malloc0 (gmem.c:124)
	==16240==    by 0x842801F: g_malloc0_n (gmem.c:355)
	==16240==    by 0x527B44: dispatcher_constructed (dispatcher.c:141)
	==16240==    by 0x529321: main_dispatcher_constructed (main-dispatcher.c:307)
	==16240==    by 0x7F873DB: g_object_new_internal (gobject.c:1823)
	==16240==    by 0x7F87EE4: g_object_new_valist (gobject.c:2042)
	==16240==    by 0x7F86E90: g_object_new (gobject.c:1626)
	==16240==    by 0x5292A5: main_dispatcher_new (main-dispatcher.c:295)
	==16240==    by 0x429A0A: do_spice_init (reds.c:3416)
	==16240==    by 0x42A3F5: spice_server_init (reds.c:3663)
	==16240==    by 0x4095B1: server_leaks (test-leaks.c:45)
	==16240==    by 0x844C60A: test_case_run (gtestutils.c:2161)
	==16240==    by 0x844C9CA: g_test_run_suite_internal (gtestutils.c:2244)
	==16240==    by 0x844CA73: g_test_run_suite_internal (gtestutils.c:2256)
	==16240==    by 0x844CC8A: g_test_run_suite (gtestutils.c:2332)
	==16240==    by 0x844B92C: g_test_run (gtestutils.c:1599)
	==16240==    by 0x409A0B: main (test-leaks.c:126)
	==16240==
	==16240== 96 bytes in 1 blocks are definitely lost in loss record 639 of 771
	==16240==    at 0x4C2FA50: calloc (vg_replace_malloc.c:711)
	==16240==    by 0x8427D3C: g_malloc0 (gmem.c:124)
	==16240==    by 0x842801F: g_malloc0_n (gmem.c:355)
	==16240==    by 0x527B44: dispatcher_constructed (dispatcher.c:141)
	==16240==    by 0x529321: main_dispatcher_constructed (main-dispatcher.c:307)
	==16240==    by 0x7F873DB: g_object_new_internal (gobject.c:1823)
	==16240==    by 0x7F87EE4: g_object_new_valist (gobject.c:2042)
	==16240==    by 0x7F86E90: g_object_new (gobject.c:1626)
	==16240==    by 0x5292A5: main_dispatcher_new (main-dispatcher.c:295)
	==16240==    by 0x429A0A: do_spice_init (reds.c:3416)
	==16240==    by 0x42A3F5: spice_server_init (reds.c:3663)
	==16240==    by 0x40BFD4: test_new (test-display-base.c:902)
	==16240==    by 0x40979D: vmc_leaks (test-leaks.c:92)
	==16240==    by 0x844C60A: test_case_run (gtestutils.c:2161)
	==16240==    by 0x844C9CA: g_test_run_suite_internal (gtestutils.c:2244)
	==16240==    by 0x844CA73: g_test_run_suite_internal (gtestutils.c:2256)
	==16240==    by 0x844CC8A: g_test_run_suite (gtestutils.c:2332)
	==16240==    by 0x844B92C: g_test_run (gtestutils.c:1599)
	==16240==    by 0x409A0B: main (test-leaks.c:126)
	==16240==
	==16240== LEAK SUMMARY:
	==16240==    definitely lost: 224 bytes in 4 blocks
	==16240==    indirectly lost: 0 bytes in 0 blocks
	==16240==      possibly lost: 0 bytes in 0 blocks
	==16240==    still reachable: 207,718 bytes in 3,312 blocks
	==16240==                       of which reachable via heuristic:
	==16240==                         newarray           : 1,536 bytes in 16 blocks
	==16240==         suppressed: 34,548 bytes in 302 blocks
	==16240== Reachable blocks (those to which a pointer was found) are not shown.
	==16240== To see them, rerun with: --leak-check=full --show-leak-kinds=all
	==16240==
	==16240== For counts of detected and suppressed errors, rerun with: -v
	==16240== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 20 from 20)
	FAIL test-leaks (exit status: 1)

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	smartcard: Remove unneeded 'dispose' implementation
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-03-13  Frediano Ziglio  <fziglio@redhat.com>

	tests: Enable address sanitizer on GitLab CI
	Add required library and options so tests will use the
	sanitizer.

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

2017-03-09  Jonathon Jongsma  <jjongsma@redhat.com>

	DisplayChannel: start documenting drawable tree
	The code that manages pending QXL Drawable operations is fairly complex
	and difficult to understand. This is an attempt to start documenting
	that code to save time when we have to work on this code in the future.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-03-09  Christophe Fergeau  <cfergeau@redhat.com>

	reds-stream: Use true/false instead of TRUE/FALSE
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Use bool rather than int return values when appropriate
	This commit changes all functions returning TRUE/FALSE from having an
	'int' return value to 'bool'.
	This way it's obvious that such a function is not going to return
	anything else than TRUE or FALSE.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Remove stdbool.h include from .c files
	It's already included in red-common.h

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-03-08  Frediano Ziglio  <fziglio@redhat.com>

	red-channel: Move config_socket vfunc to RedChannelClient
	config_socket is configuring the client stream socket.
	As is responsibility of RedChannelClient to handle the stream
	it make more sense to have the function in this object.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	test-leaks: Checks some leaks using TLS
	Verify stuff are freed correctly (like TLS context).
	The different PKI file required are generated with
	base values (localhost and rsa 1024).

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	test-leaks: Test that creating and destroying spicevmc does not leak
	Add and remove some vmc device to check for leaking.
	These combination assure that currently implemented type
	of devices (webdav, usb and generic) are checked.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	reds: Change if style
	The nested if statements could be confusing, no needs for them.

	Acked-by: Victor Toso <victortoso@redhat.com>

2017-03-07  Frediano Ziglio  <fziglio@redhat.com>

	reds: Send link replies with less chunks
	Send header and reply together.
	This potentially save up to 160 bytes on the network which
	is a considerable amount considering that the message is
	about 50 bytes.
	This as sending multiple chunks you can have different framing,
	specifically:
	- if you use TLS every chunk get encrypted separately
	  (reds-stream, currently usually 29 bytes for every chunks);
	- tcp settings and no delay on socket. More likely with fast
	  connections or better network cards. The tcp framing is
	  usually about 80 bytes;
	- additional tcp acknowledge (usually 64 bytes).
	So 80 + 29 + 64 = 173 bytes.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-03-06  Frediano Ziglio  <fziglio@redhat.com>

	reds: Do not leak SSL context
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-03-06  Victor Toso  <me@victortoso.com>

	syntax-check: Fix missing AUTHORS
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-03-04  Frediano Ziglio  <fziglio@redhat.com>

	red-channel: Move alloc_recv_buf and release_recv_buf to RedChannelClient
	These vfuncs are more appropriate in RedChannelClient.
	The buffer they allocated are related to the client stream
	which is managed directly by RedChannelClient.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Introduce CommonGraphicsChannelClient
	This prepare for the next patch.
	The network recieve buffer should be per-client rather than per-channel.
	The following patch will make this change, but this common base class
	will allow the cursor client and the display client to share a common
	implementation.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	sound: Remove header dependency
	Sound code is not using Qxl interface.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	red-channel: Move byte statistic to RedChannelClient
	As the counters are shared there is no reason why not
	handling the byte count from RedChannelClient directly.
	This remove a dependency and avoid some function calls.
	The only visible difference at user level is that the
	counters are created when a client connects.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	red-channel-client: Add message counters to statistics
	Show messages sent to clients.
	This is useful to understand the message number as an high
	message number can affects performance and is not easy to
	understand the message count from the byte count (which is
	available).

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-03-03  Frediano Ziglio  <fziglio@redhat.com>

	tests: Reuse GLib compatibility code
	Instead of disabling the code use the compatibility functions.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	tests: Move some specific GLib compatibility to compatibility file
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	tests: Move some glib compatibility code to a separate file
	Allow to reuse this code in other tests.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Use variable values instead of computing again
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2017-03-02  Victor Toso  <me@victortoso.com>

	dcc: handle preferred video codec message
	[0] SPICE_MSGC_DISPLAY_PREFERRED_VIDEO_CODEC_TYPE

	This message provides a list of video codecs based on client's order
	of preference.

	We duplicate the video codecs array from reds.c and sort it using the
	order of codecs as reference.

	This message will not change an ongoing streaming but it could change
	newly created streams depending the rank value of each video codec
	that can be set by spice_server_set_video_codecs()

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-03-02  Frediano Ziglio  <fziglio@redhat.com>

	record: Allocate recording file globally from reds.c
	Allows to use recording function for multiple purposes.
	This will allow to register multiple screen VM or recording
	additional stuff like sound.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	record: Use reference counting for recording
	Allows to share the recording object.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	record: Synchronize write to record file
	The synchronization code is required to avoid mixing writing
	from multiple threads.
	Following patches will add this feature.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	red-channel: Use RedChannelCapabilities directly to pass capabilities
	For each channel there are two set of capabilities, one
	for the common ones and one for the specific ones.
	A single set were almost always passed using 2 arguments,
	a number of elements and an array but then before using
	these were converted to a GArray.
	Use a single structure (already available) to pass all
	channel capabilites using a single argument.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	red-channel: Separate RedChannelCapabilities
	Add function to initialize and destroy this type.
	Add GType type for boxing it.
	These changes a in preparation for next patch.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-channel-client: Make capabilities property write only
	These properties are not read and code is broken (the content of
	the array would be uninitialized).

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-channel: Remove unused type definition
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	main-dispatcher: Remove watch leak
	Watch was added but never removed.
	The added basic_event_loop_destroy() addition allows to see that
	this leak is gone).

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-03-01  Christophe Fergeau  <cfergeau@redhat.com>

	test-vdagent: Make test case more useful
	This switches the test to using the GTest API, and add several tests
	related to https://bugzilla.redhat.com/show_bug.cgi?id=1411194

	This uses some API not available in glib 2.28, so this checks we have a
	new enough glib before building this test, and disables warnings when
	using too new glib API when building it.

	The "multiple-vmc-devices" is based off code written by Frediano Ziglio.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Use spice_debug rather than spice_info in library code
	Using spice_info() gets in the way of tests using
	g_test_expect_message() as all the messages emitted using
	a non-debug log level must be listed as expected, otherwise we get a
	critical about an expected message not having been logged.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	reds: Close sockets when using spice_server_destroy()
	Currently, the network sockets opened by reds_init_net() are not closed
	on destruction, in other words they are leaked.

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

	test: Add test_destroy()
	This allows to chain several test cases by using
	test_new()/test_destroy().

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

2017-03-01  Frediano Ziglio  <fziglio@redhat.com>

	tests: Add basic spice_server_init()/spice_server_destroy()
	This can be used for very basic leak checks.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	reds: Free remaining configuration
	Free security, migration, sasl and name stuff.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	display-channel: Clean more stuff on finalize
	Release surfaces, cache and monitor configurations.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	stream: Remove region leak
	clip_in_draw_dest was not freed correctly.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-02-28  Frediano Ziglio  <fziglio@redhat.com>

	reds: Check that we do not free the wrong agent device
	Do not assume the device passed as an argument to
	spice_server_char_device_remove_interface() is the same as the current
	Reds::vdagent instance. This commit adds a check that this is the case,
	and returns early if not.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Remove reds_stream_set_info_flag
	Encapsulate into reds_stream_set_channel.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	spicevmc: Use spice_new instead of spice_malloc
	spice_new is a bit more safe as return a properly typed pointer.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	sound: Avoid unused IOV_MAX definition
	The usage was removed with commit 7ea1f2c133a8e57523078ba3112cec6a1d2f353e
	("sound: Use RedChannelClient to receive/send data").

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

2017-02-27  Frediano Ziglio  <fziglio@redhat.com>

	style: Change boolean style convention
	Following
	https://lists.freedesktop.org/archives/spice-devel/2017-February/035800.html
	, the consensus was to use 'bool' rather than 'gboolean', and to use
	true/false rather than TRUE/FALSE. New code should attempt to follow
	the new style.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-02-27  Christophe de Dinechin  <dinechin@redhat.com>

	Remove X == TRUE tests for non-boolean values
	Using X == TRUE is fragile, since the input value is a uint8_t. It would be
	surprising if the value was set to 2 or 0xFF and the test failed.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-02-27  Frediano Ziglio  <fziglio@redhat.com>

	style: Group together indentation sections
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-02-16  Frediano Ziglio  <fziglio@redhat.com>

	Fix minor inconsistencies with declaration and definition
	Declaration used gboolean while definition used int.

	Acked-by: Uri Lublin <uril@redhat.com>

2017-02-15  Frediano Ziglio  <fziglio@redhat.com>

	rcc: Make some functions/macros private
	Some constants/macros/function prototypes are defined in
	red-channel-client.h while they are only used by red-channel-client.c.
	This commit moves them to the .c file to make them private.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	rcc: Remove unused RedChannelClient::{is_connected,disconnect} vfuncs
	RedChannelClient is responsible for talking to the client so it knows
	if is connected or not.
	These vfuncs where used by DummyChannel used by SoundChannel.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	rcc: Use class name in comment
	red_channel seems a variable name.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Make RedChannel::config_socket() optional
	Most channels don't need to do specific settings for the client socket
	so avoid the need to do this setting making easier to setup the client
	channnel.

	Some improvements and commit subject suggested by Christophe Fergeau.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Do not set TCP_NODELAY flag twice
	TCP_NODELAY flag is set by default for all connection inside
	reds.c so there's no need to set again for the single
	client channel.

	Note that there are still some calls to setsockopt to change this
	option.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Clear "msg" pointers after releasing
	Avoid possible dangling pointers.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-02-15  Christophe Fergeau  <cfergeau@redhat.com>

	gstreamer: Add #ifdef around zero_copy()
	Since c3d237 "gstreamer: Avoid memory copy if strides are different" is
	only needed when zero copy is disabled. This moves the function
	definition to an already existing #ifdef block.

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

	test-playback: Pass proper types to spice_server_add_interface
	This is a revert of b76e561d.
	For a SpicePlaybackInstance, the base interface must be a
	SpicePlaybackInterface instance, not a SpiceBaseInterface instance, or
	spice-server code will end up reading out of bounds.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	test-display-base: Pass proper types to spice_server_add_interface
	This is a revert of 93b4f4050^ and 93b4f4050.
	For a SpiceCharDeviceInstance, the base interface must be a
	SpiceCharDeviceInterface instance, not a SpiceBaseInterface instance, or
	spice-server code will end up reading out of bounds.

	vmc_state/vmc_write/vmc_read implementations also have to be provided.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	test-vdagent: Pass proper types to spice_server_add_interface
	This is a revert of 93b4f4050^ and 93b4f4050.
	For a SpiceCharDeviceInstance, the base interface must be a
	SpiceCharDeviceInterface instance, not a SpiceBaseInterface instance, or
	spice-server code will end up reading out of bounds.

	vmc_state/vmc_write/vmc_read implementations also have to be provided.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	gstreamer: Remove unused function
	rate_control_is_active() is static and not used in gstreamer-encoder.c

	Not needed since 97fcad82eb7d1f3bbd8d1163801b5a3db92944c2.

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

2017-02-15  Frediano Ziglio  <fziglio@redhat.com>

	spicevmc: Add some statistics
	Allows to see compressed/uncompressed ratio

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Improve statistic code interface
	Use new structures and functions to implement the statistics code.
	Use inline functions instead of macros for increased type-safety.
	If statistics are disabled, the structures and functions become
	empty. This confines the configuration-specific #defines to the
	statistics implementation itself and avoids the need for #defines in
	the calling functions. This greatly reduces the chance of accidentally
	breaking the build for one configuration or the other. The reds option
	was removed from stat_inc_counter() as it was not used.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Do not set not blocking flag twice
	Non blocking flag is set for all connection inside reds.c so
	there's no need to set again for the single client channel.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-channel-client: Pass array size to red_channel_client_prepare_out_msg
	Do not make it assume vec contains IOV_MAX elements.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	red-channel-client: Remove vec field from OutgoingHandler
	This was always set to vec_buf.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-02-15  Christophe Fergeau  <cfergeau@redhat.com>

	rcc: Rename {Outgoing,Incoming}Handler
	They no longer contain any vfuncs, so calling them "handler" does not
	make a lot of sense. This commit renames them to
	OutgoingMessageBuffer/IncomingMessageBuffer.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	rcc: Remove red-channel-client-private.h
	Nothing outside of RedChannelClient needs access to data contained in
	RedChannelClientPrivate, so we can move all the type definitions to the
	.c file to make it fully opaque rather than relying on a private header.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	rcc: Move SpiceDataHeaderOpaque to red-channel-client-private.h
	It's only used by red-channel-client.c

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	rcc: Replace 'opaque' arg with typed RedChannelClient
	The methods previously used by OutgoingHandlerInterface and
	IncomingHandlerInterface are no longer used as generic callbacks,
	but are directly called from RedChannelClient code. We can be explicit
	about the type of their first argument (RedChannelClient *) rather than
	using a generic void * pointer.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	rcc: Pass RedChannelClient to red_peer_handle_outgoing()
	There is only one implementation of OutgoingHandler which relies
	OutgoingHandler::opaque being a RedChannelClient. This commit makes this
	explicit in order to get rid of the OutgoingHandler::opaque data member.

	This renames red_peer_handle_outgoing() to
	red_channel_client_handle_outgoing() as the method is now very much tied
	to RedChannelClient.

	If we want to keep some genericity, we could return error codes from
	red_channel_client_handle_outgoing() and handle RedChannelClient
	disconnection/... from the caller rather than directly in the
	_handle_outgoing() method. This would probably allow to move the
	data reading logic to reds-stream.c

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	rcc: Pass RedChannelClient to red_peer_handle_incoming()
	There is only one implementation of IncomingHandler which relies
	IncomingHandler::opaque to be a RedChannlClient. This commit makes this
	explicit. This allows to get rid of the IncomingHandler::opaque data
	member.

	This renames red_peer_handle_incoming() to
	red_channel_client_handle_incoming() as the method is now very much tied
	to RedChannelClient.

	If we want to keep some genericity, we could return error codes from
	red_channel_client_handle_incoming() and handle RedChannelClient
	disconnection/... from the caller rather than directly in the
	_handle_incoming() method. This would probably allow to move the
	data reading logic to reds-stream.c

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	channel: Remove IncomingHandlerInterface
	This commit removes what remains of IncomingHandlerInterface. The
	remaining function pointers were pointing to RedChannel vfuncs.
	Moreover the IncomingHandlerInterface abstraction is unused, ie the
	codebase only has a single implementation for it, so we can directly
	call the relevant methods and make them static instead.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	channel: More removal of IncomingHandlerInterface vfuncs
	This commit removes IncomingHandlerInterface::on_error and
	IncomingHandlerInterface::on_input. As with previous commits, these
	vfuncs are always calling the method, and RedChannel::init sets them to
	point to RedChannelClient methods, which RedChannelClient is then going
	to call indirectly through the IncomingHandlerInterface instance.

	This commit changes this to direct calls to the corresponding methods.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	channel: Remove IncomingHandlerInterface::{alloc,release}_msg_buf
	Similarly to the previous commits, this removes an indirection level,
	IncomingHandlerInterface stores pointers to
	alloc_recv_buf/release_recv_buf vfuncs, but these are always set to
	RedChannel::alloc_recv_buf/RedChannel::release_recv_buf, which are also
	vfuncs which can be overridden if needed. This commit removes the
	indirection and directly calls the relevant methods.

	These vfuncs really should be in RedChannelClient rather than
	RedChannel.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	channel: Remove OutgoingHandlerInterface
	RedChannel uses OutgoingHandlerInterface to provide constant pointers to
	RedChannelClient methods. This OutgoingHandlerInterface structure is
	then used in RedChannelClient to indirectly call these methods.

	The OutgoingHandlerInterface abstraction is unused, ie the codebase
	only has a single implementation for it, so we can directly call the
	relevant methods and make them static instead.

	Acked-by: Frediano Ziglio <figlio@redhat.com>

	channel: Rework red_channel_on_output a bit
	Have the RedChannelClient callback call into a RedChannel callback
	rather than doing the opposite. This will be useful in some subsequent
	refactoring of this code.

	channel: Remove RedChannel::handle_parsed
	red_channel_client_parse() currently does roughly:

	if (klass->parser) {
	    parsed = klass->parser(msg, msg_size, &parsed_size);
	    klass->handle_parsed(rcc, parsed_size, msg_type, parsed);
	} else {
	    klass->handle_message(rcc, msg_type, msg, msg_size);
	}

	The handle_parsed implementation expects a void * 'parsed' argument,
	which will then be cast to the correct type. There is not really a need
	to provide distinct handle_parsed/handle_message vfuncs, instead we can
	say that if a RedChannel subclass provides a 'parser' vfunc, then it's
	'handle_message' vfunc will be called with the parsed message, otherwise
	it will be called with unparsed data (ie what handle_message currently
	expects).

	This makes the code slightly easier to follow as messages will always be
	handled by the same vfunc.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-02-14  Frediano Ziglio  <fziglio@redhat.com>

	smartcard: Remove an unnecessary wrapper function
	smartcard_channel_client_pipe_add_push was just calling
	red_channel_client_pipe_add_push without any cast or other
	changes.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-02-13  Christophe Fergeau  <cfergeau@redhat.com>

	channel: Remove unused vfunc typedefs from header
	They became unused more than 5 years ago in commit f84dfe

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-02-10  Christophe Fergeau  <cfergeau@redhat.com>

	Move variables to inner block in red_peer_handle_incoming()
	This makes the code slightly more readable as this means less local
	variables to keep track of when taking a high level view of that code.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-02-08  Frediano Ziglio  <fziglio@redhat.com>

	replay: Avoid double free of primary surface
	read_binary() attaches 'mem' to the SpiceReplay::allocated list.

	On failure, SpiceReplay::allocated and its content are freed by
	spice_replay_free().

	SpiceReplay::primary_mem is also freed, which causes a double free
	as replay_handle_create_primary() added 'mem' both to
	SpiceReplay::primary_mem and SpiceReplay::allocated.

	This commit avoids this by ensuring SpiceReplay::primary_mem is not
	kept in the SpiceReplay::allocated list.

	Note that this double free can happen only on currupted or wrong
	record images.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-02-06  Jonathon Jongsma  <jjongsma@redhat.com>

	DisplayChannel: add documentation for Ring types
	The Surface and Display channels each have a 'current_list' Ring, and
	Surface also has a 'current' Ring. these names are confusing, so at
	minimum, add a comment indicating the type of object they hold. The
	DisplayChannel::current_list already had a comment, but it was
	incorrect.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Shadow: remove unused 'owner' field
	This field is set but is never read. The only usage of this field was
	removed in 3dffeb25edc9d7a893d9697fc7b19739aff36cc9

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-02-06  Frediano Ziglio  <fziglio@redhat.com>

	replay: Support TLS in replay utility
	Allows to test encrypted connections.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	main-channel: Prevent overflow reading messages from client
	Caller is supposed the function return a buffer able to store
	size bytes.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Prevent integer overflows in capability checks
	The limits for capabilities are specified using 32 bit unsigned integers.
	This could cause possible integer overflows causing buffer overflows.
	For instance the sum of num_common_caps and num_caps can be 0 avoiding
	additional checks.
	As the link message is now capped to 4096 and the capabilities are
	contained in the link message limit the capabilities to 1024
	(capabilities are expressed in number of uint32_t items).

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Prevent possible DoS attempts during protocol handshake
	The limit for link message is specified using a 32 bit unsigned integer.
	This could cause possible DoS due to excessive memory allocations and
	some possible crashes.
	For instance a value >= 2^31 causes a spice_assert to be triggered in
	async_read_handler (reds-stream.c) due to an integer overflow at this
	line:

	   int n = async->end - async->now;

	This could be easily triggered with a program like

	  #!/usr/bin/env python

	  import socket
	  import time
	  from struct import pack

	  server = '127.0.0.1'
	  port = 5900

	  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	  s.connect((server, port))
	  data = pack('<4sIII', 'REDQ', 2, 2, 0xaaaaaaaa)
	  s.send(data)

	  time.sleep(1)

	without requiring any authentication (the same can be done
	with TLS).

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-02-03  Frediano Ziglio  <fziglio@redhat.com>

	sound: Use default message handler if possible
	red_channel_client_handle_message can handle base messages
	so reuse it.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	stat-file: Avoid compiler warning
	Some gcc version reports this error:

	stat-file.c: In function 'stat_file_add_node':
	stat-file.c:180:15: error: 'node' may be used uninitialized in this function
	[-Werror=maybe-uninitialized]
	     g_strlcpy(node->name, name, sizeof(node->name));
	               ^~~~
	cc1: all warnings being treated as errors

	This warning is a false positive as this loop:
	    for (ref = 0; ref <= stat_file->max_nodes; ref++) {
	        node = &stat_file->stat->nodes[ref];
	        ...
	    }
	will always iterate at least once.

	This patch rewrite the loop in order to make more compilers
	understand that node variable is always initialized.

	There are two checks apparently removed in the patch:
	- check for stat_file->stat not being NULL. This was worthless as the
	  field was already used in the function. Also this field is never
	  NULL (unless memory corruption happened);
	- stat_file->stat->num_of_nodes >= stat_file->max_nodes. It's implicit
	  in the loop. If num_of_nodes >= max_nodes means that there are no
	  free nodes so all nodes should have SPICE_STAT_NODE_FLAG_ENABLED set,
	  loop will exit and function will return INVALID_STAT_REF.

	Reported-by: Christophe Fergeau <cfergeau@redhat.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	stat-file: Fix off by one buffer overflow
	The stat file contains an array of max_nodes elements
	so we must stay in [0, max_nodes) range, not [0, max_nodes].

	There are no spice path that lead to these overflows but
	it's better to have them fixed before creating one.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-02-03  Snir Sheriber  <ssheribe@redhat.com>

	autotools: compile gst-test only if gstreamer is available
	Needed in order to avoid compilation error when gstreamer is
	unavailable

	autotools: Add automake conditional for gstreamer
	Adding conditional for having gstreamer_0_10 or gstreamer_1_0,
	removing the previous conditionals and update relevant ifdefs
	with the newly defined conditional

2017-02-02  Frediano Ziglio  <fziglio@redhat.com>

	sound: Make clear active and client_active are boolean
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	sound: Reuse code to set volume and mute
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	sound: Reuse code for migrating client channels
	We support only a single client so don't waste code just
	to check this.
	The worst stuff can happen is that we'll migrate multiple
	connections.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	sound: Reuse code for snd_set_{playback,record}_peer
	Almost identical beside the type.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	sound: Use default disconnect for client channels
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	sound: free SndChannel data in finalize()
	Move the freeing of SndChannel data members from snd_detach_common() to
	the finalize function to encapsulate things a bit more cleanly. It
	doesn't really change the behavior or order of destruction since
	snd_detach_common() destroys the channel.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Make RedChannelClient::incoming private
	Sound implementation used internal RedChannelClient data while now
	it just uses the public interface not thouching RedChannelClient
	internal state so now is possible to make this field private.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-02-02  Christophe Fergeau  <cfergeau@redhat.com>

	sound: Convert SndChannelClient to RedChannelClient
	Now that SndChannelClient has switched from using its own code for
	sending data to using RedChannelClient, it's very close to being an
	actual RedChannelClient.
	This commit makes it directly inherit from RedChannelClient rather than
	having a channel_client field. This allows to get rid of the whole
	DummyChannel/DummyChannelClient code.

	Based on a patch from Frediano Ziglio <fziglio@redhat.com>

	sound: Prefer snd_set_command() over snd_*_send_*()
	snd_set_command()/snd_send() are higher level methods which take care of
	scheduling calls to the corresponding snd_*_send_*() methods when
	appropriate. This commit switches a few direct snd_*_send_*() calls to
	snd_set_command()/snd_send().

	Based on a patch from Frediano Ziglio <fziglio@redhat.com>

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	sound: Use RedChannelClient to receive/send data
	You can see that SndChannelClient has much less field
	as the code to read/write from/to client is reused from
	RedChannelClient instead of creating a fake RedChannelClient
	just to make the system happy.

	One of the different between the old sound code and all other
	RedChannelClient objects was that the sound channel don't use
	a queue while RedChannelClient use RedPipeItem object. This was
	the main reason why RedChannelClient was not used. To implement
	the old behaviour a "persistent_pipe_item" is used. This RedPipeItem
	will be queued to RedChannelClient (only one!) so signal code we
	have data to send. The {playback,record}_channel_send_item will
	then send the messages to the client using RedChannelClient functions.
	For this reason snd_reset_send_data is replaced by a call to
	red_channel_client_init_send_data and snd_begin_send_message is
	replaced by red_channel_client_begin_send_message.

	sound: Remove code from spice_server_record_get_samples()
	The removed code was trying to read data when
	spice_server_record_get_samples() is called. Since reading of data is
	event-driven anyway (see snd_event), it's redundant to try
	again to read more data.
	This commit removes this code as this will some refactoring easier in
	the next commits.

	Based on a patch from Frediano Ziglio <fziglio@redhat.com>

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	sound: Remove SndChannelClient::channel
	We can get it from our DummyChannelClient rather than storing it in
	SndChannelClient.

	Based on a patch from Frediano Ziglio <fziglio@redhat.com>

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	sound: Remove SndChannelClient::send_data::marshaller
	We can use the marshaller provided by the dummy RedChannelClient
	associated with SndChannelClient.

	Based on a patch from Frediano Ziglio <fziglio@redhat.com>

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	sound: Add sanity checks in snd_{playback,record}_send
	Filter out commands which should not happen. Should it be a
	g_warn_if_fail() or such instead?

	Based on a patch from Frediano Ziglio <fziglio@redhat.com>

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	sound: Implement snd_channel_config_socket
	This is in preparation for switching SndChannelClient into a proper
	RedChannelClient. The prototype of the new helper matches what is
	expected from the RedChannel::config_socket vfunc.

	To be able to achieve that, this commit associates the sound channel
	RedsStream instance with the DummyChannelClient instance we have, and
	then call snd_channel_config_socket() on that instance.

	Based on a patch from Frediano Ziglio <fziglio@redhat.com>

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	sound: Rework spice_server_playback_get_buffer() error handling
	The main goal of this commit is to avoid to dereference 'client' before
	it's checked for NULL. This meant splitting one error condition in 2
	separate ones.

	This also sets default values for the 'frame' and 'num-samples'
	out parameters so that we just have to return on error conditions.

	Based on a patch from Frediano Ziglio <fziglio@redhat.com>

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-02-02  Frediano Ziglio  <fziglio@redhat.com>

	gstreamer: Include only needed fields in SpiceFormatForGStreamer structure
	This structure is used to store format information for
	both Gstreamer 0.10 and 1.0 however the two format uses
	different fields from it.
	Use a macro to filter only needed fields.
	This currently also fixes a compile error using Gstreamer 0.10
	(GST_VIDEO_FORMAT_RGB15 not defined as not available).

	Acked-by: Victor Toso <victortoso@redhat.com>

2017-02-01  Frediano Ziglio  <fziglio@redhat.com>

	display-channel: Move _Drawable declaration to private header
	The structure is used only to allocate private data.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	spicevmc: Avoid computing some variable value if not necessary
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2017-01-31  Christophe Fergeau  <cfergeau@redhat.com>

	Add some NULL checks to spice_server_remove_interface()
	Currently, calling spice_server_remove_interface() twice in a row with
	the same SPICE_INTERFACE_CHAR_DEVICE is going to cause a crash when
	calling red_char_device_get_server(char_device->st); because
	char_device->st will have been set to NULL by the first call.

	This commit adds a few sanity checks before trying to use the various
	'st' members of the interfaces.

	This should avoid the crash described in
	https://bugzilla.redhat.com/show_bug.cgi?id=1411194 even though it's not
	clear how we got in that situation.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-01-31  Frediano Ziglio  <fziglio@redhat.com>

	reds: Get state using red_char_device_get_server
	Avoid to use g_object_get if not necessary.
	red_char_device_get_server is more type safe and we are
	not bound to dynamic fields.

	Acked-by: Uri Lublin <uril@redhat.com>

	display-channel: Remove current_size field
	This field is used only for debugging.
	Remove it reducing a bit all these "current" fields around.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Support VP9 encoder using GStreamer
	Acked-by: Victor Toso <victortoso@redhat.com>

2017-01-28  Frediano Ziglio  <fziglio@redhat.com>

	gstreamer: Avoid memory copy if strides are different
	If bitmap stride and stream stride are different copy was used.
	Using GStreamer 1.0 you can avoid the copy setting correctly
	image offset and stride.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-01-27  Frediano Ziglio  <fziglio@redhat.com>

	reds-stream: Simplify error logic
	Handling read returning 0 (usually end of connection/pipe)
	is the same of handling an error (read result -1) with errno == 0
	so merge the two paths to reuse code and simplify.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-01-26  Frediano Ziglio  <fziglio@redhat.com>

	reds: Check link header magic without waiting for the whole header
	This allows the connection to early fail in case initial bytes
	are not correct.
	This allows for instance VNC client to graceful fail connecting
	to a spice-server. This happens easily as the two protocols
	share the same range of ports.

	This resolves rhbz#1416692.

	Tested-by: Daniel P. Berrange <berrange@redhat.com>
	Acked-by: Uri Lublin <uril@redhat.com>

	spicevmc: Reduce number of last saved IDs
	Acked-by: Uri Lublin <uril@redhat.com>

	spicevmc: Remove leak of RedPortInitPipeItem::name
	Acked-by: Uri Lublin <uril@redhat.com>

	spicevmc: Avoid useless pointer cast
	red_channel_client_handle_message already accepts a void* pointer.

	Acked-by: Uri Lublin <uril@redhat.com>

2017-01-25  Jeremy White  <jwhite@codeweavers.com>

	Avoid a 'missing braces around initializer' warning.
	Static variables don't need initializers to be 0.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-01-24  Pavel Grunt  <pgrunt@redhat.com>

	Include compat header for g_clear_pointer
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	build-sys: Warn on usage of unavailable glib functions
	Warnings are printed when glib2 >= 2.32 is present

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-01-24  Frediano Ziglio  <fziglio@redhat.com>

	red-worker: Reuse code to process display command
	Code to read and process display commands were the same
	so use a common function for better reuse.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	gstreamer: Add gst_format to the table of supported formats
	This format is required to add metadata to the source buffer
	using gst_buffer_add_video_meta_full.
	This metadata can be used to pass strides/offsets, or
	dmabuf-specific information.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-worker: Do not leak memory for surface commands
	This happened during VM resume.
	RedSurfaceCmd were allocated but never freed.
	We don't need to malloc the RedSurfaceCmd used in handle_dev_close()
	as display_channel_process_surface_cmd() will not try to reference
	it after it has returned.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	red-worker: Reuse code to process cursor command
	Code to read and process cursor commands were the same
	so use a common function for better reuse.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-01-21  Frediano Ziglio  <fziglio@redhat.com>

	tests: Make possible to have a report of the video encoding
	This allows to do some possible statistics or graph.
	Currently the report contains encoded sizes.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Compatibility for GStreamer 0.10 for test utility
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2017-01-11  Christophe Fergeau  <cfergeau@redhat.com>

	sound: Add separate SND_MUTE_MASK
	Currently MUTE and VOLUME commands use the same VOLUME mask. This commit
	introduces a separate SND_MUTE_MASK for MUTE commands to make things
	a bit more clear.

	Based on a patch from Frediano Ziglio <fziglio@redhat.com>

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	sound: Remove dummy-channel.[ch]
	This is no longer used since "sound: Convert SndChannel to GObject"

	Based on a patch from Frediano Ziglio <fziglio@redhat.com>

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	sound: Remove duplicate AudioFrame typedef
	It's already defined before in the same source file.

	Based on a patch from Frediano Ziglio <fziglio@redhat.com>

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	sound: Don't dereference pointer before NULL check
	Based on a patch from Frediano Ziglio <fziglio@redhat.com>

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	sound: Remove unused __new_channel() argument
	It became unused in 26027036c 'red_channel: remove unused migrate flag
	from RedChannel' but was never removed from the function prototype.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	sound: Remove extraneous whitespace
	No need for this whitespace before ';'

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	channel: Remove commented out function prototype
	This became obsolete when RedChannel became GObject-based.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-01-10  Frediano Ziglio  <fziglio@redhat.com>

	gstreamer: Do not warn for tested formats
	These formats were tested manually using test-gst utility
	in server/tests.

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

	Add an helper to test VideoEncoder
	Add an utility to make possible to check various features of
	VideoEncoder.
	2 GStreamer plugins are used in a chain like this:
	  (1) input pipeline -> (2) video encoder -> (3) output pipeline
	While converting output from (1) is compared with output of (3)
	making sure the streaming is working correctly.
	You can set various options:
	- part of the input pipeline description to allow specifying different
	  video from GStreamer test ones to a video file;
	- the encoder to use;
	- different image properties to use for (2) input:
	  - different bit depth;
	  - top/down or down/up;
	- initial bitrate.

	The idea is to use this helper in combination with a shell script
	and some video sources to make able to test various settings.
	Also can be used to extend the current encoder list.

	As an example you can use a command like

	$ ./test-gst -e gstreamer:vp8 -i \
	  'filesrc location=bbb_sunflower_1080p_30fps_normal.mp4 \
	  ! decodebin ! videoconvert'

	to check vp8 encoding.

	Currently it does not emulate bandwidth changes as stream reports
	from the client are not coded.

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

2017-01-10  Victor Toso  <me@victortoso.com>

	reds: set the video_codecs in a separated function
	Small refactor. As reds_get_video_codecs() returns the video codecs as
	GArray, we should match reds_set_video_codecs() to have a GArray as
	parameter instead of string.

	reds_set_video_codecs_from_string() seems more appropriate for the
	previous function.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-01-06  Victor Toso  <me@victortoso.com>

	Update spice-common
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-01-06  Jonathon Jongsma  <jjongsma@redhat.com>

	Sound: Fix confusing channel/client terminology
	Previously, the object we now call SndChannel was named SndWorker, and
	the object we now call SndChannelClient was called SndChannel. When
	these names were changed, the functions
	on_new_(record|playback)_channel() were not updated, so the function
	names and the arguments are both a bit confusing now. Update them to
	match the new names.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2017-01-05  Frediano Ziglio  <fziglio@redhat.com>

	Increment correctly reference before adding the item to marshaller
	When the initial image was sent to the client the reference
	was not incremented leading to some user after free.
	This regression was introduced in
	3bde2e570cbfd4f29a2e94c14ff28b6e3987048d
	("DCC: remove more init_send_data() arguments").

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

	Avoid integer overflow for Drawable::refs field
	This fixes a regression caused by
	a43c21b6bcdda701763afb6d73e38a3c419e54c7
	("DCC: change how fill_bits() marshalls data by reference").
	Before the mentioned patch there were a few references to Drawable
	structure so an uint8_t was enough.
	Now that every chunk of the image is accounted you can easily
	get an overflow.
	This fixes https://bugs.freedesktop.org/show_bug.cgi?id=99258.

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

2017-01-04  Snir Sheriber  <ssheribe@redhat.com>

	tests: Fix compilation error
	Fix compilation error due to -Werror=maybe-uninitialized:

	  CC       test-display-base.o
	test-display-base.c: In function 'do_wakeup':
	test-display-base.c:579:13: error: 'update' may be used uninitialized...
	             push_command(&update->ext);

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-12-20  Jonathon Jongsma  <jjongsma@redhat.com>

	Remove third argument from red_channel_client_init_send_data()
	This third argument (and the 'item' member of
	RedChannelClient::priv::send_data) was a somewhat roundabout way to keep
	the RedPipeItem alive until a message is sent, just in case some data
	owned by that pipeitem was added to the marshaller by reference. This
	was a rather confusing mechanism, however, since it did not have any
	obvious connection to the _add_by_ref() call. It was never very clear
	whether you needed to pass an item to this function or not. The previous
	series of patches made this parameter unnecessary since the referencing
	of the pipe item (or other related structure) is now more explicitly
	connected to the calls to spice_marshaller_add_by_ref_full().

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	DCC: change how fill_bits() marshalls data by reference
	The fill_bits() function marshalls some data by reference. This data is
	owned by the RedDrawable that is owned by the Drawable that is owned by
	the RedDrawablePipeItem.  Instead of keeping the RedPipeItem alive by
	passing it to red_channel_client_init_send_data(), simply reference the
	Drawable and marshall it with _add_by_ref_full(). This means that we
	can't use  the _add_chunks_by_ref() convenience function since that
	function doesn't allow us to pass a free function to clean up the data
	after it is sent.

	This change is not perfect since the fill_bits() function makes an
	assumption that 'simage' is owned by the 'drawable'. On the other hand,
	the previous code made a much bigger assumption: that the caller would
	ensure that the data would be kept alive

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	DCC: remove more init_send_data() arguments
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Spicevmc: don't pass pipe item to init_send_data()
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Smartcard: Don't pass pipe item to _init_send_data()
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	MainChannel: remove another init_send_data arg
	Use spice_marshaller_add_by_ref_full() instead of _add_by_ref() to
	handle the referenced data properly rather than passing the pipe item to
	red_channel_client_init_send_data() to keep the pipe item alive
	indirectly.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-12-20  Frediano Ziglio  <fziglio@redhat.com>

	Refactor cursor marshalling for SET, INIT
	Use spice_marshaller_add_by_ref_full() instead of
	spice_marshaller_add_by_ref() to allow the marshaller to manage the
	lifetime of the referenced data buffer rather than having to manage it
	by passing a PipeItem to red_channel_client_init_send_data(). Since the
	data is owned by CursorItem (which is not in fact a RedPipeItem, but is
	owned by a pipe item and is itself refcounted), we take a reference on
	the CursorItem when adding the data buf to the marshaller, and then
	unreference it in the marshaller free func.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-12-20  Jonathon Jongsma  <jjongsma@redhat.com>

	Avoid passing pipe item to red_channel_client_init_send_data()
	The only time that the pipe item needs to be passed as the third
	argument to red_channel_client_init_send_data() is when the pipe item
	holds a data buffer that has been added to the marshaller by reference
	(spice_marshaller_add_by_ref()) and needs to be kept alive until the
	data has been sent. In all other cases, the item does not need to be
	kept alive, so we can safely pass NULL for this third parameter.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Reset marshaller as soon as a message is sent
	Any data that is added to the marshaller by reference (using e.g.
	spice_marshaller_add_by_ref_full()) is freed during
	spice_marshaller_reset(). But the marshaller is not currently reset
	until we begin to send the next message (in
	red_channel_client_send_item()). This means that the sent message data
	lives longer than expected and can violate some assumptions in other
	parts of the code.

	To make sure that the data is cleaned up right after being sent, I've
	added a reset call to clear_sent_item() and called that function from
	_on_out_msg_done().  This means that _restore_main_sender() no longer
	needs to reset the marshaller, and we no longer need to call
	_reset_sent_item() within _on_out_msg_done() (since this function is
	called from _clear_sent_item()).

	This prepares the way for refactoring
	red_channel_client_init_send_data() to change how we keep the
	RedPipeItem alive while sending a message.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-12-16  Jonathon Jongsma  <jjongsma@redhat.com>

	CursorChannel: minor improvement to cursor_fill()
	Move all 'out' parameters to the end of the function.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-12-16  Frediano Ziglio  <fziglio@redhat.com>

	Sort include order in source files
	Sort based on coding style.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	red-worker: Optimise check
	Use compile time check instead of runtime one.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-12-15  Victor Toso  <me@victortoso.com>

	reds: don't replace video_codecs on failure
	We should replace the video_codecs GArray only after the parsing of
	input is done, otherwise we might lose previous configuration.

	Tests were updated to match this situation. Input that fails to
	replace video_codecs are considered bad.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-12-14  Jonathon Jongsma  <jjongsma@redhat.com>

	Rename cursor_set_item() to cursor_channel_set_item()
	Follow C method naming convention.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-12-14  Frediano Ziglio  <fziglio@redhat.com>

	gitignore: Reuse top-level gitignore
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	gitignore: Limit scope of some files
	This make more obvious which directory they refer
	and potentially avoid ignoring unwanted files.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	gitignore: Remove obsolete files
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-12-12  Frediano Ziglio  <fziglio@redhat.com>

	gstreamer: Prevent integer overflow in delay computation
	The partial expression "MSEC_PER_SEC * size * 8" can overflow if
	size is 536870 or more. This as the operation is done using
	32 bit unsigned integers. Being the size potentially double of
	a compressed frame size the limit can be easily reached.
	As get_average_frame_size already return a 64 bit use 64 bit
	even for the size to avoid the integer overflow.

	Acked-by: Francois Gouget <fgouget@codeweavers.com>

	Removed unused red_channel_pipes_new_add_tail function
	This function is supposed to add an item to the queue to
	be sent before all other queued items.
	Was never used.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Remove unused refs field
	refs was used before GObject for reference counting.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	build: Optimise headers check
	Check multiple headers using a single m4 macro.
	The resulting script is reduced.

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

	red-worker: Introduce RedWorkerMessageGlDraw structure
	All RedWorker messages starts with RedWorker except
	SpiceMsgDisplayGlDraw.
	For coherence introduce a RedWorkerMessageGlDraw structure
	holding just SpiceMsgDisplayGlDraw. This also allows possible
	extensions.

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

2016-12-08  Victor Toso  <me@victortoso.com>

	Fix gitignore
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2016-12-08  Frediano Ziglio  <fziglio@redhat.com>

	marshaller: rename _add_ref() to _add_by_ref()
	The spice_marshaller_add_ref() family of functions is confusing since it
	sounds like you're incrementing a reference on the marshaller. What it
	is actually doing is adding a data buffer to the marshaller by reference
	rather than by value. Changing the function names to _add_by_ref() makes
	this clearer.

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

2016-12-06  Uri Lublin  <uril@redhat.com>

	dispatcher: write_safe: move EINTR debug message
	spice_debug was called for not-EINTR case, move
	it to the right place.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	red-record-qxl: child_output_setup: remove fcntl call
	man 2 dup2 specifies:
	  The close-on-exec flag (FD_CLOEXEC; see  fcntl(2))  for
	  the duplicate descriptor is off.

	Since the purpose of the fcntl call is to turn off FD_CLOEXEC
	flag, and it's already done, just remove this call.

	Suggested-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	red-record-qxl: add curly braces to empty while loop
	Spice coding style suggests to use curly braces
	for while blocks.

	Some prefer the block to not be empty so continue
	is untouched.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	red_get_image_data_flat: allocate mem after sanity check
	This patch prevents possible memory leak.

	Found by coverity.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	image_encoders: check shared_dict before accessing it
	In both image_encoders_restore_glz_dictionary() and
	image_encoders_get_glz_dictionary() shared-dict may
	be NULL if size is too large, and the server gets
	size from the network.

	Both functions end up calling glz_enc_dictionary_create()
	that calls glz_dictionary_window_create() where size is
	checked.

	Found by coverity.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	display-channel: current_remove: rename inner variable 'container'
	It shadows the outer one.

	Renamed also the outer 'container' variable.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-12-06  Frediano Ziglio  <fziglio@redhat.com>

	tests: Apply same warning level as main server code
	Allow to catch minor issue with test code.
	Although test usually are coded with less care than production
	code the current changes required are not so extensive and
	can catch different issues.
	Most of the patch is making functions static to avoid warnings for
	undeclared functions.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-12-06  Pavel Grunt  <pgrunt@redhat.com>

	build-sys: Require GLIB 2.28
	We are already using it

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	build-sys: Use variables instead of numbers for library versions
	Allow to easily change library versions.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-12-06  Frediano Ziglio  <fziglio@redhat.com>

	build: Remove not existing include directory
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-12-06  Victor Toso  <me@victortoso.com>

	display-channel: Make video-codecs property read-write
	This patch creates display_channel_get_video_codecs() helper to let
	stream.c get the video-codecs without accessing the internal structure
	of DisplayChannel.

	As video-codecs is a property of DisplayChannel, this change means
	making this property readable as well.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-12-06  Frediano Ziglio  <fziglio@redhat.com>

	Support QXL remove on spice_server_remove_interface
	Allow to dynamically remove QXL interfaces. This could be used to
	support hot swapping of QXL cards.
	This code is actually not used in any way.
	QXL interfaces are destroyed by spice_server_destroy automatically.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Free properly primary surface during replay
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	Free replay queues
	There could be still some data pending.

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

	replay: Free spice server to detect leaks
	Acked-by: Pavel Grunt <pgrunt@redhat.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Free main_dispatcher in spice_server_destroy
	Avoid leaking it.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Free QXL instances in spice_server_destroy
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Free inputs_channel in spice_server_destroy
	Avoid leaking this channel.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Call parent finalize at the and of display_channel_finalize
	Make finalization of DisplayChannel consistent with other code.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-12-05  Jonathon Jongsma  <jjongsma@redhat.com>

	Manual: add info about QEMU_AUDIO_DRV
	hramrach on IRC had an issue with audio not working. He was using
	suse and his qemu defaulted to using the pulseaudio audio driver instead
	of spice.  Explicitly setting the audio driver to spice using the
	QEMU_AUDIO_DRV environment variable solved the problem. Add this tip to
	the manual for others having the same issue in the future.

	Switch example sound device to 'hda'
	Recommended sound device for newer operating systems is Intel HD audio
	(hda). Use this in the commandline examples.

2016-12-05  Victor Toso  <me@victortoso.com>

	syntax-check: Fix missing AUTHORS
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-12-05  Pavel Grunt  <pgrunt@redhat.com>

	test: Ignore too new warnings
	There is an explicit check for the version

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-12-05  Frediano Ziglio  <fziglio@redhat.com>

	sound: Load marshaller into a variable
	Reduce GObject changes coming in the next commit since we'll need to
	change how we access the marshaller anyway. This will make the
	following commits easier to review.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	smartcard: Optimise sending data
	As data is packae in a single piece of memory send it
	altogether.

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

2016-12-05  Victor Toso  <me@victortoso.com>

	display-channel: reuse function to set video codecs
	Including g_clear_pointer() in glib-compat.h and using it to avoid
	warnings in odd situations.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-12-02  Frediano Ziglio  <fziglio@redhat.com>

	dcc: Avoid to include RedChannelClient private header
	Make sure we don't tamper with RedChannelClient internals.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	sound: Reuse client variable if available
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	sound: Introduce a macro to cast to SndChannelClient
	This make easier the transition to GObject.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	sound: Change AudioFrame allocation
	When qemu (for example) delivers audio samples to the spice server, it
	does so by requesting a buffer from the spice server
	(spice_server_playback_get_buffer()), filling them with audio data, and
	then calling spice_server_playback_put_samples() to send them to the
	client. Between the call to _get_buffer() and the call to
	_put_samples(), we need to ensure that the buffer remains valid. Since
	this buffer is allocated within PlaybackChannelClient, we did this by
	incrementing a ref on the PlaybackChannelClient in _get_buffer(), and
	decrementing the ref in _put_samples(). This has the effect of
	potentially keeping the PlaybackChannelClient alive after the spice
	client has disconnected.

	This was not a problem when PlaybackChannelClient was a simple helper
	class. But we intend to change PlaybackChannelClient so that it
	inherits from RedChannelClient. In that case, the reference taken in
	_get_buffer() would result in the RedChannelClient (and associated
	RedChannel, etc) being kept alive longer than expected. To avoid this,
	we add an additional ref-counted adapter class (AudioFrameContainer)
	that owns the allocated audio frames and can outlive the
	RedChannelClient if necessary. When the client is freed, the
	AudioFrameContainer is just unreferenced.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	sound: Reuse record_client variable
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	sound: Convert SndChannel to GObject
	Stops using the dummy channel.
	Data handling still goes through DummyChannelClient which is why
	empty implementation of some required vfuncs is working.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Rearrange object destruction
	Try to arrange destruction in the opposite order of the creation

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Add red_qxl_destroy function
	Allows to destroy a QXL object

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	gstreamer: Correctly don't allow too limited bit rates
	The check to limit too low bit rates was setting encoder->bit_rate
	instead of bit_rate. However after some lines bit_rate was used
	to set encoder->bit_rate basically removing the lower threshold.

	Acked-by: Francois Gouget <fgouget@codeweavers.com>

2016-12-02  Francois Gouget  <fgouget@codeweavers.com>

	streaming: Stop streaming if the client reports a streaming error
	By removing the stream's video encoder we force the stream to send
	future frames using the fallback code, that is as regular screen
	updates.
	However note that we keep the stream object: we have to. Otherwise
	future frames would trigger the creation of a new stream object with a
	new video encoder which would again try to stream the video and fail
	again and again.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>
	Reviewed-by: Victor Toso <victortoso@redhat.com>

2016-12-01  Frediano Ziglio  <fziglio@redhat.com>

	sound: Rename SndWorker to SndChannel
	SndWorker has been historically based on RedChannel, initial git commit
	has:
	struct SndWorker {
	     Channel base;
	     ...
	};

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	sound: Rename {Record,Playback}Channel to *ChannelClient
	Make easier to understand that they refer to client and not
	all channel.

	Specifically:
	- RecordChannel -> RecordChannelClient
	- PlaybackChannel -> PlaybackChannelClient
	- playback_channel -> playback_client
	- record_channel -> record_client

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	sound: Rename SndChannel to SndChannelClient
	SndWorker has been historically based on RedChannel, initial git commit
	has:
	struct SndWorker {
	     Channel base;
	     ...
	};

	SndChannel, contrary to what its name may imply is more focused on
	marshalling/sending of sound data, which is the responsibility of
	RedChannelClient for the other SPICE channels.

	This commit and following ones make the naming of these 2 types more
	consistent with how the rest of the code is structured.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	sound: Use worker directly
	SpicePlaybackState and SpiceRecordState have same structures
	changing only slightly the behaviour.
	Using SndWorker instead allows some minor simplification and
	more code reuse.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-12-01  Uri Lublin  <uril@redhat.com>

	manual: usbredir: remove the note about usbclerk
	The usbdk driver is preferred over usbclerk.

	manual: move usbdk to the client subsection
	Also added "clients" to the sentence to make it clear
	that usbdk is to be installed on the client machine.

	manual: smartcard: add id=ccid to qemu command line
	Add it to "-chardev spicevmc" option.

	Without it I get:
	qemu-system-x86_64: -chardev spicevmc,name=smartcard: chardev: no id specified

2016-11-30  Frediano Ziglio  <fziglio@redhat.com>

	Allows reds_core_timer_remove to accept NULL for timer
	Most of the times the check is done externally
	so moving inside the function reduce the code.
	This is similar to the way free(3) works.

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

	Remove unused red_channel_get_first_socket
	This function assume there is only one client.
	Was used only by some obsolete functions.
	Avoid to use such function in the future.

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

	Remove unused and obsolete main_channel_close
	This function wrongly close the first client.
	Wrongly as closing the file descriptor cause a dandling
	file descriptor in the object potentially leading
	to closing another file descriptor open later.

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

	Use red_channel_destroy to free main_channel
	This will close all clients and release the channel properly

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

	Move some include from header to source
	Now that RedStatFile is private there is no need
	to include some headers in stat-file.h.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Return invalid value from very old obsolete functions
	These functions are not used since years and are not supporting
	multiple clients.

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

	cursor: Avoid cursor item leak
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	Avoid to leak timer in InputsChannel
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	Do not leak mig_timer
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	Free state on spice_server_destroy
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	Free statistic file on spice_server_destroy
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2016-11-29  Frediano Ziglio  <fziglio@redhat.com>

	sound: Unify commands
	Use same constants for common commands.
	This will allow code reuse between Record and Playback.

	Acked-by: Uri Lublin <uril@redhat.com>

	Remove unused fields
	Acked-by: Uri Lublin <uril@redhat.com>

2016-11-29  Pavel Grunt  <pgrunt@redhat.com>

	build-sys: Add configure option to enable statistics
	Follow up to 5fba8dd1a346248f215f0167d113fb20a7bb733a
	to make it easier to enable them

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-11-28  Frediano Ziglio  <fziglio@redhat.com>

	Reuse reds_core_timer_add
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	red_worker: add RED_WORKER_MESSAGE_CLOSE_WORKER message
	Allows to close worker thread.
	This will be used to destroy cleanly CursorChannel and
	DisplayChannel.
	CursorChannel and DisplayChannel are run in a different
	thread. However deregistration of channels and different
	steps of destruction should be done in the same thread
	so this make possible to join again the 2 threads to
	avoid race conditions.
	For the moment there is no correct cleanup.

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

	Use LZ4_compress_fast_continue if available
	This make compression faster and avoids a warning on newer
	lz4 versions.

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

2016-11-25  Frediano Ziglio  <fziglio@redhat.com>

	Add a red_memslot_info_destroy function
	Allows to free RedMemSlotInfo structure

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

	tests: Normalize test names
	Use dash instead of underscores for file names. This is coherent
	with rest of file names.
	Rename all tests to test-XXX and remove the spice- prefix when
	present. This is coherent with most of the tests.

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

2016-11-24  Frediano Ziglio  <fziglio@redhat.com>

	Rename self field to thread_id
	self is usually used for GObject, avoid confusion.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	dcc: Remove unneeded private header inclusion
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-11-21  Francois Gouget  <fgouget@codeweavers.com>

	streaming: Always delegate bit rate control to the video encoder
	The video encoders already have sophisticated bit rate control code that
	can react to both stream reports sent by the client, and server frame
	drop notifications. Furthermore they can adjust both the frame rate and
	the image quality to best match the network conditions.

	But if the client cannot send stream reports all this is bypassed and
	instead the streaming code performs its own primitive bit rate control
	that can only adjust the frame rate.

	So this patch removes the code duplication and lets the video encoders
	do their job.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-21  Pavel Grunt  <pgrunt@redhat.com>

	reds: Replace strncpy with g_strlcpy
	strncpy is considered unsafe

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-21  Christophe Fergeau  <cfergeau@redhat.com>

	build: Update NEWS file

	build: Update SPICE_REVISION for new release
	No ABI addition/removal/... so no need to change anything else.

	smartcard: Remove duplicate accessor
	smartcard_channel_client_get_device() is the same as
	smartcard_channel_client_get_char_device(). Let's only keep the latter.

	smartcard: Fix SmartcardChannelClient creation
	The wrong type (RED_TYPE_CHANNEL_CLIENT rather than
	TYPE_SMARTCARD_CHANNEL_CLIENT) was used when creating a
	SmartcardChannelClient, which meant the _init function was never called,
	and SmartcardChannelClient::priv was never initialized.

	This caused a crash when trying to connect with --spice-smartcard to a
	VM with a smartcard channel configured.

2016-11-18  Pavel Grunt  <pgrunt@redhat.com>

	syntax-check: Skip strncpy check
	strncpy used in reds_init_socket() has destination NUL terminated

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	syntax-check: Update gnufiles
	Fix make check, otherwise it fails on
	   GEN      public-submodule-commit
	 Stopping at 'spice-common'; script returned non-zero status.
	 maint.mk: found non-public submodule commit

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-18  Frediano Ziglio  <fziglio@redhat.com>

	Avoid leaking ping_timer in MainChannelClient
	This leaks happen for every connection. Potentially the timer can
	be called after the client is closed causing an use after free.
	Recently RED_STATISTICS was switched off by default but previous
	version have this issue.

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

2016-11-18  Pavel Grunt  <pgrunt@redhat.com>

	red-qxl: Remove traling semicolon
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-18  Frediano Ziglio  <fziglio@redhat.com>

	Avoid use after free
	self->priv was deleted and then used

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

2016-11-17  Pavel Grunt  <pgrunt@redhat.com>

	Do not crash on NULL codecs
	Reviewed-by: Christophe Fergeau <cfergeau@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Add test for codecs parsing
	With Glib2.34 test invalid codec strings

	Reviewed-by: Christophe Fergeau <cfergeau@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-17  Frediano Ziglio  <fziglio@redhat.com>

	Make sure statistic file are initialized even if init is not called
	This caused a NULL pointer dereference executing some tests
	calling spice_server_destroy.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Revert "replay: Replicate wakeups properly"
	This reverts commit c6881ad1a00d95d0231dcab7bb30827e86d4d572.

	This patch cause the replay utility run at full speed
	to slow down a lot and in some cases getting stuck.
	I don't understand the reason and when I tested was working
	but as we are going to release would be a pity if this test utility
	won't work as useful to get feedback and reports.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-11-17  Pavel Grunt  <pgrunt@redhat.com>

	Define G_LOG_DOMAIN
	Otherwise messages produced by g_{warn, return, ...} are not prefixed
	like the spice_ variants.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-16  Jonathon Jongsma  <jjongsma@redhat.com>

	Fix build when builddir != srcdir
	The following build error occurs when building outside of the source
	directory:

	glib-mkenums --template spice-server-enums.tmpl.c ../../server/spice-server.h > spice-server-enums.c
	Can't open spice-server-enums.tmpl.c: No such file or directory
	Makefile:1111: recipe for target 'spice-server-enums.c' failed

	Make/Automake uses VPATH to determine that the spice-server-enums.tmpl.c
	file listed in the prerequisites for the rule is located in the srcdir.
	When we use an automatic variable (e.g. $<), the full path to the
	resolved file is used. But when we use the literal filename directly
	within the rule definition, this won't happen. So we need to explicitly
	specify that the input template file is located in srcdir.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-16  Frediano Ziglio  <fziglio@redhat.com>

	Make RedStatFile private inside stat-file.c
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Avoid leaking file descriptor for statistics
	mmap memory area will remain even if the descriptor is closed.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Use g_strdup_printf instead of manually malloc/snprintf
	Make the code easier and shorter.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Add a base test for statistic file
	Create a file and add/remove some nodes.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Fix node removal
	Avoid to produce loop in the tree removing and adding nodes.
	Unlink the node from the containing tree.
	This possibly will create unlinked trees if a parent node is
	deleted.

	What was happening is that the creation of loops inside
	the tree caused some statistical function to go into an
	infinite loop (and reds_stat tool too).

	Nodes were only invalidated but still linked so when reused
	the new node could point to an already existing node (like a
	sibling) which pointed to the new reused one.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Separate code to manage statistic file
	Code is quite independent so move in separate file.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-11-16  Pavel Grunt  <pgrunt@redhat.com>

	Do not use gstreamer in default codecs if not available
	Avoid the following warning when build with disabled gstreamer:
	Spice-WARNING **: reds.c:3660:reds_set_video_codecs: spice: unsupported video encoder gstreamer

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-15  Pavel Grunt  <pgrunt@redhat.com>

	ci: Test syntax-check
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	ci: Print results of tests on failure
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-15  Frediano Ziglio  <fziglio@redhat.com>

	Remove core_public and core_interface_adapter globals usage
	Avoid not constant globals.

	We started encapsulating all global state into RedsState however
	there are still some global variable. This patch remove the
	core_public global variable.

	To implement this a new SpiceCoreInterface *public_interface
	field is added to SpiceCoreInterfaceInternal and the
	SpiceCoreInterfaceInternal* argument is passed to callbacks to
	understand which external interface to use.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Handle top down bitmaps dumping
	The top down flag can be specified using negative heights.

	According to
	https://msdn.microsoft.com/en-us/library/windows/desktop/dd183376(v=vs.85).aspx:

	"The height of the bitmap, in pixels. If biHeight is positive, the
	bitmap is a bottom-up DIB and its origin is the lower-left corner.
	If biHeight is negative, the bitmap is a top-down DIB and its origin
	is the upper-left corner."

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	spicevmc: Remove some duplicate typedefs
	These cause compiler errors using RHEL6.
	These typedefs are defined in the same file some lines above.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	gstreamer: Use pthread to avoid Glib compatibility issues with RHEL6
	GCond/GMutex interface is different between Glib 2.32 and
	previous versions. Use pthread for compatibility.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-11-14  Frediano Ziglio  <fziglio@redhat.com>

	sound: Remove sin field from SpicePlaybackState and SpiceRecordState
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	sound: Reuse code for spice_server_get_best_{record,playback}_rate
	These function were really similar.
	Factor out a new snd_get_best_rate to avoid code duplication.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	sound: Move frequency field to SndWorker
	This field is common to SpicePlaybackState and SpiceRecordState
	which are based on SndWorker.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	sound: Free worker volume in common function
	The common function is supposed to clear the state of SndWorker
	so clear even volume which now is in SndWorker

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Fix header include order for some files
	Include common and libraries includes before local ones as
	stated by style.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	syntax-check: Use templates for glib-mkenums
	Syntax checker complained about autoconf variable expansion used
	inside Makefile.am.
	This patch uses template files instead of options.
	This also reduces quoting making template code more readable.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Use SPICE_VERIFY macro for RHEL6 compatibility
	The verify macro used currently has some problem
	as it raise a warning in RHEL6.
	Use new SPICE_VERIFY macro defined in spice-common
	to avoid this issue.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-11-14  Jonathon Jongsma  <jjongsma@redhat.com>

	char-device: add 'self' param to vfuncs
	Add a 'self' parameter to all of the char device virtual functions so
	that we don't have to play games with the 'opaque' pointer.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-14  Christophe Fergeau  <cfergeau@redhat.com>

	build: Cleanup disabled warnings a bit
	Some C-specific warnings were turned off as the spice module used to
	ship a C++ spice client. It's long gone, so we can reenable these
	warnings.
	There were warnings disabled for tunnel support and CEGUI usage which
	have both been removed too.
	-Wno-format-nonliteral was disabled twice.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-12  Frediano Ziglio  <fziglio@redhat.com>

	Fix typo in comment

	replay: Update comment
	Function just return the command, has no ext_cmd parameter to fill.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-11-12  Jonathon Jongsma  <jjongsma@redhat.com>

	Sound: change on_new_*_channel() signatures
	Pass the new sound channel to these functions rather than setting
	worker->connection before calling the function and expecting it to be
	set when the function is called. The fewer unenforced assumptions that
	must be true for a function to work properly, the easier it will be to
	maintain.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-12  Frediano Ziglio  <fziglio@redhat.com>

	sound: Peep hole optimisation
	Reduce SpiceVolumeState structure size on 64 architectures
	swapping the order of two fields.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	sound: Minor simplification due to volume move
	Reuse more code in snd_send_volume and snd_send_mute.
	Reduce conversions in on_new_playback_channel and
	on_new_record_channel.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	sound: Move volume field to SndWorker
	This field is common to SpicePlaybackState and SpiceRecordState
	which are based on SndWorker.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-11-10  Frediano Ziglio  <fziglio@redhat.com>

	replay: Remove time argument from recording functions
	Time is always the the current real time so avoid to compute
	it for every call but move to red-record-qxl.c.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	build: Disable some newly added warnings
	-Wshift-overflow cause an error to be detected in Glib headers.
	-Wformat-signedness and -Wnull-dereference probably could be
	fixed but currently they produce lot of errors.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	build: Update manywarnings.m4
	Allows to catch more issues.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Make red-replay-qxl.h a public header
	The functions declared in that header are all exported by the
	library.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	replay: Check properly version number
	0 as version was never used so don't allow it

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	replay: Replicate wakeups properly
	Instead of waking up the command loop for every command queued,
	handle saved wakeups and replicate these.
	This better reproduces what happened in the server.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-11-09  Frediano Ziglio  <fziglio@redhat.com>

	Make QXLMessage handling safe
	The QXLMessage has no size so potentially a guest could give an
	address that cause the string to overflow out of the video memory.
	The current solution is to parse the message, release the resources
	associated without printing the message from the client.
	This also considering that the QXLMessage usage was deprecated
	a while ago (I don't know exactly when).
	This patches limit the string to 100000 characters (guest can feed
	so much logs in other way) and limit to video memory.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	red-parse-qxl: Use same fuction to parse blend and copy commands
	SpiceBlend and SpiceCopy are just different names for the same
	structure.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	syntax-check: Silent a wrong positive
	Due to syntax-check limitation this free calls results in
	a syntax error.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	syntax-check: Include config.h file #include <>
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	syntax-check: Remove empty line at end of file
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	syntax-check: Remove space at end of line
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-11-09  Christophe Fergeau  <cfergeau@redhat.com>

	syntax-check: Add exception for server/stat.h
	Due to the use of static inline functions, the headers uses
	G_GNUC_UNUSED, which the sc_avoid_attribute_unused_in_header test
	complains about.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-09  Frediano Ziglio  <fziglio@redhat.com>

	Fix typo in comment

	Revert accidentally merged experimental patches

2016-11-07  Frediano Ziglio  <fziglio@redhat.com>

	build a structure to hold all DCC stream fields
	try to understand streams

	NOTES

	channel: cap roundtrip using Linux information if available
	Linux kernel already compute roundtrip.
	If available use it to limit discovered one.

2016-11-07  Jonathon Jongsma  <jjongsma@redhat.com>

	RedChannelClient: use Gobject properties
	Use g_param_spec_object() instead of g_param_spec_pointer() for the
	'client' and 'channel' properties now that these types are GObjects.
	This improves refcounting and typesafety slightly.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-11-07  Pavel Grunt  <pgrunt@redhat.com>

	spice-options-test: Convert to gtest to catch criticals
	Fail on glib warnings instead of ignoring them

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-11-07  Frediano Ziglio  <fziglio@redhat.com>

	spicevmc: Change creation of RedCharDeviceSpiceVmc
	Instead of having channel and device object create one the other
	create the objects at the beginning and then join them.

	This make explicit the code that links the two objects and separate
	the objects creation from the linking.

	Also remove some boilerplate code.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-04  Jonathon Jongsma  <jjongsma@redhat.com>

	spicevmc: use 'channel' instead of 'state'
	After renaming the object to RedVmcChannel, the local variables still
	used the old 'state' terminology. Changing these variables to 'channel'
	makes things a bit more consistent.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Remove spicevmc_red_channel_client_get_state()
	This helper function does nothing but cast the return from
	red_channel_client_get_channel(), and it has a confusing name
	(_get_state(), but returns a channel)

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-04  Frediano Ziglio  <fziglio@redhat.com>

	spicevmc: Clear RedVmcChannel on red_char_device_spicevmc_dispose
	This move object destructions from spicevmc_device_disconnect
	to RedCharDeviceSpiceVmc destructor functions assuring any possible
	RedCharDeviceSpiceVmc object free will clear its references.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	spicevmc: More RedVmcChannel::recv_from_client_buf cleanup to finalize
	No reason why this should be done only on spicevmc_device_disconnect.
	red_char_device_write_buffer_release can be called with first pointer
	NULL.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	spicevmc: Free pipe_item in finalize
	Assure field is freed at the end and not used or allocate again.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-11-04  Jonathon Jongsma  <jjongsma@redhat.com>

	spicevmc: store channel in char device
	Store the channel in the char device object, and unref it in dispose.
	Previously, we were just creating a channel and potentially allowing it
	to leak.  There may be better long-term solutions, but this works for
	now.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-02  Jonathon Jongsma  <jjongsma@redhat.com>

	Convert RedClient to GObject
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Move RedClient to a separate file
	Also move the RedClient struct out of the header to avoid accessing the
	internals from other files.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Re-arrange channel client creation to avoid exposing client lock
	Instead of requiring the channel client to lock the client's lock,
	re-arrange things so that all of the locking can be internal to
	RedClient methods. So instead of having a pre-create validate function,
	we simply move the check to red_client_add_channel() and return an error
	if a channel already exists. This encapsulates the client implementation
	better and also reduces code duplication in RedChannelClient and
	DummyChannelClient.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Convert RedsState::clients to GList
	Switch from a Ring to a GList so that we can hide the internals of
	RedClient in a future commit.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-02  Frediano Ziglio  <fziglio@redhat.com>

	Avoid to typedef twice RedChannel
	It's already defined in the same file some lines above.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	red-channel-client: Change initialization order
	Make the order of initialization closer to what it was before
	conversion to GObject.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	red-channel-client: Move incoming/ougoing initialization to constructor
	These fields need just channel to be set to be initialized.
	Move their initialization to constructor to make sure
	they are initialized as soon as possible.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	red-channel-client: Init pipe field during init
	There was a chance that on error GQueue were not
	initialized but an attempt to destroy it is made.
	This ensures GQueue is initialized as soon as
	possible. Note that red_channel_client_initable_init
	is called after all init and construction callbacks.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-11-01  Pavel Grunt  <pgrunt@redhat.com>

	Add .gitlab-ci.yml
	Acked-by: Victor Toso <victortoso@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-01  Jonathon Jongsma  <jjongsma@redhat.com>

	Rename SpiceVmcState to RedVmcChannel
	Internal types use the 'Red' prefix by convention, rather than the
	'Spice' prefix. In addition, this type inherits from RedChannel, so
	makes the code a lot clearer to call it a 'channel' rather than a
	'state'.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-01  Frediano Ziglio  <fziglio@redhat.com>

	red-channel-client: Remove only written field
	id field of RedChannelClient is not used and marked as debugging.
	Also it's value is quite confusing.

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

2016-11-01  Christophe Fergeau  <cfergeau@redhat.com>

	syntax-check: Add missing license headers
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	syntax-check: Remove unused header includes
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	syntax-check: Add missing <config.h> includes
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	syntax-check: Remove trailing whitespace from EOL and EOF
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	syntax-check: Add missing contributors names to AUTHORS
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	syntax-check: Change tabs to spaces
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	syntax-check: Add missing license
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-01  Francois Gouget  <fgouget@codeweavers.com>

	streaming: Clarify GStreamer's virtual buffer size documentation
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-01  Jonathon Jongsma  <jjongsma@redhat.com>

	Limit maximum "n-surfaces" via param spec
	In commit beec1b41, we manually limited this property value in
	_set_property(). But there's a simpler way to do it: via the param spec
	for the property.

	This also means that we can remove the warning log in red_worker_new()
	since GObject will automatically warn if a property is assigned a value
	outside of its valid range.

	Change the minimum and default value for this property from 0 to 1 so
	that we always have a primary surface.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-01  Pavel Grunt  <pgrunt@redhat.com>

	Do not enable statistic by default
	It is more a feature for developers, not force them.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Allow to compile without RED_STATISTICS
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-11-01  Frediano Ziglio  <fziglio@redhat.com>

	Do not declare image_encoders_compress_lz4 if LZ4 is not available
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove red_pipe_add_verb family function
	These functions were implementing the same stuff as empty
	messages functions provided by RedChannel so reuse them.

	The implementation seems a bit different but the result
	is the same. Specifically:
	- RedEmptyMsgPipeItem::msg is int while RedVerbItem::verb was
	  uint16_t however this data goes into the message type which
	  is uint16_t (a 16 bit on the network protocol);
	- red_channel_client_send_empty_msg calls
	  red_channel_client_begin_send_message while red_marshall_verb
	  does not. However red_marshall_verb is called only by
	  cursor_channel_send_item and dcc_send_item which always
	  calls red_channel_client_begin_send_message.
	  Note that in dcc_send_item when an empty message is sent
	  red_channel_client_send_message_pending always returns
	  true;
	- when a PipeItem is created red_channel_client_pipe_add_empty_msg
	  calls red_channel_client_push while red_pipe_add_verb does not.
	  This actually make very little difference as this kind of item are
	  never removed from the queue and a push is forced in every case
	  running the event handler for the stream watch (see
	  prepare_pipe_add and red_channel_client_event).

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-10-31  Frediano Ziglio  <fziglio@redhat.com>

	Constify video_codec_caps
	This remove a writable global variable.

	Acked-by: Uri Lublin <uril@redhat.com>

	worker: Remove dependencies from red-worker.h
	red_drawable_unref declaration was moved to red-parse-qxl.h.
	Result is that only RedDispatcher know of the existence of RedWorker.

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

	Move capability initialisation into channel creation
	No reason why RedWorker should know the capabilities of
	DisplayChannel.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-10-29  Francois Gouget  <fgouget@codeweavers.com>

	streaming: Limit the h264 image compression level
	When uncapped x264enc can compress the frames beyond recognition in low
	bitrate situation. Beyond the set limit the gains are modest and it is
	better to drop frames to reduce the bit rate further.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-10-28  Frediano Ziglio  <fziglio@redhat.com>

	Allows to have more than 1 QXL device
	This was introduced with 96e94c6f32d4345ea25ef7a474fbd92de03b38ad
	(Convert RedChannel hierarchy to GObject).
	The id of CursorChannel/DisplayChannel were always 0 causing
	a wrong assertion on the code.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Call parent constructor always at the beginning
	In this case there is not much change but better
	to follow that style as all other constructors
	do.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Fix handle-acks regression
	This was introduced with 96e94c6f32d4345ea25ef7a474fbd92de03b38ad
	(Convert RedChannel hierarchy to GObject).
	The handle-acks settings was TRUE for CursorChannel and DisplayChannel.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-10-27  Frediano Ziglio  <fziglio@redhat.com>

	Fix typo in comment
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Make reds_stat utility work with both 32 and 64 bit architectures.
	Due to alignment problems the structure of statistics file is
	different between 32 and 64 bit. This as on 32 bit uint64_t is
	aligned to 4 bytes instead of 8 so sizeof(SpiceStat) can be either
	20 (32 bit) or 24 (64 bit).
	This cause reds_stat utility to be bit dependent.
	Detect the correct SpiceStat size and use that information.

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

	Fix core-interface type regression
	This was introduced with 96e94c6f32d4345ea25ef7a474fbd92de03b38ad
	(Convert RedChannel hierarchy to GObject).
	The type for "core-interface" property should be
	SpiceCoreInterfaceInternal, not SpiceCoreInterface.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Remove g_smartcard_channel global
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-10-26  Frediano Ziglio  <fziglio@redhat.com>

	Remove duplicate include
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-10-26  Pavel Grunt  <pgrunt@redhat.com>

	Add missing header to Makefile.am
	Fix make distcheck

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-10-25  Jonathon Jongsma  <jjongsma@redhat.com>

	Implement vfuncs for DummyChannel
	96e94c6f inadvertantly introduced a regression where an assert was
	triggered in red_channel_constructed for DummyChannel since DummyChannel
	didn't implement any of the expected RedChannel vfuncs. This patch
	avoids the assert by assigning some empty vfuncs.

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

	Convert RedChannel hierarchy to GObject
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-10-25  Frediano Ziglio  <fziglio@redhat.com>

	Remove unused declaration
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-10-20  Frediano Ziglio  <fziglio@redhat.com>

	red-worker: Do not include not necessary red-channel-client.h
	Definitions are all in red-channel.h

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Avoid to typedef twice MainChannel
	MainChannel is already defined in main-channel.h.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	display channel: Don't let client set too many surfaces
	Limit the n_surfaces argument to avoid overflowing the surfaces array.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Avoid recursive inclusion of headers
	red-common.h included utils.h which included red-common.h

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Allows to use scripts for "make check"
	Allow both compiled and non-compiled tests to be used with "make
	check". Compiled tests should be added to check_PROGRAMS, and scripts
	that do not need to be built should be added to TESTS.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Declare same enumerator in a single header
	Avoid having duplication and desynchronisation.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Move monitors_config_ref inside red_monitors_config_item_new
	This makes red_monitors_config_item_new() and
	red_monitors_config_item_free() symmetric.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	dcc: Use spice_new instead of spice_malloc
	spice_new return directly the correct type.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Fix typo in comment
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Make compression image declarations more similar
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Reuse SPICE_N_ELEMENTS macro
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-10-19  Frediano Ziglio  <fziglio@redhat.com>

	Include main-channel-client.h where MainChannelClient is used
	Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

	Avoid to typedef twice RedChannel and RedClient
	These are already defined in red-channel.h which is included in
	red-channel-client.h header.

	Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

	Add reds_stat to compiled software
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Remove warnings from reds_stat utility
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-10-18  Frediano Ziglio  <fziglio@redhat.com>

	Include directly used header in dcc.h
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-10-18  Jonathon Jongsma  <jjongsma@redhat.com>

	Improve MainChannel encapsulation
	Encapsulate MainChannel a bit better in preparation for proting to
	GObject.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-10-18  Frediano Ziglio  <fziglio@redhat.com>

	Be consistent with opaque type
	vdi_port_read_buf_release is registered passing data as
	RedVDIReadBuf*, not RedPipeItem*. Cast opaque to proper
	pointer type to avoid the assumption that first field of
	RedVDIReadBuf is a RedPipeItem.

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

	Use a compatibility header to support GLib 2.28
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	Do not typedef DisplayChannel twice
	Already defined in dcc.h.

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

	Avoid to typedef twice CursorChannel
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2016-10-17  Uri Lublin  <uril@redhat.com>

	mjpeg_encoder_new: allocate memory after sanity check
	This patch prevents a leak in case the function returns early

	Found by coverity.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	input-channel: add a comment to mark fallthrough in switch
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-10-14  Jonathon Jongsma  <jjongsma@redhat.com>

	Add CommonGraphicsChannelPrivate struct
	Encapsulate private data for CommonGraphicsChannel and prepare for
	GObject conversion.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-10-14  Christophe Fergeau  <cfergeau@redhat.com>

	doc: Remove mention that qxl.guestdebug is Windows-only
	The Linux QXL KMS driver also uses it.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-10-14  Pavel Grunt  <pgrunt@redhat.com>

	rcc: Make OutgoingHandler private
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	reds: Define openssl lock only if needed
	Silence a warning:
	 reds.c:150:25: warning: 'lock_cs' defined but not used [-Wunused-variable]
	  static pthread_mutex_t *lock_cs;

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-10-14  Francois Gouget  <fgouget@codeweavers.com>

	server: Remove a redundant IncomingHandler typedef
	This fixes a compilation error with gcc 4.4.7 on RHEL 6.8.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-10-14  Jonathon Jongsma  <jjongsma@redhat.com>

	Use macros for casting Channel types
	In preparation for converting RedChannel to GObject, switch to using
	RED_CHANNEL()-type macros for casting. For now they just do a regular
	cast, but it helps reduce the size of the GObject patch to make it
	easier to review.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Move CommonGraphicsChannel to a new file
	Move out of red-worker.c. This requires a little bit of minor
	refactoring to avoid accessing some RedWorker internals in the
	constructor function, etc.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-10-14  Francois Gouget  <fgouget@codeweavers.com>

	server: Remove a redundant CursorChannelClient typedef
	CursorChannelClient is already defined in cursor-channel-client.h.
	This fixes compilation errors with gcc 4.4.7 on RHEL 6.8.

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

2016-10-13  Jonathon Jongsma  <jjongsma@redhat.com>

	Don't increment num_clients_mig_wait twice
	When MainChannelClient was split to a separate file, the responsibility
	for incrementing this field was supposed to belong to the MainChannel
	function (main_channel_connect_semi_seamless()), but by mistake it was
	incremented both there and in the client function
	(main_channel_client_connect_semi_seamless()).

	The bug was introduced in a11b785f191d2381932f8c1bb6281539f2afe483

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-10-11  Pavel Grunt  <pgrunt@redhat.com>

	Test agent message filter processing
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Add agent message filter test
	Test filter initialization and configuration

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	agent-msg-filter: Remove extra headers
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-10-11  Frediano Ziglio  <fziglio@redhat.com>

	style: Specify function definition indentation
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-10-07  Frediano Ziglio  <fziglio@redhat.com>

	Convert RedChannelClient hierarchy to GObject
	Convert the RedChannelClient heirarchy into GObjects. Since the existing
	constructors could fail and return NULL, I inherited the base channel
	client from GInitable, which introduces a dependency on gio.

	When using private structs with GObject, there's a maximum size of (I
	think) 64k, which was exceeded by some of the private structs. To avoid
	this limitation I changed some members to dynamically allocated.

2016-09-30  Frediano Ziglio  <fziglio@redhat.com>

	Split RedCharDeviceSmartcard and SmartCardChannelClient

	Cache field to make code easier
	Acked-by: Victor Toso <victortoso@redhat.com>

2016-09-29  Frediano Ziglio  <fziglio@redhat.com>

	Add a comment for marshaller field
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-09-27  Jonathon Jongsma  <jjongsma@redhat.com>

	Generate GTypes for spice-server enums
	The GType will be useful to allow these enums to be used as GObject
	properties.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-09-27  Frediano Ziglio  <fziglio@redhat.com>

	Rename red_surface to surface
	Attempt to use consistent naming.
	Usually we use surface name for RedSurface.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Rename surface argument to surface_cmd
	Attempt to use consistent naming.
	Usually we use surface name for RedSurface so make sure
	code reader do not get confused using a different name
	for RedSurfaceCmd.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Rename detach_stream to stream_detach_drawable and removed unused argument
	This function deal only with Stream.
	Also the name was misleading and was not clear if it detached the stream
	from the DisplayChannel.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Removed only written roundtrip_stat field
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Removed unused stat field
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Use enum value returning invalid value
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Check client is using unix sockets in dcc_gl_draw_item_new
	Currently this is simply avoided by the fact that Virgl with 3d means
	Unix socket. Once you enable (in Qemu) tcp sockets this message will
	be added to all clients (supposing multiple clients) so potentially
	will be in all queues. The same check is done for dcc_gl_scanout_item_new.
	dcc_gl_scanout_item_new is called when Qemu calls spice_qxl_gl_draw_async.
	Technically a client can support SPICE_DISPLAY_CAP_GL_SCANOUT but server
	cannot send the DRM prime directly as this require a unix socket so
	if the test for SPICE_DISPLAY_CAP_GL_SCANOUT is done here it make sense
	to do the check for the socket type too.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-09-26  Frediano Ziglio  <fziglio@redhat.com>

	Reuse VD_AGENT_HAS_CAPABILITY macro for bit array
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	worker: RedCompressBuf optimization
	Move large buffer field at the end of structure.
	Due to the way machine address memory this usually can reduce code size
	and make program sligthly faster.
	Actually reduce size by 100 bytes.

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

	Make error simpler in reds_stat
	There's no reason for so hard optimisations so avoid
	having to maintain multiple labels.

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

	Prevent setting invalid image compression values
	In case of invalid value the original compression is unchanged.

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

2016-09-22  Frediano Ziglio  <fziglio@redhat.com>

	replay: Update pointer in allocated list
	Avoid to free invalid pointer.

	Reported-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Small comment on structure checking
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove unused fields
	These fields were added in a32e90257e834e340075e633132b52c612be4578
	as part of the multiple client support and were never used.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Capitalize option documentation
	All other options are documented using initial capital case letter.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Simplify serial sending packets
	serial was the future serial to send while last_sent_serial was the
	last sent.
	serial sent started from 1.
	To make sure sequence variable is updated just before sending the
	message, not every message prepared.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: Do not check surface twice
	validate_surface already do the same checks.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-09-21  Frediano Ziglio  <fziglio@redhat.com>

	replay: Use unsigned in formatting
	Avoid negative syntax. Also could prevent some memory problem is number
	get too big.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	replay: Use proper formatting for scanf family
	Currently on Linux PRIu64 and SCNu64 are the same but just to make
	sure in the future use the correct macros.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	replay: Propagate error correctly in replay_fread
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	replay: Move error check
	Do the check after replay_fscanf to make sure everything
	is fine before calling red_replay_compat_drawable or
	red_replay_native_drawable.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	replay: Detect errors from red_replay_data_chunks
	Change the return to ssize_t to be able to distinguish from
	empty buffer to error.
	Check result returned and avoid continuing potentially
	deferencing NULL pointers.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	replay: Handle errors reading strings from record file
	To check fscanf read all needed information a dummy "%n" is appended
	to any string and the value stored there is tested. This as scanf family
	could return a valid value but not entirely process the string so
	adding a "%n" and checking this was processed make sure all expected
	string is found.
	The code to check for a specific string is now a bit more complicated
	as replay_fscanf use a macro which append a constant string.
	The "error" field is used to mark any error happened, so in most cases
	there is no explicit check beside when this could cause a problem
	(for instance results of replay_fscanf used which would result in
	uninitialised variable usage).

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	replay: Record allocations in a GList to handle errors
	Allocations are kept into a GList to be able to free in case some
	errors happened.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Base FOREACH_DCC on GLIST_FOREACH
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Base FOREACH_CLIENT on GLIST_FOREACH
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Use proper FOREACH_DCC instead of FOREACH_CLIENT
	FOREACH_DCC should be more DisplayChannel related.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	RedChannel: Use more FOREACH_CLIENT macro
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	RedChannel: Add FOREACH_CHANNEL_CLIENT and use it to iterate
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Introduce some macros to simplify iteration on GList
	Noting that coding by hand these loop introduced some regression
	I'm trying to introduce back from macros.
	Before trying something harder to make possible to bind the type of
	the content I'm trying some simple macro as were before.
	I added the type to avoid some blindly void* casts.
	Also the GListIter is introduced to avoid the possibility to exchange
	easily some parameters.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Use spice_realloc instead of manually code it
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove only set serial field
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-09-20  Frediano Ziglio  <fziglio@redhat.com>

	Simplify send_free_list
	The check for free_list->wait.header.wait_count was always true.

	Acked-by: Uri Lublin <uril@redhat.com>

	Revert if to make code more readable
	Keep all code to send SPICE_MSG_LIST together.

	Acked-by: Uri Lublin <uril@redhat.com>

2016-09-20  Jonathon Jongsma  <jjongsma@redhat.com>

	Use and introduce channel client cast macros
	In anticipation of porting to GObject, use casting macros (e.g.
	MAIN_CHANNEL_CLIENT()) to cast RedChannelClient types. This will help
	reduce the changeset slightly porting to GObject and thus make it easier
	to review those upcoming changes.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-09-19  Jonathon Jongsma  <jjongsma@redhat.com>

	Change RedCharDevicePrivate::clients to GList
	More Ring cleanup. At the moment, we only support a single client, so
	this is only a one-element list

	Change RedCharDevice::write_queue to GQueue
	Change a couple more Rings to GQueue

	Change Drawable->pipes from Ring to GList
	This improves the readability of the code and keeps things
	encapsulated better.

	RedChannelClient: store pipe items in a GQueue
	Instead of using a Ring (and having a ring item link in every pipe
	item), store them in a GQueue. This also necesitated changing
	RedCharDeviceVDIPort->priv->read_bufs to a GList as well.

	Also Optimise client pipe by passing pipe position instead of data.
	This avoids having the search the data scanning all the queue changing
	the order of these operations from O(n) to O(1).

2016-09-16  Jonathon Jongsma  <jjongsma@redhat.com>

	Rename display_channel_set_monitors_config_to_primary()
	Since this function is a DisplayChannel method, use a name consistent
	with naming conventions.

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

	Add DisplayChannelPrivate struct
	Move all of the DisplayChannel data memembers into a private struct to
	encapsulate things better. This necessitated a few new 'public' methods
	and a small bit of refactoring to avoid poking into DisplayChannel
	internals from too many places. The DisplayChannel and the
	DisplayChannelClient are still far too intertwined to completely avoid
	accessing private data, so at the moment the private struct is defined
	in display-channel.h and the DisplayChannelClient implementation
	still accesses it sometimes.

	Improve encapsulation of DisplayChannel
	Add a couple new functions to the header so that they can be called by
	other objects rather than poking into the internals of the struct.

2016-09-16  Pavel Grunt  <pgrunt@redhat.com>

	reds: Simplify vdi_port_read_buf_process
	Reuse and handle the return value from agent_msg_filter_process_data

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-09-16  Frediano Ziglio  <fziglio@redhat.com>

	replay: Rename eof to error
	The eof variable and enumeration will be used for all errors
	so avoid confusion.

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

	replay: Assure read_binary receives a NULL pointer
	read_binary do not allocate a buffer for no-NULL pointers.
	Avoid using uninitialized data and allocate proper buffer.

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

2016-09-16  Pavel Grunt  <pgrunt@redhat.com>

	agent-filter: Use enum as return value
	Explicitely discard AGENT_MSG_FILTER_MONITORS_CONFIG messages
	from the agent.

	Also remove unused AGENT_MSG_FILTER_END

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-09-16  Frediano Ziglio  <fziglio@redhat.com>

	Remove unused drawable parameter
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	Reduce indentation
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	Simplify some boolean arithmetic
	Pass boolean directly.

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

2016-09-16  Jonathon Jongsma  <jjongsma@redhat.com>

	Replace a couple Rings with GList
	Make RedsState::mig_target_clients into a GList to improve encapsulation
	and maintainability. Also RedsMigTargetClient::pending_links. With
	GList, a type implementation can be ignorant of whether they're
	contained within a list or not.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-09-15  Jonathon Jongsma  <jjongsma@redhat.com>

	Make glz_dictionary_list a GList
	Removing more intrusive RingItems from various structures and improving
	readibility.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Add CursorChannelPrivate struct
	Encapsulate private data of CursorChannel in a private struct. This
	isn't very useful at the moment, but it will help prepare the way for
	porting the RedChannel heirarchy to GObject.

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

2016-09-15  Uri Lublin  <uril@redhat.com>

	dcc_compress_image: fix a possible overflow when calculating image_size
	Both src->stride and src->y are uint32_t
	Fixed by making one of them uint64_t

	Found by coverity

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	dcc_gl_draw_item_new: allocate item when needed
	Prevents a leak on early return.

	Found by coverity.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	dcc_gl_scanout_item_new: allocate item when needed
	Prevents a leak on early return.

	Found by coverity.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	dcc: do not check the pointer returned by spice_new
	The rest of the code assumes spice_new does not return NULL

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-09-13  Li Zhijian  <lizhijian@cn.fujitsu.com>

	docs/spice_style.txt: fix typo
	'then' -> 'than'
	'character' -> 'characters'

2016-09-12  Pavel Grunt  <pgrunt@redhat.com>

	agent-filter: Constantify parameter
	Filter should not modify data

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-09-12  Frediano Ziglio  <fziglio@redhat.com>

	Remove global key_modifiers_timer variable
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	Remove unused structure declaration
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2016-09-09  Jonathon Jongsma  <jjongsma@redhat.com>

	RedsState: clean up spice_server_char_device_add_interface
	Previously we were creating a variable named 'dev_state' and then
	apparently not using it. Well, we *were* actually using it, but in a
	convoluted sort of way. Creating a new RedCharDevice has a
	side-effect of setting itself as the 'st' attribute of
	SpiceCharDeviceInstance. So 'dev_state' and 'char_device->st' are in
	fact the same variable. But they were being used interchangeably, which
	was rather confusing. For example

	if (dev_state)
	    // do something with char_device->st

	So this patch doesn't actually change anything, but it makes the code a
	bit easier to follow.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-09-09  Christophe Fergeau  <cfergeau@redhat.com>

	Fix 'freezed' typo
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-09-08  Jonathon Jongsma  <jjongsma@redhat.com>

	Use RED_CHANNEL_CLIENT() macro for casting
	Also remove (main|inputs)_channel_client_get_base() function to prepare
	for porting to GObject.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-09-08  Victor Toso  <victortoso@redhat.com>

	mcc: early return and lower indentation
	main_channel_client_start_net_test() checks MainChannelClient already
	which is the single reason why main_channel_client_push_ping() could
	fail. Reorganizing this code a little bit.

	Acked-by: Frediano Ziglio <fziglio@redhat.com

	mcc: early return and lower indentation
	Acked-by: Frediano Ziglio <fziglio@redhat.com

2016-09-08  Jonathon Jongsma  <jjongsma@redhat.com>

	Rename RCC_TO_DCC() to DISPLAY_CHANNEL_CLIENT()
	Prepare for port to GObject

	Acked-by: Frediano Ziglio <fziglio@redhat.com

	Add DisplayChannelClientPrivate and CursorChannelPrivate structs
	These need to be introduced at the same time since cache-item.tmpl.c
	assumes that both of these classes will have a cache in the same place:
	either within the channel client struct itself or (now) within a priv
	struct owned by the channel client.

	This encapsulates private data and prepares for porting to GObject.

	Acked-by: Frediano Ziglio <fziglio@redhat.com

	Add RedChannelClientPrivate struct
	Encapsulate private data and prepare for port to GObject

	Acked-by: Frediano Ziglio <fziglio@redhat.com

	Add MainChannelClientPrivate struct
	Encapsulate private data and prepare for port to GObject

	Acked-by: Frediano Ziglio <fziglio@redhat.com

	Add InputsChannelClientPrivate struct
	Encapsulate private data and prepare for port to GObject.

	Acked-by: Frediano Ziglio <fziglio@redhat.com

	Add SmartCardChannelClientPrivate struct
	Prepare to port to GObject by encapsulating all private data

	Acked-by: Frediano Ziglio <fziglio@redhat.com

	Move CursorChannelClient to separate file
	Acked-by: Frediano Ziglio <fziglio@redhat.com

	Move RedChannelClient to separate file
	Reduce direct access to RedChannelClient, and get ready to convert to
	GObject.

	Acked-by: Frediano Ziglio <fziglio@redhat.com

2016-09-07  Pavel Grunt  <pgrunt@redhat.com>

	tests: Check setting of agent properties
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	reds: Do not crash when setting agent property
	Agent properties like file transfer or copy & paste can be disabled by
	calling spice_server_set_agent_{copypaste, file_xfer} before the spice
	server is initialized. In that case the call crashes the server because
	the agent device is created after the initialization.

	To avoid the crash this commit introduce a helper function for setting
	the agent properties after the server is initialized.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-08-30  Jonathon Jongsma  <jjongsma@redhat.com>

	Use red_channel_client_get_stream()
	Don't touch the rcc struct directly. Improve encapsulation to help
	prepare for separating RedChannelClient to a separate file.

	Don't poke RedChannelClient::send_data from RedChannel
	More preparation for separating RedChannelClient into a separate file.
	Rename function slightly for improved readability:
	 red_channel_client_blocked() -> red_channel_client_is_blocked()

	Add red_channel_client_(set|is)_destroying()
	Encapsulate the structure a bit more and avoid poking into it from other
	class implementations. Getting ready to split RedChannelClient out to a
	separate file.

	Use red_channel_client_get_client() everywhere
	Instead of having all other classes poke into the RedChannelClient
	struct to get the RedClient associated with the channel client, call the
	accessor function. This commit allows us to encapsulate RedChannelClient
	and move it to its own file soon.

	Add red_channel_client_get_channel()
	Don't poke into the structure to get the channel

	This prepares for encapsulating RedChannelClient a bit more and
	separating it into its own source file.

2016-08-12  Francois Gouget  <fgouget@codeweavers.com>

	server: Use SPICE_GNUC_DEPRECATED to avoid a dependency on glib.h
	spice-server.h cannot include glib.h because it is a public header and
	is used by projects that do not use GLib.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-08-12  Frediano Ziglio  <fziglio@redhat.com>

	OpenSSL from 1.1.0 is thread safe by default
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2016-08-11  Frediano Ziglio  <fziglio@redhat.com>

	Avoids to initialise OpenSSL threading twice
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	gstreamer: Use a dummy format to make sure format is always defined.
	This avoid a check for NULL.
	Also will be used to catch invalid values when table will be extended.

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

	Make process_commands_generation variable type coherent
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	gstreamer: Peephole optimisation for SpiceFormatForGStreamer
	Reduce structure length using static allocated string inside the
	structure.
	This will also avoid using .data.rel.ro section and relocations
	reducing even more library size.

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

	gstreamer: Fix infinite loop in get_period_bit_rate
	This was discovered by chance by me and Uri trying some remote connection
	with slow network (8Mbit) and high latency

	  $ ping 10.10.48.87 -c 3
	  3 packets transmitted, 3 received, 0% packet loss, time 2002ms
	  rtt min/avg/max/mdev = 281.069/316.758/374.413/41.153 ms

	The encoder->history status was (edited for readability):

	(gdb) p ((SpiceGstEncoder*)0x61c000264880)->history_first
	$6 = 29
	(gdb) p ((SpiceGstEncoder*)0x61c000264880)->history_last
	$14 = 28
	(gdb) p ((SpiceGstEncoder*)0x61c000264880)->history
	[0] {mm_time = 11298131, duration = 7391006, size = 5616},
	[1] {mm_time = 11298148, duration = 7373663, size = 5559},
	[2] {mm_time = 11298166, duration = 7052209, size = 5511},
	[3] {mm_time = 11298183, duration = 7006828, size = 5722},
	[4] {mm_time = 11298199, duration = 7433311, size = 5756},
	[5] {mm_time = 11298216, duration = 7134734, size = 5545},
	[6] {mm_time = 11298232, duration = 7436589, size = 5521},
	[7] {mm_time = 11298249, duration = 7152181, size = 5540},
	[8] {mm_time = 11298266, duration = 7181308, size = 7796},
	[9] {mm_time = 11298283, duration = 5053084, size = 50824},
	[10] {mm_time = 11298298, duration = 7472305, size = 7427},
	[11] {mm_time = 11298315, duration = 7385017, size = 6682},
	[12] {mm_time = 11298333, duration = 7287125, size = 6377},
	[13] {mm_time = 11298349, duration = 7191461, size = 6159},
	[14] {mm_time = 11298367, duration = 7104546, size = 6035},
	[15] {mm_time = 11298382, duration = 7266942, size = 5896},
	[16] {mm_time = 11298400, duration = 7108001, size = 5812},
	[17] {mm_time = 11298418, duration = 7020583, size = 5807},
	[18] {mm_time = 11298433, duration = 7066056, size = 5758},
	[19] {mm_time = 11298450, duration = 7052900, size = 5676},
	[20] {mm_time = 11298467, duration = 7248233, size = 5765},
	[21] {mm_time = 11298483, duration = 7077348, size = 5712},
	[22] {mm_time = 11298502, duration = 7495368, size = 5835},
	[23] {mm_time = 11298517, duration = 7068626, size = 5805},
	[24] {mm_time = 11298534, duration = 7060375, size = 5801},
	[25] {mm_time = 11298551, duration = 7020383, size = 5868},
	[26] {mm_time = 11298568, duration = 7248400, size = 5830},
	[27] {mm_time = 11298584, duration = 7001304, size = 6621},
	[28] {mm_time = 11298600, duration = 7311600, size = 6113},
	[29] {mm_time = 11297612, duration = 6999174, size = 5666},  <--- to
	[30] {mm_time = 11297628, duration = 7506688, size = 5502},
	[31] {mm_time = 11297646, duration = 7209494, size = 5687},
	[32] {mm_time = 11297663, duration = 7396429, size = 5724},
	[33] {mm_time = 11297679, duration = 7172624, size = 5839},
	[34] {mm_time = 11297696, duration = 7300811, size = 5645},
	[35] {mm_time = 11297713, duration = 7108985, size = 5553},
	[36] {mm_time = 11297729, duration = 7171701, size = 5774},
	[37] {mm_time = 11297745, duration = 7174018, size = 5637},
	[38] {mm_time = 11297762, duration = 7313549, size = 5655},
	[39] {mm_time = 11297780, duration = 5183985, size = 51014},
	[40] {mm_time = 11297796, duration = 7038329, size = 7374},
	[41] {mm_time = 11297813, duration = 7211506, size = 6585},
	[42] {mm_time = 11297830, duration = 7112690, size = 5729},
	[43] {mm_time = 11297846, duration = 7103074, size = 5761},
	[44] {mm_time = 11297864, duration = 7599826, size = 5661},
	[45] {mm_time = 11297879, duration = 7355392, size = 5351},
	[46] {mm_time = 11297897, duration = 7454367, size = 5488},
	[47] {mm_time = 11297913, duration = 7127145, size = 5573},
	[48] {mm_time = 11297932, duration = 7550098, size = 5447},
	[49] {mm_time = 11297948, duration = 7506884, size = 5809},
	[50] {mm_time = 11297966, duration = 7405712, size = 5783},
	[51] {mm_time = 11297982, duration = 7182025, size = 5599},
	[52] {mm_time = 11298001, duration = 7323887, size = 5817},
	[53] {mm_time = 11298014, duration = 7342091, size = 5575},
	[54] {mm_time = 11298031, duration = 7596319, size = 5739},
	[55] {mm_time = 11298052, duration = 7428169, size = 5669},
	[56] {mm_time = 11298065, duration = 7457282, size = 5732},
	[57] {mm_time = 11298081, duration = 7174029, size = 5541},
	[58] {mm_time = 11298097, duration = 7340512, size = 5680},
	[59] {mm_time = 11298115, duration = 7427439, size = 5701}}
	(gdb) p from
	$16 = 11297544
	(gdb) p to
	$17 = 11297612

	You can see that encoder->history[encoder->history_first].mm_time == to
	cause the check index == encoder->history_first to not be executed.

	This code change was suggested by Uri.

	Reported-by: Uri Lublin <uril@redhat.com>
	Tested-by: Uri Lublin <uril@redhat.com>
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	gstreamer: Use static compile check
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2016-08-09  Jonathon Jongsma  <jjongsma@redhat.com>

	Miscellaneous header changes
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-08-09  Frediano Ziglio  <fziglio@redhat.com>

	remove CommonGraphicsChannelClient structure
	Was just containing a RedChannelClient field

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	move is_low_bandwidth to DisplayChannelClient
	The field is only used by DisplayChannelClient, not by CursorChannelClient

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	remove common_graphics_channel_new_client function
	The function was just calling another function with same parameters

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	move during_target_migrate out of common_graphics_channel_new_client
	This reduces the number of arguments that need to be passed to the
	function, and also avoids changing a different object within a function
	that is supposed to just create a new object

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	move channel window setting to config_socket
	Make common_graphics_channel_new_client smaller

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-08-09  Jonathon Jongsma  <jjongsma@redhat.com>

	Limit direct access to DisplayChannelClient
	Add a few more methods and accessors so that other files don't need to
	manipulate the struct members directly. Move the struct definition to a
	private header which only the dcc-* files will include.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-08-04  Christophe Fergeau  <cfergeau@redhat.com>

	build: Update libtool versioning for 0.13.2

	Update spice-common
	This brings these changes:

	Christophe Fergeau (6):
	      Update verify.h to latest version
	      codegen: Remove unused write_message_marshaller argument
	      Adjust verify.h licence
	      codegen: Fix 'registred' typo
	      codegen: Use "" rather than <> for cmdline includes
	      codegen: Autogenerate client_marshallers.h

	Eduardo Lima (Etrunko) (1):
	      Use explicit path for inclusion

	Francois Gouget (1):
	      codegen: Fix compatibility with Python 2.6

	Frediano Ziglio (4):
	      add a check for negate cases on enumerations
	      extend a comment for type attributes
	      Use a macro to simplify ring_get_length
	      codegen: Improve header guard generation

	Pavel Grunt (1):
	      codegen: Do not generate extra null check

	Update NEWS for 0.13.2

2016-08-03  Frediano Ziglio  <fziglio@redhat.com>

	gstreamer: Allows to add output format to options
	This allow option string to contain separator so you could set as
	"field=value ! format".
	This is useful as some encoders use the output format to specify
	compression types (for instance with some H264 encoders you can
	specify the profile to use).

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

	gstreamer: Peephole optimisation
	SpiceGstFrameInformation change from 24 to 16 bytes reducing
	SpiceGstEncoder 480 bytes.

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

2016-08-02  snir sheriber  <ssheribe@redhat.com>

	User-Manual: mention webdav is disabled by default
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2016-08-02  Frediano Ziglio  <fziglio@redhat.com>

	Reduce indentation inverting condition
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Fix typo for macro names
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-08-01  Frediano Ziglio  <fziglio@redhat.com>

	Handle scancode extensions E1 and E2
	Do not handle them as normal keys.
	State is not saved for these keys.

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

	Prevent possible buffer overflow in SpiceKbdState
	key and key_ext in SpiceKbdState are indexed using

	   state[scan & 0x7f]

	where scan is a 8 bit value got from client. In theory client can send
	any value causing scan & 0x7f to be 0x7f. However these arrays contains
	only 0x7f values so 0x7f cause a off one overflow.
	This potentially cause key_ext to overflow in reds pointer following.
	Happily this is not exploitable in either 32 or 64 bit environment.
	On 64 bit key_ext is followed by a 4 byte (sizeof(bool) == 4) padding
	which is written by the possible overflow.
	On 32 bit reds will be overwritten with either 0 or 1 which will cause
	a SIGSEGV leading to a DoS. Considering that you have to have access
	to the machine with a client you are just shutting down only guests you
	can access to.

	Acked-by: Uri Lublin <uril@redhat.com>

2016-07-28  Marc-André Lureau  <marcandre.lureau@redhat.com>

	Call migrate_end_complete() after falling back to switch-host
	Eventually, during a seamless migration, qemu may finish to migrate
	before the spice client even finished to connect all channels to
	destination and informed the server. In this case,
	main_channel_client_migrate_src_complete() will fall back to
	switch-host method, and reds_mig_fill_wait_disconnect() is called to
	complete the migration (disconnecting all channels).

	reds_mig_cleanup() is called when all channels are disconnected, but
	reds->mig_wait_connect is still TRUE, and it will call
	migrate_connect_complete() instead of the expected
	migrate_end_complete(). Setting reds->mig_wait_connect to FALSE when
	reds_mig_fill_wait_disconnect() solves the issue.

	Fixes:
	https://bugzilla.redhat.com/show_bug.cgi?id=1352836

2016-07-28  Francois Gouget  <fgouget@codeweavers.com>

	streaming: Don't start streaming if there is no video encoder
	Without a video encoder no frame will be streamed anyway.
	This fixes the case where the client does not support any of the
	server's codecs, such as if it was compiled with --enable-gstvideo=no
	--disable-builtin-mjpeg.

2016-07-27  Francois Gouget  <fgouget@codeweavers.com>

	server: Make sure g_object_new receive the correct data
	g_object_new is a variadic function which takes property values.
	As the compiler cannot check if these property values are correct,
	make sure they are using casts.
	This actually fixes a crash in reds.c for 32 bit architectures.

	Based on a patch by Frediano Ziglio <fziglio@redhat.com>

2016-07-14  Uri Lublin  <uril@redhat.com>

	spicevmc_device_connect: get parser for appropriate channel_type
	spicevmc_device_connect() is called for non-usb types too.

2016-07-13  Frediano Ziglio  <fziglio@redhat.com>

	Fix gl draw command called without scanout
	This happens during VM shutdown.
	Qemu should never send a draw command without scanout.
	This should be fixed in Qemu  or in Virgl driver.

	Acked-by: Uri Lublin <uril@redhat.com>

	Use fd parameter instead of reading file descriptor from reds
	Acked-by: Uri Lublin <uril@redhat.com>

	Remove useless return statement
	Acked-by: Uri Lublin <uril@redhat.com>

2016-07-08  Marc-André 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  Pavel Grunt  <pgrunt@redhat.com>

	Fix -Werror=format with DEBUG_ENCODE
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Do not force computing streaming statistic
	Let user to define STREAM_STATS to enable them

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Fix compiling with defined DEBUG_DISPATCHER
	setup_dummy_signal_handler was used before declared

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-06-29  Frediano Ziglio  <fziglio@redhat.com>

	Constify spice_server_char_device_recognized_subtypes
	Users should not change the list of supported subtypes.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Constify event_loop_core
	Was used as write variable only for testing.
	Avoid usage of not constant globals.
	Making globals constants avoid future race condition
	usages.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-06-22  Frediano Ziglio  <fziglio@redhat.com>

	Protect globals servers variable with a mutex
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Make video_encoder_procs constant
	This is not going to be modified.

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

	Initialise OpenSSL just once
	Avoid multiple initializations of this library.
	Also initialize using thread safe code to avoid possible race
	conditions.

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

	Make spice_server_char_device_recognized_subtypes_list static
	Not used outside the compile unit.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Make servers global static
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-06-20  Frediano Ziglio  <fziglio@redhat.com>

	Use proper types in compress_send_data_t
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-06-17  Frediano Ziglio  <fziglio@redhat.com>

	Make RedGlzDrawable typedef private
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Destroy pthread structures
	Current Linux pthread implementation should use futex so there should
	be no leak but calling destroy avoid possible future leaks.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Rename dcc-encoders.[ch] to image-encoders.[ch]
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Reduce header dependency
	Avoid dependencies from RedChannel stuff.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove dependency from dcc-encoders to Drawable
	Encoding image requires a RedDrawable (where the data is stored) and
	a Ring where to store information to free Glz structures.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Use new GlzImageRetention instead of accessing Drawable internals
	Remove some coupling, we mainly need to store a list of RedGlzDrawables.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-06-16  Frediano Ziglio  <fziglio@redhat.com>

	Make GlzSharedDictionary structure private in dcc-encoders.c
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Do not access ImageEncoders internal to lock/unlock glz encoding
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Better encapsulation for image_encoders_compress_glz call
	Do not access too much encoders data.
	Slightly different as now if glz is frozen lz compression is used.
	Glz is frozen only during migration.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Rename encoder_globals to encoder_shared_data
	Was missing due to a mistake.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove unused free_compress_bufs field from DisplayChannel
	RedCompressBuf are no longer pooled.
	The usage was removed in 92d9b782bd0754083f79a04a9e9edc38339c0cc4.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-06-16  Eduardo Lima (Etrunko)  <etrunko@redhat.com>

	Move lz4-encoder.[ch] to conditional block in Makefile.am
	Let's follow the 'standard' for optional components. This commit also
	drops (now) unecessary #ifdef USE_LZ4 from lz4-encode.c, as the decision
	to build this file is now made in Makefile.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Use correct variable to print if LZ4 support is to be built.

2016-06-16  Frediano Ziglio  <fziglio@redhat.com>

	Make video-encoder.h self independent
	gpointer definition was not included causing the header to fails to
	compile if included first.

	Acked-by: Francois Gouget <fgouget@codeweavers.com>

2016-06-16  Eduardo Lima (Etrunko)  <etrunko@redhat.com>

	Fix set but not used variable warning
	Introduced by commit 903c91cd3013c763abd3f2292f8fbd911a0c83f0, this
	variable is used only for LZ4 code. Move the declaration to the proper
	block of code.

	Build log:

	spicevmc.c: In function 'handle_compressed_msg':
	spicevmc.c:346:14: error: variable 'decompressed' set but not used [-Werror=unused-but-set-variable]
	     uint8_t *decompressed;
	                   ^

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Fix build for systems without LZ4 dependency installed
	This was introduced by commit 903c91cd3013c763abd3f2292f8fbd911a0c83f0.
	To fix it, we simply protect the try_compress_lz4 function with proper
	ifdef guards.

	Build log:

	spicevmc.c: In function 'try_compress_lz4':
	spicevmc.c:143:5: error: implicit declaration of function 'LZ4_compress_default' [-Werror=implicit-function-declaration]
	     compressed_data_count = LZ4_compress_default((char*)&msg_item->buf,
	     ^
	spicevmc.c:143:5: error: nested extern declaration of 'LZ4_compress_default' [-Werror=nested-externs]

	spicevmc.c: At top level:
	spicevmc.c:124:24: error: 'try_compress_lz4' defined but not used [-Werror=unused-function]
	 static RedVmcPipeItem* try_compress_lz4(SpiceVmcState *state, int n, RedVmcPipeItem *msg_item)
	                        ^

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-06-16  Frediano Ziglio  <fziglio@redhat.com>

	Remove message_buf from EncoderData
	This buffer was just written and then used, no reason to store into
	a more persistent structure.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-06-16  Eduardo Lima (Etrunko)  <etrunko@redhat.com>

	configure: Better wording hasn't -> has not
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-06-15  Frediano Ziglio  <fziglio@redhat.com>

	Make red_glz_drawable_free() static
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Encapsulate some data in dcc-encoders
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-06-15  Pavel Grunt  <pgrunt@redhat.com>

	Fix missing prototypes
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Remove unused reds_expects_link_id
	Not needed since f683815ad53cc39f485ddac9770e23282ca5c340

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-06-15  Jonathon Jongsma  <jjongsma@redhat.com>

	Rename image_encoders_free_glz_drawable()
	Rename this function to red_glz_drawable_free() and remove the
	ImageEncoders argument since the RedGlzDrawable already holds a pointer
	to the ImageEncoders structure

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Rename image_encoders_free_glz_drawable_instance()
	Rename this function to glz_drawable_instance_item_free() and remove the
	ImageEncoders argument since the RedGlzDrawable already holds a pointer
	to the ImageEncoders structure.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-06-15  Frediano Ziglio  <fziglio@redhat.com>

	Make image_encoders_freeze_glz() static
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Encapsulate code to save glz state
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Change RedGlzDrawable::drawable from pointer to boolean
	The field was used just as a flag.
	This has the advantage to make clear to not use the pointer as we don't
	have ownership.
	Also makes the structure a bit smaller.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Better encoders encapsulation
	Avoid to access some fields from dcc.c

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Encapsulate dcc_release_glz
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-06-14  Francois Gouget  <fgouget@codeweavers.com>

	streaming: Add support for GStreamer 0.10
	configure will use GStreamer 1.0 if present and fall back to
	GStreamer 0.10 otherwise.
	ffenc_mjpeg takes its bitrate as a long so extend set_gstenc_bitrate().

	streaming: Dynamically adjust the GStreamer encoder bitrate if possible
	This is faster and lets the encoder leverage past bitrate shaping
	history to attain the target faster.

	streaming: Respect the GStreamer encoder's valid bit rate range
	GObject returns an error instead of clamping if given an out of range
	property value.

	streaming: Give up after a while if GStreamer cannot handle the video
	This typically happens when sending very small frames (less than
	16 pixels in one dimension) to the x264enc encoder.
	This avoids repeatedly wasting time rebuilding the pipeline.

	streaming: Adjust the frame rate based on the GStreamer encoding time

	streaming: Adjust the GStreamer encoder bit rate to the network
	The video encoder uses the client reports and/or notifications of
	server frame drops as its feedback mechanisms. In particular it keeps
	track of the maximum video margin and reduces the bit rate whenever the
	margin goes below certain thresholds or decreases too sharply.
	It uses these to figure out the lowest bit rate that causes negative
	feedback, and the highest bit rate that allows a return to positive
	feedbacks. It then works to narrow this range and settles on the lower
	end once the spread has gone below a given threshold.
	All the while it monitors the effective bit rate to ensure the target
	bit rate does not grow significantly beyond what the GStreamer encoder
	will produce: this avoids target bit rate 'bubbles' which would
	invariably be followed by a bit rate crash with accompanying frame loss.
	As soon as the network feedback indicates a significant degradation the
	bit rate is lowered to minimize the risk of frame loss and/or long
	freezes.
	It also relies on the existing shaping of the GStreamer output bit rate
	to minimize the pipeline reconfigurations.

	streaming: Shape the bit rate of the GStreamer codecs output
	The GStreamer codecs don't follow the specified bit rate very closely:
	they can decide to exceed it for ten seconds or more if they consider
	the scene deserves it. Such long bursts are enough to cause network
	congestion, resulting in many lost frames which cause significant
	display corruption.
	So the GStreamer video encoder now uses a short 300ms virtual buffer
	to shape the compressed video output and ensure we don't exceed the
	target bit rate for any significant length of time.
	It could instead rely on the network feedback (when available) to lower
	the bit rate. However frequent GStreamer bit rate changes lower the
	overall compression level and also result in a lower average bit rate,
	both of which result in lower video quality.
	The GStreamer video encoder also keeps track of the encoded frame size
	so it can gather statistics and call update_client_playback_delay()
	with accurate information and also annotate the client report debug
	traces with the corresponding bit rate information.

	streaming: Add h264 support to the GStreamer video encoder

	streaming: Avoid copying the input frame in the GStreamer encoder
	Note that we can only avoid copies for the first 1 Mpixels or so.
	That's because Spice splits larger frames into more chunks than we can
	fit GstMemory fragments in a GStreamer buffer. So if there are more
	pixels we will avoid copies for the first 3840 KB and copy the rest.
	Furthermore, while in practice the GStreamer encoder will only modify
	the RedDrawable refcount during the encode_frame(), in theory the
	refcount could be decremented from the GStreamer thread after
	encode_frame() returns.

	streaming: Handle and recover from GStreamer encoding errors
	If an error occurs for whatever reason (e.g. codec not supporting odd
	frame sizes), the GStreamer pipeline will drop the current buffer,
	causing the encoder to be stuck waiting for the sample. So this patch
	tracks error notifications and ensures we don't wait for a sample if
	none will come.

	streaming: Let the video encoder manage the compressed buffer
	This way the video encoder is not forced to use malloc()/free().
	This also allows more flexibility in how the video encoder manages the
	buffer which allows for a zero-copy implementation in both video
	encoders.

	streaming: Add VP8 support to the GStreamer video encoder

2016-06-14  Pavel Grunt  <pgrunt@redhat.com>

	replay: Add an option to change video codec

2016-06-14  Francois Gouget  <fgouget@codeweavers.com>

	streaming: Let the administrator pick the video encoder and codec
	The Spice server administrator can specify the encoder and codec
	preferences to optimize for CPU or bandwidth usage. Preferences are
	described in a semi-colon separated list of encoder:codec pairs.
	The server has a default preference list which can explicitly be
	selected by specifying 'auto'.

	streaming: Check the client video codec capabilities
	The server picks a codec supported by the client based on the following
	new client capabilities:
	 * SPICE_DISPLAY_CAP_MULTI_CODEC which denotes a recent client that
	   supports multiple codecs. This capability is needed to not have to
	   hardcode that MJPEG is supported. This makes it possible to write
	   clients that don't support MJPEG.
	 * SPICE_DISPLAY_CAP_CODEC_XXX, where XXX is a supported codec. Note
	   that for now the server only supports the MJPEG codec.

	streaming: Add a GStreamer 1.0 MJPEG video encoder and use it by default
	This introduces a pared down GStreamer-based video encoder to serve as
	the basis for later enhancements.
	In this form the new encoder supports both regular and sized streams
	but lacks any rate control. It should still work fine if bandwidth is
	sufficient such as on LANs.

	streaming: Remove the width/height encode_frame() parameters
	encode_frame() needs the QXL_DRAW_COPY operation's SpiceCopy.src_area
	field anyway, so the width and height parameters were redundant.

	mjpeg: Use src_area as the authoritative source for the frame dimensions
	Video frames correspond to QXL_DRAW_COPY operations where the frame area
	is defined by the SpiceCopy.src_area field.

	streaming: Simplify is_next_stream_frame()
	After the removal of Drawable::sized_stream, we no longer need to detect
	if the stream changes size in is_next_stream_frame() so it can return a
	boolean rather than a value from an enum.

	streaming: Remove unused detach_stream() argument
	After the removal of Drawable::sized_stream, the last argument to
	detach_stream() is no longer used.

	streaming: Remove the Drawable.sized_stream field
	Only red_marshall_stream_data() needs to know whether to send the frame
	using a SpiceMsgDisplayStreamDataSized or a regular StreamData message.
	So check whether we have a sized frame there and simplify the rest of
	the code.

	streaming: Rework red_marshall_stream_data a bit
	This code just refactors the function without doing any functional
	changes. The actual changes will be in the next commit, and this will
	make the next commit much more obvious.

	streaming: Better check for sized frames
	Usually the RedDrawable bbox dimensions match the src_area dimensions
	so that checking that the bbox matches the stream's original dest_area
	should be enough to determine if sized stream support is needed to
	send the frame.
	But making the bbox different could be used to have the scaling be
	performed on the client side. So it's better not to assume the bbox and
	src_area have the same dimensions.

2016-06-14  Frediano Ziglio  <fziglio@redhat.com>

	Move image_encoders_compress_glz to dcc-encoders.c
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Make dcc_compress_image_glz independent to DisplayChannelClient
	Also rename to image_encoders_compress_glz

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Move others glz fields to dcc-encoders
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Change dcc_encoders_init to take ImageEncoders instead of DisplayChannelClient
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Move some glz fields to ImageEncoders
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Add a structure to hold ImageEncoders shared data
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-06-14  snir sheriber  <ssheribe@redhat.com>

	LZ4 compression is now available at the Spicevmc channel
	Compressed message type is CompressedData which contains compression
	type (1 byte) followed by the uncompressed data size (4 bytes - exists
	only if data was compressed) followed by the compressed data

	If SPICE_USBREDIR_CAP_DATA_COMPRESS_LZ4 capability is available &&
	data_size > COMPRESS_THRESHOLD && !AF_LOCAL data will be sent
	compressed otherwise data will be sent uncompressed (also if
	compression has failed)

	Update the required protocol to 0.12.12

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-06-10  Frediano Ziglio  <fziglio@redhat.com>

	Remove unused DCC_TO_WORKER macro
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	More encapsulation for dcc_encoders_free
	Encoders function should not use DisplayChannelClient

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Encapsulate zlib information in ImageEncoders structure
	This change is less clean the other similar patches as zlib and
	glz require more steps.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-06-09  Frediano Ziglio  <fziglio@redhat.com>

	Move image_encoders_compress_lz4 to dcc-encoders.c
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Prepare to move dcc_compress_image_lz4 to ImageEncoders
	Remove all DisplayChannel(Client) dependencies.
	Rename function.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Encapsulate lz4 information in ImageEncoders structure
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Move image_encoders_compress_jpeg to dcc-encoders.c
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Prepare to move dcc_compress_image_jpeg to ImageEncoders
	Remove all DisplayChannel(Client) dependencies.
	Rename function.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Encapsulate jpeg information in ImageEncoders structure
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Move image_encoders_compress_lz to dcc-encoders.c
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Prepare to move dcc_compress_image_lz to ImageEncoders
	Remove all DisplayChannel(Client) dependencies.
	Rename function.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Encapsulate lz information in ImageEncoders structure
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Move image_encoders_compress_quic to dcc-encoders.c
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Prepare to move dcc_compress_image_quic to ImageEncoders
	Remove all DisplayChannel(Client) dependencies.
	Rename function.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Encapsulate quic information in a new ImageEncoders structure
	Start putting all encoding code into dcc-encoders.c.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Move marshalling code from dcc-encoders to dcc-send
	No reasons why dcc-encoders should know about marshalling.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Add compress_buf_free function
	dcc-encoders should be in change of allocate and free the structure
	don't put internal assumptions (which functions are used for memory
	management) in different files.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-06-08  Frediano Ziglio  <fziglio@redhat.com>

	record: Use spice_get_monotonic_time_ns instead of stat_now(CLOCK_MONOTONIC)
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	record: Use proper type for timestamp
	Use red_time_t to make sure timestamp has the right precision even
	on 32 bit systems.

	Acked-by: Jonathon Jongsma <jjongsma@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>

	Move dcc glz field initialization into dcc_new
	There is no reason to initialize these fields in two different places.
	Note that an usage between dcc_new and the function where these
	field were initialised would have resulted in a crash.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-06-07  Frediano Ziglio  <fziglio@redhat.com>

	record: Make red_record_cursor_cmd static
	This function is never used outside this compile unit.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	replay: Handle cursor commands
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-06-07  Victor Toso  <victortoso@redhat.com>

	char-device: fix mismatch of client tokens
	As the tokens counter were not being reset you could enter in a
	situation where client thinks it has more tokens then server which
	would eventually lead to client's disconnection from 0c5eca97f16ec6
	onwards (before it was crashing).

	It is easy to check the above situation if you track the amount of
	tokens you have in the client and simply kill and restart the agent
	while doing some file transfer: the client could reach more then 13
	tokens which should not really be possible.

	Based on patch from Frediano Ziglio <fziglio@redhat.com>

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-06-06  Frediano Ziglio  <fziglio@redhat.com>

	replay: Load cursor commands
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: Record cursor commands
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	record: Support cursor commands
	Use red_record_cursor_cmd to be able to record cursor commands.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	avoid integer underflow under 32 bit architectures
	The segment_size computation on 32 bit can lead to big numbers which
	can lead to negative offset. Let'ss avoid to underrun the buffer,
	as it's not checked.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2016-06-05  Frediano Ziglio  <fziglio@redhat.com>

	fix integer overflows in red_get_path
	Use 64 bit arithmetic to avoid overflows.
	The multiplication between count and a constant can overflow.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2016-06-04  Frediano Ziglio  <fziglio@redhat.com>

	Remove unused parameter
	Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

2016-06-03  Frediano Ziglio  <fziglio@redhat.com>

	Remove only written field
	EncoderData::dcc field is never read back.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-06-03  Francois Gouget  <fgouget@codeweavers.com>

	red-parse-qxl: Check consistency of QXL_DRAW_COPY operations
	The source area should not extend outside the source bitmap, or have
	swapped coordinates.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-06-02  Jonathon Jongsma  <jjongsma@redhat.com>

	Remove global "allowed" variable
	This variable was always the same value as
	dispatcher_allows_client_mouse.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-06-02  Frediano Ziglio  <fziglio@redhat.com>

	Remove only written lock_count variable
	Possibly used for debugging or an initial recursive lock.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-06-01  Frediano Ziglio  <fziglio@redhat.com>

	channel: Remove clients_num and use g_list_length
	This fixes a regression introduced by
	4028fb1c794ef2a212f22b024b1c39f460439e7b, where clients_num
	was not updated correctly anymore.

	There is no reason to cache the number of elements on that list,
	as the expected number of clients is quite small.

	Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>

	smartcard: Avoid crash on remove_interface call
	SpiceCharDeviceInstance is not a GObject, the GObject is char_device->st
	as the above line is stating.
	The crash never happen as Qemu never calls spice_server_remove_interface
	for smartcards.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Simplify setting char device instance
	Setting "sin" property is equivalent to call
	red_char_device_reset_dev_instance so there is no need for a if/else
	as the code is doing mostly (beside setting agent_attached) the
	same thing

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove obsolete comment
	AGENT_CONNECT with token count is implemented by agent_connected_tokens
	message.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Fix some typos in comments
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-05-31  Jonathon Jongsma  <jjongsma@redhat.com>

	Replace RedClient::channels with GList
	Allows us to not expose the client_link in RedChannelClient.

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

2016-05-31  Frediano Ziglio  <fziglio@redhat.com>

	Handle flow control without crashing for agent
	RedCharDevice used for the agent has flow control enabled.
	This make possible for red_char_device_write_buffer_get to return NULL.
	Handle such situation without crashing avoiding NULL dereference.

	This fixes https://bugs.freedesktop.org/show_bug.cgi?id=95416.

	Acked-by: Uri Lublin <uril@redhat.com>

2016-05-27  Frediano Ziglio  <fziglio@redhat.com>

	Avoid getting channel from client
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Move upcast conversion to a safer place
	Upcast conversions are by definition unsafe. There are however some
	location where such conversion are more safe. In this case send_item
	callback is registered specifically for this type of RedChannel making
	the conversion more reliable.
	The other conversion (CursorChannel -> RedChannel) became safe.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Add some comments to cursor-channel.h header
	Explain usage of the class.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-05-26  Frediano Ziglio  <fziglio@redhat.com>

	Avoid double conversion
	Avoid converting from RedChannelClient* to DisplayChannelClient* and
	DisplayChannelClient* to RedChannelClient* just to use RedChannelClient*
	('display_channel->clients' is a list of RedChannelClients).

	Acked-by: Uri Lublin <uril@redhat.com>

	Remove useless double conversion
	Avoid converting RedChannelClient* to CursorChannelClient* and then
	CursorChannelClient* to RedChannelClient* just to use RedChannelClient*.

	Acked-by: Uri Lublin <uril@redhat.com>

	replay: rename red_record_dev_input_primary_surface_create
	Rename red_record_dev_input_primary_surface_create to
	red_record_primary_surface_create.
	Name is more concise and was not clear what "dev_input" was supposed
	to specify.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	replay: allows to specify a filter for record output
	This allows compression using external programs or any type
	of filters.

	To use it set SPICE_WORKER_RECORD_FILTER environment to the
	filter command you want to use. The command is executed with
	g_spawn_async_with_pipes (which uses execve) so is not a shell
	command although the command is parsed using g_shell_parse_argv
	which split arguments as shell does.

	One easy way to use it is to just use a compressor like gzip with

	  export SPICE_WORKER_RECORD_FILENAME=/tmp/qemu_record.gz
	  export SPICE_WORKER_RECORD_FILTER=gzip
	  qemu ...

	The filter will receive the recording on standard input and is
	supposed to write in output filename (which is the standard output).
	You can use additional arguments in SPICE_WORKER_RECORD_FILTER to
	specify for instance compression level.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	replay: better record encapsulation
	Remove global/static from red_record_qxl.c.
	Defined a structure and use it to hold record state.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Hide CursorChannelClient implementation details
	The existence of this class can be hidden to user of CursorChannel class

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Make cursor_channel_client_new static
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Move cursor_connect to CursorChannel
	This function was handling mainly CursorChannel state

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-05-25  Frediano Ziglio  <fziglio@redhat.com>

	Make some function static
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Simplify current_add_equal loop
	Acked-by: Eduardo Lima <etrunko@redhat.com>

	dc: use FOREACH_CLIENT macro for loop

	dc: inline dpi computation
	Actually not exactly the same as this fix a bug if base is not the
	first element (in this case if dpi_ring_item is NULL dpi is not)

	dc: join the two loop
	They tested the same condition, no break in inside loop (which would
	exit all loops)

	dc: reuse code inside loop

	dc: convert break to continue
	Both jump to check worker_ring_item (internal or external loops)

	dc: use while again
	Convert from for(;;) { if () break; ... } to while

	dc: if link is NULL jumping outside loop will check variable and exit
	The outer loop will exit too.

	dc: if dpi is not NULL even dpi_ring_item is not NULL

	dc: dpi is always a value computed from dpi_ring_item

	dc: move code inside if
	these lines are only executed then the condition are satisfied

	dc: dcc used is always a value from current link

	dc: link is never null here

	dc: the link condition make this case terminate loop
	dpi_ring_item is changed but ignored

	dc: split if

	dc: convert to infinite loop

	style: Add some abbreviations
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	style: Sort abbreviations alphabetically
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Removed unused GET_CODE definition
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Remove potentially unsafe casts
	The id type is already uint64_t, no need to cast using some low
	level casts.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove unused macro definitions
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Move RedCacheItem size field inside cache_data union
	This reduce a bit the structure size and make clear that
	the field is used only when the item is a cache item.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove not necessary inval_type from RedCacheItem
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-05-25  Jonathon Jongsma  <jjongsma@redhat.com>

	Fix build warning when RED_WORKER_STAT is undefined
	since display_channel_print_stats is now static, the compiler complains
	when RED_WORKER_STAT is undefined since this function is not used:

	    ../../server/display-channel.c:853:13: error: 'display_channel_print_stats' defined but not used [-Werror=unused-function]

	To fix, don't define the function when RED_WORKER_STAT is undefined.
	Acked-by: Victor Toso <victortoso@redhat.com>

2016-05-24  Jonathon Jongsma  <jjongsma@redhat.com>

	RedChannel: Add FOREACH_CLIENT and use it to iterate
	Remove the custom FOREACH_DCC macro and use the more generic
	FOREACH_CLIENT macro and use it for all channels.

	Replace RedChannel::clients with GList
	Instead of using a Ring, use a GList to store the list of channel
	clients. This allows us to iterate the clients without poking inside of
	the client struct to get the channel_link. This is required in order to
	make the RedChannelClient struct private.

	Move InputsChannelClient to a separate file
	Preparation for converting to GObject

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-05-24  Frediano Ziglio  <fziglio@redhat.com>

	change main_channel_marshall_mouse_mode call style
	Make the call more similar to other marshall function calls in the
	same function.

	move all item creation in main-channel-client.c
	Move all core to create and destroy MainChannel pipe items in a single
	place.

	Introduce SPICE_UPCAST macro
	This was proposed by Christophe as improvement over some typesafe
	patches.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-05-24  Jonathon Jongsma  <jjongsma@redhat.com>

	cache-item.h: remove unnecessary channel include
	It's only necessary to include red-pipe-item.h

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	AgentMsgFilter: use typedef
	Instead of using the full 'struct AgentMsgFilter', use the typedef name

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-05-24  Frediano Ziglio  <fziglio@redhat.com>

	Make some function static
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-05-21  Frediano Ziglio  <fziglio@redhat.com>

	Get code more typesafe
	Scan remaining code searching for problems with structure
	layout assumptions in the code.
	Where code required some restructuring put some verify checks
	to make sure code won't compile if these assumptions are not
	in place anymore.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	reduce casts to RedPipeItem and RingItem
	Make code more type safe. This allow to move or delete structure
	fields more safely

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	rename RedVDIReadBug::parent to base
	All other classes using RedPipeItem as base use base as parent name

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	make red_pipe_item_unref more typesafe
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	make red_pipe_item_ref more typesafe
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	make red_pipe_item_init_full more typesafe
	Use a proper type for free callback

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Use a marker instead of checking a RedPipeItem presence
	This avoids having to retain a pointer just to check item is still in
	the queue with ring_item_is_linked(&item->link).

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Call dcc_send_item directly
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Handle reference for RedPipeItem in RedChannel
	Remove the need to release the item inside send_item callbacks.
	This looks like a partial rollback of previous patch but is
	to make clear the intention of the change.
	The lifetime of items could extend a bit further but there
	are no cases this small lag should cause problems.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove RedChannel::hold_item callback
	This is quite confusing and prone to errors.
	Use RedPipeItem reference counting instead.
	To compensate for the additional reference due to red_pipe_item_ref
	in RedChannel sub class with empty hold_item have to add a
	red_pipe_item_unref call in send_item.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-05-20  Jonathon Jongsma  <jjongsma@redhat.com>

	Remove 'peer' from name of channel client methods
	There is some inconsistent naming of RedChannelClient methods. Some
	include the word 'peer' (which normally seems to refer to RedsStream).
	Remove the 'peer' terminology from those functions that are basically
	RedChannelClient methods.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-05-20  Frediano Ziglio  <fziglio@redhat.com>

	let compiler manage the copy in a more typesafe way
	Do not use memcpy but just copy the data

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

2016-05-20  Jonathon Jongsma  <jjongsma@redhat.com>

	Move MainChannelClient to separate file
	Preparation for converting to GObject

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-05-20  Uri Lublin  <uril@redhat.com>

	glz: simplification of do_match and PIXEL_ID
	Following commit e8017dd366afabbd099a13d7d455a37fd50be124 here
	are some more ifdef simplification.

	For PIXEL_ID and PIXEL_DIST macros,
	the ifndef LZ_PLT defines are special cases of the LZ_PLT
	(#else) defines, when pix_per_byte is 1

	Now do_match can accept pix_per_byte param for all different
	definitions (implementations).

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2016-05-20  Frediano Ziglio  <fziglio@redhat.com>

	Fix typo in comment
	Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>

	style: Add an abbreviation
	Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>

2016-05-19  Jonathon Jongsma  <jjongsma@redhat.com>

	Add red_client_seamless_migration_done_for_channel()
	This is a public RedClient API that handles updating itself rather than
	having the RedChannelClient poke around at the internal structure in
	rec_channel_client_seamless_migration_done().

	Simplify DisplayChannel hold_item()
	Since all pipe items implement refcounting now, just call
	red_pipe_item_ref() and eliminate the switch statement.

	Remove unnecessary cursor_pipe_item_ref()
	Use the base red_pipe_item_ref() instead of adding an additional static
	wrapper function.

2016-05-18  Frediano Ziglio  <fziglio@redhat.com>

	make spice-server-replay use dynamic spice-server library
	spice-server-replay is built with the same settings as tests.
	Currently the tests links to a convenience spice-server library.
	A convenience library is a static library build with object file
	for a dynamic library.
	This make all tests contain all spice-server library code and not
	linking to the spice-server dynamic library (the .so).
	It's not a problem for most tests however this make impossible for
	spice-server-replay utility to be used with a dynamic spice-server
	library (you have to recompile it including the library).
	This is a pity as you could for instance compare your system
	library behavior with the library you are developing.
	Also if we decide to install in a future the utility for testing
	we would have lot of code duplication.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	remove a warning building a test
	With my compile switches (which are mostly derived from RedHat spec
	file) I'm getting this warning:

	stream-test.c: In function 'sock_fd_read':
	stream-test.c:66:43: warning: dereferencing type-punned pointer will
	break strict-aliasing rules [-Wstrict-aliasing]
	             *fd = *((int *) CMSG_DATA(cmsg));
	                                           ^

	memcpy could decrease performance but as this is a test it's not
	an issue.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Simplify #ifdef/#endif in glz code
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	char-device: Update function names in documentation
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Make sure all headers are independent
	Make sure is possible to include any headers alone.

	I used this script to check independence (run under server directory):
	----
	#!/bin/bash

	set -e

	# check not already modified
	if grep -q libheaders.la Makefile.am; then
	    echo "Header library already prepared" >&2
	    exit 1
	fi

	add_lib() {
	    local hdr="$1"

	    hdr=${hdr%.h}
	    c="mao_${hdr}.c"
	    echo "#include \"${hdr}.h\"" > $c
	    echo -e "\t$c \\" >&3
	}

	# add library to compile all headers alones
	exec 3>> Makefile.am
	echo "
	noinst_LTLIBRARIES += libheaders.la
	libheaders_la_SOURCES =				\\" >&3
	for hdr in *.h; do
	    case $hdr in
	    spice-bitmap-utils.h)
	        add_lib $hdr
	        ;;
	    spice*.h)
	        ;;
	    *)
	        add_lib $hdr
	        ;;
	    esac
	done
	echo -e "\t\$(NULL)" >&3
	exec 3>&-
	----

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	style: Add some documentation for names
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Use more reference counting on RedPipeItem
	This is the continuation of Christophe patches using reference
	counting for RedPipeItem.
	Extend it's usage.
	This for instance leads to the removal of release_item callback.

	Use reference counting for RedPipeItem
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Reuse red_channel_client_release_sent_item function
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Make red_channel_client_clear_sent_item static
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove red_channel_client_release_item
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove release_item callback
	Just a call to red_pipe_item_unref.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove main_channel_release_pipe_item
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Simplify main_channel_release_pipe_item
	Reuse RedPipeItem facilities.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Use a default release_item implementation in RedChannel
	Avoid having to provide a lot of empty implementations

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove dcc_release_item
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Simplify pipe items release in CursorChannel
	All RedPipeItems can be freed with red_pipe_item_unref.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Reuse RedPipeItem facilities for RedCursorPipeItem
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove unused parameter from put_cursor_pipe_item
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Simplify spicevmc_red_channel_release_pipe_item
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Simplify smartcard_channel_release_pipe_item
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Simplify dcc_release_item
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Simplify release_item_after_push
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Handle STREAM_CREATE and STREAM_DESTROY pipe items more coherently
	The items of these pipe items were allocated staticaly inside the
	StreamAgent structure. All others RedPipeItem are allocated dynamically.
	This could solve possible future maintenance as the life of these
	item is more easier to understand.
	It's more easier to understand why reference where incremented.
	It also make the StreamAgent structure a bit smaller.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Simplify release of STREAM_CREATE and STREAM_DESTROY pipe items
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Simplify release of CREATE_SURFACE and DESTROY_SURFACE pipe items
	Putting base as first item the default free function is fine.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Call red_pipe_item_unref instead of free
	This is the standard way to release a RedPipeItem

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Simplify RED_PIPE_ITEM_TYPE_DRAW item release
	Move ring_remove to the function to release this type of item.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove useless assignment
	Type was already initialized calling red_pipe_item_init

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove unused refs field
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-05-17  Frediano Ziglio  <fziglio@redhat.com>

	remove only written num_mig_target_clients field in RedsState
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	remove only written peer_minor_version field in RedsState
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	use more portable SPICE_OFFSETOF instead of offsetof
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	glz: simplification of PIXEL_DIST calls
	Make macro have same prototype even if we need an extra argument.
	This avoids having different calls for LZ_PLT.

	Acked-by: Uri Lublin <uril@redhat.com>

	stats: change image statistics format
	Change from %f to %g. This allows printf to choose format based on
	order of numbers.
	Also increase precision making sure that number of precision is
	respected, not matter the order of the number.

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

	stats: simplify printing statistics
	Use some utility function to show and compute statistics.

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

2016-05-13  Frediano Ziglio  <fziglio@redhat.com>

	fix wrong assert causing streaming to crash
	This regression was introduced by commit
	18d3876b78c7f19c577da000d322dbd44e63e456
	("UpgradeItem: use base PipeItem for refcounting")

	This fix https://bugs.freedesktop.org/show_bug.cgi?id=95365.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-05-12  Frediano Ziglio  <fziglio@redhat.com>

	style: put some notes on inclusion order
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	unify header include order
	Use this style for include headers inside headers:

	  #include <system_headers.h>
	  #include <no_spice_no_system_libraries.h>
	  #include <spice_protocol.h>
	  #include <spice_common.h>

	  #include "spice_server.h"

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-05-12  Jonathon Jongsma  <jjongsma@redhat.com>

	Add missing include to red-pipe-item.h
	This doesn't cause problems at the moment, because the files that
	include this file also include the other files that are needed, but just
	for completeness...

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

2016-05-12  Marc-André Lureau  <marcandre.lureau@gmail.com>

	spice-migration.h: un-deprecate set_seamless_migration()
	This function was wrongly marked as deprecated in commit b41220b1441b8.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-05-11  Frediano Ziglio  <fziglio@redhat.com>

	fix crash if agent interface is removed
	Removing an interface cause SpiceBaseInstance->st to be set to NULL.
	This pointer was then deferenced in agent code.
	As SpiceBaseInstance should not be used after this call make sure
	we don't keep pointers to it.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	style: use capital case for C language
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	style: remove outdated void argument
	For C is better to have void instead of arguments as otherwise
	K&R rules apply.

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

	style: update file name style
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	style: update copyright lines
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	style: fix condition indentation example
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	style: we are now using capital FIXME and TODO
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	style: remove documentation for C++
	C++ usage was removed with spicec (the old client).

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

	style: remove spice client section
	Spice client is no more in this repository and also the style was changed

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

2016-05-10  Frediano Ziglio  <fziglio@redhat.com>

	removed converted Spice_style.odt
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	converts Spice_style.odt to asciidoc spice_style.txt
	The conversion try keeps the content as is no matter if updated or not.
	Asciidoc format is already used for manual.
	Using a text format make easier to see git diff and send patches.
	Also it's easier to convert to different format and copy to web pages.

	Related: https://bugs.freedesktop.org/show_bug.cgi?id=95258

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

	reset pointer to RedCharDeviceWriteBuffer calling red_char_device_write_buffer_release
	This code make easier to be sure we don't have dangling pointers
	resetting in the function which free the structure.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-05-10  Christophe Fergeau  <cfergeau@redhat.com>

	build-sys: Remove 'CXX' from configure summary
	We no longer make use of a c++ compiler since dropping the client, so
	no need to show it in the configure summary.

	build-sys: Drop unneeded python check
	spice-server does not use python, the spice-common submodule needs it, but
	it has its own python check through the use of AM_PATH_PYTHON

2016-05-10  Frediano Ziglio  <fziglio@redhat.com>

	fix "spice--gtk" typo in configure.ac
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-05-09  Frediano Ziglio  <fziglio@redhat.com>

	char-device: improved comment
	- fix typo;
	- simplify sentence.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	Remove unused definitions
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	remove sw-canvas.h
	This include was just including another file

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

	use #include<> style for spice-common header inclusions.
	The include directory is specified with the -I which is the directory
	used directly by #include<>.

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

2016-05-05  Frediano Ziglio  <fziglio@redhat.com>

	remove dangling pointer for RedCharDeviceVDIPort
	When a client disconnects remove it from the list of clients connected
	to the spice char-device.

	This was caused by commit 1cec1c5118b65124de6bc6f984f376ff4e297bfb
	("reds: Make VDIPortState a GObject") as the lifespan of RedCharDevice
	was changed.

	This could be reproduced with:
	- start rhel7 machine
	- connect remote viewer (RV)
	- RV: login
	- connect ssh
	- SSH: stop agent
	- disconnect RV
	- SSH: start agent
	- connect to RV

	and caused (using address sanitizer):

	main_channel_handle_parsed: agent start
	=================================================================
	==29592==ERROR: AddressSanitizer: heap-use-after-free on address 0x60c00001cff0 at pc 0x7fa85b6e8595 bp 0x7ffde3801940 sp 0x7ffde3801930
	READ of size 8 at 0x60c00001cff0 thread T0
	    #0 0x7fa85b6e8594 in red_client_get_main /home/freddy/work/spice-server/server/red-channel.c:2190
	    #1 0x7fa85b7311e6 in vdi_port_send_msg_to_client /home/freddy/work/spice-server/server/reds.c:880
	    #2 0x7fa85b69383e in red_char_device_send_msg_to_client /home/freddy/work/spice-server/server/char-device.c:138
	    #3 0x7fa85b69383e in red_char_device_send_msg_to_clients /home/freddy/work/spice-server/server/char-device.c:356
	    #4 0x7fa85b69383e in red_char_device_read_from_device /home/freddy/work/spice-server/server/char-device.c:403
	    #5 0x55a2633b81c1  (/usr/bin/qemu-system-x86_64+0x5561c1)
	    #6 0x55a2633afe7a  (/usr/bin/qemu-system-x86_64+0x54de7a)
	    #7 0x55a2634cb7b1  (/usr/bin/qemu-system-x86_64+0x6697b1)
	    #8 0x55a2632078d0  (/usr/bin/qemu-system-x86_64+0x3a58d0)
	    #9 0x55a26379b2e8  (/usr/bin/qemu-system-x86_64+0x9392e8)
	    #10 0x55a26379a7a0  (/usr/bin/qemu-system-x86_64+0x9387a0)
	    #11 0x55a26313fb78 in main (/usr/bin/qemu-system-x86_64+0x2ddb78)
	    #12 0x7fa85a3cc57f in __libc_start_main (/lib64/libc.so.6+0x2057f)
	    #13 0x55a26314b0c8  (/usr/bin/qemu-system-x86_64+0x2e90c8)

	0x60c00001cff0 is located 48 bytes inside of 128-byte region [0x60c00001cfc0,0x60c00001d040)
	freed by thread T0 here:
	    #0 0x7fa869e3667a in __interceptor_free (/lib64/libasan.so.2+0x9867a)
	    #1 0x7fa85b6d75f7 in red_client_unref /home/freddy/work/spice-server/server/red-channel.c:2076
	    #2 0x7fa85b6ead74 in dispatcher_handle_single_read /home/freddy/work/spice-server/server/dispatcher.c:291
	    #3 0x7fa85b6ead74 in dispatcher_handle_recv_read /home/freddy/work/spice-server/server/dispatcher.c:314
	    #4 0x55a26379b2e8  (/usr/bin/qemu-system-x86_64+0x9392e8)
	    #5 0x55a26379a7a0  (/usr/bin/qemu-system-x86_64+0x9387a0)
	    #6 0x55a26313fb78 in main (/usr/bin/qemu-system-x86_64+0x2ddb78)
	    #7 0x7fa85a3cc57f in __libc_start_main (/lib64/libc.so.6+0x2057f)

	previously allocated by thread T0 here:
	    #0 0x7fa869e36b19 in __interceptor_calloc (/lib64/libasan.so.2+0x98b19)
	    #1 0x7fa85b7d6858 in spice_malloc0 /home/freddy/work/spice-server/spice-common/common/mem.c:109
	    #2 0x7fa85b6e760c in red_client_new /home/freddy/work/spice-server/server/red-channel.c:2053
	    #3 0x7fa85b7449e4 in reds_handle_main_link /home/freddy/work/spice-server/server/reds.c:1762
	    #4 0x7fa85b7449e4 in reds_handle_link /home/freddy/work/spice-server/server/reds.c:2002
	    #5 0x7fa85b745d3a in reds_handle_ticket /home/freddy/work/spice-server/server/reds.c:2056
	    #6 0x55a26379b2e8  (/usr/bin/qemu-system-x86_64+0x9392e8)
	    #7 0x55a26379a7a0  (/usr/bin/qemu-system-x86_64+0x9387a0)
	    #8 0x55a26313fb78 in main (/usr/bin/qemu-system-x86_64+0x2ddb78)
	    #9 0x7fa85a3cc57f in __libc_start_main (/lib64/libc.so.6+0x2057f)

	SUMMARY: AddressSanitizer: heap-use-after-free /home/freddy/work/spice-server/server/red-channel.c:2190 red_client_get_main
	Shadow bytes around the buggy address:
	  0x0c187fffb9a0: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
	  0x0c187fffb9b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
	  0x0c187fffb9c0: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
	  0x0c187fffb9d0: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
	  0x0c187fffb9e0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
	=>0x0c187fffb9f0: fa fa fa fa fa fa fa fa fd fd fd fd fd fd[fd]fd
	  0x0c187fffba00: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
	  0x0c187fffba10: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
	  0x0c187fffba20: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
	  0x0c187fffba30: fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa
	  0x0c187fffba40: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd

	Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
	Acked-by: Uri Lublin <uril@redhat.com>

2016-05-04  Pavel Grunt  <pgrunt@redhat.com>

	agent-msg-filter: Move include from header
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-05-04  Frediano Ziglio  <fziglio@redhat.com>

	char-device: remove unused refs field
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2016-05-04  Francois Gouget  <fgouget@codeweavers.com>

	server: Enable adding alternative MJPEG video encoders
	This replaces the original mjpeg_encoder API with a VideoEncoder base
	class which can be reimplemented by other encoders.
	This also renames the members and enums from mjpeg_* to video_*.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	server: Correctly handle and trace stream report errors
	We may get stream reports after the stream has been closed, and even, in
	extreme cases, after a new stream has started reusing the same stream
	id. Neither case should cause the server to crash.
	So restore dcc_handle_stream_report() to how it was before being moved
	to dcc.c.

	Acked-by: Victor Toso <victortoso@redhat.com>

2016-05-04  Snir Sheriber  <ssheribe@redhat.com>

	Using already exists function instead of SPICE_CONTAINEROF
	Using spicevmc_red_channel_client_get_state(rcc) (which already
	exists) instead of SPICE_CONTAINEROF(rcc->channel, SpiceVmcState,
	channel).

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-04-29  Jonathon Jongsma  <jjongsma@redhat.com>

	Name MainChannelClient methods consistently
	Always use main_channel_client_ prefix instead of just main_channel_ in
	some cases.

	Call public RedClient API instead of poking internals
	Use red_client_during_migrate_at_target() instead of checking
	rcc->client->during_target_migrate.

	Don't touch RedClient internals from RedChannelClient
	Change red_channel_client_set_migration_seamless() so that it returns a
	boolean which RedClient can use to update its internal count of
	num_migrated_channels rather than having RedChannelClient reaching into
	the internals of RedClient

2016-04-27  Christophe Fergeau  <cfergeau@redhat.com>

	audio: Remove global 'playback_compression' variable
	This variable belongs to SpiceServerConfig rather than being a static
	global variable hidden in sound.c

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove dead code in reds_fill_channels()
	channels_info->num_of_channels is assigned, its value is not used, and
	then it's assigned a different value. The first assignment can be
	removed.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Improve Reds/RedMainChannel interface
	Instead of exporting 2 methods to get number of channels, and to fill
	channel information, and use that from the main channel code, it's
	better to do everything in one go in reds.c, and call that single method
	from the main channel code.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Add _config_ to SpiceServerConfig accessors
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Mark unused public API methods/code as deprecated
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Add RedServerConfig
	This wraps/groups the various parameters that can be set by spice-server
	users through the spice_server_set_xxx public API.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-04-27  Jonathon Jongsma  <jjongsma@redhat.com>

	Rename all RedPipeItem subclasses
	Use 'Red' prefix to match internal type naming convention

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Rename PipeItem to RedPipeItem
	Following internal type naming conventions

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-04-27  Christophe Fergeau  <cfergeau@redhat.com>

	Use weak gobject ref instead of reds_on_char_device_state_destroy
	RedCharDevice implementation had to callback into reds.c in order to let
	it know a char device was being destroyed. Now that RedCharDevice is a
	gobject, a weak reference can be used instead allowing to remove that
	coupling.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Use GQueue for RedCharDevice::send_queue
	There was an extra RedCharDeviceMsgToClientItem type whose only
	purpose was to manage a linked list of items to send. GQueue has the
	same purpose as this type in addition to being generic. As the length of
	the send queue is tracked, a GQueue is more appropriate than a GList and
	allow to remove RedCharDevice::send_queue_size.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-04-27  Jonathon Jongsma  <jjongsma@redhat.com>

	UpgradeItem: use base PipeItem for refcounting
	No need to re-implement refcounting in this subclass.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Store display in Drawable struct
	If the Drawable keeps a pointer to the Display channel that it is
	associated with, we can unref it directly and not need to pass the
	'display' parameter separately to the unref function

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-04-26  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: remove check for canvas during cursor connect
	We want the cursor to be initialized even if there is no canvas,
	especially when using a GL scanout. This solves some client warnings
	when using qemu with GL scanout-only (patches under review on qemu ML).

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-04-25  Eduardo Lima (Etrunko)  <etrunko@redhat.com>

	Fix make dist
	spicec screenshot has been removed since commit b0186fe1267dfa2b8534c7c083dc301791279f08

2016-04-22  Pavel Grunt  <pgrunt@redhat.com>

	manual: Remove spicec screenshot

	manual: No need to use sudo to run qemu

	manual: Recommend UsbDk instead of USB Clerk

	manual: Recommend enabling monitors using remote-viewer's menu

2016-04-20  Christophe Fergeau  <cfergeau@redhat.com>

	Remove use of opaque from vdi_port_read_one_msg_from_device
	We can get 'reds' from the RedCharDevice accessible from the
	SpiceCharDeviceInstance passed as an argument.

	Acked-by: Pavel Grunt <pgrunt@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-04-20  Jonathon Jongsma  <jjongsma@redhat.com>

	char device: use _reset_dev_instance() to set 'sin'
	Internally, use the method to set the 'sin' member variable so that we
	don't have to duplicate the g_object_notify() calls, and there are
	consistent debug statements whenever this value is modified. This also
	means that we need to handle NULL arguments to this function.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	char device: use 'device' rather than 'state' for var names
	Since the type name was changed, use variable names / debug statements
	that are consistent with the new name.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	char-device: notify when device instance is changed
	Since the device instance ("sin") is a gobject property, we should make
	sure to notify when it changes, particularly since we do some
	initialization in response to the "notify::sin" signal.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-04-19  Pavel Grunt  <pgrunt@redhat.com>

	sw-canvas: Get rid of unsused SW_CANVAS_IMAGE_CACHE
	See spice-common commit edac1b36b572cbd8988c44341185a9f51ea3eeb5
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-04-15  Christophe Fergeau  <cfergeau@redhat.com>

	char-device: Remove RedCharDeviceClass::{un, }ref_msg_to_client
	Now that client messages are always RedPipeItem, we don't need virtual
	functions to know how to ref/unref them.

	char-device: Replace RedCharDeviceMsgToClient with PipeItem
	Now that all derived classes use a type deriving from PipeItem for their
	RedCharDeviceMsgToClient, we can make this explicit in the
	RedCharDeviceClass vfuncs, and remove the RedCharDeviceMsgToClient
	typedef.

2016-04-15  Jonathon Jongsma  <jjongsma@redhat.com>

	dcc: Use refcounting for MonitorsConfigItem

	StreamClipItem: use base class refcounting
	PipeItem already implements refcounting. Use it.

	DrawablePipeItem: use base class for refcounting
	Since PipeItem already implements refcounting, there's no need to
	re-implement it here.

	dcc: use PipeItem refcounting for ImageItem
	Since the base class now implements refcounting, there's no need to
	re-invent it here.

2016-04-15  Christophe Fergeau  <cfergeau@redhat.com>

	SpiceVmcPipeItem: use base PipeItem for ref counting
	This allows to reuse pipe_item_{ref, unref} rather than
	reimplementing them in spicevmc.c

	smartcard: Use base PipeItem for MsgItem refcounting
	This allows to reuse pipe_item_{ref, unref} rather than
	reimplementing them in smartcard.c

	reds: Derive VDIPortReadBuf from PipeItem
	Since PipeItem is already refcounted, this allows to remove various
	layers of ref/unref helpers from reds.c, and use the generic
	pipe_item_{ref, unref} instead.

	Add reference counting to PipeItem class
	A user-defined callback is called when the refcount drops to 0.

	Reference counting is manually coded for several classes deriving from
	PipeItem, so this change will help to share this code, and allow to remove
	some ref/unref virtual functions in some interfaces when we can assume
	every instance derives from this base class.

	Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-04-12  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-04-11  Christophe Fergeau  <cfergeau@redhat.com>

	char-device: Fix el6 compilation
	One more duplicate typedef, once in reds.c and another time in
	reds-private.h
	RedsState::agent_dev is defined in reds-private.h but only used in
	reds.c, so longer term this could all be moved back to reds.c

2016-04-07  Christophe Fergeau  <cfergeau@redhat.com>

	Move RedCharDeviceCallbacks into RedCharDeviceClass
	This structure holding virtual function pointers was kept until now as a
	RedCharDevice member in order to make the GObject conversion easier.
	Now that all RedCharDevice children are converted to GObject, it can be
	moved into RedCharDeviceClass.

	reds: Remove red_char_device_new()
	Nothing is using it anymore now that CharDevice classes are
	gobjectified.

2016-04-06  Christophe Fergeau  <cfergeau@redhat.com>

	reds: Make VDIPortState a GObject
	This inherits from RedCharDevice.

2016-04-06  Jonathon Jongsma  <jjongsma@redhat.com>

	Rename VDIPortState to RedCharDeviceVDIPort
	Consistent with internal naming conventions, and prepares for
	conversion to GObject

2016-04-06  Christophe Fergeau  <cfergeau@redhat.com>

	smartcard: Turn RedCharDeviceSmartcard into a GObject
	This inherits from RedCharDevice. Once all char device states are
	converted, we can turn the associated vfuncs into RedCharDeviceClass
	vfuncs.

2016-04-06  Jonathon Jongsma  <jjongsma@redhat.com>

	Rename SmartCardDeviceState to RedCharDeviceSmartcard
	More consistent with naming conventions, and prepares for converting
	this type to a GObject which inherits from RedCharDevice.

2016-04-06  Christophe Fergeau  <cfergeau@redhat.com>

	Update spice-common submodule
	Mostly to get fixes for older glib versions (both at compile time and
	runtime).

	Changes this brings in:

	Christophe Fergeau (4):
	      tests: Fix glib version check
	      log: Clamp SPICE_DEBUG_LEVEL if it's too high
	      log: Use SPICE_CONSTRUCTOR_FUNC
	      log: Make sure glib threading is initialized

	Eduardo Lima (Etrunko) (2):
	      Fix build in systems with Glib version older than 2.38
	      Add check for openssl

	qxl: Remove duplicate QXLState typedef
	We can directly include spice-qxl.h in red-qxl.h as it already gets it indirectly anyway.
	>

	reds: Move RedsState typedef to red-common.h
	This allows to stop using struct RedsState * rather than RedsState * in
	headers which cannot include reds.h. This also allows to remove the
	duplicate RedsState typedef in reds.h and reds-stream.h which is causing
	issues with older gcc versions.

	char-device: Fix property name in red_char_device_new()
	This method will be removed in a subsequent commit, but for now it's
	causing breakage since it's setting "reds" instead of "spice-server"

2016-04-05  Christophe Fergeau  <cfergeau@redhat.com>

	audio: Improve snd_receive type-safety
	We can pass it a SndChannel rather than an opaque void* data pointer
	which we then blindly cast.
	This came to light through a -Wshadow warning as there was a local
	variable 'data' in addition to the 'data' parameter.

	char-device: Remove duplicate typedef

	gobject: Add g_type_init() for older glibs
	Older glib versions require g_type_init() to be called before using
	GObject.

2016-04-02  Christophe Fergeau  <cfergeau@redhat.com>

	reds: Prepare to make VDIPortState a GObject
	This inherits from RedCharDevice.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	reds: Make VDIPortState private to reds.c
	VDIPortState and VDIReadBuf don't really need to be defined in a header
	file as they are only used in reds.c

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	spicevmc: Introduce RedCharDeviceSpiceVmc GObject
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	char-device: Make RedCharDevice a GObject
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-04-01  Frediano Ziglio  <fziglio@redhat.com>

	Rename some missing names related to RedCharDevice
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	Rename SpiceCharDeviceCallbacks to RedCharDeviceCallbacks
	The structure is an internal one so should not have the Spice prefix
	but use the Red one.

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

2016-04-01  Christophe Fergeau  <cfergeau@redhat.com>

	doc: Be more explicit about virgl requirements
	This is an attempt at listing the versions of the various packages which
	needs to be up to date for a functional virgl + spice.

	mjpeg: Add missing space to debug string

	build-sys: Update libtool versioning for 0.13.1

	Update NEWS for 0.13.1

2016-04-01  Jonathon Jongsma  <jjongsma@redhat.com>

	Rename RedCharDevice functions
	make the function names match the type names. So
	spice_char_device_state_* becomes red_char_device_* and
	spice_char_device_* also becomes red_char_device_*.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Rename SpiceCharDeviceClientState to RedCharDeviceClient
	Make it consistent with the renamed RedCharDevice and the convention of
	using 'Red' namespaces for internal types

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Rename SpiceCharDeviceState to RedCharDevice
	This is more consistent with internal type naming convention, and it
	paves the way for a new char device GObject heirarchy

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Rename SpiceCharDeviceWriteBuffer to RedCharDeviceWriteBuffer
	Internal types should use 'Red' namespace for consistency

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Rename SpiceCharDeviceMsgToClient to RedCharDeviceMsgToClient
	Internal types should use Red namespace for consistency

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-03-31  Christophe Fergeau  <cfergeau@redhat.com>

	char-device: Avoid use-after-free
	Reset pointer after freeing the structure pointing to it.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-03-30  Christophe Fergeau  <cfergeau@redhat.com>

	smartcard: Prepare to turn SmartcardState into a GObject
	Move all internal data into a private struct so that it won't be exposed
	when we move SmartCardDeviceState into the header.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-03-30  Jonathon Jongsma  <jjongsma@redhat.com>

	Convert Dispatcher and MainDispatcher to GObjects
	Allows more explicit inheritance relationship, and numerous other
	advantages.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-03-29  Christophe Fergeau  <cfergeau@redhat.com>

	char-device: Move instance data to SpiceCharDeviceState::priv
	Create a structure to hold private data.
	This helps to make patch for GObject smaller.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-03-29  Frediano Ziglio  <fziglio@redhat.com>

	dispatcher: move channel final initialization to red-worker
	CursorChannel and DisplayChannel was initialized half in red_worker_new
	and half in red_dispatcher_init using some accessor for RedWorker
	(red_worker_get_cursor_channel and red_worker_get_display_channel).
	Moving directly into red_worker_new make easier to follow code path.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-03-24  Frediano Ziglio  <fziglio@redhat.com>

	qxl: use Dispatcher in channel callbacks
	There is no need callbacks knows about internal QXLState.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-03-24  Francois Gouget  <fgouget@codeweavers.com>

	server: More clearly identify channels that support multiple clients
	Rename the function to channel_supports_multiple_clients() as
	channel_is_secondary() is unclear and was coded to return the opposite
	of what was originally intended.
	Also there are few channel types and whether they support multiple
	clients is totally static so we might as well delegate the check to
	the compiler.

2016-03-24  Frediano Ziglio  <fziglio@redhat.com>

	do not compile dump_bitmap if not necessary
	This function is used only for debugging

	Acked-by: Victor Toso <victortoso@redhat.com>

2016-03-24  Christophe Fergeau  <cfergeau@redhat.com>

	doc: Add virgl documentation
	Document how to use virgl with QEMU/libvirt

	virt-manager documentation still needs to be added.

2016-03-24  Frediano Ziglio  <fziglio@redhat.com>

	make some functions static
	No need to have callback registered internally no static

	Acked-by: Victor Toso <victortoso@redhat.com>

	removed unused red_qxl_set_mm_time
	This helper call a deprecated callback.

	Acked-by: Victor Toso <victortoso@redhat.com>

	remove unused reds_set_mm_time
	Acked-by: Victor Toso <victortoso@redhat.com>

2016-03-23  Frediano Ziglio  <fziglio@redhat.com>

	use constructor/destructor macros
	Initialize global images at load time:
	- make sure these stuff are initialized without using runtime
	resources;
	- make sure stuff are initialize really earlier.
	Do not use atexit function but a destructor.

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

	qxl: implement QXLWorker interface, do not use as a base class
	QXLWorker is the old interface now completely deprecated.
	Remove the strict dependency of having it as a base class.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	declare and use message for RED_WORKER_MESSAGE_GL_SCANOUT
	All other messages (even empty ones) have a structure defined.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	build-sys: use safer SPICE_CONTAINEROF version
	Enable additional checks for this macro.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-03-23  Jonathon Jongsma  <jjongsma@redhat.com>

	Remove last usage of global 'reds' variable
	This should be the final piece of removing the global reds variable. We
	still need a global variable to clean up during the atexit() function,
	but we use a GList of servers (even though we technically don't support
	multiple servers in the same process yet).

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-03-22  Christophe Fergeau  <cfergeau@redhat.com>

	char-device: Add helpers for SpiceCharDeviceCallbacks vfuncs
	Add helper functions wrapping calls to the virtual functions
	defined in SpiceCharDeviceCallbacks.

	Acked-by: Pavel Grunt <pgrunt@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-03-21  Christophe Fergeau  <cfergeau@redhat.com>

	Remove dependency of vdi_port_read_buf_process on RedsState
	This makes it easier to move the VDIPort API to a different file, and
	make it as self-contained as possible.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	agent: Sync AgentMsgFilter state upon agent connection
	AgentMsgFilter needs to know whether monitors config messages need to be
	filtered or not. This used to be done from within
	agent_msg_filter_config() using the global RedsState, but this got more
	tricky as it was removed.
	A first attempt a1e62fa5ae9 caused crashes on qemu startup with
	"qemu-system-x86_64 -spice port=5900" (without -vga qxl). A second
	attempt added a RedsState* argument to agent_msg_filter_config() which
	in my opinion is not really nice from a layering point of view.

	This new attempt makes sure AgentMsgFilter state is correct when the
	filter is set to stop discarding all data, which allows to remove direct
	use of RedsState from within AgentMsgFilter.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Revert "fix regression due to callback called earlier"
	Passing Reds into agent-msg-filter.[ch] isn't the right thing to do from
	a layering point of view.

	This reverts commit a1e62fa5ae983b7b69cb437b2635ce84b2471383.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-03-17  Christophe Fergeau  <cfergeau@redhat.com>

	Remove red_channel_set_data()
	It's always called at the same time as red_channel_register_client_cbs()
	and the data is used by the callbacks, so we can pass the data as an
	argument to red_channel_register_client_cbs().

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Use red_qxl_check_qxl_version in red-worker
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Add more red_qxl_ methods
	Add red_qxl_ methods wrapping the QXLInterface vfuncs. This allows to
	remove most of the qxl_get_interface() use outside of red-qxl.c

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Use QXLInstance instead of QXLState in red_qxl_*
	This seems to make more sense this way, QXLInstance is the 'main' object
	with QXLState being its private data. External users then use QXLInstance
	rather than passing a pointer to the private data to red-qxl.h methods.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-03-16  Francois Gouget  <fgouget@codeweavers.com>

	server: Add some comments to the sound structures.
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	server: Give the SndChannel's ref and unref methods their expected name
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-03-16  Uri Lublin  <uril@redhat.com>

	replay: skip the first N (slow) commands
	Note that the commands are executed by spice-server.
	The "skip" is only done on the "sleep" part of the
	"slow" command-line option.

	This is helpful to run quickly through uninsteresting commands
	in a beginning of a recorded file and going slowly when
	interesting parts appear

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	replay: count commands
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-03-15  Christophe Fergeau  <cfergeau@redhat.com>

	Use more explicit variable name in marshall_gl_scanout()
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Fix typo in variable name in function prototype
	num_common_cap rather than num_common_caps was not consistent with
	the naming of the other arguments.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Remove unused red_qxl_set_dispatcher_opaque
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-03-11  Christophe Fergeau  <cfergeau@redhat.com>

	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 present in the 0.13.0 release, but was never added to a
	stable release, in my opinion it's still acceptable to remove it without
	changing soname.

	Always enable TCP keepalive
	Always enabled, hardcoded interval
	as per https://bugzilla.redhat.com/show_bug.cgi?id=1298590

2016-03-11  Marc-André Lureau  <marcandre.lureau@gmail.com>

	Update spice-common
	Pick codegen build fix (codegen is back in spice-common, see related
	commits & discussion thread)

2016-03-10  Christophe Fergeau  <cfergeau@redhat.com>

	smartcard: Move private constant to C file
	APDUBufSize is only used within smartcard.c, no need to expose it in
	smartcard.h

	Acked-by: Pavel Grunt <pgrunt@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Rename red_channel_pipe_item_init to pipe_item_init
	The RedChannel argument is not used by pipe_item_init. Removing it
	will make code simpler in places where we don't have a RedChannel
	directly available.
	This is acting on a PipeItem object so correct name is pipe_item_init.

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

	char-device: Refactor spice_char_device_client_add a bit
	Factor out CharDeviceClientState creation out of
	spice_char_device_client_add.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-03-09  Christophe Fergeau  <cfergeau@redhat.com>

	Replace RedsPrivate::mig_wait_disconnect_clients with a GList
	The code was introducing an intermediate RedsMigWaitDisconnectClient type to
	hold linked list elements, resulting in a memory handling behaviour very
	similar to a GList. Using GList directly makes the code shorter and more
	readable.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Replace RedsPrivate::char_devs_state with a GList
	The code was introducing an intermediate SpiceCharDevStateItem type to
	hold linked list elements, resulting in a memory handling behaviour very
	similar to a GList. Using GList directly makes the code shorter and more
	readable.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Introduce spice_char_device_get_interface()
	Hides awkward casting/dereferencing to go from a
	SpiceCharDeviceInstance to a SpiceCharDeviceInterface

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-03-09  Frediano Ziglio  <fziglio@redhat.com>

	Fix regression initialising QXL interface
	st field in QXLInstance was not checked for NULL before
	initialisation.
	The additional check make Xspice crash during startup.

	Reported-by: Francois Gouget <fgouget@codeweavers.com>
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-03-08  Marc-André Lureau  <marcandre.lureau@gmail.com>

	Fix dcc_start() regression
	Commit e9ed125d introduced a dead-lock regression by taking twice the
	same lock recursively. The previous code checked if a dmabuf was set
	without taking the lock, for queuing scanout messages. Since the message
	is being processed later on, it make sense to queue and delay until it
	is sent to check if there is a scanout.

	backtrace:
	 #0  red_qxl_get_gl_scanout (qxl_state=0x5555582373c0) at red-qxl.c:828
	 #1  0x00007fffec1ae654 in marshall_gl_scanout (rcc=0x7fffda6a7010,
	 #m=0x7fff44025e60, item=0x7fff440958a0) at dcc-send.c:2310
	 #2  0x00007fffec1aec7b in dcc_send_item (dcc=0x7fffda6a7010,
	 #pipe_item=0x7fff440958a0) at dcc-send.c:2441
	 #3  0x00007fffec1730f6 in send_item (rcc=0x7fffda6a7010,
	 #item=0x7fff440958a0) at display-channel.c:1963
	 #4  0x00007fffec1504c3 in
	 #red_channel_client_send_item (rcc=0x7fffda6a7010, item=0x7fff440958a0)
	 #at red-channel.c:578
	 #5  0x00007fffec152d98 in red_channel_client_push (rcc=0x7fffda6a7010)
	 #at red-channel.c:1365
	 #6  0x00007fffec1a387e in dcc_push_monitors_config (dcc=0x7fffda6a7010)
	 #at dcc.c:563
	 #7  0x00007fffec1a3489 in dcc_start (dcc=0x7fffda6a7010) at dcc.c:475

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-03-05  Jonathon Jongsma  <jjongsma@redhat.com>

	Remove use of global 'reds' within RedWorker
	Get the server variable from the QXLState instead of using the
	global variable

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Add red_qxl_get_server()
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Store reference to RedsState in QXLState
	Remove use of global 'reds' variable from QXLState functions.
	Instead store the owning RedsState variable inside the QXLState
	struct and use that when necessary.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-03-04  Frediano Ziglio  <fziglio@redhat.com>

	worker: remove useless qxl_state
	qxl_state can be extracted easily from qxl.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	use QXLState instead of RedDispatcher
	Considering that:
	- QXLState is the state of QXLInstance implementation;
	- RedDispatcher is the implementation of QXL;
	- qif (QXLInterface*) field can be computed really easy from QXLInstance;
	- most of its state is private.
	Make all structure private and use QXLState instead of RedDispatcher.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	rename red-dispatcher.* files to red-qxl.*
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	rename red_dispatcher_ functions to red_qxl_
	RedDispatcher is basically implementing QXLInstance.
	After some internal discussion we decided to use QXLState structure
	and red_qxl_ as function prefix.
	This is the first of 3 patches that rename functions, structure
	and files.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	fix indentation
	Fix indentation for spice_debug call.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	optimize handle_dev_input call
	Pass directly dispatcher to handle_dev_input callback.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	reduce header dependencies
	Avoid to include headers in cursor-channel.h which are only
	used by cursor-channel.c

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-03-03  Francois Gouget  <fgouget@codeweavers.com>

	server: Fix the order of the attach_stream() asserts
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-03-03  Christophe Fergeau  <cfergeau@redhat.com>

	Make use of the new reds_core_timer_* API
	This makes the code more readable.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Introduce reds_core_timer_*

	Introduce reds_core_watch_*
	These methods wrap the RedsCoreInterface::watch_add,
	RedsCoreInterface::watch_remove and RedsCoreInterface::watch_update_mask
	vfuncs.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-03-03  Uri Lublin  <uril@redhat.com>

	replay: do not use argv after g_option_context_parse
	Apparently, after using g_option_context_parse with G_OPTION_REMAINING
	argv is modified and should not be used.
	This patch uses "file" instead of "argv" and makes sure
	file is freed later.
	No free is called upon error - exit takes care of it.

2016-03-03  Francois Gouget  <fgouget@codeweavers.com>

	server: Store the opaque pointer in VideoEncoderRateControlCbs
	It has the same lifetime as the corresponding structure so this
	simplifies keeping track of it.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-26  Francois Gouget  <fgouget@codeweavers.com>

	server: Don't call snd_channel_get_server() if we don't have a channel
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-25  Francois Gouget  <fgouget@codeweavers.com>

	server: Remove an unnecessary cast in spice_replay_next_cmd()
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-25  Michal Privoznik  <mprivozn@redhat.com>

	Update .gitignore files
	The first part updates the .gitignore file in the root directory
	because the file is obviously generated by automake but poison
	our working tree.
	The second part updates the .gitignore under server/tests/
	directory because since 0db1137d we have a noinst test library
	libtest.a. However, like in previous case, git should never track
	this file.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	configure: Require spice-protocol-0.12.11 at least
	After 7a06efde we require SPICE_MSG_DISPLAY_GL_SCANOUT_UNIX
	symbol from spice-protocol (or value to be more precise). This
	has been however introduced in version 0.12.11 of the
	spice-protocol (commit 3fc2221e there). However, our configure
	check does not reflect this change. Fix it.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-23  Frediano Ziglio  <fziglio@redhat.com>

	use G_N_ELEMENTS instead of manually compute array size
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	constify some global variables
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-02-20  Frediano Ziglio  <fziglio@redhat.com>

	fix possible core calling timer callback
	Was possible to have ping_timer_cb called with a NULL pointer.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-02-19  Frediano Ziglio  <fziglio@redhat.com>

	fix regression due to callback called earlier
	Patch 1f210080609f2c00b4d1859eb0b363a38838e7d3 ("Remove use of global
	'reds' from AgentMsgFilter") introduced a regression. This because
	QXLInterface->client_monitors_config was called before returning
	from spice_add_interface. Some client of spice-server expect the
	spice_add_interface already returned and some state change was done
	before client_monitors_config was called.

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

2016-02-18  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>

2016-02-17  Frediano Ziglio  <fziglio@redhat.com>

	reds: remove unneeded variable
	Remove version_string variable.
	Was never changed and used in a single place.

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

2016-02-17  Jonathon Jongsma  <jjongsma@redhat.com>

	CommonChannel -> CommonGraphicsChannel
	Rename this struct to make it clear that it's only the base class for
	graphics channels (e.g. display and cursor), not all channels.

	Also renamed CommonChannelClient to CommonGraphicsChannelClient.

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

2016-02-17  Pavel Grunt  <pgrunt@redhat.com>

	compress-stat: Add not compressed image to statistics
	To see how many images and data could not be compressed.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	dcc: Move COMPRESS_DEBUG to compression functions
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	dcc: Rewrite dcc_image_compress
	Rules are now:

	Compression type:
	  off      -> uncompressed
	  quic     -> jpeg if possible else quic else off
	  lz       -> lz if possible else off
	  glz      -> glz if possible else lz else off
	  auto_lz  -> lz if possible else jpeg else quic else off
	  auto_glz -> glz if possible else lz else jpeg else quic else off
	  lz4      -> lz4 if possible else lz else off

	jpeg is used only when jpeg-wan-compression allows it

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-16  Frediano Ziglio  <fziglio@redhat.com>

	make RedDataChunk structure private inside red-parse-qxl.c
	The structure is strictly used by the parser only, no reason to make it
	public.

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

	worker: removed unused red_worker_get_qxl function
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	dcc: move id from CommonChannelClient to DisplayChannelClient
	Was not used by CursorChannelClient but only by DisplayChannelClient.

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

2016-02-16  Jonathon Jongsma  <jjongsma@redhat.com>

	Add GObject to build requirements
	Preparation for GObject-ifying some internals

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-16  Christophe Fergeau  <cfergeau@redhat.com>

	Remove redundant argument to vdi_port_read_buf_process
	The 'port' argument can be determined from VDIPortState, so no need to
	pass both (through RedsState) to vdi_port_read_buf_process().

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-16  Jonathon Jongsma  <jjongsma@redhat.com>

	Remove use of global 'reds' from AgentMsgFilter
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	Remove use of global 'reds' from sound.c
	Pass RedsState variable to snd_attach_(playback|record) and get a
	reference to this variable when needed by various functions.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	Remove global main_dispatcher variable
	Requires changing a bunch of internal API to take MainDispatcher
	arguments, etc. The main dispatcher object is now owned by RedsState,
	since that is the object that previously created (initialized) it.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	Add red_channel_get_server()
	Instead of poking into the internals of the RedChannel, provide an
	accessor.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	Add RedsState reference to RedsStream
	Allows us to remove use of global 'reds' variable from reds-stream.c.
	Requires changing the RedsStream constructor to accept a RedsState arg.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2016-02-16  Frediano Ziglio  <fziglio@redhat.com>

	Remove global 'dispatchers', 'num_active_workers' variables
	Since these are server-level variables, move them into RedsState.
	However, num_active_workers was removed because:
	- each dispatcher always has 1 active worker, so we can determine the
	  number of active workers by counting the dispatchers
	- it was never actually set correctly. Even if there was more than one
	  worker, this variable was always only set to either 0 or 1.

	This change required moving a bunch of helper code into RedsState as
	well, an providing some RedDispatcher interfaces to access dispatcher
	information from RedsState.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	move red_dispatcher_on_vm_stop and red_dispatcher_on_vm_start to RedsState
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	remove unused function
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	use list in RedsState for ic_change and sv_change
	Instead of using list in RedDispatcher (which is going to be removed)
	use the one in RedsState.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	keep dispatcher list in RedsState
	This duplicate the other list which will be removed

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	move calc_compression_level to reds
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	add RedsState parameter to update_client_mouse_allowed
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	remove num_active_workers
	This global variable was mainly 1.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2016-02-15  Frediano Ziglio  <fziglio@redhat.com>

	Revert "dcc: remove not necessary volatile specifications"
	This reverts commit efe5a0c501d157566522f87a394e29c5290e2185.

	Due to a problem in the compiler this causes compile to fail.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-02-15  Christophe Fergeau  <cfergeau@redhat.com>

	display-channel: Remove extra group_id arguments
	They are now carried in the appropriate command through
	QXLReleaseInfoExt, so we don't need to pass them around explicitly.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Remove CursorItem::group_id
	Now that the group_id is known to RedCursorCmd, we don't need to store
	it separately in CursorItem.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	red-parse-qxl: Use QXLReleaseInfoExt instead of QXLReleaseInfo
	This should allow to avoid moving the group_id separately from the QXL
	commands all over the code.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Remove RedGlzDrawable::group_id
	It's unused.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Remove Drawable::group_id
	We can now directly get it from RedDrawable.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Simplify red_drawable_unref()
	Now it no longer needs external state in order to destroy the
	RedDrawable instance when needed, so we can remove this from the
	prototype.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Add group_id to RedDrawable
	Storing a QXLReleaseInfoExt rather than a QXLReleaseInfo in RedDrawable
	gives us a place to store group_id for free. Since we are building a
	QXLReleaseInfoExt from QXLReleaseInfo and group_id when destroying a
	RedDrawable instance, this is a move in the right direction.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Add QXLInstance member to RedDrawable
	This allows to get rid of the DisplayChannel parameter to
	red_drawable_unref()

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Remove DisplayChannel::red_drawable_count
	It's only used in a few debug printfs. If we want these stats, we'll
	have to find a better way than forcing a dependency on a high-level
	class in a lower-level _unref method just to maintain the stats.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	qxl: Remove unused group_id arg to fill_attr
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-15  Jonathon Jongsma  <jjongsma@redhat.com>

	Add RedsState arg to all stat functions
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-12  Frediano Ziglio  <fziglio@redhat.com>

	revert new event-loop code for timers
	Was causing sporadic crashes.
	Also cause compatibility problems with RHEL 6.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	tests: add a new case for event loop timers
	Check that cancelling a timer the timer callback is not called.

	This can happen in latency code (red-channel.c).
	In red_channel_client_cancel_ping_timer latency timer is cancelled and
	state is set to PING_STATE_NONE however if timer was already active what
	happens is that the red_channel_client_ping_timer is called and the line

	  spice_assert(rcc->latency_monitor.state == PING_STATE_TIMER);

	is triggered causing spice-server to abort.
	This happens as GLib loop add all active sources to an array but if the
	timer is deactivated before the event is dispatched the event will be
	dispatched unless the source is destroyed.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-02-12  Jonathon Jongsma  <jjongsma@redhat.com>

	MainChannel: don't use global 'reds' variable
	Add RedsState arg to main_channel_new(), and use the 'reds' property
	that is stored in the base RedChannel struct rather than the global
	'reds' variable.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Add RedsState arg to reds_set_migration_dest_info()
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Add RedsState arg to inputs_channel_new()
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Store a reference to RedsState in Channel base class
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Add RedsState arg to smartcard_device_connect()
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-12  Frediano Ziglio  <fziglio@redhat.com>

	dcc: remove not necessary volatile specifications
	These automatic variable are used just inside the function.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	CommonChannel: hold a reference to QXLInstance instead of RedWorker
	CommonChannel does not need to know about RedWorker.
	This reduce a bit dependencies between objects.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	ccc: remove unused field
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: remove unused red_worker_get_memslot function
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	remove unused structure definition
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	dcc: remove group_id from compression functions
	The parameter was not used.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	channel: rename misleading functions
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: simplify process loops
	It was not clear when req_cmd_notification was called.
	This code reproduce just the old behavior but is easier to read.

	Steps are:

	// original

	if (worker->display_poll_tries < CMD_RING_POLL_RETRIES) {
	    worker->display_poll_tries++;
	    worker->event_timeout = MIN(worker->event_timeout, CMD_RING_POLL_TIMEOUT);
	    return n;
	}
	if (worker->display_poll_tries > CMD_RING_POLL_RETRIES ||
	             worker->qxl->st->qif->req_cmd_notification(worker->qxl)) {
	    worker->display_poll_tries++;
	    return n;
	}
	continue;

	// split if

	if (worker->display_poll_tries < CMD_RING_POLL_RETRIES) {
	    worker->display_poll_tries++;
	    worker->event_timeout = MIN(worker->event_timeout, CMD_RING_POLL_TIMEOUT);
	    return n;
	}
	if (worker->display_poll_tries > CMD_RING_POLL_RETRIES) {
	    worker->display_poll_tries++;
	    return n;
	}
	if (worker->qxl->st->qif->req_cmd_notification(worker->qxl)) {
	    worker->display_poll_tries++;
	    return n;
	}
	continue;

	// order inside if

	if (worker->display_poll_tries < CMD_RING_POLL_RETRIES) {
	    worker->event_timeout = MIN(worker->event_timeout, CMD_RING_POLL_TIMEOUT);
	    worker->display_poll_tries++;
	    return n;
	}
	if (worker->display_poll_tries > CMD_RING_POLL_RETRIES) {
	    worker->display_poll_tries++;
	    return n;
	}
	if (worker->qxl->st->qif->req_cmd_notification(worker->qxl)) {
	    worker->display_poll_tries++;
	    return n;
	}
	continue;

	// consider cases

	if (worker->display_poll_tries < CMD_RING_POLL_RETRIES) {
	    worker->event_timeout = MIN(worker->event_timeout, CMD_RING_POLL_TIMEOUT);
	    worker->display_poll_tries++;
	    return n;
	}
	if (worker->display_poll_tries > CMD_RING_POLL_RETRIES) {
	    worker->display_poll_tries++;
	    return n;
	}
	if (worker->display_poll_tries == CMD_RING_POLL_RETRIES) {
	    if (worker->qxl->st->qif->req_cmd_notification(worker->qxl)) {
	        worker->display_poll_tries++;
	        return n;
	    }
	    continue;
	}
	// unreachable

	// invert if

	if (worker->display_poll_tries < CMD_RING_POLL_RETRIES) {
	    worker->event_timeout = MIN(worker->event_timeout, CMD_RING_POLL_TIMEOUT);
	    worker->display_poll_tries++;
	    return n;
	}
	if (worker->display_poll_tries > CMD_RING_POLL_RETRIES) {
	    worker->display_poll_tries++;
	    return n;
	}
	if (worker->display_poll_tries == CMD_RING_POLL_RETRIES) {
	    if (!worker->qxl->st->qif->req_cmd_notification(worker->qxl)) {
	        continue;
	    }
	    worker->display_poll_tries++;
	    return n;
	}
	// unreachable

	// reuse code

	if (worker->display_poll_tries < CMD_RING_POLL_RETRIES) {
	    worker->event_timeout = MIN(worker->event_timeout, CMD_RING_POLL_TIMEOUT);
	} else if (worker->display_poll_tries > CMD_RING_POLL_RETRIES) {
	} else if (worker->display_poll_tries == CMD_RING_POLL_RETRIES) {
	    if (!worker->qxl->st->qif->req_cmd_notification(worker->qxl)) {
	        continue;
	    }
	}
	worker->display_poll_tries++;
	return n;

	// remove empty if

	if (worker->display_poll_tries < CMD_RING_POLL_RETRIES) {
	    worker->event_timeout = MIN(worker->event_timeout, CMD_RING_POLL_TIMEOUT);
	} else if (worker->display_poll_tries == CMD_RING_POLL_RETRIES) {
	    if (!worker->qxl->st->qif->req_cmd_notification(worker->qxl)) {
	        continue;
	    }
	}
	worker->display_poll_tries++;
	return n;

	// collapse two conditions

	if (worker->display_poll_tries < CMD_RING_POLL_RETRIES) {
	    worker->event_timeout = MIN(worker->event_timeout, CMD_RING_POLL_TIMEOUT);
	} else if (worker->display_poll_tries == CMD_RING_POLL_RETRIES &&
	           !worker->qxl->st->qif->req_cmd_notification(worker->qxl)) {
	    continue;
	}
	worker->display_poll_tries++;
	return n;

	Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

2016-02-11  Frediano Ziglio  <fziglio@redhat.com>

	dispatcher: remove unused async_commands ring
	The only usage of this ring was to have a message when there was no
	commands on the list.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Store 'renderers' as GArray in RedsState
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-11  Jonathon Jongsma  <jjongsma@redhat.com>

	Add RedsState arg to activate_modifiers_watch()
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Add RedsState arg to spicevmc_device_connect|disconnect()
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Add RedsState arg to red_on_main_agent_tokens()
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Store a reference to RedsState in RedsMigTargetClient
	This allows RedsMigTargetClient methods to use local variables rather
	than the global 'reds' variable

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	spice_server_kbd_leds: don't use global 'reds'
	Store a reference to the RedsState server in the keyboard state struct

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Add reference to server in RedClient
	Allows client methods to not use global 'reds' variable

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Remove use of global 'reds' from VDIReadBuf functions
	Add a new 'state' property to VDIReadBuf so that we can refer back to
	the VDIPortState struct from the readbuf functions.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	char-device: use local 'reds' variable
	Store a reference to the server in the SpiceCharDeviceState struct and
	use that rather than the global 'reds' variable

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Add RedsState member to RedLinkInfo
	This allows us to use local 'reds' variables in all of the various async
	callbacks rather than using the global 'reds' variable.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Move 'core' into RedsState struct
	Also add reds_get_core_interface() accessor for external use.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-10  Christophe Fergeau  <cfergeau@redhat.com>

	reds: Pass RedState instance to reds_accept()
	Rather than relying on a global 'reds' variable, we can pass the needed
	instance through the callback user data.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	reds: Make sure accept_ssl_connection() gets a reds instance
	Commit 3a66b75 changed reds_accept_ssl_connection() to expect a RedState
	instance when its called, but the core->watch_add() which is calling it
	was not changed accordingly. This causes a crash when connecting through
	SSL.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-09  Marc-André Lureau  <marcandre.lureau@gmail.com>

	Handle GL_DRAW_DONE
	When a client is done with drawing and sends
	SPICE_MSGC_DISPLAY_GL_DRAW_DONE, or when it ends, update the number of
	async counts.

	[reduce critical message to a warning; do not reset gl_draw_ongoing
	 - Frediano Ziglio]

	Handle GL_DRAW messages
	Create an async, and marshall the GL_DRAW message. Count number of
	clients, and wait until gl_draw_async_count is 0 to complete the async.
	The count is going to be updated in the following patch when the client
	is done with the draw.

	[removed unused sent field; move gl_draw_async_count to DisplayChannel
	 - Frediano Ziglio]

	Send current GL scanout to new client

	Handle GL_SCANOUT messages
	Go through dispatcher and marshall scanout message. Since the marshaller
	and the QXL state are manipulated from different threads, add a mutex to
	protect the current scanout.

	Add new spice-gl stubs API
	- spice_qxl_gl_scanout() to take the current scanout

	- spice_qxl_gl_draw_async() to draw the scanout, is like other Spice async
	  functions, it takes a cookie and will return in the
	  QXLInterface.async_complete()

	Two new fields are also added to QXLState, in order to save the current
	scanout, and the pending async.

	A scanout can't be updated if there are pending draw atm. Discarding
	outdated draws is left as a future improvement to allow updating the
	scanout without waiting for draw async to be done.

	[make QXL function names more coherent - Frediano Ziglio]

	red-channel: return number of created pipe items
	This is useful in the following patches to count the number of replies
	to wait for.

2016-02-09  Jonathon Jongsma  <jjongsma@redhat.com>

	Add RedsState arg to reds_handle_channel_event()
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Add RedsState arg to reds_init_client_[ssl_]connection()
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Rename vdi_port_read_buf_get() to match convention
	Since this is technically a RedsState method, name it as such.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-05  Frediano Ziglio  <fziglio@redhat.com>

	record: save real time during recording
	Instead of using CPU time use a timer depending on real times.
	Currently that time in the record log is not used.
	However if we want to reproduce problems with stream would be useful
	to have real times instead.

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

	channel: fix typo in comment
	Acked-by: Victor Toso <victortoso@redhat.com>

2016-02-04  Jonathon Jongsma  <jjongsma@redhat.com>

	Move ssl_parameters to RedsState struct
	Removing more global variables

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Move agent_mouse to RedsState struct
	Required adding a RedsState arg to reds_get_agent_mouse()

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Move streaming_video to RedsState struct
	Also requires adding reds_get_streaming_video() accessor so that other
	files can check this value.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-03  Marc-Andre Lureau  <marcandre.lureau@gmail.com>

	tests: link test-qxl-parsing with libserver
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-03  Frediano Ziglio  <fziglio@redhat.com>

	worker: don't do too much polling
	Now that processing is correctly restored there is no need to keep
	polling to avoid main loop hangs. Reduce the polling count to 1
	(just try once).
	This reduce cpu usage if guests are mainly idle.
	If you consider 100 guests waiting to login with cursor blinking
	and considering the polling was done 200 times every 10ms (maximum)
	just the cursor blinking was causing 10100 loop iterations per second
	while now only 200 are needed (considering cursor blinking every
	second).

	Signed-by: Frediano Ziglio <figlio@redhat.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: avoid blocking loop
	Make sure we process commands after we can send data to client.
	If during processing we detected that there was too much data in the
	clients queues the processing of commands just stop till the next
	iteration.
	However if all data are pushed in a single iteration of the loop
	and commands were already processed there was the (remote) possibility
	that the loop hangs till a separate event (like a screen resize on
	client window) arrive.
	I manage to reproduce and after half an hour no events arrived.
	This patch detect that processing was stuck and now we can process new
	commands and force a new iteration.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	replay: remove a message that could be caused by a race condition
	The req_cmd_notification callback is called by spice-server when it
	has processed all commands and wants to be notified (by a wakeup) that
	new commands have been appended to the command queue.
	Replay utility tries to fill the commands when it detects that
	spice-server is trying to read commands but there are no more commands.
	However, new commands are appended in a separate thread so if the main
	red worker loop on spice-server is really tight this request can
	happen.
	Avoid printing any message on this condition, message will be appended
	and loop woken up when replay code can do it.

	Signed-by: Frediano Ziglio <figlio@redhat.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: push data when clients can receive them
	During every iteration of the main worker loop, outgoing data was pushed to
	the client. However, there was no guarantee that the loop would be woken up
	in every situation. So there were some conditions where the loop would stop
	iterating until a new event was sent.

	Currently, the events that can wake up the main worker loop include:
	 - data from dispatcher (including wakeups from the guest)
	 - data from clients
	 - timeouts on a stream
	 - other timeouts
	 - polling

	This patch adds a new wakeup event: when we have items that are queued to
	be sent to a client, we set up a watch event for writing data to the
	client. If no items are waiting to be sent, this watch will be disabled.
	This allows us to remove the explicit push from the main worker loop.

	This has some advantages:
	 - it could lower latency as we don't have to wait for a polling timeout.
	   From my experiments using a tight loop (so not really the ideal
	   condition to see the improvements) the total time was reduced by 2-3%)
	 - helps reduce the possibility of hanging loops
	 - avoids having to scan all clients to detect which one can accept data.

	Signed-by: Frediano Ziglio <figlio@redhat.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-02-03  Jonathon Jongsma  <jjongsma@redhat.com>

	Move zlib_glz_state to RedsState struct
	Also required adding reds_get_zlib_glz_state() for external access.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Move exit_on_disconnect to RedsState struct
	Removing more global variables

	Acked-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	Move agent_file_xfer to RedsState struct
	Removing more global variables

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Move agent_copypaste to RedsState struct
	Removing more global variables

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-03  Frediano Ziglio  <fziglio@redhat.com>

	compatibility patch for event loop
	This patch use old code to implement timer events.
	The new version use some function from GLib 2.34 however some systems
	(like RHEL 6) have former GLib version (RHEL 6 has GLib 2.28 installed)

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	spice-common: pick up fix for uninitialized field
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2016-02-03  Jonathon Jongsma  <jjongsma@redhat.com>

	Remove use of global 'reds' var from spice_server_remove_interface()
	Since this is public API, we can't easily change the signature of the
	function to take a RedsState argument, so instead we apply a hack and
	store the reds argument inside the device state struct when the
	interface is added, and retrieve it for use later when it is removed.

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

	Move ticketing_enabled to RedsState struct
	Removing more global variables

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-02  Jonathon Jongsma  <jjongsma@redhat.com>

	Move jpeg_state to RedsState struct
	Also required adding reds_get_jpeg_state() for external access.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Move image_compression to RedsState struct
	Removing more global variables

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Make default_security and channels_security non-global
	Move them into the RedsState struct, adjust functions that use these
	variables to take a RedsState arg.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-02  Frediano Ziglio  <fziglio@redhat.com>

	red-channel: send marshaller message fd
	Send the fd associated to the last message sent.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Update spice-common
	Needed to have the updated spice_marshaller_get_fd function

2016-02-02  Marc-Andre Lureau  <marcandre.lureau@gmail.com>

	tests: make sure that the default rule builds all tests
	The default rule being "all", it builds noinst_PROGRAMS but not
	check_PROGRAMS. Let's build all the tests by default.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-01  Victor Toso  <victortoso@redhat.com>

	reds: remove unused structs
	RedsMigSpiceMessage and RedsMigCertPubKeyInfo

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-02-01  Frediano Ziglio  <fziglio@redhat.com>

	reds: constify renderers_info array
	Acked-by: Pavel Grunt <pgrunt@redhat.com>
	Acked-by: Victor Toso <victortoso@redhat.com>

	reds: remove default_renderer as field
	Was used to just assure there was at least one renderer in the list.

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

2016-02-01  Jonathon Jongsma  <jjongsma@redhat.com>

	Move spice_uuid, spice_uuid_is_set to RedsState struct
	Removing more global variables

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Move spice_name to RedsState struct
	Remove more global variables

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Move sasl_enabled, sasl_appname to RedsState struct
	Removing more global variables

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Move taTicket to RedsState struct
	Removing more global variables

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Move spice_family to RedsState struct
	Removing more global variables

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Move spice_addr to RedsState struct
	Removing more global variables

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Move migration_interface to RedsState struct
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Move vdagent to RedsState struct
	Also change API of reds_has_vdagent() to take RedsState arg.  Removes
	another global variable.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Move spice_listen_socket_fd to RedsState struct
	Removing more global variables

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-01-29  Jonathon Jongsma  <jjongsma@redhat.com>

	Move spice_secure_port to RedsState struct
	removing more global variables

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

	Move spice_port to RedsState struct
	Remove another global variable

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

	Change init_vd_agent_resources() to take RedsState arg
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2016-01-29  Frediano Ziglio  <fziglio@redhat.com>

	worker: unify flush_cursor_commands and flush_display_commands
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-01-28  Frediano Ziglio  <fziglio@redhat.com>

	worker: use glib main loop
	Use the glib mainloop instead of writing our own. The glib loop is both
	cleaner to use and is more extensible. It is also very mature and
	reduces the maintenance burden on the spice server.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-01-28  Jonathon Jongsma  <jjongsma@redhat.com>

	Move default_renderer into RedsState
	Not global.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	main_channel_init() -> main_channel_new()
	Rename to make function name more consistent

	Acked-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	inputs_init() -> inputs_channel_new()
	Rename function to be more consistent

	Acked-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	Remove global inputs channel
	Make the RedsState object own an InputsChannel object rather than
	having a global inputs channel. This means changing a lot of
	inputs-related API to take an InputsChannel* argument and moving the
	keyboard, mouse, and tablet objects into the InputsChannel object.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-01-28  Frediano Ziglio  <fziglio@redhat.com>

	worker: remove useless check
	display_channel is never NULL.

	Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

	worker: remove useless test
	red_channel_max_pipe_size returns 0 if no client (channel disconnected)
	no need to check if cursor_channel/display_channel are NULL or
	connected.

	Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

	worker: do not leak cursor after disconnecting clients
	Calling cursor_channel_disconnect does not free cursor_display
	so this causes a leak.
	Is the only code where this pointer is reset preventing any
	further cursor channel connection. If a client is lazy reading
	cursor data during the flush connection is closed and further clients
	won't be able to use the cursor.
	This also prevents future use of a NULL pointer.

	Acked-by: Jonathon Jongsma <jjongsma at redhat.com>

2016-01-27  Frediano Ziglio  <fziglio@redhat.com>

	qxl: inline documentation for get_command and req_cmd_notification

2016-01-26  Frediano Ziglio  <fziglio@redhat.com>

	worker: improved implementation of SpiceTimer
	Use a custom GSource.
	This to avoid having to allocate a timer all the time we add one.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	replay: do not wake up loop too much
	Send wakeups only when a command is available.
	This emulate better what a guest driver should do (append the command
	to the ring and then signal).

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

	worker: use core interface to create watch
	This increase code reuse and make Glib integration more straight forward.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	worker: remove empty statement at line end
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	worker: use variable already set at beginning of loops
	This is mainly question of style.
	Instead of repeating same conversion use the variable we set at the
	beginning of the function.
	Note also that I used same name to make the two functions more
	similar.

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

	worker: remove max_pipe_size constant parameter
	All checks for full channel pipes have to be consistents
	so there is no point in passing as a parameter.

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

2016-01-22  Marc-Andre Lureau  <marcandre.lureau@gmail.com>

	channel: do not call pipe_add with null items
	If the creator was not able to produce the item, no need to call
	pipe_add().

	Acked-by: Frediano Ziglio <fziglio@redhat>

	channel: document pipes_create_batch() function
	Rename callback to pipe_add, and document the arguments.

	Acked-by: Frediano Ziglio <fziglio@redhat>

2016-01-22  Jonathon Jongsma  <jjongsma@redhat.com>

	Replay: report error if we don't read the correct file header
	The replay file should start with a header such as
	  SPICE_REPLAY 1

	Instead of soldiering on if we don't encounter this header, print a
	warning and return NULL.  Also exit with a failure if spice_replay_new()
	returns a NULL object in main.

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

2016-01-21  Jonathon Jongsma  <jjongsma@redhat.com>

	Change some functions to take RedsState arg
	In preparation for getting rid of the global 'reds' variable, we need to
	pass the RedsState variable to all functions where it is needed. For now
	the callers just pass in the global reds variable.

	Functions changed:
	- reds_mig_fill_wait_disconnect;
	- reds_mig_cleanup_wait_disconnect;
	- reds_mig_remove_wait_disconnect_client;
	- reds_migrate_channels_seamless;
	- reds_mig_finished;
	- reds_mig_switch;
	- reds_enable_mm_time;
	- reds_disable_mm_time;
	- attach_to_red_agent;
	- reds_char_device_add_state;
	- reds_char_device_remove_state;
	- reds_on_char_device_state_destroy;
	- spice_server_char_device_remove_interface;
	- migrate_timeout.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-01-21  Christophe Fergeau  <cfergeau@redhat.com>

	event-loop: Remove template
	Since SpiceCoreInterfaceInternal is a private data structure, we can
	extend it as we see fit without breaking ABI. In particular, adding a
	GMainContext member to it allows us to remove the need for
	the event loop template which is currently included in the
	basic_event_loop.c test file.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	test-loop: Improve basic_event_loop base_{timer, watch}_add
	They call the functions provided by event_loop_core, but with a NULL
	SpiceCoreInterfaceInternal parameter. It makes more sense to pass
	event_loop_core rather than NULL.
	This will allow to pass the GMainContext to be used through
	SpiceCoreInterfaceInternal rather than through a template parameter.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-01-20  Pavel Grunt  <pgrunt@redhat.com>

	dcc: make dcc_compress_image_*() private
	Reviewed-by: Victor Toso <victortoso@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	dcc-send: Use dcc_compress_image to compress image
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	dcc_compress_image: Handle NULL drawable
	It will be used in the following commit.
	The GLZ compression cannot be used when the drawable is NULL.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	build-sys: Update spice-common submodule

2016-01-20  Jonathon Jongsma  <jjongsma@redhat.com>

	Change some functions to take RedsState arg
	In preparation for getting rid of the global 'reds' variable, we need to
	pass the RedsState variable to all functions where it is needed. For now
	the callers just pass in the global reds variable.

	Functions changed:
	- reds_link_mig_target_channels;
	- reds_on_migrate_dst_set_seamless;
	- reds_on_client_seamless_migrate_complete;
	- reds_on_client_semi_seamless_migrate_complete;
	- reds_handle_other_links;
	- reds_handle_link;
	- reds_send_mm_time;
	- reds_set_client_mm_time_latency;
	- reds_init_net;
	- do_spice_init;
	- reds_init_ssl;
	- on_activating_ticketing;
	- reds_mig_release to take RedsState arg
	- reds_mig_started.

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

	Change some functions to take RedsState arg
	In preparation for getting rid of the global 'reds' variable, we need to
	pass the RedsState variable to all functions where it is needed. For now
	the callers just pass in the global reds variable.

	Functions changed:
	- reds_on_main_migrate_connected;
	- reds_on_main_mouse_mode_request;
	- reds_on_main_channel_migrate;
	- reds_marshall_migrate_data;
	- reds_agent_state_restore;
	- reds_handle_migrate_data;
	- reds_send_link_ack;
	- reds_mig_target_client_add;
	- reds_mig_target_client_find;
	- reds_mig_target_client_free;
	- reds_mig_target_client_disconnect_all;
	- reds_find_client;
	- reds_get_client;
	- reds_handle_main_link;
	- reds_set_client_mouse_allowed.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-01-20  Frediano Ziglio  <fziglio@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>

	tests: test removed triggered timers are not called
	This could happen for instance if a given timer remove all clients
	which have associated timers.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	tests: add a test for event loop
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	tests: extract code for event loop
	This code will be reused for main loop

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	tests: do not use default loop context
	Make sure we don't handle event reserved to other loop contexts.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-01-19  Christophe Fergeau  <cfergeau@redhat.com>

	Remove use of spice_warn_if()
	spice_warn_if_fail() is doing the same thing except for the inverted
	condition. spice_warn_if() is being removed from spice-common to avoid
	having potentially confusing redundancy.

2016-01-19  Jonathon Jongsma  <jjongsma@redhat.com>

	reds_num_of_clients() -> reds_get_n_clients()
	More consistent with glib naming conventions. Also make the function
	static since it's not used outside of this source file.

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

	reds_num_of_channels() -> reds_get_n_channels()
	More consistent with glib naming conventions.

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

	Change some functions to take RedsState arg
	In preparation for getting rid of the global 'reds' variable, we need to
	pass the RedsState variable to all functions where it is needed. For now
	the callers just pass in the global reds variable.

	Functions changed:
	- vdi_port_read_buf_process;
	- vdi_port_read_buf_get;
	- vdi_port_read_buf_unref;
	- reds_handle_agent_mouse_event;
	- reds_num_of_channels;
	- reds_num_of_clients;
	- reds_fill_channels;
	- reds_on_main_agent_start;
	- reds_get_agent_data_buffer;
	- reds_release_agent_data_buffer;
	- reds_client_monitors_config_cleanup;
	- red_on_main_agent_data.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2016-01-19  Frediano Ziglio  <fziglio@redhat.com>

	tests: remove leaks in test-qxl-parsing
	This make happy address sanitizer during make check.
	Otherwise memory leak detector can keep in and make tests fails.

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

2016-01-19  Jonathon Jongsma  <jjongsma@redhat.com>

	Pass 'reds' as opaque data in vdi port char device
	This allows us to access the RedsState variable non-globally without
	changing the signature of the callback functions.

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

2016-01-18  Jonathon Jongsma  <jjongsma@redhat.com>

	Change some functions to take RedsState arg
	In preparation for getting rid of the global 'reds' variable, we need to
	pass the RedsState variable to all functions where it is needed. For now
	the callers just pass in the global reds variable.

	Functions changed:
	- reds_register_channel;
	- reds_unregister_channel;
	- reds_get_mouse_mode;
	- reds_set_mouse_mode;
	- reds_update_mouse_mode;
	- reds_agent_remove;
	- reds_find_channel;
	- reds_mig_cleanup;
	- reds_reset_vdp;
	- reds_main_channel_connected;
	- reds_client_disconnect;
	- reds_disconnect;
	- reds_mig_disconnect.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2016-01-15  Frediano Ziglio  <fziglio@redhat.com>

	replay: better documentation for -C and -S options
	Document all possible values

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

	replay: add streaming setting option
	Add -S to allow to set a video streaming rule.

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

	utils: handle errors writing to bitmap file
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	utils: fix endianess issues writing bitmap file
	Do not print directly binary data but serialize in a portable way
	and then use write functions.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	utils: use always fwrite to write bitmap
	Make easier to check error on next patch

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-01-15  Jonathon Jongsma  <jjongsma@redhat.com>

	Make global 'reds' extern
	This allows it to be accessed from other files. This is a temporary step
	toward getting rid of the global-ness of this variable, and it allows us
	to update the function signature bit-by-bit.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-01-15  Marc-Andre Lureau  <marcandre.lureau@gmail.com>

	stream-test: add batch test
	Check that two consecutive msgfd are read back from two different reads.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-01-15  Frediano Ziglio  <fziglio@redhat.com>

	replay: use spice_malloc(0) instead of raw malloc
	These function report memory allocation errors.
	spice_malloc0 also reset memory after allocation.

	Acked-by: Victor Toso <victortoso@redhat.com>

2016-01-15  Marc-Andre Lureau  <marcandre.lureau@gmail.com>

	build-sys: build a noinst libtest.a to link to
	Group the test utility in a library, to avoid repeating the same
	sources. In this case, automake already figues out what the source of
	the programs to build is.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-01-15  Frediano Ziglio  <fziglio@redhat.com>

	replay: remove command line memory leaks
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2016-01-14  Frediano Ziglio  <fziglio@redhat.com>

	build-sys: update spice-common
	This is an update to fix build issues with spice-protocol.git.
	generated_server_demarshallers.c: In function
	‘parse_msgc_display_gl_draw_done’:
	generated_server_demarshallers.c:767:23: error:
	‘SpiceMsgcDisplayGlDrawDone’ undeclared (first use in this function)
	     mem_size = sizeof(SpiceMsgcDisplayGlDrawDone);
	...

	Also needed for upcoming gl-scanout messages.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-01-14  Christophe Fergeau  <cfergeau@redhat.com>

	Remove GSlice use
	It's being slowly deprecated in glib
	https://bugzilla.gnome.org/show_bug.cgi?id=754687

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Remove compress_buf_new
	This commit reworks a bit the management of RedCompressBuf so that
	compress_buf_new/compress_buf_free become unneeded.
	Since d25d6ca0 and the introduction of encoder_data_reset,
	compress_buf_free is already unused outside of dcc-encoders.c and could
	be static. This in turn makes compress_buf_new a bit odd as the matching
	destructor is never used in dcc.c.
	This commit introduces an encoder_data_init() method which is hiding
	the initialization of the EncoderData structure from the dcc.c code,
	allowing to get rid of compress_buf_new() calls from dcc.c code.

	It also uses this as an opportunity to stop using GSlice for
	RedCompressBuf.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-01-14  Frediano Ziglio  <fziglio@redhat.com>

	channel: simplify red_channel_client_send_item
	Acked-by: Pavel Grunt <pgrunt@redhat.com>
	Acked-by: Victor Toso <victortoso@redhat.com>

2016-01-14  Marc-Andre Lureau  <marcandre.lureau@gmail.com>

	tests: add fdpass stream test
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-01-14  Marc-André Lureau  <mlureau@redhat.com>

	reds-stream: add send_msgfd()
	A new function to send fd with unix socket anciliary data.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-01-14  Marc-Andre Lureau  <marcandre.lureau@gmail.com>

	build-sys: build a utility libserver.la
	This allow tests programs to link with statically built library to access all symbols

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-01-13  Christophe Fergeau  <cfergeau@redhat.com>

	Update NEWS for 0.13.0 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-12  Sunny Shin  <sunny4s.git@gmail.com>

	channel: add option tcp keepalive timeout to channels

2016-01-12  Christophe Fergeau  <cfergeau@redhat.com>

	stat: Make stat_compress_init/stat_init the same
	When COMPRESS_STAT is not set, and RED_WORKER_STAT is set,
	stat_time() will be a no-op, but stat_start_time_init() will try to use
	stat_info_t::clock. This causes a compile warning on 32 bit arches (not
	sure why not on 64 bit builds), as well as an error from valgrind.

	Since stat_time() and stat_compress_time() are both doing the same work,
	this commit makes them the same function, which ensures
	stat_info_t::clock will be set and stat_start_time_init() can be used
	regardless of the _init() method which is called.

2016-01-12  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.

2016-01-11  Frediano Ziglio  <fziglio@redhat.com>

	channel: use iface parameter to distinguish interface context
	Now we can use the iface parameter to distinguish the context instead
	of doing strange assumption on opaque and its state.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	channel: add interface parameters to SpiceCoreInterfaceInternal
	This patch and previous ones want to solve the problem of not having a
	context in SpiceCoreInterface. SpiceCoreInterface defines a set of
	callbacks to handle events in spice-server. These callbacks allow to
	handle timers, watch for file descriptors and send channel events.
	All these callbacks do not accept a context (usually in C passed as a
	void* parameter) so it is hard for them to differentiate the interface
	specified.
	Unfortunately this structure is used even internally from different
	contexts for instance every RedWorker thread has a different context. To
	solve this issue some workarounds are used. Currently for timers a variable
	depending on the current thread is used while for watches the opaque
	parameter to pass to the event callback is used as it currently points just
	to RedChannelClient structure.  This however imposes some implicit
	maintainance problem in the future. What happens for instance if for some
	reason a timer is registered during worker initialization, run in another
	thread? What if we decide to register a file descriptor callback for
	something not a RedChannelClient?  Could be that the program will run
	without any issue till some bytes change and weird things could happen.

	The implementation of this solution is done implementing an internal "core"
	interface that has context specific and use it to differentiate the
	context instead of relying on some other, hard to maintain, detail. Then an
	adapter structure (name inpired to the adapter pattern) will provide the
	internal core interface using the external, public, definition (in the
	future this technique can be used to extend the external interface without
	breaking the ABI).

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	channel: build adapter for public core interface
	Add wrapper functions for SpiceCoreInterface in order to present
	a SpiceCoreInterfaceInternal. These functions just expect
	SpiceCoreInterfaceInternal API and forward request to
	SpiceCoreInterface.
	This allows to change ABI details of internal one.

	See comments in "channel: add interface parameters to
	SpiceCoreInterfaceInternal" patch.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	channel: add a new internal SpiceCoreInterface
	Define an internal structure that matches 100% the ABI of the public one.
	The structure will be changed by following patches.
	See comments in "channel: add interface parameters to
	SpiceCoreInterfaceInternal" patch.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	stats: use CLOCK_THREAD_CPUTIME_ID for cpu statistics
	Use CLOCK_THREAD_CPUTIME_ID instead of getting the clock
	with pthread_getcpuclockid.
	This avoids to call red_worker_get_clockid. This function returns
	uninitialized value at the time DisplayChannel is built resulting in setting
	statistics to CLOCK_REALTIME (which is 0) instead to cpu time as expected.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	dcc: avoid to report errors triggered by client
	Client can always send report even if a stream is not available.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-01-08  Frediano Ziglio  <fziglio@redhat.com>

	add some tests for cursors parsing
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	add test for QXL parsing functions
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	check properly if red_get_data_chunks fails or not
	Instead of returning 0 which could be a valid value returns an invalid
	one and check on the caller.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	prevent integer overflow in red_get_clip_rects
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	dcc: write and use a new encoder_data_reset function to clean buffers
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	dcc: free glz buffer after zlib compression
	For zlib+glz compression image if first compressed with glz then the
	resulting buffer is compressed again with zlib then the buffer from
	zlib is returned to the caller.
	However the temporary glz buffer was not freed resulting in a memory
	leak.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2016-01-08  Eduardo Lima (Etrunko)  <etrunko@redhat.com>

	server: Fix tests Makefile
	As reported in https://bugs.freedesktop.org/show_bug.cgi?id=93520, the
	build from git is failing in Archlinux systems with undefined
	references to glib symbols.

	This patch fixes the problem by simply reordering the order libraries
	will be linked. Also, removes duplicate $(GLIB_LIBS) variable.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2016-01-08  Pavel Grunt  <pgrunt@redhat.com>

	syntax-check: Fix sc_cast_of_argument_to_free
	red_replay_qxl.c was renamed in 525cd67be7c5

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	syntax-check: Remove empty line at EOF
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	syntax-check: Fix missing AUTHORS
	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2015-12-22  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-21  Marc-André Lureau  <mlureau@redhat.com>

	reds-stream: add reds_stream_is_plain_unix()
	Utility function used in follow-up code.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-12-21  Pavel Grunt  <pgrunt@redhat.com>

	build-sys: Use sasl check from spice-common
	Support only libsasl2 providing libsasl2.pc file

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

2015-12-21  Marc-Andre Lureau  <marcandre.lureau@gmail.com>

	tests: remove test_util.h
	Replace ASSERT() with spice_assert().

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-12-21  Frediano Ziglio  <fziglio@redhat.com>

	tests: remove unused macro
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2015-12-17  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>

2015-12-16  Christophe Fergeau  <cfergeau@redhat.com>

	build: Remove unused SPICEC_STATIC_LINKAGE_BSTATIC
	A left-over from the client code.

2015-12-16  Marc-Andre Lureau  <marcandre.lureau@gmail.com>

	stream: consitify reds_stream_get_family() argument
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-12-15  Francois Gouget  <fgouget@codeweavers.com>

	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: Remove an unneeded mjpeg-encoder.h include
	The corresponding code has been moved elsewhere during the refactoring.

	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>

2015-12-15  Frediano Ziglio  <fziglio@redhat.com>

	tests: reuse Makefile macro
	For coherency use COMMON_BASE macro instead of including single
	files.

	Acked-by: Victor Toso <victortoso@redhat.com>

	tests: allocate memory in a coherent fashion
	Do not free memory allocated with C functions (like calloc) using g_free;
	although this is possible with default Glib allocator this is not safe.
	Also use consistent allocation functions. All other spice-server code
	does not use Glib allocations so for coherence do not use them for
	watches.

	Acked-by: Victor Toso <victortoso@redhat.com>

2015-12-14  Marc-André Lureau  <mlureau@redhat.com>

	red-channel: constify some callback structs
	Because we can.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-12-14  Christophe Fergeau  <cfergeau@redhat.com>

	build: Don't list some installed headers twice
	Since commit febaed3, spice.h and spice-experimental.h are listed both
	in libspice_server_la_HEADERS and libspice_server_la_SOURCES. Since we
	want these headers to be installed, we can remove them from _SOURCES.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-12-14  Francois Gouget  <fgouget@codeweavers.com>

	server: Add time constants to go with spice_get_monotonic_time_ms()
	They clarify the time unit being used and simplify calculations.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	server: Add time constants to go with spice_get_monotonic_time_ns()
	They clarify the time unit being used, reduce the need for casts and
	simplify calculations.

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

	server: Rename DISPLAY_CLIENT_TIMEOUT and de-duplicate it
	Given that it is used for both cursor and display, COMMON_CLIENT_TIMEOUT
	seems more appropriate. Also define it only in red-worker.h.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-12-11  Pavel Grunt  <pgrunt@redhat.com>

	worker: Rename function name in the comment as well
	It was renamed in 47b023866faac2c5e3302d4d3fc42a0260a5557c

	Acked-by: Christophe Fergeau <cfergeau@redhat.com>

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>

	reds: do not use g_malloc0 in server code
	The rest of code is using spice_malloc* functions, use them for
	consistency.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2015-12-11  Francois Gouget  <fgouget@codeweavers.com>

	server: Use spice_get_monotonic_time_ms() in spice_timer_queue.c
	This reduces code duplication.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	server: Add spice_get_monotonic_time_ms()
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	server: Rename red_get_monotonic_time() to spice_get_monotonic_time_ns()
	This is a generic function not tied to the red_xxx functionality and the
	new name clarifies that it returns the time in nanoseconds (unlike
	g_get_monotonic_time()).

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	server: Provide a framerate estimate based on the initial frames
	This way the video encoder can actually count on a real estimate when
	it is initializing.
	Note that the server only creates a video stream if at least 20 bitmap
	'blits' of the same size and type arrive, each within a maximum time
	interval from the previous one. So it was only keeping track of the
	frame to frame interval. Thus to get an average frame rate over all the
	20 frames it's necessary to also keep track of the first_frame_time.

2015-12-11  Marc-André Lureau  <mlureau@redhat.com>

	snd: remove duplicated snd_attach_*() code
	red_channel_set_data() already sets channel->data.

	Acked-by: Frediano Ziglio <fziglio@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>

2015-12-10  Marc-Andre Lureau  <marcandre.lureau@gmail.com>

	red-dispatcher: group cases
	A small cleanup.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-12-10  Marc-André Lureau  <mlureau@redhat.com>

	snd: simplify reds_register_channel() call
	Give channel argument directly

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-12-10  Frediano Ziglio  <fziglio@redhat.com>

	channel: make sure we retain RedChannelClient while processing it
	During display_channel_handle_migrate_data the pointer is passed
	to different functions which could release it making the pointer
	invalid. Make sure pointer is not freed while processing.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	channel: rename red_channel_(client_)waits_* functions
	Make clear that these funcion are just checking a condition.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2015-12-10  Francois Gouget  <fgouget@codeweavers.com>

	server: Remove an unneeded time.h include directive
	main-channel.c now uses g_get_monotonic_time() instead of
	clock_gettime().

2015-12-09  Frediano Ziglio  <fziglio@redhat.com>

	server: misc header cleanups
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	server: merge spice-bitmap-utils and spice_bitmap_utils
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	stat: add test for statistic functions
	Make sure code compile with and without statistics enabled (beside
	printing functions).

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	stat: use a better design for statistic functions
	make sure code compile with statistics enabled or disabled.
	Dummy (empty) structures and functions are used instead of preprocessor.
	Also fix a problem as stat_compress_init did not initialize clock
	field.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	stat: fix portability problem in stat_time_t declaration
	Assure stat_time_t is 64 bit on all architectures.
	long is not 64 bit on 32 bit systems so use uint64_t intead.
	Also avoid 32 bit overflows for such architectures.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2015-12-09  Marc-André Lureau  <marcandre.lureau@gmail.com>

	display: replace some dubious asserts
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
	Acked-by: Uri Lublin <uril@redhat.com>

2015-12-08  Francois Gouget  <fgouget@codeweavers.com>

	server: Use g_get_monotonic_time() to get the time in microseconds
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	server: Define the MJPEG encoder warmup time in nanoseconds
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	server: Simplify the MJPEG encoder's maximum framerate estimation
	Note that if frame_size == bytes_per_sec == 0 this now returns
	MJPEG_MAX_FPS but this should not happen anyway.

	server: Rename SUPPORT_AUTOMATED_TESTS to HAVE_AUTOMATED_TESTS
	This improves consistency with spice-deps.m4 which names its
	AM_CONDITIONAL() variables HAVE_XXX.

2015-12-04  Alon Levy  <alon@pobox.com>

	server: multiple clients works ok if we limit the pipe to the slowest client
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-12-04  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>

	worker: improve validation for update command
	If surface_id is not valid we should still release resource allocated
	by red_get_update_cmd and from the guest.
	This to reduce leaks in case of a race or another error in the guest
	driver.
	Also not issue a warning on invalid surface number to avoid filling
	log space unconditionally.

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

2015-12-04  Jonathon Jongsma  <jjongsma@redhat.com>

	remove glz_encoder_config.h
	Move all code from glz_encoder_config.h into other files.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-12-04  Alon Levy  <alon@pobox.com>

	tests: test_display_base: use a faster wakeup time to easily test multiple client blocking
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-12-04  Frediano Ziglio  <fziglio@redhat.com>

	server: rename files
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	memslot: change some spice_assert to spice_return_if_fail
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	display: misc style and rename changes
	- remove some red_ prefix;
	- move red_drawable->self_bitmap check outside handle_self_bitmap;
	- move update check outside red_get_area (renamed surface_read_bits);
	- rename depend_on_surface_id argument to surface_id;
	- rename success variable to add_to_pipe.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: move red_process_draw to display-channel.c
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	display: make get_drawable symmetric to display_channel_drawable_unref
	Make possible to safely call display_channel_drawable_unref straight
	after calling get_drawable.

	Problem was function definitions and dependency.

	display_channel_drawable_try_new is supposed to return an uninitialized
	pointer (or NULL on failure) to a Drawable structure.

	(display_channel_)get_drawable is supposed to return an initialized
	pointer (or NULL) to a Drawable structure.

	(display_channel_)add_drawable is supposed to add the Drawable to the
	list/tree of drawing to draw.

	Now, with these definitions after get_drawable the Drawable state (if
	pointer is not NULL) should be consistent and we should be able to call
	display_channel_drawable_unref.

	In the current code this was not true as for instance surface_id was
	copied to Drawable but the reference counter of the surface was not
	incremented leading possible unref call to decrement the counter and
	free the surface. This can happen if any call between get_drawable and
	unref does not increment the reference in a consistent way. This
	basically means that every present or future code in the path between
	get_drawable and unref have to know this unconsistency and handle it.
	This is a maintaining problem as people need to know these details when
	editing existing code (actually this is display_channel_add_drawable
	code).
	This basically create a dependency between get_drawable and
	add_drawable.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2015-12-03  Francois Gouget  <fgouget@codeweavers.com>

	server: Reuse red_get_monotonic_time() in the MJPEG video encoder
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-12-03  Frediano Ziglio  <fziglio@redhat.com>

	stat: fix stat_info_t initialization
	For compression statistics clock field was not initialized but used
	computing statistics.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2015-12-03  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: rename process_commands process_display
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-12-03  Frediano Ziglio  <fziglio@redhat.com>

	dcc: reduce statement wrapping
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: change red_worker_new_channel result to CommonChannel*
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	memslot: prefix memslot functions with memslot_
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: do not use dynamic memory for RedSurfaceCmd
	Allocation on stack is sufficient and code is more similar to
	QXL_CMD_MESSAGE and QXL_CMD_UPDATE cases.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	display: move more logic in display_channel_get_drawable()
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: move get_drawable to display-channel.c
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-12-02  Marc-André Lureau  <marcandre.lureau@gmail.com>

	smartcard: include libcacard.h if possible

2015-12-02  Yonit Halperin  <yhalperi@redhat.com>

	red_worker: make dcc_clear_surface_drawables_from_pipe declaration consistent with definition
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-12-02  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: merge handle_new_display_channel
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	display: rename detach_streams_behind
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	display: add update_compression() method
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	worker: move red_process_surface
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2015-11-27  Marc-André Lureau  <marcandre.lureau@gmail.com>

	Add travis CI file

	Update spice-common
	Fix distcheck

	build-sys: remove --enable-opengl
	OpenGL was removed in commit c5c176a5c7, enabling it on discheck will
	fail to link with spice-common gl-enabled library

	server: cleanups
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: remove some unnecessary inline
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	worker: move dcc_send & marshallers to dcc-send.c
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-26  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: move red_pipes_remove_drawable
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: move current_remove*
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: move more stream functions
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	display: remove some public declarations
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	server: move LZ_IMAGE_TYPE_* enum to dcc
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	display: Simplify display_channel_create_surface
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	server: rename _tmpl files
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	display: reuse code in display_channel_draw_until
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: use spice_return_if_fail() instead of spice_assert() in release_item
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	worker: changed some spice_assert in display_channel_draw_till
	Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-25  Marc-André Lureau  <marcandre.lureau@gmail.com>

	display: Remove extra parameters from create_canvas_for_surface
	Get them from the surface

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

	worker: move display_channel_create_surface
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	worker: move display_channel_update
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	worker: move destroy_surface() familly
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	worker: move display_channel_new
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	display: factor out current_find_intersects_rect
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	display: factor out draw_until
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: move display_channel_draw
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	worker: simplify surface_update_dest()
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-25  Francois Gouget  <fgouget@codeweavers.com>

	server: Remove MJPEG's video callback assert
	A NULL get_roundtrip_ms() callback simply disables rate control so
	that mjpeg_encoder_get_source_fps() will not be called.
	Should it be called despite this, simply return the highest allowed
	framerate (get_source_fps()'s value is only an estimate anyway).
	Finally update_client_playback_delay() is always checked before use.

	server: Encapsulate the get_source_fps() video encoder callback

2015-11-24  Frediano Ziglio  <fziglio@redhat.com>

	worker: simplify handle_dev_oom
	Do not check if worker->display_channel is NULL as we are already using
	to get some field so must be not NULL.
	Reuse display_red_channel variable.

	Acked-by: Uri Lublin <uril@redhat.com>

	dcc: remove possible dandling pointers
	Set pointers to NULL after releasing encoders.
	This to make sure no further access will occurs.

	Acked-by: Victor Toso <victortoso@redhat.com>
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2015-11-24  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: Change validate_area to surface_update_dest
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	worker: rename red_connect_cursor and tidy up a bit
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2015-11-24  Frediano Ziglio  <fziglio@redhat.com>

	worker: fix constant
	Use mnemonic instead of constant to return enumeration value

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-24  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: move drawable_draw
	Acked-by: Fabiano Fidêncio <fabiano@fidencio.org>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	worker: remove display_channel prefix from channel callbacks
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: move dcc_release_item
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: simplify handle_migrate_data functions
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: move dcc_handle_migrate_data
	Acked-by: Fabiano Fidêncio <fabiano@fidencio.org>

	worker: move attach_stream
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: move dcc_add_drawable*
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: move dcc_handle_message
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: do not set worker image compression on client request
	Display client can ask to change the preferred compression.
	Previously this setting change the entire worker setting
	so every future client created would have this setting.
	Remove the setting in the worker make the change only to the
	current client.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-23  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: rename update_area
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
	Acked-by: Fabiano Fidêncio <fabiano@fidencio.org>

	worker: move display_channel_free_some
	Author:    Marc-André Lureau <marcandre.lureau@gmail.com>
	Acked-by: Fabiano Fidêncio <fabiano@fidencio.org>

	worker: replace some precondition checks
	Acked-by: Fabiano Fidêncio <fabiano@fidencio.org>

	worker: generalize surface_dirty_region_to_rects
	Acked-by: Fabiano Fidêncio <fabiano@fidencio.org>

	worker: move dcc_add_surface_area_image
	Author:    Marc-André Lureau <marcandre.lureau@gmail.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2015-11-23  Pavel Grunt  <pgrunt@redhat.com>

	main channel: Remove unused main_channel_client_get_link_id
	It was introduced in 9cece23ba3e49e6eec9e380daa95d6ee0133c91c
	but never used.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	main channel: Remove unused main_channel_push_notify
	It is not needed since 8d44aa032892ea6643925fa7485d9af32853e127

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	red channel: Remove unused red_channel_apply_clients_data
	It was introduced in 7e8e13593ee681cf04c349bca57dd225d7802494
	but never used.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	red channel: Remove unused declaration of red_channel_pipes_remove
	It was introduced in 09ae4700d27b7c1cca64c2ce4c90f0c6cdf81ccf
	but never used.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	red channel: Remove unused red_channel_push_set_ack
	It is not needed since 8e7b22b7861d2859167767822f29749bfe3ecc16

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	red dispatcher: Remove unused declaration of red_dispatcher_set_mm_time
	It is not used since c541d7e29dc0053e6434d053a50454bb8a7121e9

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	dispatcher: Remove unused dispatcher_read_message
	It is not needed since d3153f861065235c2a7a7120375be5db948c5a77

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-23  Frediano Ziglio  <fziglio@redhat.com>

	worker: move red_drawable_count to DisplayChannel
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	reuse red_get_monotonic_time function
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2015-11-21  Marc-André Lureau  <marcandre.lureau@gmail.com>

	server: remove OpenGL
	This is really not supported, requires X11, so better to remove it for
	now. Some day it might be revived, using DRM, ..

	Note for later, this could be removed too (not used by client):
	- spice-common/common/ogl_ctx

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	stream: remove red_stream_ prefix from mjpeg callbacks
	Author:    Marc-André Lureau <marcandre.lureau@gmail.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	stream: rename {red_stream_, }get_initial_bit_rate
	Author:    Marc-André Lureau <marcandre.lureau@gmail.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	stream: remove dcc parameter from stream_agent_stop()
	Author:    Marc-André Lureau <marcandre.lureau@gmail.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-20  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: move more free_glz_drawable
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-20  Pavel Grunt  <pgrunt@redhat.com>

	worker: Free encoders when client disconnects

	dcc: Fix unused display_channel variable
	Avoid problem when compiling with lz4 and without COMPRESS_STAT

	dcc.c: In function 'dcc_compress_image_lz4':
	dcc.c:657:21: error: unused variable 'display_channel' [-Werror=unused-variable]
	     DisplayChannel *display_channel = DCC_TO_DC(dcc);

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-20  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: move stream_clip_item_unref()
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: merge red_draw_qxl_drawable in drawable_draw
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: move dcc_pixmap_cache_add
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: move dcc_freeze_glz
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: few function renames
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: add display_channel_free_glz_drawables_to_free()
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: move dcc_free_glz_drawable_instance
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: move display_channel_flush_all_surfaces
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-20  Frediano Ziglio  <fziglio@redhat.com>

	worker: move compress to dcc_compress_image()
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: move glz_drawable_count to DisplayChannel
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2015-11-19  Christophe Fergeau  <cfergeau@redhat.com>

	manual: Document path to vdagent logs on Windows

	manual: Small formatting fixes
	The XML namespace to use with libvirt when adding custom QEMU arguments
	looks better in a monospace font.
	asciidoc will also replace the '->' in '<->' with an arrow character,
	which looks bad. This commit reformulates the sentence to avoid the use
	of <->

2015-11-19  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: move display_channel_wait_for_migrate_data
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: move dcc_start()
	Author:    Marc-André Lureau <marcandre.lureau@gmail.com>
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: start a DisplayChannelClient unit
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-19  Pavel Grunt  <pgrunt@redhat.com>

	Fix spice-common submodule
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-19  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: simplify GlzDrawableInstanceItem fields name
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	worker: move encoders to dcc-encoders
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-18  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: painfully move display_channel_add_drawable
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	worker: add compression parameters to dcc
	This allow different dcc to have different settings from default one.
	The parameters are copied initially from default settings but then they
	can change independently for each client.
	Even having a single client a future client is not affected by a
	previous setting on the old dcc.

	[updated for the preferred compression]
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-18  Jonathon Jongsma  <jjongsma@redhat.com>

	Rename red_display_free_* to dcc_free_*
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2015-11-18  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: simplify RedCompressBuf
	Make sure an allocated buffer is correctly referenced by the marshaller,
	and can't be free and reused by mistake. Simplify the code by using
	GSlice

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: move surfaces to DisplayChannel
	Ok. this one was painful.Note that in some cases, DCC_TO_DC should be
	made safer (there used to be a if !dcc guard in some places, although
	that looks wrong anyway)...

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

2015-11-18  Jonathon Jongsma  <jjongsma@redhat.com>

	Move stream creation and maintenance functions to stream.[ch]
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-18  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: move stream_agent_stop and friends
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2015-11-18  Pavel Grunt  <pgrunt@redhat.com>

	worker: Remove unused red_show_tree
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-18  Marc-André Lureau  <marcandre.lureau@gmail.com>

	display-channel: Keep macro definition in one line
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-18  Frediano Ziglio  <fziglio@redhat.com>

	worker: simplify red_marshall_image
	Remove some nested blocks using else if.

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

2015-11-18  Jonathon Jongsma  <jjongsma@redhat.com>

	worker: Move stream functions to stream.c
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-17  Jonathon Jongsma  <jjongsma@redhat.com>

	Move some tree item functions to tree.[ch]
	Also rename some functions slightly:
	     __find_shadow -> tree_item_find_shadow()
	     __contained_by -> tree_item_contained_by()
	     ring_of -> tree_item_container_items();

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2015-11-16  Francois Gouget  <fgouget@codeweavers.com>

	build-sys: Use SPICE_WARNING() to issue the architecture warning
	Note that spice-deps.m4 now provides the AS_VAR_APPEND() fallback.

2015-11-16  Jonathon Jongsma  <jjongsma@redhat.com>

	Move some more drawable functions to display channel
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: Rename current_clear() to current_remove_all()
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	Move dcc_push_stream_agent_clip() to display channel
	rename to dcc_add_stream_agent_clip()

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

2015-11-16  Francois Gouget  <fgouget@codeweavers.com>

	server: Duplicate typedef definitions are not allowed in C99
	This fixes some compilation errors with gcc 4.4.7 on RHEL 6.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	server: Include stdint.h for int64_t
	This fixes a compilation error with gcc 4.4 on RHEL 6.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-13  Francois Gouget  <fgouget@codeweavers.com>

	server: Remove the display_channel_attach_stream() prototype
	It is unused.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	build-sys: Use AC_MSG_NOTICE()
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-13  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: don't use weird RedCompressedBuf nbytes shifting
	Acked-by: Pavel Grunt <pgrunt@redhat.com>
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-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

2015-11-13  Pavel Grunt  <pgrunt@redhat.com>

	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>

2015-11-13  Victor Toso  <victortoso@redhat.com>

	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

2015-11-12  Frediano Ziglio  <fziglio@redhat.com>

	worker: fix compiling with COMPRESS_STAT enabled
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-12  Pavel Grunt  <pgrunt@redhat.com>

	worker: Remove usage of streaming_video global in DisplayChannel
	Avoid creating streams for every image due to not properly initialized
	DisplayChannel->stream_video field.

	Regression since: 4987df8e67f48cde13d39f4e81909f672ae33e29

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-12  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: move some tree container functions
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: rename a bit current_add functions
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-11  Jonathon Jongsma  <jjongsma@redhat.com>

	worker: Remove duplicate DISPLAY_CLIENT_TIMEOUT define
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-11  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: move RED_WORKER_STAT, make it compile again
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-11  Jonathon Jongsma  <jjongsma@redhat.com>

	worker: Move drawable utility functions to display channel
	Functions that check the equality of a path, brush, etc are moved the
	display channel source file to prepare for moving the surfaces to the
	display channel.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: Move is_opaque_item() to tree.h
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-11  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: move drawable to display
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2015-11-10  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: move current to display
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: move red_destroy_surface_item()
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: move stream to display channel
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: move DisplayChannel/DisplayChannelClient functions together
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: rename functions that handle DisplayChannelClient
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: move stream functions to a new stream.c file
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: move stream definitions to a new stream.h file
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: fix RED_STREAM_TIMOUT macro spelling
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-10  Frediano Ziglio  <fziglio@redhat.com>

	remove server/stream.h file added by mistake in previous commit
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

2015-11-10  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: move image cache to display
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	worker s/surfaces_dest/surface_deps
	Acked-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2015-11-09  Pavel Grunt  <pgrunt@redhat.com>

	syntax-check: Add missing #include <config.h>

	red_dispatcher: Remove unused signal.h include

2015-11-09  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: group add_memslot
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	worker: remove unused NUM_CURSORS define
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	worker: make more functions static
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	worker: remove unused function
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	worker: rename {put,ref}_red_drawable
	Acked-by: Pavel Grunt <pgrunt@redhat.com>

	worker: s/destroy_surface/surface_unref
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-09  Frediano Ziglio  <fziglio@redhat.com>

	worker: remove unused parameter from remove_shadow
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2015-11-09  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: remove some useless counters
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	dispatcher: remove receive_data and send_data functions
	Use read_safe/write_safe instead which do the same stuff

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	server: create display and cursor channels in RedWorker constructor
	Instead of requiring the dispatcher to send a message to the worker to
	create the display channel and cursor channel, just create them when
	the worker is created.

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2015-11-06  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: use RED_CHANNEL_CLIENT for dcc
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-06  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

2015-11-06  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: move shadow_new() and container_new()
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: use more DCC_TO_WORKER
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: move some compress stats to display
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: rename WORKER_FOREACH_DCC_SAFE macro to FOREACH_DCC
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: remove unused WORKER_TO_DCC macro
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: rename red_pipe_add_drawable* to dcc_add_drawable*
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: move delta computation
	Move delta computation from red_add_drawable to red_current_add_with_shadow.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-05  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: move MonitorsConfig to display channel
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	worker: minor simplification
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-05  Frediano Ziglio  <fziglio@redhat.com>

	worker: don't process drawable if it can't be allocated
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-05  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: move DisplayChannel struct
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-04  Jonathon Jongsma  <jjongsma@redhat.com>

	style: prefer early return to large if blocks
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Remove unnecessary typedef from pixmap-cache.h
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-04  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: Move some dpi code to display channel
	This commit moves some DrawablePipeItem declarations to
	display-channel.h, though the function implementations remain in
	red_worker.c until they can be disentangled some more.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-04  Fabiano Fidêncio  <fidencio@redhat.com>

	cursor: fix wrong logic when initializing the channel
	It's a regression introduced by commit e601e920bd5. The logic error was
	introduced when trying to achieve the following code[0]. but rewritten
	to prefer an early return, which was wrogly negated.

	[0]:
	if (cursor_is_connected(worker)
	    && !COMMON_CHANNEL(worker->cursor_channel)->during_target_migrate) {
	        red_channel_pipes_add_type(RED_CHANNEL(worker->cursor_channel),
	                                   PIPE_ITEM_TYPE_CURSOR_INIT);
	}

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-04  Jonathon Jongsma  <jjongsma@redhat.com>

	Palette cache: Use correct marshal function
	In order to invalidate a single palette cache item, we were using
	spice_marshall_msg_cursor_inval_one(), which is the marshal function
	used to send an invalidation message for the Cursor channel's cache.
	This didn't cause any problems because SPICE_MSG_CURSOR_INVAL_ONE and
	SPICE_MSG_DISPLAY_INVAL_PALETTE have the same message ID and parameters,
	but it's better to use the correct marshalling function.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-04  Marc-André Lureau  <marcandre.lureau@gmail.com>

	Various changes in RedWorker and CursorChannel related to error and warning messages.
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Move monitors_config to display
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	s/process_drawable/process_draw
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-03  Marc-André Lureau  <marcandre.lureau@gmail.com>

	server: move renderer members to DisplayChannel
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-11-03  Frediano Ziglio  <fziglio@redhat.com>

	worker: remove only assigned set_client_capabilities_pending field
	This field is only assigned and never readed so can be removed.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-03  Marc-André Lureau  <marcandre.lureau@gmail.com>

	server: move bitmap related to spice-bitmap-utils
	Also remove some unused function parameters from
	bitmap_get_graduality_level()

	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: remove unused worker parameter
	Acked-by: Pavel Grunt <pgrunt@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Store QXLInstance in CursorItem
	Doing so allows us to remove the extra QXLInstance parameter from
	cursor_item_unref() and makes the code a bit cleaner.

	Also add cursor_item_ref().

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	server: make more of cursor private
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	server: make cursor channel private
	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

2015-11-02  Marc-André Lureau  <marcandre.lureau@gmail.com>

	Move pipe item enumerations out of red_worker.h
	Move the cursor-specific pipe item types to cursor-channel.h, and the
	display-specific types to red_worker.c. Only leave the common
	definitions in red_worker.h. This prepares for splitting the display
	channel into a separate file.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>

	server: move display_channel_client_create() to dcc_new()
	Move function from server/red_worker.c to new server/display-channel.c.

	Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	tree: move that to a separate unit
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	worker: s/repoll/poll_tries
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-10-30  Marc-André Lureau  <marcandre.lureau@gmail.com>

	Various minor style changes to worker and cursor channel
	Acked-by: Frediano Ziglio <fziglio@redhat.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>

	__new_channel -> red_worker_new_channel()
	Rename and lightly refactor the function that creates new common
	channels for RedWorker (essentially Cursor and Display channels).

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Make cursor_channel_disconnect a CursorChannel method
	The first argument should be CursorChannel* rather than RedChannel*
	since it's essentially a CursorChannel method.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-10-30  Francois Gouget  <fgouget@codeweavers.com>

	server: Hide the MJPEG encoder internals from red_worker.c

	server: Move the MJPEG encoder functions to mjpeg_encoder.c
	Note that this requires some adjustments to the encode_frame()
	parameters to avoid red_worker-specific types.

	server: Move mjpeg_encoder_new() to the end of mjpeg_encoder.c
	This also allows getting rid of a couple of forward definitions.

	server: Remove an unnecessary cast in encode_frame()

2015-10-30  Marc-André Lureau  <marcandre.lureau@gmail.com>

	Remove a couple single-use static functions
	red_cursor_marshall_inval(), red_migrate_cursor() and
	on_new_cursor_channel() were short functions that were each only called
	from a single location, so there's no need for them to be separate
	functions.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	CursorChannel* arg in cursor_channel_client_new()
	Instead of passing a CommonChannel* argument, use CursorChannel* since
	this function is only valid for CursorChannels.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	common_channel_client_create -> common_channel_new_client
	Rename and re-order the initial arguments to make this function look and
	act more like a method of the CommonChannel class.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Change red_marshall_verb() to accept a VerbItem
	Instead of passing a verb enumeration value, pass the verb pipe item

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	Remove unused parameter from cursor_channel_new()
	cursor_channel_new() is only called from one location, and always passes
	FALSE as the value for the 'migrate' paramater. In addition, this
	parameter is not used within the function. Remove it.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-10-29  Frediano Ziglio  <fziglio@redhat.com>

	server: remove undefined declaration

2015-10-29  Marc-André Lureau  <marcandre.lureau@gmail.com>

	Replace now() with get_mononotonic_time()
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	utils: add red_get_monotonic_time()

2015-10-29  Frediano Ziglio  <fziglio@redhat.com>

	worker: avoid to use constant directly for capabilities size
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

2015-10-29  Marc-André Lureau  <marcandre.lureau@gmail.com>

	Move red_bitmap_utils.h->tmpl.c
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	worker: move some cursor code to cursor-channel.c
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: rename some cursor functions
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: change CursorItem memory allocation
	Do not use static allocate space but handle dynamically

2015-10-28  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: remove unused type field from AddBufInfo
	value was always BUF_TYPE_RAW

	Acked-by: Uri Lublin <ulublin@redhat.com>

2015-10-28  Frediano Ziglio  <fziglio@redhat.com>

	worker: fix timer queue creation
	Timer queue is attached to current thread when created so it must be
	created from the proper thread.
	After worker initialization is moved in a following patch to main
	thread the queue was created in the wrong thread causing program to
	fail saying that the queue is NULL.

	Acked-by: Uri Lublin <ulublin@redhat.com>

2015-10-26  Marc-André Lureau  <marcandre.lureau@gmail.com>

	server: group worker channel related stuff
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	worker: remove need for WorkerInitData
	Move code around to declare and place it where it fits better.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	worker: access dispatcher pending field using helper functions

2015-10-23  Marc-André Lureau  <marcandre.lureau@gmail.com>

	server: split cache-item.h
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	server: start separate display/cursor channel headers
	Just move some declarations around

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	server: remove worker->id
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-10-23  Christophe Fergeau  <cfergeau@redhat.com>

	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-10-23  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.

	reduce locking time in async_command_alloc

	removed unused recv_core field

2015-10-23  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: remove useless MESSAGE_READY
	Now that worker is created before running, and run() returns success,
	there is no point in using MESSAGE_READY.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

	dispatcher: style update
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-10-22  Marc-André Lureau  <marcandre.lureau@gmail.com>

	server: remove worker thread creation from dispatcher
	Acked-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	server/dispatcher: move worker enums to dispatcher header
	Group enums with their respective struct location.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Fabiano Fidêncio <fabiano@fidencio.org>

2015-10-21  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: use a single clockid
	The stat functions in worker are not generic enough to deserve to be
	"non-worker", so just pass the worker instance.

2015-10-20  Marc-André Lureau  <marcandre.lureau@gmail.com>

	server: rename red_client_cache.h to cache_item.tmpl.c
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-10-19  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-10-19  Marc-André Lureau  <marcandre.lureau@gmail.com>

	worker: use GOnce to surround some global init in dispatcher
	Acked-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	server: move some pixmap cache code in own file
	Remove that hideous template header that should really be regular code
	since it's specialized and instanciated only for pixmap.

	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-10-19  snir sheriber  <ssheribe@redhat.com>

	fix spelling mistakes in comments (reseting to resetting & dummym to dummy)
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-10-16  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-16  Marc-André Lureau  <marcandre.lureau@gmail.com>

	Remove DRAW_ALL
	Acked-by: Frediano Ziglio <fziglio@redhat.com>

2015-10-15  Marc-André Lureau  <marcandre.lureau@gmail.com>

	Remove PIPE_DEBUG
	Acked-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove ACYCLIC_SURFACE_DEBUG
	Acked-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	Remove unfinished UPDATE_AREA_BY_TREE
	Acked-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	server: small move to red_channel
	Acked-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	worker: replace init with red_worker_new
	Acked-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

	red_worker: replace some abort()
	Acked-by: Frediano Ziglio <fziglio@redhat.com>
	Acked-by: Jonathon Jongsma <jjongsma@redhat.com>

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 isn’t 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
