Commit Graph

1044 Commits

Author SHA1 Message Date
Alon Levy
8b4ff62ddb 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-31 13:31:58 +03:00
Christophe Fergeau
048b003468 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.
2011-07-28 11:32:46 +02:00
Christophe Fergeau
830410e3be fix typo in big endian code path
uint63_t should be uint64_t
2011-07-28 11:32:46 +02:00
Hans de Goede
608713b9ac 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-26 14:16:07 +02:00
Hans de Goede
37a24a888f 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-25 12:21:46 +02:00
Alon Levy
7cb2997c71 Release 0.9.0 2011-07-23 18:42:31 +03:00
Alon Levy
b371824269 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 22:36:12 +03:00
Christophe Fergeau
47684d2885 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.
2011-07-22 16:53:56 +02:00
Christophe Fergeau
c12bafbc53 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.
2011-07-22 16:53:56 +02:00
Christophe Fergeau
3a433912e9 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.
2011-07-22 16:53:56 +02:00
Christophe Fergeau
ad55230a2d 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
2011-07-22 16:53:56 +02:00
Christophe Fergeau
b0cd4f4883 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.
2011-07-22 16:53:56 +02:00
Christophe Fergeau
d4305e16ad mjpeg_encoder: add mjpeg_encoder_get_bytes_per_pixel
Returns the number of bytes per pixel corresponding to the input
data format.
2011-07-22 16:53:56 +02:00
Christophe Fergeau
4275095ff9 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.
2011-07-22 16:53:56 +02:00
Christophe Fergeau
cacca4dce6 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.
2011-07-22 16:53:56 +02:00
Christophe Fergeau
1d808d31f4 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.
2011-07-22 16:53:56 +02:00
Christophe Fergeau
22743bee9f 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.
2011-07-22 16:53:56 +02:00
Christophe Fergeau
29b09d1a98 set version number to 0.9.0 2011-07-22 10:24:30 +02:00
Christophe Fergeau
e0e8d091ff fix make distcheck 2011-07-22 10:24:30 +02:00
Christophe Fergeau
4531c065ba 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.
2011-07-22 10:24:30 +02:00
Christophe Fergeau
d89991165a add SASL and smartcard to distcheck flags 2011-07-22 10:24:30 +02:00
Christophe Fergeau
eb6f554094 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
2011-07-22 10:24:30 +02:00
Christophe Fergeau
fc2f7d14a2 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
2011-07-22 10:24:30 +02:00
Christophe Fergeau
d81578ec0c client: split overlong option descriptions 2011-07-22 10:24:29 +02:00
Hans de Goede
765948d449 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 14:59:26 +02:00
Yonit Halperin
419222f0f3 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 12:43:37 +03:00
Hans de Goede
77a9a62556 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-21 11:15:24 +02:00
Yonit Halperin
51628f5124 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 16:00:19 +03:00
Alon Levy
3be08d68c0 server/spice.h: bump QXL_MINOR because of QXLWorker and QXLInterface changes 2011-07-20 16:00:19 +03:00
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
4db8f5efdd bump required spice-protocol to 0.8.1 for qxl_dev async and s3 updates 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
Alon Levy
a3cde2d971 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 20:33:25 +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
b8a1de3274 client: add missing "," in option list
In commit 44073d1b38 - 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-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
Uri Lublin
082431ba8d 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 18:15:40 +02:00
Christophe Fergeau
492f7a9b84 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
2011-07-18 18:15:40 +02:00
Christophe Fergeau
44073d1b38 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
2011-07-18 18:15:40 +02:00
Christophe Fergeau
933ca15ff4 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
2011-07-18 18:15:39 +02:00
Christophe Fergeau
40043d3bc2 client: match delete[] with new[]
vinfo in x11/platform.cpp is allocated using new[] so it needs to
be freed with delete[]
2011-07-18 18:15:39 +02:00
Christophe Fergeau
659499478e client: s/recive/receive 2011-07-18 18:15:39 +02:00