summaryrefslogtreecommitdiffstats
path: root/server/red_dispatcher.c
Commit message (Collapse)AuthorAgeFilesLines
* server: remove OpenGLMarc-André Lureau2015-11-211-6/+0
| | | | | | | | | | This is really not supported, requires X11, so better to remove it for now. Some day it might be revived, using DRM, .. Note for later, this could be removed too (not used by client): - spice-common/common/ogl_ctx Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
* red_dispatcher: Remove unused signal.h includePavel Grunt2015-11-091-1/+0
|
* server: create display and cursor channels in RedWorker constructorMarc-André Lureau2015-11-091-52/+22
| | | | | | | | Instead of requiring the dispatcher to send a message to the worker to create the display channel and cursor channel, just create them when the worker is created. Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* worker: remove need for WorkerInitDataMarc-André Lureau2015-10-261-70/+5
| | | | | | Move code around to declare and place it where it fits better. Acked-by: Frediano Ziglio <fziglio@redhat.com>
* worker: access dispatcher pending field using helper functionsMarc-André Lureau2015-10-261-6/+22
| | | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
* reduce locking time in async_command_allocFrediano Ziglio2015-10-231-1/+2
| | | | Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
* dispatcher: style updateMarc-André Lureau2015-10-231-1/+1
| | | | Acked-by: Frediano Ziglio <fziglio@redhat.com>
* server: remove worker thread creation from dispatcherMarc-André Lureau2015-10-221-18/+3
| | | | | Acked-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* worker: use GOnce to surround some global init in dispatcherMarc-André Lureau2015-10-191-3/+7
| | | | | Acked-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* display: Advertise preferred compression capChristophe Fergeau2015-09-241-0/+1
| | | | | | | | The patches adding a way for the client to set its preferred compression method added a new capability so that the server can indicate support for this feature. However, spice-server was not setting this capability on its display channel, which means clients are not going to try to send 'preferred-compression' messages even though the user request it.
* server: remove hardcoded RED_MAX_RENDERERSMarc-André Lureau2015-09-011-2/+2
| | | | | Acked-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* Adjust to new SpiceImageCompress nameChristophe Fergeau2015-07-291-2/+2
| | | | | | | | This has been renamed to SpiceImageCompression in order to avoid clashes with older spice-server in the SPICE_IMAGE_COMPRESS_ namespace. This commit is a straight rename of SpiceImageCompress to SpiceImageCompression and SPICE_IMAGE_COMPRESS_ to SPICE_IMAGE_COMPRESSION_
* server: spice_debug() messages don't need a trailing '\n'.Francois Gouget2015-07-201-1/+1
| | | | Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
* Use image compress constants from spice-protocolJavier Celaya2015-06-301-1/+1
|
* server: allows to set maximum monitorsFrediano Ziglio2015-06-261-0/+10
| | | | | | | | | | | | | spice-server will attempt to limit number of monitors. Guest machine can send monitor list it accepts. Limiting the number sent by guest will limit the number of monitors client will try to enable. The guest usually see client monitors enabled and start using it so not seeing client monitor won't try to enable more monitor. In this case the additional monitor guest can support will always be seen as heads with no attached monitors. This allows limiting monitors number without changing guest drivers. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
* Remove duplicate streaming enumerationJonathon Jongsma2015-06-151-2/+2
| | | | | | There is already a enumeration in a public header that defines the different streaming options, so there's no need to duplicate that enumeration internally. Just use the public enum values.
* server: Remove an unused structure.Francois Gouget2015-06-091-10/+0
|
* Remove guest side video time-stampingMarc-André Lureau2014-11-271-9/+0
| | | | | | | | | | | | | | | | | The multimedia time is defined by the server side monotonic time [1], but the drawing time-stamp is done in guest side, so it requires synchronization between host and guest. This is expensive, when no audio is playing, there is a ~30x/sec wakeup to update the qxl device mmtime, and it requires marking dirty the rom region. Instead, the video timestamping can be done more efficiently on server side, without visible drawbacks. [1] a better timestamp could be the audio time, since audio players are usually sync with audio time) Related to: https://bugzilla.redhat.com/show_bug.cgi?id=912763
* dispatcher: lower a monitor-config warning to a debug levelMarc-André Lureau2014-09-081-2/+2
| | | | | | | | Some QXLInterface implementations might not have or succeed with client_monitors_config(). Thus, lower warning to debug level. https://bugzilla.redhat.com/show_bug.cgi?id=1119220
* server: set dispatcher before calling attache_workerMarc-André Lureau2013-10-071-5/+7
| | | | | This allows to call spice_qxl_add_memslot during attache_worker(), like done in the tests.
* server: move bit set/clear utilities out of red_worker.hAlon Levy2013-08-141-1/+3
|
* server/dispatchers: initialize stack to 0 for valgrindAlon Levy2013-05-171-4/+4
|
* server: Add public spice_qxl_driver_unload methodHans de Goede2013-04-241-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | With a SPICE_DISPLAY_CAP_MONITORS_CONFIG capable client, the client needs to know what part of the primary to use for each monitor. If the guest driver does not support this, the server sends messages to the client for a single monitor spanning the entire primary. As soon as the guest calls spice_qxl_monitors_config_async once, we set the red_worker driver_has_monitors_config flag and stop doing this. This is a problem when the driver gets unloaded, for example after a reboot or when switching to a text vc with usermode mode-setting under Linux. To reproduce this start a multi-mon capable Linux guest which uses usermode mode-setting and then once X has started switch to a text vc. Note how the client window does not only not resize, if you try to resize it manually you always keep blackborders since the aspect is wrong. This patch is the spice-server side of fixing this, it adds a new spice_qxl_driver_unload method which clears the driver_has_monitors_config flag. The other patch needed to fix this is in qemu, and will calls this new method from qxl_enter_vga_mode. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* red_worker: support SPICE_MSGC_DISPLAY_STREAM_REPORTYonit Halperin2013-04-221-0/+1
| | | | | | update mjpeg_encoder with reports from the client about the playback quality. The patch also updates the spice-common submodule.
* server: red_dispatcher: check major/minor of qxl for client_monitors_configUri Lublin2012-10-241-14/+7
| | | | | | | | This solves a problem with new spice-server and old qemu-kvm, where spice thinks qif->client_monitors_config exists, while it does not exist in qemu-kvm. Also "major > required_major" was added to the condition. Also only the specific RedDispatcher is checked (and not all dispatchers).
* server/red_dispatcher: client_monitors_config supportAlon Levy2012-09-131-0/+49
| | | | | | | | | Adds two functions: - red_dispatcher_use_client_monitors_config: check that QXLInterface supports client_monitors_config and that it's functional. - red_dispatcher_client_monitors_config: send the client monitors configuration to the guest.
* server/red_dispatcher: change a printerr to debugAlon Levy2012-09-121-1/+1
|
* spice_server_vm_start/stop: notify red_dispatcher on vm start/stopYonit Halperin2012-08-271-0/+22
| | | | | | | Till now, red_worker was notfied about vm status changes via QXLWorker->start/stop (or spice_qxl_start/stop). Newer qemu, that supports calling spice_server_vm_start/stop, will call only these routines, and won't call QXLWorker->start/stop.
* server: add monitors_config supportAlon Levy2012-07-221-0/+25
| | | | | | | | | | | | | | | | a SpiceMsgDisplayMonitorsConfig is sent on two occasions: * as a result of a spice_qxl_monitors_config_async * whenever a client connects and there is a previously set monitors config Sending the new message is protected by a new cap, SPICE_DISPLAY_CAP_MONITORS_CONFIG More elaborately: spice_qxl_monitors_config_async receives a QXLPHYSICAL address of a QXLMonitorsConfig struct and reads it, caching it in the RedWorker, and sending it to all clients. Whenever a new client connects it receives a SpiceMsgDisplayMonitorsConfig message as well.
* Use the spice-common logging functionsMarc-André Lureau2012-03-251-22/+15
| | | | | It will abort by default for critical level messages. That behaviour can be tuned at runtime.
* Use the spice-common submoduleMarc-André Lureau2012-03-251-1/+2
| | | | | | | | | | | | | | | | | | This patch will replace the common/ directory with the spice-common project. It is for now a simple project subdirectory shared with spice-gtk, but the goal is to make it a proper library later on. With this change, the spice-server build is broken. The following commits fix the build, and have been seperated to ease the review. v2 - moves all the generated marshallers to spice-common library - don't attempt to fix windows VS build, which should somehow be splitted with spice-common (or built from tarball only to avoid generation tools/libs deps) v3 - uses libspice-common-client - fix a mutex.h inclusion reported by Alon
* Ensure all members of ChannelCbs and ClientCbs are either assigned or NULLHans de Goede2012-03-101-1/+1
| | | | | | | | | | | | | | | While git-bisecting another issue I ended up hitting and not recognizing the bug fixed by commit 7a079b452b026d6ce38f95dcc397fa64b059fffb. While fixing this (again) I noticed that (even after the fix) not all users of ChannelCbs first zero it. So this patch ensures that all users of ChannelCbs first zero it, and does the same for ClientCbs while at it. Since before this patch there were multiple zero-ing styles, some using memset and other using a zero initializer this patch also unifies all the zero-ing to use a NULL initializer for the first element. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* server/red_worker: pass remote caps to display/cursor red_channel_client'sYonit Halperin2012-01-121-0/+16
|
* server/red_worker: reuse dispatcherAlon Levy2011-11-081-211/+276
| | | | | | | | | | | | | | | | | | | | | | This patch reuses Dispatcher in RedDispatcher. It adds two helpers to red_worker to keep RedWorker opaque to the outside. The dispatcher is abused in three places that use the underlying socket directly: once sending a READY after red_init completes once for each channel creation, replying with the RedChannel instance for cursor and display. FDO Bugzilla: 42463 rfc->v1: * move callbacks to red_worker.c including registration (Yonit) * rename dispatcher to red_dispatcher in red_worker.c and red_dispatcher.c * add accessor red_dispatcher_get_dispatcher * s/dispatcher_handle_recv/dispatcher_handle_recv_read/ and change sig to just Dispatcher *dispatcher (was the SpiceCoreInterface one) * remove SpiceCoreInterface parameter from dispatcher_init (Yonit) * main_dispatcher needed it for channel_event so it has it in struct MainDispatcher * add dispatcher_get_recv_fd for red_worker
* server/red_dispatcher: remove semicolon from DBG_ASYNCAlon Levy2011-11-071-1/+1
|
* server: add prefix argument to red_printf_debugAlon Levy2011-11-071-5/+12
| | | | | printed before function name. No central location for prefixes. Adding "WORKER", "ASYNC", "MAIN" since those were the current users.
* server/red_dispatcher: support concurrent asyncsAlon Levy2011-11-071-61/+56
| | | | | | | | | | | | | | | This is part of the dispatcher update, extracting the dispatcher routine from red_dispatcher and main_dispatcher into dispatcher. Supporting multiple async operations will make it natural to support async monitor commands and async guest io requests that could overlap in time. Use a Ring for AsyncCommands. Free Desktop Bugzilla: 42463 Related FD: 41622
* fix inverted memset parametersChristophe Fergeau2011-08-251-1/+1
| | | | Issue found by the Coverity scanner.
* server: registering RedChannel in reds, instead of ChannelYonit Halperin2011-08-231-64/+99
| | | | | | | | | | | | | | | | | | | | | | | Merging the functionality of reds::channel, into RedChannel. In addition, cleanup and fix disconnection code: before this patch, red_dispatcher_disconnect_display_client could have been called from the red_worker thread (and it must be called only from the io thread). RedChannel holds only connected channel clients. RedClient holds all the channel clients that were created till it is destroyed (and then it destroys them as well). Note: snd_channel still doesn't use red_channel, however it creates dummy channel and channel clients, in order to register itself in reds. server/red_channel.c: a channel is connected if it holds at least one channel client Previously I changed RedChannel to hold only connected channel clients and RedClient, to hold all the channel clients as long as it is not destroyed. usbredir: multichannel has not been tested, it just compiles.
* server: Add RedClientAlon Levy2011-08-231-2/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | That means RedClient tracks a ring of channels. Right now there will be only a single client because of the disconnection mechanism - whenever a new client comes we disconnect all existing clients. But this patch adds already a ring of clients to reds.c (stored in RedServer). There is a known problem handling many connections and disconnections at the same time, trigerrable easily by the following script: export NEW_DISPLAY=:3.0 Xephyr $NEW_DISPLAY -noreset & for ((i = 0 ; i < 5; ++i)); do for ((j = 0 ; j < 10; ++j)); do DISPLAY=$NEW_DISPLAY c_win7x86_qxl_tests & done sleep 2; done I fixed a few of the problems resulting from this in the same patch. This required already introducing a few other changes: * make sure all removal of channels happens in the main thread, for that two additional dispatcher calls are added to remove a specific channel client (RED_WORKER_MESSAGE_CURSOR_DISCONNECT_CLIENT and RED_WORKER_MESSAGE_DISPLAY_DISCONNECT_CLIENT). * change some asserts in input channel. * make main channel disconnect not recursive * introduce disconnect call back to red_channel_create_parser The remaining abort is from a double free in the main channel, still can't find it (doesn't happen when running under valgrind - probably due to the slowness resulting from that), but is easy to see when running under gdb.
* server/red_dispatcher: fix wrong resolution set for tabletAlon Levy2011-07-311-4/+4
| | | | | | | | | | | when changing resolutions due to the new async code paths the surface creation command was kept by reference, and later, when the red_worker signaled completion by calling async_complete the mouse mode was updated using the reference. This caused the wrong values to be read resulting in wrong resolutions set and a non working mouse pointer. Fix this by keeping a copy of the surface creation command instead of a reference. No bz. Found in testing.
* server: add QXLWorker.flush_surfaces_async for S3/S4 supportAlon Levy2011-07-201-0/+20
| | | | | | | | | | | This does the following, all to remove any referenced memory on the pci bars: flush_all_qxl_commands(worker); flush_all_surfaces(worker); red_wait_outgoing_item((RedChannel *)worker->display_channel); red_wait_outgoing_item((RedChannel *)worker->cursor_channel); The added api is specifically async, i.e. it calls async_complete when done.
* server: add async io supportAlon Levy2011-07-201-40/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | The new _ASYNC io's in qxl_dev listed at the end get six new api functions, and an additional callback function "async_complete". When the async version of a specific io is used, completion is notified by calling async_complete, and no READY message is written or expected by the dispatcher. update_area has been changed to push QXLRects to the worker thread, where the conversion to SpiceRect takes place. A cookie has been added to each async call to QXLWorker, and is passed back via async_complete. Added api: QXLWorker: update_area_async add_memslot_async destroy_surfaces_async destroy_primary_surface_async create_primary_surface_async destroy_surface_wait_async QXLInterface: async_complete
* server: api: add spice_qxl_* calls based on QXLWorker contentsAlon Levy2011-07-201-32/+191
| | | | | | | | | For each callback in QXLWorker, for example QXLWorker::update_area, add a direct call named spice_qxl_update_area. This will (a) remove the pointless indirection and (b) make shared library versioning alot easier as we'll get new linker symbols which we can tag with the version they appeared in the shared library.
* add missing staticChristophe Fergeau2011-05-031-2/+3
|
* s/USE_OGL/USE_OPENGLChristophe Fergeau2011-05-031-5/+5
| | | | This is more explicit about what it does, and not much longer
* add #include <config.h> to all source filesChristophe Fergeau2011-05-031-0/+3
| | | | | | | | When using config.h, it must be the very first include in all source files since it contains #define that may change the compilation process (eg libc structure layout changes when it's used to enable large file support on 32 bit x86 archs). This commit adds it at the beginning of all .c and .cpp files
* autotools: correctly build canvas-related codeChristophe Fergeau2011-05-031-2/+2
| | | | | | | | | | | | | | | | | | | | | spice client and spice server shares code from common/{gdi,gl,sw}_canvas.[ch]. However, while most of the code is shared, the server code wants a canvas compiled with SW_CANVAS_IMAGE_CACHE defined while the client code wants a canvas compiled with SW_CANVAS_CACHE. The initial autotools refactoring didn't take that into account, this is now fixed by this commit. After this commit, the canvas files from common/ are no longer compiled as part of the libspice-common.la convenience library. Instead, there are "proxy" canvas source files in client/ and server/ which #include the appropriate C files after defining the relevant #define for the binary that is being built. To prevent misuse of the canvas c files and headers in common/, SPICE_CANVAS_INTERNAL must be set when including the canvas headers from common/ or when building the c files from common/ otherwise the build will error out.
* use foo(void) instead of foo() in prototypesChristophe Fergeau2011-05-021-7/+7
| | | | | In C, the latter isn't a prototype for a function with no arg, but declares a function with an undefined number of args.
* server: rename s/peer/streamMarc-André Lureau2011-02-281-4/+4
| | | | | | | | This is stylish change again. We are talking about a RedStream object, so let's just name the variable "stream" everywhere, to avoid confusion with a non existent RedPeer object. https://bugs.freedesktop.org/show_bug.cgi?id=34795