Commit Graph

240 Commits

Author SHA1 Message Date
Stefan Weil
969baca93e stream-device: Fix some typos in comments (found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-04-09 19:03:59 +02:00
Frediano Ziglio
ce0c4211e6 protocol: Fix enumeration deprecation for Visual Studio
Deprecation on enumeration items is not supported by Microsoft
compiler.
Define and use SPICE_GNUC_DEPRECATED_ENUMERATOR.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <uril@redhat.com>
2020-11-04 12:14:48 +00:00
Marc-André Lureau
6918bacfe5 vdagent: add a MonitorsMM field to VDAgentMonitorsConfig
Allow to update the physcial dimensions of the monitors,
only sent if the flag PHYSICAL_SIZE is present.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-09-14 09:41:01 +01:00
SimonP
cbe7b2c285 protocol: Add support for side mouse buttons
Side mouse buttons currently do not exist in the protocol, causing them
to be inexplicably ignored by VMs in virt-manager and such. This lays
the groundwork for fixing that issue.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-08-19 15:11:38 +01:00
Jakub Janků
7689b6922b vdagent: add VD_AGENT_CLIPBOARD_FILE_LIST
Signed-off-by: Jakub Janků <jjanku@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-07-08 15:47:41 +01:00
Frediano Ziglio
dcf21aafb9 vd_agent: Add some documentation
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2020-05-15 14:32:40 +01:00
Victor Toso
5ab1474cb5 Formally deprecated celt 0.5.1 usage
Quoting git log from spice-common 72b0d60 "build: Disable celt 0.5.1
by default" in 2018-06-05 [0]

  |  build: Disable celt 0.5.1 by default
  |
  |  This version of the CELT codec has long been obsolete, and
  |  Opus support has been added nearly 5 years ago. It's time
  |  we move on and try to stop using Celt ;)
  |  This commit disables CELT by default, but since
  |  this could be an unexpected change for packagers, if CELT
  |  0.5.1 development headers are installed, it will error
  |  out unless --enable-celt051/--disable-celt051 has
  |  been explicitly specified.

[0] https://gitlab.freedesktop.org/spice/spice-common/commit/72b0d60

This change is part of spice server since f5785db1 or v0.14.1 and
spice-gtk e6e9d7a or v0.35.

It is time to formally deprecated it and remove from all  components
in favor of opus mode.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-07 10:31:57 +01:00
Kevin Pouget
896aacee50 enums: add quality_indicator messages
These messages are used to exchange Streaming Quality messages between
SPICE client and SPICE server:

- `SPICE_MSGC_MAIN_QUALITY_INDICATOR`: a client->server message on the
  Main channel. This message is used by the client to share streaming
  quality observation with the server and the adaptive streaming
  control center. The format of the string message is not specified
  yet, it will depend of the sender/receiver final implementation.

- `SPICE_MSG_DISPLAY_QUALITY_INDICATOR`: a server->client message on
  the Display channel. This message is used to inform the client about
  adaptive-streaming specific details. The client should use it to
  configure its quality-message generation algorithms. The format of
  the string message is not specified yet, it will depend of the
  sender/receiver final implementation.

As an example, a `SPICE_MSG_DISPLAY_QUALITY_INDICATOR` message can
inform the client about the requested framerate (say, 60 FPS); and the
client will send a `SPICE_MSGC_MAIN_QUALITY_INDICATOR` warning message
when the measured framerate drops below 45 FPS.

Signed-off-by: Kevin Pouget <kpouget@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-04-02 13:34:35 +01:00
Frediano Ziglio
2d3324b899 vd_agent: Fix incompatibility with Microsoft compiler
Do not nest a zero-size array in another zero size array.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Marek Kedzierski <mkedzier@redhat.com>
2020-04-01 12:24:57 +01:00
Frediano Ziglio
edd2bb7143 vd_agent: Add some documentation
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2020-03-26 09:31:02 +00:00
Frediano Ziglio
0ceb92087e vd_agent: Fix indentation
Use 4 spaces, not 3.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-20 08:55:13 +00:00
Frediano Ziglio
dfc27e60d7 vd_agent: Add structure for VD_AGENT_FILE_XFER_STATUS_NOT_ENOUGH_SPACE details
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2020-03-19 14:36:05 +00:00
Frediano Ziglio
f224422c0d vd_agent: Add a new detail for VD_AGENT_FILE_XFER_STATUS_ERROR status
This will allow the agent to send back a more detailed error code.
More comments on header file.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2020-03-19 14:35:58 +00:00
Victor Toso
b0891e4c79 Remove foreign-menu and controller interfaces
Both were formally deprecated and announced for 0.14.1 release and can
be removed from the codebase.

    4816ae5 "foreign-menu: mark as deprecated" in 2020-03-06
    2981f21 "controller: mark as deprecated" in 2020-03-06

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-10 16:07:48 +00:00
Eduardo Lima (Etrunko)
33946522aa Remove autotools files in favor of meson
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-09 19:00:36 +00:00
Victor Toso
4816ae58d2 foreign-menu: mark as deprecated
This patch deprecates this interface and suggests to drop it in the
next release.

I don't know any user for this interface in the past 5 years. Spice
clients like remote-viewer do use oVirt API for foreign menu.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-06 10:46:00 +00:00
Victor Toso
2981f214d3 controller: mark as deprecated
This patch deprecates this interface and suggests to drop it in the
next release.

The last known user of this interface was spice-gtk, which dropped its
implementation in 2017-08-01 with

    spice-gtk@8da3378f "build-sys: remove the spice-controller library"

The commit log there has good enough justification to also drop this
in the protocol.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-03-06 10:45:55 +00:00
Marc-André Lureau
045a6978d6 vdagent: introduce VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL
When this capability is negoticated by both the client & the agent,
the clipboard grab messages have an associated serial counter.

The serial is reset to 0 upon client connection.

The counter is increment by 1 on each grab message, by both sides.

The sender of the message with the highest serial should be the
clipboard grab owner, and the current session serial should be
updated.

If a lower serial than the current session serial is received, the
grab should be discarded.

Whenever two grabs share the same serial, the one coming from the
client should have a higher priority and the client should gain the
clipboard ownership.

No special treatement is done for the unlikely case of overflowing the
counter. It may temporarily inverse the priority, until both side have
overflown and/or synchronized.

Note: this mechanism isn't aiming at making "the most recent" (as in
time) side gaining the ownership. One side sending subsequent grab
messages earlier will likely take the ownership over a side sending a
single message simultaneously the other way. It only clears the
situation where both side believe that the other is the current
clipboard owner, by having a global ordering and priority in case of
serial conflict.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2020-03-06 09:24:31 +01:00
Marc-André Lureau
4f397d695d vdagent: introduce VD_AGENT_CAP_CLIPBOARD_NO_RELEASE_ON_REGRAB
This capability means the peer will not send a release event between
two subsequent grabs. This helps with interaction issues with
clipboard managers which can be worked around by time-based filters at
this point. With this capability, there is no need for such filter.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2020-03-06 09:24:26 +01:00
Victor Toso
faed1bf410 vdi_dev: remove deprecated header
Deprecated since 2d7bf3e "vdi-dev: mark as deprecated" in 2014-12-04
and version 0.12.8.

Signed-off-by: Victor Toso <victortoso@redhat.com>
2020-03-02 18:23:16 +01:00
Victor Toso
1366a78cac vd_agent: remove VD_AGENT_CLIPBOARD_MAX_SIZE_[DEFAULT ENV]
Not used since fc1e7e "Mark VD_AGENT_CLIPBOARD_MAX as deprecated" in
2013-11-14, release v0.12.7

Signed-off-by: Victor Toso <victortoso@redhat.com>
2020-03-02 18:15:24 +01:00
Kevin Pouget
96d7dd9eef stream-device: Define Quality Indicator messages
These messages are used to transmit streaming quality indicators from
the streaming device to SPICE Server.

The message is a variable-length, zero-terminated string.

A new capability is introduced (STREAM_CAP_QUALITY_INDICATOR) for
SPICE server and streaming agent capabilities negotiation.

Signed-off-by: Kevin Pouget <kpouget@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-11-08 14:35:48 +00:00
Kevin Pouget
8ee9c7822c protocol: Define an enumeration for Quality Indicator messages
These messages are used to transmit streaming quality indicators from
SPICE client to SPICE server.

The message data structure is defined in spice-common/spice.proto:

    message {
        Data data @to_ptr;
    } @declare quality_indicator;

Signed-off-by: Kevin Pouget <kpouget@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-11-08 14:35:44 +00:00
Frediano Ziglio
7d28c75ba6 qxl_dev: Add comment to QXLQUICData->data field
Recently a bug using this structure was fixed.
The bug involved understand the usage of this field so add some
note on the field for future reference.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2019-08-22 13:30:26 +01:00
Francois Gouget
22f1b1297b protocol: Add some comments to vd_agentd.h
Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2019-08-07 10:39:45 +01:00
Frediano Ziglio
81f56cf07a start-packet: Correct misleading comment
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
2019-07-21 13:57:37 +01:00
Frediano Ziglio
2d34651f40 qxl_dev: Move QXLReleaseInfoExt out of start/end-packed.h
This structure is not declares as SPICE_ATTR_PACKED resulting it
as aligned and no packed using GCC (no MingW).
This structure is only packed under MingW or Microsoft compilers.
This structure is not technically a definition for QXL device but
is used only for spice-server QXL interface.
As said above this change could affect only MingW/Microsoft that is
only Windows ABI of spice-server (very recently added) so
following lines are really not much important.
Note that Windows does not support architectures with CPUs not
supporting unaligned access.
Under Win32 this change don't affect size so nothing much can change.
This structure is currently passed as value to release_resource
callback. Under Win64 this structure is passed like a
"const QXLReleaseInfoExt *" so even if the structure is 16 bytes instead
of 12 this is read the same way.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
2019-07-21 09:47:20 +01:00
Frediano Ziglio
f436204ead qxl_dev: Fix alignment for QXLReleaseInfo
Do not declare the structure as aligned.
The start/end-packed.h headers affects structures without
specification only using MingW or Microsoft compilers. For other
platform SPICE_ATTR_PACKED macro should be used.  This way the
definition are the same for all compiler.
This structure is used in a lot of QXL structures which are not
aligned causing to have an aligned structure to be potentially
unaligned. Some compilers may report a warning.
As this structure has no holes this change does not make any size
change using any compiler.
The change will only change the alignment from 4/8 to 1.
This could affect structures containing this union however beside
packed structure in qxl_dev.h (which are not affected) there are no
other usages affecting ABI by spice-gtk, Qemu or spice-server.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
2019-07-18 16:38:04 +01:00
Francois Gouget
5874495db3 macros: Remove unused SPICE_GNUC_XXX macros
We don't want to maintain more macros than necessary and these have
been unused for over two years.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-06-27 09:42:07 +01:00
Frediano Ziglio
f7ba19224d protocol: Generate enums.h again to remove old protocol definitions
spice.proto was updated to remove really old definitions,
update enums.h accordingly.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-03-29 16:06:32 +00:00
Frediano Ziglio
f6e4cb65da stats: Avoid holes in SpiceStat structure
The SpiceStat structure can be 20 or 24 bytes depending on alignment.
Being a memory mapped structure potentially used with lockless access,
it is not good to have it unaligned.
The only tool that we know of that reads this memory mapped file
(reds_stats) is able to detect if the structure is either 20 or 24
bytes and act accordingly so changing this structure won't affect the
behaviour (unless you have an old tool but as they are usually
packaged together this is quite improbable).
This will also help on Windows as in that system it is not possible
for reds_stats to implement the same discovery trick implemented on
Linux.  On Windows it is not possible to read the size of the file
mapping (on Windows to implement shared memory you can use a file
mapping not associated to a file).
The structure will change layout only on 32-bit architectures which is
not recommended nowadays (the 64-bit platforms that we support align
64-bit integers to 64 bits).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2019-01-17 17:10:58 +00:00
Lukáš Hrázký
5ab9f2f7a5 Add the StreamMsgGraphicsDeviceInfo message
The message contains information about the graphics device and monitor
belonging to a particular video stream (which maps to a channel) from
the streaming agent.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-01-16 13:48:25 +00:00
Lukáš Hrázký
839cd8c1dd Add the VDAgentGraphicsDeviceInfo message
The message serves for passing the device address and device display ID
information for all display channels from SPICE server to the vd_agent.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-01-16 13:48:02 +00:00
Frediano Ziglio
334cef51d0 error_codes: Remove obsolete header file
This file was used by the old client to hold return error codes.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Snir Sheriber <ssheribe@redhat.com>
2019-01-02 10:00:52 +00:00
Frediano Ziglio
beda5ec7a6 qxl_dev: Align QXLRam to 4 bytes
This avoids compilers detect misaligned access which can lead to
warnings.
In QEMU the structure is allocated at the beginning of a 4Kb page,
in Xspice is allocated with a calloc, so the structure will end up 4
bytes aligned as well with these users. We are not aware of other users
of QXLRam, but if there was, it's likely the struct would be at least
naturally aligned, so this change should not impact anyone.
Aligning to 4 bytes maintains the size of the structure unchanged
avoiding possible ABI changes.
clang currently generates an invalid function call if a misaligned
4 byte atomic operation is detected.

This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1565766

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-07-11 10:19:45 +01:00
Frediano Ziglio
dec80bfe28 Fix typo in comment
extrenal -> external

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2018-06-21 11:27:09 +01:00
Snir Sheriber
5e2001b0ed Add support for h265 video codec
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-19 15:31:32 +01:00
Frediano Ziglio
ccda863268 vd_agent: Do not define structures without fields
According to C standard the size of a structure without fields is
not defined (see
https://stackoverflow.com/questions/21851930/size-of-empty-structure-in-c-and-c).
As we almost only use GCC currently these structures are of size 0.
This can became a problem if 2 sides talking a given protocol use
these structures.
To avoid such possible mismatch (for instance having one side C and
the other C++ which defines these structures as having 1 as size) add
an empty (0-size array) field.
Although a 0-size array is not considered also that portable we use
extensively this feature with different compilers never encountering
issues.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2018-05-31 17:20:54 +01:00
Eduardo Lima (Etrunko)
440b515086 Add support for building with meson
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-08 10:38:22 +01:00
Victor Toso
545fbb8b11 streaming: define max of number of concurrent streams
This definition is lacking in client while in server it is hardcoded
to 50. Having a well defined limitation allow us to make the code
more robust and optimized.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-05 12:52:11 +01:00
Frediano Ziglio
87441524f4 stream-device: Define an enumeration to store capabilities constants
This will allow to define new capabilities.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe de Dinechin <dinechin@redhat.com>
2018-04-11 12:31:08 +01:00
Lukáš Hrázký
967ac4a24c stream-device.h: Remove the reference to the streaming port name
It is a duplicate information in a place where it is not necessary and
of little value.

Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-04-05 16:53:14 +02:00
Frediano Ziglio
235ac17349 stream-device: Specify how padding shoud be inside new structures
Depending on how structures are initialised in the code is
possible that implicit padding bytes are not initialised
causing possible information leaks as the entire structure
with all padding is sent through device/network.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe de Dinechin <dinechin@redhat.com>
2018-03-10 07:15:44 +00:00
Frediano Ziglio
bd279b1fc1 macros: Use Visual C++ built-ins for byte swapping if available
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-03-09 15:41:09 +00:00
Frediano Ziglio
d1dca6450c macros: Use GCC built-ins to swap bytes
GCC introduced __builtin_bswapXX intrinsics in a quite old
version.
As version 2 and 3 are no more used nowadays instead of manually
craft these functions using assembly language use the new built-ins.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-03-09 15:41:04 +00:00
Frediano Ziglio
4250216baf Allow to specify a surface will be streamed
This flag will allow the client to perform some optimisations
on output and buffering processing.
Old clients will ignore this additional flag.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2017-12-01 15:53:44 +00:00
Jonathon Jongsma
6371ecbcb1 Change STREAM_MSG_CAPABILITIES_MAX_BYTES
Clarify that this value specifies the size in bytes, not the number of
capabilities.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2017-11-09 11:43:00 -06:00
Jonathon Jongsma
e2176efb0e Add definition of STREAM_MSG_CAPABILITIES_MAX
This message is specified to have a size limit of 1024, so provide this
as a #define

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Christophe de Dinechin <dinechin@redhat.com>
2017-11-01 17:06:00 +01:00
Frediano Ziglio
c05cc91972 Add support for mouse movement
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe de Dinechin <cdupontd@redhat.com>
2017-09-15 18:47:04 +01:00
Frediano Ziglio
a419692ea9 Add support for setting cursor shape from guest
This allows to better support client mouse using streaming device

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe de Dinechin <cdupontd@redhat.com>
2017-09-15 18:47:04 +01:00