summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Cap logging level to the valid boundsHEADmasterFrediano Ziglio2016-03-111-1/+2
| | | | | | | Avoid overflows using its values. The patch was originally written by Christophe Fergeau Acked-by: Victor Toso <victortoso@redhat.com>
* Remove 2 unused vfuncs from client_marshallers.hChristophe Fergeau2016-03-111-2/+0
| | | | | | The AudioVolume and AudioMute messages are not sent by the client, so they do not need to appear in SpiceMessageMarshallers in client_marshallers.h
* protocol: Add support for the VP8 and h264 video codecsFrancois Gouget2016-03-101-0/+2
| | | | | | | | | | | | | Clients that support multiple codecs must advertise the SPICE_DISPLAY_CAP_MULTI_CODEC capability and one SPICE_DISPLAY_CAP_CODEC_XXX per supported codec. Signed-off-by: Francois Gouget <fgouget@codeweavers.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com> (cherry picked from spice-protocol commit 7937915d67702a5c4b5147b277c432f5555e3852) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* protocol: add unix GL scanout messagesMarc-Andre Lureau2016-03-101-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add 2 new messages to the display channel to stream pre-rendered GL images of the display. This is only possible when the client supports SPICE_DISPLAY_CAP_GL_SCANOUT capability. The first message, SPICE_MSG_DISPLAY_GL_SCANOUT_UNIX, sends a gl image file handle via socket ancillary data, and can be imported in a GL context with the help of eglCreateImageKHR() (as with the 2d canvas, the SPICE_MSG_DISPLAY_MONITORS_CONFIG will give the monitors coordinates (x/y/w/h) within the image). There can be only one scanount per display channel. A SPICE_MSG_DISPLAY_GL_DRAW message is sent with the coordinate of the region within the scanount to (re)draw on the client display. For each draw, once the client is done with the rendering, it must acknowldge it by sending a SPICE_MSGC_DISPLAY_GL_DRAW_DONE message, in order to release the context (it is expected to improve this in the future with a cross-process GL fence). The relation with the existing display channel messages is that all other messages are unchanged: the last drawing command received must be displayed. However the scanout display is all or nothing. Consequently, if a 2d canvas draw is received, the display must be switched to the drawn canvas. In other words, if the last message received is a GL draw the display should switch to the GL display, if it's a 2d draw message the display should be switched to the client 2d canvas. (there will probably be a stipped-down "gl-only" channel in the future, or support for other streaming methods, but this protocol change should be enough for basic virgl or other gpu-accelerated support) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com> (cherry picked from spice-protocol commit 3fc2221e965623c5a7e50d95f1623269a067c2d3) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* proto: Use proper type for preferred_compression fieldChristophe Fergeau2016-03-101-1/+1
| | | | | | | | | No need to use an uint8 typed member, we can directly use the appropriate enum8 type here, which makes everything more explicit. (cherry picked from spice-protocol commit 8a3def14e35039753097094ba356e85e8fc2d128) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* proto: Rename image_compress to image_compressionChristophe Fergeau2016-03-101-1/+1
| | | | | | | | | | | Re-using the SPICE_IMAGE_COMPRESS_ prefix in newer spice-protocol releases is going to cause issues as there will be clashing enum members in older spice-server releases. Using SPICE_IMAGE_COMPRESSION_ as a prefix sidesteps these backward compability issues. (cherry picked from spice-protocol commit e857cd9a378cdf56805b64284491a12af93a7cbf) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* codegen: simplify FdTypeMarc-André Lureau2016-03-101-4/+4
| | | | | | | | | | | | This patch is a left-over from the fd passing commit 267391c8fd as suggested by Frediano Ziglio during review. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Acked-by: Frediano Ziglio <fziglio@redhat.com> (cherry picked from spice-protocol commit 47076559628d71c128e14e11147ce36b92677885) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* protocol: learn to describe fd passing in messagesMarc-Andre Lureau2016-03-103-1/+15
| | | | | | | | | | | | | | | | | | | | | Add a new type, "unix_fd", used to describe file descriptor sharing via socket ancillary data (these messages are local only). The marshaller/demarshaller can't serialize this in memory (consume_fd implementation is empty), so it is the responsability of the marshaller user to handle sending and receiving the handles, which are appended at the end of the message with an extra stream byte (because some Unix requires sending at least a byte with ancillary data). Even if there is no fd to send (or if the fd is invalid etc), the receiver side expects an extra byte anyway. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com> (cherry-picked from spice-protocol commit 267391c8fd7c90c067b3e4845ff0227a2580e2e2) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* Revert "Remove files moved to spice-protocol"Marc-André Lureau2016-03-1014-33/+6023
| | | | | | | | | | | | | | | | This reverts commit 7665dcf1bb2fa0b16b3d0015b28d7f5912664c3f. Also revert the related build-sys changes to fix the build. codegen generated code depends on spice-common code (marshaller, messages etc), it makes more sense to keep the generator along this. Otherwise a newer protocol release will fail to build older projects. *.proto files are required as well, since it generates code that parent modules depend on unconditionnaly. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* test-logging: unset G_MESSAGES_DEBUGMarc-André Lureau2016-03-101-0/+1
| | | | | | | | This test is sensitive to G_MESSAGES_DEBUG variable. Make it insensitive by unsetting the environment variable. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
* marshaller: fix uninitialized field usageFrediano Ziglio2016-02-031-0/+1
| | | | | | | has_fd was not initialized. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Marc-André Lureau <mlureau@redhat.com>
* marshaller: track if add_fd() was given -1Marc-Andre Lureau2016-02-022-9/+17
| | | | | | | | | In some cases, it might be worth to be able to send a message with a -1 fd, has the protocol permits. Change add_fd/get_fd in order to track if the caller wanted to send -1. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
* Use lz4 if possiblePavel Grunt2016-01-281-5/+11
| | | | | | Change the default option to "auto" Acked-by: Victor Toso <victortoso@redhat.com>
* Use code to compute a bit maskFrediano Ziglio2016-01-271-11/+2
| | | | | | | Code is in the slow path, this reduce space needed for data+code. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* Avoid to call ceil_log_2 twice with same valueFrediano Ziglio2016-01-271-2/+2
| | | | | Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* ConstificationFrediano Ziglio2016-01-271-1/+1
| | | | | Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* zeroLUT has same content of lzeroesFrediano Ziglio2016-01-271-25/+2
| | | | | Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* common: constify some declarationsFrediano Ziglio2016-01-273-4/+7
| | | | | Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* small spice_strdup optimizationFrediano Ziglio2016-01-261-2/+4
| | | | | | | | avoid to compute the string length twice and use memcpy instead of strcpy which is faster not having to check for terminator. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* remove wrong statement terminator from preprocessor macroFrediano Ziglio2016-01-261-1/+1
| | | | | | | | Actually not causing problems as when used is always followed by another terminator but better to fix the definition. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* log: Kill spice_warn_ifChristophe Fergeau2016-01-261-6/+0
| | | | | | It's redundant with spice_warn_if_fail(), and can even be confusing. Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* log: Add test case for logging codeChristophe Fergeau2016-01-262-1/+424
| | | | | | | | | | | | | | | | | This gives us a baseline of how the SPICE/glib integration is supposed to behave. Everything goes through glib logging facilities, and is impacted by G_MESSAGES_DEBUG/G_DEBUG=fatal-{warnings,criticals} Messages in the SPICE_LOG_DOMAIN log domain (output either through spice_log() or g_log()) will also consider the legacy SPICE_DEBUG_LEVEL and SPICE_ABORT_LEVEL environment variables. Messages in other domains will not be impacted by these legacy environment variables. If spice-common is built without SPICE_DISABLE_ABORT, spice_return_if_fail()/spice_critical() will abort the program. g_return_if_fail()/g_critical() will not abort the program.
* tests: Always build testsChristophe Fergeau2016-01-261-1/+1
| | | | | | | | | | | | | The next commit will introduce a test for log messages. As libspice-common.la behaviour varies depending on whether SPICE_DISABLE_ASSERT was defined at compile-time, this test will also take into account this preprocessor define. We are more likely to get a consistent build (SPICE_DISABLE_ASSERT being the same when building libspice-common.la and the test) if both are built at the same time. This commit changes that, tests are now built (but not run) at 'make' time rather than 'make check' time.
* log: Use glib for loggingChristophe Fergeau2016-01-262-60/+112
| | | | | | | | | | | | | spice-common has been duplicating glib logging methods for a long while. Now that spice-common is depending on glib, it's more consistent to use glib logging too. However, the code base is still using spice logging functions. This commit aims to make spice logging go through glib logging system, while keeping the same behaviour for the SPICE_ABORT_LEVEL and SPICE_DEBUG_LEVEL environment variables. They are deprecated however in favour of the glib alternatives (G_DEBUG and G_MESSAGES_DEBUG). Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
* log: Remove unneeded #ifdef/#endifChristophe Fergeau2016-01-261-26/+0
| | | | | | | | | If header guards are working as expected, there should not be multiple definitions of these macros. If they are redefined somewhere else, this is a bug we want to fix. Acked-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* log: Use more glib macrosChristophe Fergeau2016-01-211-34/+33
| | | | | | No need to have our own SPICE_STMT_BEGIN/END and SPICE_STRINGIFY Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* draw: Add spice_image_descriptor_is_lossyPavel Grunt2016-01-202-6/+8
| | | | | | It will be used in the server code Acked-by: Frediano Ziglio <fziglio@redhat.com>
* Add GL scanout structuresMarc-Andre Lureau2016-01-142-0/+20
| | | | | | | See related protocol changes. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
* marshaller: learn to describe fd passing in messagesMarc-Andre Lureau2016-01-142-0/+27
| | | | | | | | | | | | | The marshaller can't serialize fd in memory stream. Instead, append the fd to the marshaller structure. The marshaller user is responsible for sending the fd when the message is sent. The fd to send can be retrieved with spice_marshaller_get_fd(). Note: only a single fd is supported with this API, supporting multiple fd is left for the future if it becomes necessary. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
* ring: use NULL instead of 0 for null pointersFrediano Ziglio2016-01-071-1/+1
| | | | | | | | | This is consistent with the rest of the code making clear fields are pointers. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Uri Lublin <uril@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
* Remove headers that are included in spice_common.hVictor Toso2016-01-079-27/+5
| | | | Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* m4: Add macro for --with-saslPavel Grunt2015-12-181-0/+27
| | | | | | | | It is not used by spice-common, but both server and client can use it. Compared to current checks in spice-gtk and spice server this macro only supports libsasl2. Acked-by: Christophe Fergeau <cfergeau@redhat.com>
* Remove trailing whitespaceLukas Venhoda2015-12-185-18/+18
|
* ppc: Fix alpha state checking on BE machinesLukas Venhoda2015-12-171-0/+3
| | | | | The surface before conversion can be either LE or BE on a BE machine. Check against both BE and LE color order on BE machine.
* ppc: Fix colors on ppc when using jpegLukas Venhoda2015-12-171-2/+2
| | | | Fixes color order on PowerPC when using jpeg compression.
* ppc: Fix colors on ppc when using LZ4Lukas Venhoda2015-12-171-3/+3
| | | | Fixes color order on PowerPC when using LZ4 image compression.
* ppc: Fix colors on ppc when using LZLukas Venhoda2015-12-171-3/+3
| | | | Fixes color order on PowerPC when using LZ image compression.
* ppc: Fix colors on ppc when using QUICLukas Venhoda2015-12-171-3/+3
| | | | Fixes color order on PowerPC when using QUIC image compression.
* ppc: Add support for bigendian color byte orderLukas Venhoda2015-12-171-0/+14
| | | | | | | | | | | On LE machine, color order when creating surface will always be A/XRGB. On BE machines the color order will sometimes be ARGB and sometimes BGRA/X. This is because we actually create the surface two times on BE machines. Once with BE order, and then again with LE order. Copying data inbetween theese two surfaces will byteswap the colors automatically. This change introduces cases for BGRA/X color byte orders on BE machines.
* pixman_utils: Use PIXMAN_LE_ constants in spice_bitmap_try_as_pixman()Lukas Venhoda2015-12-171-15/+3
| | | | | | After the previous commit, spice_bitmap_try_as_pixman() can be simplified as its #ifdef WORDS_BIGENDIAN exactly match what the PIXMAN_LE_ constants do.
* pixman_utils: Add macros for color byte orderingLukas Venhoda2015-12-171-0/+10
| | | | | | | | | | When using image compression on PowerPC architecture, colors are in wrong order ARGB -> BGRA. This commit introduces macros, that will change the color order according to machine endianness. Theese macros are similar to QEMU macros in qemu-pixman.h
* test: Use _LDADD rather than _LDFLAGSChristophe Fergeau2015-12-161-1/+1
| | | | | | This allows libtool/automake to correctly add a dependency from libspice-common.la to test_marshallers. With _LDFLAGS, the binary won't automatically get rebuilt/relinked when the lib changes.
* m4: Fix SPICE_WARNING on el6Christophe Fergeau2015-12-141-1/+1
| | | | | autogen.sh fails on el6 unless the second argument to AC_DEFUN([SPICE_WARNING]) is enclosed in []
* ssl-verify: Don't leak GInetAddressChristophe Fergeau2015-11-271-2/+8
| | | | | GInetAddress is a GObject, so we must unref anything we create with g_inet_address_new_*
* ssl-verify: Handle NULL return from g_inet_address_new_from_string()Christophe Fergeau2015-11-271-2/+6
| | | | It will return NULL if the string we pass it cannot be parsed.
* Use new libcacard.h if possibleMarc-André Lureau2015-11-252-2/+12
| | | | | | | | | libcacard.h requires 2.5.1. Keep compatibility for older versions until the transition in distros to the standalone version is done. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> [ Christophe: add < 2.5.1 fallback ] Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
* Fix make distcheckMarc-André Lureau2015-11-253-4/+5
| | | | | | | Fix make distcheck both with standalone spice-common and with spice server. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
* canvas_base: Remove redundant switch case blockLukas Venhoda2015-11-241-4/+1
|
* build-sys: Add SPICE_CHECK_GSTREAMER_ELEMENTS()Francois Gouget2015-11-161-0/+36
| | | | | | | | This makes it possible to warn the developer that the GStreamer elements needed at runtime are missing and give him a hint on how to fix the issue. Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
* build-sys: Add SPICE_CHECK_GSTREAMER()Francois Gouget2015-11-041-0/+20
| | | | | | | This simplifies checking for GStreamer modules by setting all the variables we normally need. Signed-off-by: Francois Gouget <fgouget@codeweavers.com>