summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-07-03WIP SAVEworkingFrediano Ziglio1-0/+4
2018-07-03function to output log informations on startFrediano Ziglio1-0/+37
2018-07-03optimise H264Frediano Ziglio1-3/+14
2018-07-03WIP stateFrediano Ziglio1-0/+21
2018-07-03XXX reopen syslog connectionFrediano Ziglio1-0/+3
2018-07-03SPLIT TODO/FIXMEFrediano Ziglio1-0/+14
2018-07-03Provide helper to give information to daemonFrediano Ziglio4-2/+48
This is required so the daemon can manage the various sessions. The helper is launched every time a graphic session is started. It sends information to the daemon on how to connect to the given display server. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-03Implement a daemon/agent separationFrediano Ziglio13-10/+698
This allows to manage properly multiple servers (currently only Xorg). The executable will run as a service forking the proper agent. The agent will then manage the active server. The server receive just minimal information for the various graphic terminals and use to fork the agent. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-03Starts/stops the agent based on VT statusFrediano Ziglio4-7/+132
Check if the current display server is active or not and stream only if active. This will allow to support multiple display servers running. When multiple display servers are running only one have the GPU associated and is writing to the screen. Stop capturing and release resources when the display server is not active and vice versa. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-03Add file with utilities for XorgFrediano Ziglio4-0/+56
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-02Set default syslog mask to a lower levelSnir Sheriber1-1/+1
This will allow printing run-time information to stderr (by using LOG_NOTICE level) without classifying it as warning/error or by enabling debug mode. Signed-off-by: Snir Sheriber <ssheribe@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-02Remove unnecessary '\n' in syslog callsLukáš Hrázký2-9/+9
Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-02Move register_interrupts() before the try-catch blockLukáš Hrázký1-2/+2
It doesn't throw and is part of the main() setup, not the business code. Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-02Clean up the global try-catch blockLukáš Hrázký1-8/+5
Unify the error handling to use exceptions, narrowing down the exit spots for success/error to one each. Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-02Make the try-catch block in main() a catch-allLukáš Hrázký1-23/+23
Extends the try-catch block to encompass all the business code in main(), making it a catch-all for all errors. Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-07-02Remove the closelog() callLukáš Hrázký1-1/+0
It is unnecessary, the syslog connections are closed automatically on exit. Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-28FrameLog: Use std::chrono instead of gettimeofday for timeLukáš Hrázký1-5/+3
A C++ standard library implementation is a bit simpler and preferred in C++ codebase. The system_clock has microsecond precision and efficiency should be on par. Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-28Improve the frame log messagesLukáš Hrázký1-5/+5
Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-28Separate the code for logging frames/times into a classLukáš Hrázký4-54/+134
The FrameLog class provides RAII for the FILE and encapsulates the logging functionality. Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-25Remove the logmask variableLukáš Hrázký1-4/+2
The variable is unnecessary, we can pass the value straight to setlogmask(). Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-25Improve the invalid option argument (-c) error messageLukáš Hrázký1-1/+1
Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-25Remove the arg_error macroLukáš Hrázký1-3/+1
It doesn't help anything. Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-06Prepare for v0.2 releaseUri Lublin3-1/+31
Signed-off-by: Uri Lublin <uril@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-06spec: some small fixesUri Lublin1-4/+5
1. break a long description line into two lines 2. add changelog version of pre-release 0.1 version 3. replace "ChangeLog" documentation file with "NEWS" (we try to keep NEWS updated, but not ChangeLog) 4. description: s/Spice/SPICE/ Signed-off-by: Uri Lublin <uril@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-06-04ci: Add required xz packageFrediano Ziglio1-1/+1
Make dist requires xz as is the default compression algorithm. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-06-01Install udev ruleFrediano Ziglio3-1/+14
The udev rule is used to do some action when the device is added to the system. Current rule change the permission of the special file to allow to open it by any user. Some systems use /lib/udev while others use /usr/lib/udev. Allow to specify the full path to support both type of systems. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Uri Lublin <uril@redhat.com>
2018-06-01ci: Make sure "make distcheck" worksFrediano Ziglio1-0/+1
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-06-01ci: Install required autoconf-archive packageFrediano Ziglio1-1/+1
Due to recent check build is failing with: configure.ac:21: error: Missing AX_CXX_COMPILE_STDCXX_11, install autoconf-archive Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-06-01build: Avoid a warning running autoreconfFrediano Ziglio1-0/+1
During autoreconf this suggestion is emitted: libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-06-01build: Error out on missing AX_CXX_COMPILE_STDCXX_11Christophe Fergeau1-0/+1
A missing AX_CXX_COMPILE_STDCXX_11 at autoreconf time will only trigger a non-fatal "command not found" when configure runs, but then compilation will unexpectedly fail unless -std=c++11 is added to the CXXFLAGS. This commit makes sure we error out at autoreconf time when the macro is unknown. Acked-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Uri Lublin <uril@redhat.com>
2018-05-31test-stream-port: Remove unused variable 'buf'Frediano Ziglio1-1/+0
This with gcc 8 causes: test-stream-port.cpp: In function ‘void ____C_A_T_C_H____T_E_S_T____0()’: test-stream-port.cpp:78:18: error: unused variable ‘buf’ [-Werror=unused-variable] char buf[10]; ^~~ Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Uri Lublin <uril@redhat.com>
2018-05-31Add option to set logging categoriesFrediano Ziglio1-1/+14
Allows to enable/disable different categories of logging. Currently disabling by default logging of full frame data which can take huge amount of log and allow to enable it if needed. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Uri Lublin <uril@redhat.com>
2018-05-31Always log statisticsFrediano Ziglio1-2/+1
Allow to see frame size even if frame data is disabled. Useful to compute frame statistics not spending huge amount of space for frame data. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Uri Lublin <uril@redhat.com>
2018-05-31Enable line buffering instead of full buffering for the logFrediano Ziglio1-0/+3
Allows to kill the process without losing log lines Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Uri Lublin <uril@redhat.com>
2018-05-31Add some information to the logFrediano Ziglio1-0/+15
Allows to track different frame timing. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Uri Lublin <uril@redhat.com>
2018-05-22Detect and handle exceptions creating capture engineFrediano Ziglio1-1/+8
Currently exceptions from a plugin are not handled when creating a capture engine. Catch the exception and try to use another plugin instead of bailing out. This was tested with an experimental GStreamer plugin. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2018-05-18Refactor and simplify polling for messages to readLukáš Hrázký1-25/+22
Use exceptions for errors. Handle EINTR from poll and report nothing to read, relying on the enclosing loop to poll for the command on the next iteration. Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-18Encapsulate the stream port fd and lockingLukáš Hrázký3-62/+86
Wrap the streaming virtio port along with the mutex to lock it in a class. Pass the class temporarily around to functions that need it until the functions too are consolidated into the class. The locking needs to be outside the class for now to prevent situations like: 1 - data header 2 - cursor header 3 - data message 4 - cursor message Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-18Change the mode to NONBLOCK for the virtio portLukáš Hrázký3-7/+64
In blocking mode, a write to the virtio port blocks indefinitely if the server closes the virtio port on it's side. Change to non-blocking mode, so that we can quit the streaming agent in case the port gets closed. Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-18Fix reading from a closed virtio portLukáš Hrázký3-0/+18
Reading from a closed virtio port looped indefinitely, check the read() returning 0 and throw an exception if it happens. Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-18Add a unit test for the stream portLukáš Hrázký3-0/+64
Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-18Unify the structure of write_all() and read_all()Lukáš Hrázký2-11/+13
Both versions are fine, unify for consistency. Use the optically less verbose version. Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-18Introduce a WriteError exception for write_all()Lukáš Hrázký4-38/+33
Update the interface to not return the size written, as it is not needed anymore. Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-18Implement an exception hierarchy for ReadErrorLukáš Hrázký5-3/+63
Introduces an exception hierarchy up to a ReadError class, which is thrown from read_all(). Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-17Add name to an unnamed structureFrediano Ziglio1-1/+1
Unnamed structure combined with inheritance is considered a bit hard to read, add a name to make more readable. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Lukáš Hrázký <lhrazky@redhat.com>
2018-05-17Move out {read,write}_all() to a separate moduleLukáš Hrázký4-43/+83
This starts at the bottom and prepares for gradually moving more stuff out of the main file. Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-17Use read_all() to read headers of received messagesLukáš Hrázký1-6/+3
Unifies the reading from the virtio port, read_all() supports signals and partial reads. Signed-off-by: Lukáš Hrázký <lhrazky@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-04-26build: Use same options to compile unit testsFrediano Ziglio1-0/+4
Unit test where not compiling with same options. In this case warnings are different producing different results. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-04-26Eliminate signed/unsigned warningChristophe de Dinechin1-2/+2
Currently -Wsign-compare is disabled by default in the default settings (m4/spice-compile-warnings.m4). However is good and not that expensive to remove this warning. Signed-off-by: Christophe de Dinechin <dinechin@redhat.com> Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2018-04-20Add a macro to deal with the boilerplate of writing a streaming agent pluginChristophe de Dinechin1-0/+9
Signed-off-by: Christophe de Dinechin <dinechin@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>