Commit Graph

901 Commits

Author SHA1 Message Date
Alon Levy
4ca54e596f 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-11-01 14:29:46 +02:00
Alon Levy
3f71ed962f server/red_worker: wip: VALIDATE_SURFACE macros, remove asserts (but too late - should be done earlier) 2012-10-25 12:33:09 +02:00
Alon Levy
65b6c56cf8 release 0.12.1 2012-10-25 12:33:09 +02:00
Alon Levy
63bb37276e 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.
2012-10-25 12:33:02 +02:00
Alon Levy
2c85436dc6 server/red_worker: stride > 0 is tested, remove abort
Tested using the wip driver and xf86-video-modesetting.
2012-10-25 12:33:02 +02:00
Alon Levy
f0761ef894 server/tests/test_display_base: fix segfault in test 2012-10-25 12:31:39 +02:00
Alon Levy
488b7e4027 server/reds.c: split off reds-private.h 2012-10-25 12:31:39 +02:00
Uri Lublin
67d515b768 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-24 12:10:27 +02:00
Hans de Goede
cb27e9dad6 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.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-10-18 17:44:23 +02:00
Yonit Halperin
a179434aa9 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-11 20:23:47 +02:00
Christophe Fergeau
7f8905e58a 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 20:37:04 +02:00
Andrew Eikum
d958fc100c 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.
2012-10-01 19:13:12 +02:00
Andrew Eikum
0a62e33211 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-10-01 19:13:10 +02:00
Christophe Fergeau
4114b162ed 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.
2012-09-20 16:40:54 +02:00
Christophe Fergeau
bcec6627a2 reds: Check errors returned from SSL_CTX_set_cipher_list 2012-09-20 16:40:54 +02:00
Christophe Fergeau
3494eaf938 reds: Report errors from load_dh_params 2012-09-20 16:40:54 +02:00
Christophe Fergeau
1e5bf67c2b 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.
2012-09-20 16:40:54 +02:00
Christophe Fergeau
1c7fcefe1e 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.
2012-09-20 16:40:54 +02:00
Christophe Fergeau
5177c5fd09 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.
2012-09-20 16:40:54 +02:00
Christophe Fergeau
eb19ac081f 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-20 16:40:54 +02:00
Alon Levy
dc3cd205dd Release 0.12.0 2012-09-15 00:36:54 +03:00
Alon Levy
124984a171 server/spice-server.syms: add missing global labels
Although global is the default, this makes the file more consistent.
2012-09-13 16:43:01 +03:00
Alon Levy
c48812ee51 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.
2012-09-13 16:38:58 +03:00
Alon Levy
56eef9eeaa spice-server 0.11.5
Added api:
 QXL interface (3.2)
  client_monitors_config
2012-09-13 14:47:32 +03:00
Alon Levy
9e1d165fc0 server/tests: agent mock, client_monitors_config 2012-09-13 14:47:32 +03:00
Alon Levy
d694739b21 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.
2012-09-13 14:47:32 +03:00
Alon Levy
4338968aad server/reds: reuse already defined local 2012-09-13 14:47:32 +03:00
Alon Levy
dc69ef49d0 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.
2012-09-13 14:47:31 +03:00
Alon Levy
ce42c76aed 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
2012-09-13 14:47:31 +03:00
Alon Levy
c41616bb7f server/red_dispatcher: change a printerr to debug 2012-09-12 21:09:00 +03:00
Søren Sandmann Pedersen
b2683943fe Bump SPICE_INTERFACE_QXL_VERSION_MINOR
Then check that we have the right version before accessing the
set_client_capabilities() function.
2012-09-11 13:43:48 -04:00
Søren Sandmann Pedersen
88283023a8 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]);
2012-09-07 12:06:07 -04:00
Søren Sandmann Pedersen
7628b91a0b Set a8 capability in the QXL device if supported by the client 2012-09-07 12:06:07 -04:00
Søren Sandmann Pedersen
8855438ab6 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-07 12:05:50 -04:00
Søren Sandmann Pedersen
83b3e3f20d 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.
2012-09-06 13:04:11 -04:00
Alon Levy
5579d8721b server/red_parse_qxl: fix bitmap_consistent again 2012-09-05 23:00:55 +03:00
Jeremy White
5819976c7e Implement spice_server_set_exit_on_disconnect to enable an option whereby the spice server shuts down on client disconnect. 2012-09-05 19:18:34 +03:00
Alon Levy
bf29ff4296 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-05 19:18:31 +03:00
Alon Levy
1c4e315e3e 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 .
2012-09-03 19:27:22 +03:00
Alon Levy
f567f6b4cd 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.
2012-09-03 19:26:44 +03:00
Alon Levy
eab78033a6 server: replace syntax-check reported tabs with spaces 2012-09-03 14:56:56 +03:00
Alon Levy
078742b0ee server: add dist-hook to prevent spice version configure/spice.h difference 2012-09-03 10:31:02 +03:00
Alon Levy
a6b2c10c1e add server/tests/test_vdagent 2012-09-02 14:42:18 +03:00
Alon Levy
12c4349de7 server/tests/test_two_servers 2012-09-02 13:36:49 +03:00
Alon Levy
caea769943 server/tests: introduce Test struct 2012-09-02 13:36:41 +03:00
Alon Levy
897aaa7be5 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).
2012-08-30 17:08:10 +03:00
Alon Levy
3d28317e97 server: freezed->froze, missing whitespace after declarations 2012-08-30 17:08:09 +03:00
Alon Levy
4f7876e4c8 server: s/max_encdoers/max_encoders/ 2012-08-30 17:08:09 +03:00
Yonit Halperin
1dbe5af2ac server/inputs_channel.c: whitespace fix 2012-08-30 17:08:09 +03:00
Alon Levy
e9557228d8 server/red_tunnel_worker: remove unneeded expect_migrate_mark 2012-08-30 17:08:09 +03:00