Commit Graph

4808 Commits

Author SHA1 Message Date
Mohamed Akram
4f659065b3 build: Fix build on macOS
macOS does not have librt.

Signed-off-by: Mohamed Akram <mohd.akram@outlook.com>
2025-05-16 22:40:02 +01:00
Frediano Ziglio
b0374ff7da build: Prepare for 0.16 release
Quite some improvements to video encoding.
More details on change logs.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2025-05-05 17:06:36 +01:00
Qiang Yu
535b1b3572 red-qxl: add spice_qxl_gl_scanout2
For multi plane support.

Signed-off-by: Qiang Yu <yuq825@gmail.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2025-04-25 08:26:39 +01:00
Qiang Yu
4f94e844d7 dcc: use multi plane gl scanout message when possible
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2025-04-25 08:26:37 +01:00
Qiang Yu
e89c37a1da red-channel-client: send multiple fd at once
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2025-04-25 08:26:35 +01:00
Qiang Yu
07153b3c8c Update spice-common submodule
This is for:
  * new message gl_scanout2_unix
  * changed API spice_marshaller_get_fd(s)

Signed-off-by: Qiang Yu <yuq825@gmail.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2025-04-25 08:26:32 +01:00
Qiang Yu
cf678836a9 red-qxl: use RedGLScanout for multi plane support
Create a new scanout struct supporting multi plane.
We'll use this struct to create different protocol
message for clients with different capability.

Signed-off-by: Qiang Yu <yuq825@gmail.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2025-04-25 08:26:29 +01:00
Frediano Ziglio
bedd2e1bcb syntax-check: Add missing contributor name to AUTHORS
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2025-04-25 08:26:23 +01:00
Frediano Ziglio
4e169ee426 ci: Install missing package
Latest Fedora release does not include awk command by default.
Install it manually as required by some script.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2025-04-21 22:03:56 +01:00
Frediano Ziglio
bd378ad956 memslot: Detect host addresses and threat them verbatim
This allows to fix https://gitlab.freedesktop.org/spice/spice/-/issues/88.
Some technologies like ARM64 TBI, AMD UAI or Intel LAM use higher
address bits to store some additional information.
We should preserve such bits.
In order to do that detect if the group is for host addresses and
threat the address verbatim.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Tested-by: Momin Juned
2025-04-21 19:16:48 +01:00
Frediano Ziglio
272964dd34 build: Detect Gstreamer 1.24 using code, add Autoconf support
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Michael Scherle <michael.scherle@rz.uni-freiburg.de>
2025-04-01 21:00:42 +01:00
Frediano Ziglio
47c910fbd4 red-record-qxl: Fix space indentations
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2025-03-25 05:17:31 +00:00
Frediano Ziglio
a3a007efe2 Remove unused RedMemSlotInfo::internal_groupslot_id field
Last usage was commit d56745df19
(cfr "dcc: remove group_id from compression functions").

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2025-03-24 21:32:35 +00:00
Michael Scherle
36f79f251b dcc-send: Fix freeze when video stream is stopped during ongoing draw
Prevent a freeze that occurs if the video stream is stopped while a
gl draw is in progress (e.g., when the client requests a new codec).
Ensure proper cleanup of the ongoing gl draw.

Signed-off-by: Michael Scherle <michael.scherle@rz.uni-freiburg.de>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2025-03-16 05:09:02 +00:00
Vivek Kasireddy
0173d735a4 gstreamer-encoder: Map the drm format to appropriate Gstreamer format
We need to convert the scanout's drm format to the correct Gstreamer
format while configuring the pipeline. This can be done using
gst_video_dma_drm_fourcc_to_format() API, which will take the drm
fourcc value and return the appropriate Gst format.

Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
Signed-off-by: Michael Scherle <michael.scherle@rz.uni-freiburg.de>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2025-03-16 04:50:06 +00:00
Vivek Kasireddy
097c3ee188 video-stream: Don't stop a stream associated with gl_draw
We do not want to stop a stream associated with gl_draw as a result
of timeout because we may not get another opportunity to create a
new stream if the current one gets stopped. However, when the
stream does get stopped for other reasons, we need to clear the
gl_draw_stream pointer associated with the relevant DC.

Cc: Frediano Ziglio <freddy77@gmail.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Dongwon Kim <dongwon.kim@intel.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2025-03-16 04:50:01 +00:00
Vivek Kasireddy
63d82dad8e gstreamer-encoder: Add an encoder function that takes dmabuf fd as input
This patch adds a new function to enable the creation of Gst memory with
the dmabuf fd as the source by using a dmabuf allocator. And, it also
adds a mechanism to register and invoke any callbacks once the Gst memory
object is no longer used by the pipeline.

This patch also ensures that the source_fps value is always non-zero.

add dmabuf encoding if `drm/drm_fourcc.h` is present and
gstreamer is at least 1.24 due to
`gst_video_dma_drm_fourcc_to_format()`.

Cc: Frediano Ziglio <freddy77@gmail.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Dongwon Kim <dongwon.kim@intel.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
Signed-off-by: Michael Scherle <michael.scherle@rz.uni-freiburg.de>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2025-03-16 04:49:53 +00:00
Vivek Kasireddy
b2fcf9b3fe dcc-send: Encode and send gl_draw stream data to the remote client
For remote (or non-gl) clients, if a valid gl_draw stream exists,
then we first extract the dmabuf fd associated with the scanout and
share it with the encoder along with other key parameters such as
stride, width and height. Once the encoder finishes creating an
encoded buffer (using the dmabuf fd as input), we then send it
over to the client. And, as soon as the encoder notifies that it
is no longer using the dmabuf fd, we send a gl_draw_done async to
the application.

Cc: Frediano Ziglio <freddy77@gmail.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Dongwon Kim <dongwon.kim@intel.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2025-03-16 04:28:20 +00:00
Vivek Kasireddy
58e9e9837c dcc: Create a stream associated with gl_draw for non-gl clients
For non-gl/remote clients, if there is no stream associated with
the DisplayChannel, then we create a new stream. Otherwise, we
just update the current stream's timestamp.

Cc: Frediano Ziglio <freddy77@gmail.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Dongwon Kim <dongwon.kim@intel.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2025-03-16 04:05:43 +00:00
Frediano Ziglio
4227b86bf3 tests: Add missing output file to gitignore list
Ignore generated output files.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2025-03-16 03:50:40 +00:00
Vivek Kasireddy
64acc8749f dcc: Check to see if the client supports multiple codecs
We need to determine if the client is new enough to support multiple
codecs -- which might include any of the Gstreamer based ones.

Cc: Frediano Ziglio <freddy77@gmail.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Dongwon Kim <dongwon.kim@intel.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2025-03-15 20:32:36 +00:00
Vivek Kasireddy
0d7aecd623 gstreamer-encoder: Use a h/w based encoder with Intel GPUs if possible
Once it is determined that an Intel GPU is available/active (after
looking into udev's database), we try to see if there is a h/w
based encoder (element) available (in Gstreamer's registry cache)
for the user selected video codec. In other words, if we find that
the Intel Media SDK Gstreamer plugin (libgstmsdk.so) and associated
libraries (such as va or vaapi) are all installed properly, we add
the appropriate h/w based encoder and post-processor/converter
elements to the pipeline (along with any relevant options) instead
of the s/w based elements.

For example, if the user selects h264 as the preferred codec format,
msdkh264enc and vapostproc will be preferred instead of x264enc
and videoconvert.

Cc: Frediano Ziglio <freddy77@gmail.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Dongwon Kim <dongwon.kim@intel.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
Co-developed-by: Jin Chung Teng <jin.chung.teng@intel.com>
Co-developed-by: Hazwan Arif Mazlan <hazwan.arif.mazlan@intel.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2025-03-15 17:15:13 +00:00
Frediano Ziglio
8af20a7cf1 syntax-check: Add missing contributor name to AUTHORS
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2025-03-15 10:19:55 +00:00
Weishi Li
475f46acc4 jpeg: optimize compression process
similiar to mjpeg, when defined JCS_EXTENSIONS, there
is no need to convert BGR24/BGRX32 to RGB24.

Signed-off-by: Weishi Li <liweishi@kylinos.cn>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2025-03-13 07:52:04 +00:00
Michael Scherle
4d46576887 Update spice-common submodule
This brings in the following changes:
      common: Add a udev helper to identify GPU Vendor
      build: Avoid Meson warning
      Drop Python 2 from m4/spice-deps.m4
      Stop using Python six package
      codegen: Use context manager when opening files

Signed-off-by: Michael Scherle <michael.scherle@rz.uni-freiburg.de>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2025-03-02 17:36:12 +00:00
Michael Scherle
7c12352b2b ci: Fix platform specifier for podman
Platform specifiers have the format `<os>|<arch>|<os>/<arch>[/<variant>]`
(<9b464c3fab/platforms.go (L69)>).
Podman is more strict than docker in parsing and does not allow to specify
`<arch> only.

Signed-off-by: Michael Scherle <michael.scherle@rz.uni-freiburg.de>
2024-11-20 14:14:47 +01:00
Michael Scherle
f8534b477c ci: Fix debian32 job
Gitlab runner fails to pull the image due to:
no matching manifest for linux/amd64 in the
manifest list entries. Set the architecture of the
image to pull, see:
https://docs.gitlab.com/ee/ci/yaml/#imagedocker

Signed-off-by: Michael Scherle <michael.scherle@rz.uni-freiburg.de>
2024-11-20 11:14:11 +01:00
Michael Scherle
a2b037b1fc ci: Fix windows job
mingw64-openssl-3.2.2-2 breaks TLS,
fixing it to fedora 40 for now, so that a working
mingw64-openssl package is used.

Signed-off-by: Michael Scherle <michael.scherle@rz.uni-freiburg.de>
2024-11-20 11:14:11 +01:00
Michael Scherle
da26dd87dc ci: Fix websocket-autobahn job
Last Automat library fails to install on the container.
Similar to 71a1b112.

Signed-off-by: Michael Scherle <michael.scherle@rz.uni-freiburg.de>
2024-11-20 11:14:03 +01:00
Marc-André Lureau
f0eb8cc57d Warn on invalid surface_id at qxl_spice_destroy_surface_wait()
Fixes:
https://gitlab.freedesktop.org/spice/spice/-/issues/83

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2024-06-12 12:40:33 +01:00
Frediano Ziglio
7e56fc9fd9 Send real time to client
Do not offset the time attempting to fix client latency.
Client should handle it by itself.

This remove entirely the delay introduced by the server.
This avoids surely possible time drifts in the client.
The server just sends it's concept of time without trying to force any
delay. Only one end should handle this delay in an attempt to
synchronize audio and video instead that doing it in both ends.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2024-06-04 20:32:25 +01:00
Frediano Ziglio
1372edae95 syntax-check: Add missing contributor name to AUTHORS
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2024-05-28 21:43:20 +01:00
Frediano Ziglio
b92149f2b9 tests: Remove warning compiling
Remove:

    test-display-streaming.c: In function 'get_commands':
    test-display-streaming.c:218:42: error: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
      218 |     *commands = (Command*) calloc(sizeof(Command), *num_commands);
          |                                          ^~~~~~~
    test-display-streaming.c:218:42: note: earlier argument should specify number of elements, later size of each element

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2024-05-27 19:03:45 +01:00
osy
4674667f0c red-stream: disable socket_set_cork() on Darwin
TCP_NOPUSH is broken and cannot be used.

Signed-off-by: osy <osy@turing.llc>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2024-05-26 16:41:37 +01:00
osy
7c5f3d5e40 red-qxl: remove cookie assertion on scanout
The original check ensures we do not have an outstanding GL_DRAW. However,
in QEMU, there is no guarantee that a scanout cannot happen while the async
GL_DRAW has not returned a result yet. This introduces a race where if a
scanout is called while there is an outstanding GL_DRAW, QEMU will crash.

Signed-off-by: osy <osy@turing.llc>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2024-05-26 16:34:02 +01:00
Frediano Ziglio
fe1c25f530 test-listen: Use OpenSSL BIO instead of GIO library
test-listen using GIO had issues running under CI for a while.
GIO is reading some desktop configuration so it's not very CI
friendly.
So instead of using GIO use OpenSSL BIO. The code does not
get much bigger or complicated.
We are already using OpenSSL so we are not adding dependencies.

This fixes CI for Fedora 39 (just released and available on docker).

This allowed to remove an old workaround for GIO in .gitlab-ci.yml
(cfr commit 89edf80821
"ci: Workaround an issue with GLib on Fedora 30")

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2023-11-22 07:36:40 +00:00
Frediano Ziglio
7cfebdf61b red-stream: Fix typo in comment
renogotiation -> renegotiation

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2023-11-15 18:40:35 +00:00
Vivek Kasireddy
3208be4521 gstreamer-encoder: Use an env var to override converter format
If we use the x264enc encoder to encode a stream, then videoconvert
would convert the BGRx data into Y444, which is the preferred format
for x264enc. However, some decoders particularly the ones that are
h/w based cannot work with Y444 if it was the format used by the
encoder. Therefore, to address these situations, we need a way to
override the format used during the encoding stage which can be
accomplished by using the environment variable introduced in this
patch: SPICE_CONVERTER_PREFERRED_FORMAT.

For example, using NV12 as the output format for the videoconvert
element would allow us to pair a s/w based encoder (such as x264enc)
with a h/w based decoder (such as msdkh264dec) for decoding the
stream as most h/w based decoders only work with NV12 format given
its popularity.

Note that choosing an encoder format such as NV12 over Y444 would
probably result in decreased video quality although it would be
compatible with more decoders. Ideally, the client and server need
to negotiate a suitable format dynamically but the current
capabilities do not allow for such exchange.

Cc: Frediano Ziglio <freddy77@gmail.com>
Cc: Dongwon Kim <dongwon.kim@intel.com>
Based-on-patch-by: Hazwan Arif Mazlan <hazwan.arif.mazlan@intel.com>
Signed-off-by: Jin Chung Teng <jin.chung.teng@intel.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2023-11-15 18:04:56 +00:00
Frediano Ziglio
fe4723d176 build: Remove support for GStreamer 0.10
Deprecated since 2016.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2023-09-17 10:00:41 +01:00
Frediano Ziglio
8f315a45e6 ci: Do not deep clone spice-protocol repository
Same some network traffic, we don't need to clone entire
git repository history.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2023-05-30 20:35:57 +01:00
Frediano Ziglio
b21dc45a00 ci: Add "setup" subcommand to meson call to avoid warning
Newer meson output a warning if "setup" is not provided.
Remove that warning.
Note that Windows build was not changed due to a bug in mingw-meson
script causing duplication of arguments.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2023-05-30 20:35:57 +01:00
Frediano Ziglio
dd40fd32b9 ci: Test some more flags for meson-options
"lz4" and "tests" flags are by default "true", test we can build
if they are "false".

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2023-05-30 20:35:57 +01:00
Frediano Ziglio
f60d61186f ci: Update makecheck-windows job to Meson
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2023-05-30 20:35:57 +01:00
Frediano Ziglio
48590b23ba ci: Update makecheck-centos job
Update to stream9 instead of stream8.
Move to Meson instead of Autoconf as build system.
Remove libcacard-devel, not available.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2023-05-30 20:35:57 +01:00
Biswapriyo Nath
3dfd5243c7 smartcard: Fix compiling for Windows platform
This fixes the following compiler error while targeting Windows platform.

../../server/smartcard.cpp:20:10: fatal error: arpa/inet.h: No such file or directory
   20 | #include <arpa/inet.h>
      |          ^~~~~~~~~~~~~

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2023-05-30 19:44:15 +01:00
orbea
5e580eefac server: add SSL_OP_NO_RENEGOTIATION fallback path
With LibreSSL SSL_OP_NO_CLIENT_RENEGOTIATION is opaque which is not
compatible with the OpenSSL 1.0.2 and earlier code path in
red-stream.cpp while SSL_OP_NO_RENEGOTIATION is not yet defined for the
newer OpenSSL code path in reds.cpp.

So with OpenSSL 1.1.0 and later if SSL_OP_NO_RENEGOTIATION is undefined
and SSL_OP_NO_CLIENT_RENEGOTIATION is defined then define the former as
the latter. This will allow the build to succeed with LibreSSL 3.7.2 and
in the future when newer LibreSSL versions add SSL_OP_NO_RENEGOTIATION
that code path will then be used automatically.

Signed-off-by: orbea <orbea@riseup.net>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
2023-05-26 22:41:44 +01:00
Frediano Ziglio
0c2c1413a8 build: Prepare for 0.15.2 release
Really minor release.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2023-05-11 12:26:06 +01:00
Frediano Ziglio
77611e5490 build: Add missing file to distribution
Required to build using Meson.
Also add a check to "distcheck" job to test you can build with
Meson from distribution file.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2023-05-11 12:26:06 +01:00
Frediano Ziglio
313932ea02 ci: Remove broken OpenSSL configuration to fix makecheck-windows job
The configuration installed with mingw64-openssl cause OpenSSL
to fail to initialize during execution with Wine.
Delete it and use the compiled in options.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2023-05-10 14:33:09 +01:00
Frediano Ziglio
e625a10a7a Update OpenSSL call
SSLv23_method call was deprecated in favour of TLS_method.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2023-05-10 11:17:47 +01:00