Commit Graph

504 Commits

Author SHA1 Message Date
Alon Levy
2a4d97fb78 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.
2011-07-20 16:00:19 +03:00
Alon Levy
b26f0532c1 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.
2011-07-20 16:00:19 +03:00
Alon Levy
f300de20d9 server/red_worker: handle_dev_input: reuse write_ready introduced for async 2011-07-20 16:00:19 +03:00
Alon Levy
096f49afbf 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
2011-07-20 16:00:19 +03:00
Alon Levy
c04d60631e 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.
2011-07-20 16:00:17 +03:00
Alon Levy
f4ba39fe0f server: spice-server.syms: move sasl symbols to 0.8.2 2011-07-20 11:08:37 +03:00
Alon Levy
16c844e374 server/red_worker: remove print on handle_dev_destroy_surfaces 2011-07-20 11:08:17 +03:00
Alon Levy
5120dfb284 server/red_worker: *_release_item: less frequent debug messages 2011-07-20 11:08:09 +03:00
Alon Levy
0378df6254 server/tests: test_util.h: fix double ASSERT definition 2011-07-20 11:05:44 +03:00
Gerd Hoffmann
7013561462 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.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-07-19 14:39:28 +02:00
Christophe Fergeau
f045886a06 remove unused function 2011-07-19 13:31:10 +02:00
Christophe Fergeau
c4d6f9791a 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 18:15:40 +02:00
Yonit Halperin
00086b8898 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.
2011-07-12 09:01:45 +03:00
Yonit Halperin
686b67473f 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-12 09:01:26 +03:00
Alon Levy
7e83957d22 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-06 13:52:20 +02:00
Yonit Halperin
6d17dbeb0b server: cursor_channel: releasing pipe items resources when the pipe is cleared (on disconnect)
same as commit 74a9d10af96f4d7c8c1b1d7fca124a8df9180787 for cursor channel
2011-07-05 17:23:39 +03:00
Yonit Halperin
6336f9413a 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.
2011-07-05 17:23:39 +03:00
Yonit Halperin
b881c4b5ca 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.
2011-07-05 17:23:38 +03:00
Yonit Halperin
3d3066b175 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
2011-07-05 17:23:38 +03:00
Yonit Halperin
7b34d1994e 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 17:23:38 +03:00
Alon Levy
86f7b490a9 server/tests/basic_event_loop: strange assert failure; fix 2011-07-05 14:08:30 +02:00
Alon Levy
8b5be0609f server/smartcard: register channel only when hardware is available 2011-07-05 14:04:36 +02:00
Alon Levy
392bb921dc Revert "server/smartcard: don't register the channel if no hardware emulated"
This reverts commit 456ff9f8d5.

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-29 12:06:51 +02:00
Christophe Fergeau
5ff78b617d 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-28 18:08:57 +02:00
Alon Levy
456ff9f8d5 server/smartcard: don't register the channel if no hardware emulated 2011-06-23 13:18:39 +02:00
Alon Levy
de82fdb9dc 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-23 13:18:39 +02:00
Christophe Fergeau
e261cb2d54 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.
2011-06-22 16:29:52 +02:00
Marc-André Lureau
0400769de1 sndworker: check the caps before sending volume messages 2011-06-22 12:12:51 +02:00
Marc-André Lureau
d1758b3288 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-22 12:12:26 +02:00
Alon Levy
65350d2ab3 server/smartcard: fix use after free 2011-05-24 13:19:09 +03:00
Alon Levy
34949178a8 server/red_worker: stat_now cleanup
static, remove inline, add (void), and empty line after function variables.
2011-05-09 09:59:57 +03:00
Alon Levy
db7d6c866e server/red_worker: fix typo (lats_send_time) 2011-05-09 09:46:26 +03:00
Alon Levy
87486fd790 server/tests: show port to connect to 2011-05-09 09:46:22 +03:00
Marc-André Lureau
148dabdf62 server: bump SPICE_SERVER_VERSION to 0.9.0
SASL functions will be released with 0.9.0
2011-05-08 19:05:41 +02:00
Zeeshan Ali (Khattak)
73dc16c02b server: Unset executable bit of red_tunnel_worker.h 2011-05-05 20:04:49 +03:00
Marc-André Lureau
138c421193 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’
2011-05-03 17:16:46 +02:00
Marc-André Lureau
aae0357023 build: require c99
Because we use c99: stdbool.h, inttypes.h, bool, variadic macros, // comments, ...
2011-05-03 16:49:43 +02:00
Christophe Fergeau
68c6014ff0 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.
2011-05-03 14:44:12 +02:00
Christophe Fergeau
48db4c2181 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.
2011-05-03 14:44:11 +02:00
Christophe Fergeau
f88dc6eecb server: use gcc builtin for atomic get/set bit 2011-05-03 14:44:11 +02:00
Christophe Fergeau
cdba4ead67 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.
2011-05-03 14:44:11 +02:00
Christophe Fergeau
e17767e892 add missing static 2011-05-03 14:44:11 +02:00
Christophe Fergeau
e0c20725c8 s/USE_OGL/USE_OPENGL
This is more explicit about what it does, and not much longer
2011-05-03 14:44:11 +02:00
Christophe Fergeau
78c1465ed3 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
2011-05-03 14:44:10 +02:00
Christophe Fergeau
2db7212175 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.
2011-05-03 14:44:10 +02:00
Christophe Fergeau
2a4614ea94 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-03 14:44:10 +02:00
Christophe Fergeau
da584a5e2d add missing "LGPLv2.1 or later" header to source files 2011-05-02 11:24:44 +02:00
Christophe Fergeau
2f187d5a71 server: s/desable/disable
This fixes a typo in some function names, there should be no
functional change.
2011-05-02 11:24:44 +02:00
Christophe Fergeau
8a1ceb65fa 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.
2011-05-02 11:24:44 +02:00
Christophe Fergeau
fa6956fff5 server: remove extra arg in reds_on_main_agent_start call 2011-05-02 11:24:44 +02:00