spice/server
Vivek Kasireddy 34e342a2f7 gstreamer-encoder: Use a h/w based encoder with Intel GPUs if possible (v5)
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.

v2: (addressed some review comments from Frediano)
- Moved the udev helper into spice-common
- Refactored the code to choose plugins in order msdk > va > vaapi

v3: (Frediano)
- Added relevant encoder options for mjpeg and vp9 codecs (Jin Chung)

v4: (Fixups from Frediano)
- Free the encoder when we cannot find vpp
- Change type and find plugins array length using G_N_ELEMENTS
- Fix gstenc_name UAF by freeing it at the end of the function
- Use g_str_has_prefix instead of strstr
- Include the string "_hw_" in function names that deal with
  h/w based plugins
- Rebase on master

v5: rebase on master

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>
2024-05-28 10:28:33 -07:00
..
tests tests: Remove warning compiling 2024-05-27 19:03:45 +01:00
.gitignore gitignore: Reuse top-level gitignore 2016-12-14 19:09:21 +00:00
agent-msg-filter.c Improve big endian support for agent messages 2020-10-25 20:01:54 +00:00
agent-msg-filter.h Declare exported functions as C 2020-05-01 06:58:08 +01:00
cache-item.h cache-item: Move RedCachePipeItem declaration to common-graphics-channel.h 2020-06-23 13:24:06 +01:00
cache-item.tmpl.cpp Use smart pointers for RedPipeItem 2020-07-13 19:48:08 +01:00
char-device.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
char-device.h Use smart pointers for RedPipeItem 2020-07-13 19:48:08 +01:00
common-graphics-channel.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
common-graphics-channel.h red-pipe-item: Add and use a small utility class for easier initialization 2020-07-13 19:47:55 +01:00
cursor-channel-client.cpp cursor-channel-client: Remove unused variable 2021-06-04 08:56:44 +01:00
cursor-channel-client.h Remove GObject from RedChannel 2020-05-01 06:58:09 +01:00
cursor-channel.cpp red-parse-qxl: Use a base reference class for RedCursorCmd 2021-08-04 13:01:05 +01:00
cursor-channel.h red-parse-qxl: Use a base reference class for RedCursorCmd 2021-08-04 13:01:05 +01:00
dcc-private.h several conversions to std::array 2021-08-23 10:41:11 +01:00
dcc-send.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
dcc.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
dcc.h Fix std::array<> has initializer but incomplete type 2022-07-19 10:04:51 +01:00
dispatcher.cpp clang-tidy: replace C headers with C++ 2021-08-26 07:35:09 +01:00
dispatcher.h dispatcher: Update documentation 2020-06-25 09:12:37 +01:00
display-channel-private.h several conversions to std::array 2021-08-23 10:41:11 +01:00
display-channel.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
display-channel.h several conversions to std::array 2021-08-23 10:41:11 +01:00
display-limits.h Receive the GraphicsDeviceInfo message from the streaming agent 2019-01-29 15:46:54 +01:00
event-loop.c event-loop: Avoid useless cast 2020-06-29 09:14:25 +01:00
glib-compat.h Fix g_memdup deprecation warning with glib >= 2.68 2021-05-05 06:35:56 +01:00
glz-encode-match.tmpl.c Do not check for HAVE_CONFIG_H 2019-04-30 09:26:55 +01:00
glz-encode.tmpl.c glz-encode: Remove obsolete reference segment 2019-08-12 10:48:02 +01:00
glz-encoder-dict.c clang-tidy: do not use else after return 2021-04-11 07:49:21 +01:00
glz-encoder-dict.h Make headers independent 2021-05-18 10:13:41 +01:00
glz-encoder-priv.h glz-encoder-dict: Remove useless __packed__ attribute 2019-08-02 10:55:20 +01:00
glz-encoder.c clang-tidy: use uppercase numeric literals 2021-05-09 07:00:21 +01:00
glz-encoder.h Declare exported functions as C 2020-05-01 06:58:08 +01:00
gstreamer-encoder.c gstreamer-encoder: Use a h/w based encoder with Intel GPUs if possible (v5) 2024-05-28 10:28:33 -07:00
image-cache.cpp clang-tidy: use nullptr 2021-04-12 06:50:05 +01:00
image-cache.h Remove useless typedefs 2021-08-26 20:59:41 +01:00
image-encoders.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
image-encoders.h Declare exported functions as C 2020-05-01 06:58:08 +01:00
inputs-channel-client.cpp clang-tidy: use nullptr 2021-04-12 06:50:05 +01:00
inputs-channel-client.h inputs-channel-client: Update RECEIVE_BUF_SIZE 2020-07-02 21:17:58 +01:00
inputs-channel.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
inputs-channel.h clang-tidy: fix inconsistent declarations 2021-05-09 11:19:30 +01:00
jpeg-encoder.c Avoid build error caused by conflicting types for INT32 2021-04-15 08:51:44 +01:00
jpeg-encoder.h Make headers independent 2021-05-18 10:13:41 +01:00
lz4-encoder.c Do not check for HAVE_CONFIG_H 2019-04-30 09:26:55 +01:00
lz4-encoder.h Make headers independent 2021-05-18 10:13:41 +01:00
main-channel-client.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
main-channel-client.h clang-tidy: fix inconsistent declarations 2021-05-09 11:19:30 +01:00
main-channel.cpp Report name/uuid and agent connected tokens support. 2022-01-04 10:16:19 +00:00
main-channel.h clang-tidy: fix inconsistent declarations 2021-05-09 11:19:30 +01:00
main-dispatcher.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
main-dispatcher.h Wrap spice.h in order to do some adjustment 2020-05-01 06:58:09 +01:00
Makefile.am red-parse-qxl: Use a base reference class for RedCursorCmd 2021-08-04 13:01:05 +01:00
memslot.c clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
memslot.h Declare exported functions as C 2020-05-01 06:58:08 +01:00
meson.build red-parse-qxl: Use a base reference class for RedCursorCmd 2021-08-04 13:01:05 +01:00
migration-protocol.h Use start/end-packet.h headers instead of direct GCC attribute 2019-07-22 14:56:00 +01:00
mjpeg-encoder.c Avoid build error caused by conflicting types for INT32 2021-04-15 08:51:44 +01:00
net-utils.c Fix setsockopt on FreeBSD 2021-04-17 13:19:17 +01:00
net-utils.h Fix compatibility with MSG_NOSIGNAL and Darwin 2020-05-19 10:01:47 +01:00
pixmap-cache.cpp Removed only written "items" field from PixmapCache 2021-05-18 08:38:27 +01:00
pixmap-cache.h Remove useless typedefs 2021-08-26 20:59:41 +01:00
pop-visibility.h Reduce C++ symbols visibility 2020-05-01 06:58:09 +01:00
push-visibility.h Reduce C++ symbols visibility 2020-05-01 06:58:09 +01:00
red-channel-capabilities.c Fix g_memdup deprecation warning with glib >= 2.68 2021-05-05 06:35:56 +01:00
red-channel-capabilities.h red-channel-capabilities: Removed unused stuff from RedChannelCapabilities 2020-05-01 06:58:09 +01:00
red-channel-client.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
red-channel-client.h red-channel-client: Make RedChannelClient::pipe_item_is_linked const 2020-07-20 10:17:20 +01:00
red-channel.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
red-channel.h Use smart pointers for RedPipeItem 2020-07-13 19:48:08 +01:00
red-client.cpp red-client: Remove FOREACH_CHANNEL_CLIENT macro 2021-06-01 09:02:48 +01:00
red-client.h Use red::shared_ptr_counted for RedChannelClient 2020-05-01 06:58:09 +01:00
red-common.h red-common: Fix typo in comment 2020-06-04 11:07:32 +02:00
red-parse-qxl.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
red-parse-qxl.h Remove useless typedefs 2021-08-26 20:59:41 +01:00
red-pipe-item.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
red-pipe-item.h red-pipe-item: Remove red_pipe_item_(un)ref 2020-07-13 19:48:18 +01:00
red-qxl.cpp red-qxl: remove cookie assertion on scanout 2024-05-26 16:34:02 +01:00
red-qxl.h Declare exported functions as C 2020-05-01 06:58:08 +01:00
red-record-qxl.cpp Remove useless typedefs 2021-08-26 20:59:41 +01:00
red-record-qxl.h Declare exported functions as C 2020-05-01 06:58:08 +01:00
red-replay-qxl.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
red-stream-device.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
red-stream-device.h Use smart pointers for RedPipeItem 2020-07-13 19:48:08 +01:00
red-stream.cpp red-stream: disable socket_set_cork() on Darwin 2024-05-26 16:41:37 +01:00
red-stream.h server: add SSL_OP_NO_RENEGOTIATION fallback path 2023-05-26 22:41:44 +01:00
red-worker.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
red-worker.h red-worker: Limit visibility 2021-06-01 22:08:55 +01:00
reds-private.h Adapt to new OpenSSL with less conditional code 2022-08-03 19:03:08 +01:00
reds.cpp build: Remove support for GStreamer 0.10 2023-09-17 10:00:41 +01:00
reds.h Wrap spice.h in order to do some adjustment 2020-05-01 06:58:09 +01:00
safe-list.hpp Fix C++ compatibility issue 2022-07-19 10:11:55 +01:00
smartcard-channel-client.cpp Use smart pointers for RedPipeItem 2020-07-13 19:48:08 +01:00
smartcard-channel-client.h char-device: Remove GObject from RedCharDevice 2020-05-01 06:58:09 +01:00
smartcard.cpp smartcard: Fix compiling for Windows platform 2023-05-30 19:44:15 +01:00
smartcard.h Use smart pointers for RedPipeItem 2020-07-13 19:48:08 +01:00
sound.cpp sound: Fix pointer arithmetic in snd_record_handle_write() 2022-10-22 20:58:02 +01:00
sound.h sound: Make functions exported not visible 2020-05-01 06:58:09 +01:00
spice-audio.h clang-tidy: fix inconsistent declarations 2021-05-09 11:19:30 +01:00
spice-bitmap-utils.c clang-tidy: do not use else after return 2021-04-11 07:49:21 +01:00
spice-bitmap-utils.h Declare exported functions as C 2020-05-01 06:58:08 +01:00
spice-bitmap-utils.tmpl.c Use local variable to compute gradual score 2020-02-27 07:55:43 +00:00
spice-char.h clang-tidy: fix inconsistent declarations 2021-05-09 11:19:30 +01:00
spice-core.h windows: Do not include headers not available on Windows 2019-01-31 10:48:34 +00:00
spice-input.h Declare public exported functions as C 2020-05-01 06:58:08 +01:00
spice-migration.h Declare public exported functions as C 2020-05-01 06:58:08 +01:00
spice-qxl.h clang-tidy: fix inconsistent declarations 2021-05-09 11:19:30 +01:00
spice-replay.h Declare public exported functions as C 2020-05-01 06:58:08 +01:00
spice-server-enums.c.tmpl Avoids registering type just to get the nick of an enum value 2020-05-01 06:58:09 +01:00
spice-server-enums.h.tmpl Avoids registering type just to get the nick of an enum value 2020-05-01 06:58:09 +01:00
spice-server.h Declare public exported functions as C 2020-05-01 06:58:08 +01:00
spice-server.syms Remove reference to removed ABI 2019-08-15 11:16:42 +01:00
spice-version.h.in build-sys: generate spice-version.h 2014-11-27 14:27:33 +01:00
spice-wrapped.h sound: Move define "trick" to spice-wrapped.h header 2020-05-28 14:37:36 +01:00
spice.h Make red-replay-qxl.h a public header 2016-11-10 06:37:15 +00:00
spicevmc.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
stat-file.c stat-file: Use proper macro for container computation 2019-08-22 08:53:23 +01:00
stat-file.h Make headers independent 2021-05-18 10:13:41 +01:00
stat.h Wrap spice.h in order to do some adjustment 2020-05-01 06:58:09 +01:00
stream-channel.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
stream-channel.h clang-tidy: fix inconsistent declarations 2021-05-09 11:19:30 +01:00
sw-canvas.c Do not check for HAVE_CONFIG_H 2019-04-30 09:26:55 +01:00
sys-socket.c sys-socket: Add socket_newpair utility 2019-05-07 10:14:05 +01:00
sys-socket.h Fix compatibility with MSG_NOSIGNAL and Darwin 2020-05-19 10:01:47 +01:00
tree.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
tree.h Remove useless typedefs 2021-08-26 20:59:41 +01:00
utils.c Do not check for HAVE_CONFIG_H 2019-04-30 09:26:55 +01:00
utils.h Declare exported functions as C 2020-05-01 06:58:08 +01:00
utils.hpp utils: Add a base light class for reference counting 2021-08-04 13:01:01 +01:00
video-encoder.h build: Remove support for GStreamer 0.10 2023-09-17 10:00:41 +01:00
video-stream.cpp clang-tidy: use C++ casting 2021-09-28 09:36:49 +01:00
video-stream.h Remove useless typedefs 2021-08-26 20:59:41 +01:00
websocket.c clang-tidy: fix inconsistent declarations 2021-05-09 11:19:30 +01:00
websocket.h Declare exported functions as C 2020-05-01 06:58:08 +01:00
zlib-encoder.c Do not check for HAVE_CONFIG_H 2019-04-30 09:26:55 +01:00
zlib-encoder.h Make headers independent 2021-05-18 10:13:41 +01:00