Given that libudev is widely available on many Linux distros, we
can use the relevant APIs to iterate over all the devices associated
with the drm subsystem to figure out if a specific vendor GPU
is available or not.
This capability (identifying GPU Vendor) is useful to determine
whether to launch Gstreamer pipeline using h/w accelerated
plugins. On systems where libudev is not available (Windows,
MacOS, etc) we'd have to make this determination based on the
availability of the relevant plugins in the Gstreamer registry.
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>
Cc: Hazwan Arif Mazlan <hazwan.arif.mazlan@intel.com>
Cc: Jin Chung Teng <jin.chung.teng@intel.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
EVP_PKEY_cmp was made obsolete in OpenSSL.
The main reason is that the return value is not coherent with
other *_cmp functions.
So it was replaced by EVP_PKEY_eq, which does the same.
Rename to avoid a deprecation warning on newer OpenSSL releases.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Win32 requires winsock2.h to be included in order to use ntohl.
To avoid the include use GUINT32_FROM_BE instead, already available.
This problem was reported by Biswapriyo Nath whom also tested the
solution for Win32.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
The caller use the "size" argument in different ways. Either the size of
the data to convert, or the end boundary to be deduced by offset.
Fix it so the the "size" argument means the amount in bytes of data to
convert, that seems simpler and saner. (yay C)
Fixes: spice#53
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Avoid buffer overflows decoding images. On compression we compute
lengths till end of line so it won't cause regressions.
Proved by fuzzing the code.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <uril@redhat.com>
Avoid some overflow in code due to images too big or
negative numbers.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <uril@redhat.com>
All paths already pass some data to quic_decode_begin but for the
test check it, it's not that expensive test.
Checking for not 0 is enough, all other words will potentially be
read calling more_io_words but we need one to avoid a potential
initial buffer overflow or deferencing an invalid pointer.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <uril@redhat.com>
There's no point on checking an empty IP address, an IP
address is never empty.
This also solve some compiler warnings trying to possibly
pass a NULL pointer to memcmp or setting a variable without
reading it.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <uril@redhat.com>
The "##" before __VA_ARGS__ is a GCC extension.
Try to limit its usage where necessary.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <uril@redhat.com>
In backtrace.h spice_backtrace is defined as:
#if defined(WIN32) && !defined(__MINGW32__)
#define spice_backtrace()
#else
..
so don't try to compile if an empty macro is used.
Currently not causing any issue as we use MingW on Windows but
does not hurt is code is more portable.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Uri Lublin <uril@redhat.com>
Instead of just plain preprocessor macros use an enum.
This is more type safe and could produce better debugging
type information.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Julien Ropé <jrope@gmail.com>
mode should be an enumeration value of SpiceAudioDataMode.
Return type is just a boolean.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Julien Ropé <jrope@gmail.com>
Some Windows headers define "small" causing issues.
Use "small_rect" instead. For coherence use "big_rect" instead of
"big".
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
SpiceCopy and SpiceBlend are typedefs of the same structure.
This to prove that canvas_draw_blend and canvas_draw_copy do
exactly the same thing.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Flexible arrays cannot have other fields following, even
if the fields are from a containing structure.
To fix this use an union and put the additional field inside
other structure in the union.
The final layout is the same but the compiler is not complaining.
This works on both GCC and Visual Studio.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Add agent.h and agent.c to deal with some common agent job:
- checking message from network and fixing network order.
- send back file transfer status.
Code based on Linux agent and Windows agent.
AgentXxxx and agent_xxx are used to avoid conflicts with protocol.
See agent.h for more detail on how to use these APIs.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This structure is not used by both spice-gtk and spice-server.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
This patch introduces `set_bitmap` and `test_bitmap` + relevant
macros, adapted from `<qemu>/include/qemu/bitops.h`.
These functions differ from `set_bit`/`test_bit` as they can set/test
bits in bit arrays longer than scalar data-types.
Signed-off-by: Kevin Pouget <kpouget@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
No need to compute these variable always, only if we have
a reference to a previous sequence.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
The loop is always executed once so use a do {} while construct
to avoid the repetition.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
Boundaries checks already done some lines above, no needs
to repeat for each pixel.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
"buffers" and "marshallers" are always pointing to the static
buffers inside the same structure.
Use single array fields to avoid having initialize and have them.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Julien Rope <jrope@redhat.com>
This macro was suggested to simplify hot path expensive checks
which should be disable in production environments.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Francesco Giudici <fgiudici@redhat.com>
Include headers required for implementation only in the
implementation file.
This remove dependency and avoid the user component having to
check for header flags (in this case HAVE_CELT051 and HAVE_OPUS).
This make easier integration in other components.
This also make compilation faster.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
quic_config is used only by the implementation so include it
only from the implementation file.
This remove dependency.
This make easier integration in other components.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>