summaryrefslogtreecommitdiff
path: root/ui/vnc.c
AgeCommit message (Collapse)AuthorFilesLines
2014-03-10ui/vnc: disable adaptive update calculations if not neededPeter Lieven1-0/+9
Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-10ui/vnc: optimize setting in vnc_dpy_update()Peter Lieven1-11/+5
Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-10ui/vnc: optimize clearing in find_and_clear_dirty_height()Peter Lieven1-4/+1
The following artifical test (just the bitmap operation part) running vnc_update_client 65536 times on a 2560x2048 surface illustrates the performance difference: All bits clean - vnc_update_client_new: 0.07 secs vnc_update_client_new2: 0.07 secs vnc_update_client_old: 10.98 secs All bits dirty - vnc_update_client_new: 11.26 secs - vnc_update_client_new2: 0.29 secs vnc_update_client_old: 20.19 secs Few bits dirty - vnc_update_client_new: 0.07 secs - vnc_update_client_new2: 0.07 secs vnc_update_client_old: 10.98 secs vnc_update_client_new2 shows the performance of vnc_update_client with this patch added. Comparing with the test run of the last patch the performance is at least unchanged while it is significantly improved for the all bits dirty case. Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-10ui/vnc: optimize dirty bitmap trackingPeter Lieven1-71/+84
vnc_update_client currently scans the dirty bitmap of each client bitwise which is a very costly operation if only few bits are dirty. vnc_refresh_server_surface does almost the same. this patch optimizes both by utilizing the heavily optimized function find_next_bit to find the offset of the next dirty bit in the dirty bitmaps. The following artifical test (just the bitmap operation part) running vnc_update_client 65536 times on a 2560x2048 surface illustrates the performance difference: All bits clean - vnc_update_client_new: 0.07 secs vnc_update_client_old: 10.98 secs All bits dirty - vnc_update_client_new: 11.26 secs vnc_update_client_old: 20.19 secs Few bits dirty - vnc_update_client_new: 0.08 secs vnc_update_client_old: 10.98 secs The case for all bits dirty is still rather slow, this is due to the implementation of find_and_clear_dirty_height. This will be addresses in a separate patch. Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-10ui/vnc: derive cmp_bytes from VNC_DIRTY_PIXELS_PER_BITPeter Lieven1-1/+1
this allows for setting VNC_DIRTY_PIXELS_PER_BIT to different values than 16 if desired. Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Peter Lieven <pl@kamp.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-10ui/vnc: introduce VNC_DIRTY_PIXELS_PER_BIT macroPeter Lieven1-24/+41
Signed-off-by: Peter Lieven <pl@kamp.de> Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-10vnc: fix use-after-free in vnc_update_client_syncGerd Hoffmann1-13/+8
Spotted by Coverity: 876 static int vnc_update_client_sync(VncState *vs, int has_dirty) 877 { (1) Event freed_arg: "vnc_update_client(VncState *, int)" frees "vs". [details] Also see events: [deref_arg] 878 int ret = vnc_update_client(vs, has_dirty); (2) Event deref_arg: Calling "vnc_jobs_join(VncState *)" dereferences freed pointer "vs". [details] Also see events: [freed_arg] 879 vnc_jobs_join(vs); 880 return ret; 881 } Remove vnc_update_client_sync wrapper, replace it with an additional argument to vnc_update_client, so we can so the sync properly in vnc_update_client (i.e. skip it in case of a client disconnect). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2014-03-05input: mouse: switch vnc ui to new coreGerd Hoffmann1-24/+22
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2014-03-05input: keyboard: switch vnc ui to new coreGerd Hoffmann1-19/+6
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-06-21vnc: use booleans for vnc_connect, vnc_listen_read and vnc_display_add_clientMichael Tokarev1-7/+8
Some arguments to these functions are booleans - either by declaration, or by actual usage, but sometimes value of 0 or 1 is passed for a bool, and sometimes it is declared as int but a bool value, or true/false, is passed to it instead. Clean it up a bit. Cc: liguang <lig.fnst@cn.fujitsu.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-05-15vnc: Make ledstate comparison before modifiers updatedLei Li1-1/+2
The ledstate should be compared before modifiers updated, otherwise the ledstate would be the same as current_led_state. Reported-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-id: 1368606040-11950-1-git-send-email-lilei@linux.vnet.ibm.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-05-03TLS support for VNC WebsocketsTim Hardeck1-19/+67
Added TLS support to the VNC QEMU Websockets implementation. VNC-TLS needs to be enabled for this feature to be used. The required certificates are specified as in case of VNC-TLS with the VNC parameter "x509=<path>". If the server certificate isn't signed by a rooth authority it needs to be manually imported in the browser because at least in case of Firefox and Chrome there is no user dialog, the connection just gets canceled. As a side note VEncrypt over Websocket doesn't work atm because TLS can't be stacked in the current implementation. (It also didn't work before) Nevertheless to my knowledge there is no HTML 5 VNC client which supports it and the Websocket connection can be encrypted with regular TLS now so it should be fine for most use cases. Signed-off-by: Tim Hardeck <thardeck@suse.de> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1366727581-5772-1-git-send-email-thardeck@suse.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-29vnc: Adjust lock state sync logic with VNC_FEATURE_LED_STATELei Li1-0/+5
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1366867752-11578-4-git-send-email-lilei@linux.vnet.ibm.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-29vnc: Support for LED state extensionLei Li1-0/+45
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1366867752-11578-3-git-send-email-lilei@linux.vnet.ibm.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-29vnc: Add SCROLL lock key to kbd_ledsLei Li1-1/+5
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Message-id: 1366867752-11578-2-git-send-email-lilei@linux.vnet.ibm.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-04-25console: zap ds arg from register_displaychangelistenerGerd Hoffmann1-1/+1
We don't have multiple DisplayStates any more, so passing it in as argument is not needed. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-16console: add qemu_console_is_*Gerd Hoffmann1-3/+3
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-16console: gui timer fixesGerd Hoffmann1-51/+20
Make gui update rate adaption code in gui_update() actually work. Sprinkle in a tracepoint so you can see the code at work. Remove the update rate adaption code in vnc and make vnc simply use the generic bits instead. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-16console: rename vga_hw_*, add QemuConsole paramGerd Hoffmann1-6/+6
Add QemuConsole parameter to vga_hw_*, so the interface allows to update non-active consoles (the actual code can't handle this yet, see next patch). Passing NULL is allowed and updates the active console, like the functions do today. While touching all vga_hw_* calls anyway rename that to the functions to hardware-neutral graphics_hw_* Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-04-02oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()Stefan Hajnoczi1-1/+1
The fcntl(fd, F_SETFL, O_NONBLOCK) flag is not specific to sockets. Rename to qemu_set_nonblock() just like qemu_set_cloexec(). Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-03-18console: zap displaystate from dcl callbacksGerd Hoffmann1-5/+0
Now that nobody depends on DisplayState in DisplayChangeListener callbacks any more we can remove the parameter from all callbacks. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-03-18vnc: stop using DisplayStateGerd Hoffmann1-34/+43
Rework DisplayStateListener callbacks to not use the DisplayState any more. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-03-18console: rework DisplaySurface handling [dcl/ui side]Gerd Hoffmann1-16/+5
Replace the dpy_gfx_resize and dpy_gfx_setdata DisplayChangeListener callbacks with a dpy_gfx_switch callback which notifies the ui code when the framebuffer backing storage changes. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-03-18console: kill DisplayState->opaqueGerd Hoffmann1-21/+17
It's broken by design. There can be multiple DisplayChangeListener instances, so they simply can't store state in the (single) DisplayState struct. Try 'qemu -display gtk -vnc :0', watch it crash & burn. With DisplayChangeListenerOps having a more sane interface now we can simply use the DisplayChangeListener pointer to get access to our private data instead. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-03-18console: fix displaychangelisteners interfaceGerd Hoffmann1-14/+30
Split callbacks into separate Ops struct. Pass DisplayChangeListener pointer as first argument to all callbacks. Uninline a bunch of display functions and move them from console.h to console.c Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-01-21vnc: fix possible uninitialized removalsTim Hardeck1-3/+8
Some VncState values are not initialized before the Websocket handshake. If it fails QEMU segfaults during the cleanup. To prevent this behavior intialization checks are added. Signed-off-by: Tim Hardeck <thardeck@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-01-21vnc: added initial websocket protocol supportTim Hardeck1-18/+169
This patch adds basic Websocket Protocol version 13 - RFC 6455 - support to QEMU VNC. Binary encoding support on the client side is mandatory. Because of the GnuTLS requirement the Websockets implementation is optional (--enable-vnc-ws). To activate Websocket support the VNC option "websocket"is used, for example "-vnc :0,websocket". The listen port for Websocket connections is (5700 + display) so if QEMU VNC is started with :0 the Websocket port would be 5700. As an alternative the Websocket port could be manually specified by using ",websocket=<port>" instead. Parts of the implementation base on Anthony Liguori's QEMU Websocket patch from 2010 and on Joel Martin's LibVNC Websocket implementation. Signed-off-by: Tim Hardeck <thardeck@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-01-21vnc: added buffer_advance functionTim Hardeck1-4/+9
Following Anthony Liguori's Websocket implementation I have added the buffer_advance function to VNC and replaced all related buffer memmove operations with it. Signed-off-by: Tim Hardeck <thardeck@suse.de> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-12-19softmmu: move include files to include/sysemu/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19misc: move include files to include/qemu/Paolo Bonzini1-4/+4
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19qapi: move include files to include/qobject/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-14pixman: fix vnc tight png/jpeg supportGerd Hoffmann1-1/+1
This patch adds an x argument to qemu_pixman_linebuf_fill so it can also be used to convert a partial scanline. Then fix tight + png/jpeg encoding by passing in the x+y offset, so the data is read from the correct screen location instead of the upper left corner. Cc: 1087974@bugs.launchpad.net Cc: qemu-stable@nongnu.org Reported-by: Tim Hardeneck <thardeck@suse.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-11-26vnc: fix option misspelling ("non-adapative" -> "non-adaptive")Catalin Patulea1-1/+1
Signed-off-by: Catalin Patulea <catalinp@google.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-03Merge branch 'trivial-patches' of git://github.com/stefanha/qemuBlue Swirl1-7/+7
* 'trivial-patches' of git://github.com/stefanha/qemu: pc: Drop redundant test for ROM memory region exec: make some functions static target-ppc: make some functions static ppc: add missing static vnc: add missing static vl.c: add missing static target-sparc: make do_unaligned_access static m68k: Return semihosting errno values correctly cadence_uart: More debug information Conflicts: target-m68k/m68k-semi.c
2012-11-01vnc: add missing staticBlue Swirl1-7/+7
Add missing 'static' qualifiers. Signed-off-by: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-11-01pixman/vnc: remove dead code.Gerd Hoffmann1-18/+0
Switching the vnc server framebuffer to use 32bpp unconditionally turns the code bits which handle 8 and 16 bpp into dead code. Remove them. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01pixman/vnc: use pixman images in vnc.Gerd Hoffmann1-103/+132
The vnc code uses *three* DisplaySurfaces: First is the surface of the actual QemuConsole, usually the guest screen, but could also be a text console (monitor/serial reachable via Ctrl-Alt-<nr> keys). This is left as-is. Second is the current server's view of the screen content. The vnc code uses this to figure which parts of the guest screen did _really_ change to reduce the amount of updates sent to the vnc clients. It is also used as data source when sending out the updates to the clients. This surface gets replaced by a pixman image. The format changes too, instead of using the guest screen format we'll use fixed 32bit rgb framebuffer and convert the pixels on the fly when comparing and updating the server framebuffer. Third surface carries the format expected by the vnc client. That isn't used to store image data. This surface is switched to PixelFormat and a boolean for bigendian byte order. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01console: untangle gfx & txt updatesGerd Hoffmann1-4/+4
Stop abusing displaysurface fields for text mode displays. (bpp = 0, width = cols, height = lines). Add flags to displaystate indicating whenever text mode display (curses) or gfx mode displays (sdl, vnc, ...) are present. Add separate displaychangelistener callbacks for text / gfx mode resize & updates. This allows to enable gfx and txt diplays at the same time and also paves the way for more cleanups in the future. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01console: move set_mouse + cursor_define callbacksGerd Hoffmann1-4/+4
When adding DisplayChangeListeners the set_mouse and cursor_define callbacks have been left in DisplayState for some reason. Fix it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-10-23vnc: drop QERR_VNC_SERVER_FAILEDPaolo Bonzini1-3/+0
We now always return "nice" error messages in errp when we goto fail. Drop the default error message. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23vnc: add error propagation to vnc_display_openPaolo Bonzini1-19/+23
Before: $ qemu-system-x86_64 -vnc foo.bar:12345 getaddrinfo(foo.bar,18245): Name or service not known Failed to start VNC server on `foo.bar:12345' $ qemu-system-x86_64 -vnc localhost:12345,reverse=on inet_connect_opts: connect(ipv4,yakj.usersys.redhat.com,127.0.0.1,12345): Connection refused Failed to start VNC server on `localhost:12345,reverse=on' After: $ x86_64-softmmu/qemu-system-x86_64 -vnc foo.bar:12345 Failed to start VNC server on `foo.bar:12345': address resolution failed for foo.bar:18245: Name or service not known $ x86_64-softmmu/qemu-system-x86_64 -vnc localhost:12345,reverse=on Failed to start VNC server on `localhost:12345,reverse=on': Failed to connect to socket: Connection refused Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23vnc: reorganize code for reverse modePaolo Bonzini1-11/+9
Avoid the dance between csock and vs->lsock. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23vnc: introduce a single label for error returnsPaolo Bonzini1-25/+17
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23vnc: avoid Yoda conditionalsPaolo Bonzini1-2/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23qemu-sockets: add Error ** to all functionsPaolo Bonzini1-2/+2
This lets me adjust the clients to do proper error propagation first, thus avoiding temporary regressions in the quality of the error messages. Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-19ui/vnc: Only report/use TIGHT_PNG encoding if enabled.Joel Martin1-0/+2
If TIGHT_PNG is not enabled by the --enable-vnc-png configure flag then do not report to the client that it is supported. Also, since TIGHT_PNG is the same as the TIGHT encoding but with the filter/copy replaced with PNG data, adding it to the supported encodings list when it is disabled will cause the TIGHT encoding to be used even though the client requested TIGHT_PNG. Signed-off-by: Joel Martin <github@martintribe.org> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-10-12vnc: fix "info vnc" with "-vnc ..., reverse=on"Paolo Bonzini1-0/+4
When reverse connection is in use, there is no active VNC server socket. Because of this, getsockopt(-1, ...) is attempted and the following error is emitted: $ socat TCP-LISTEN:5900,reuseaddr TCP-LISTEN:5901,reuseaddr & $ x86_64-softmmu/qemu-system-x86_64 -vnc localhost:5900,reverse -monitor stdio QEMU 1.2.50 monitor - type 'help' for more information (qemu) info vnc An undefined error has occurred Because however the host, family, service and auth fields are optional, we can just exit if there is no active server socket. $ x86_64-softmmu/qemu-system-x86_64 -vnc localhost:5900,reverse -monitor stdio QEMU 1.2.50 monitor - type 'help' for more information (qemu) info vnc Server: Client: address: 127.0.0.1:5900 x509_dname: none username: none Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-09-25Separate inet_connect into inet_connect (blocking) and inet_nonblocking_connectOrit Wasserman1-1/+1
No need to add non blocking parameters to the blocking inet_connect add block parameter for inet_connect_opts instead of using QemuOpt "block". Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-08-13net: inet_connect(), inet_connect_opts(): add in_progress argumentLuiz Capitulino1-1/+1
It's used to indicate the special case where a valid file-descriptor is returned (ie. success) but the connection can't be completed w/o blocking. This is needed because QERR_SOCKET_CONNECT_IN_PROGRESS is not treated like an error and a future commit will drop it. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2012-08-03vnc: disable VNC password authentication (security type 2) when in FIPS modePaul Moore1-0/+10
FIPS 140-2 requires disabling certain ciphers, including DES, which is used by VNC to obscure passwords when they are sent over the network. The solution for FIPS users is to disable the use of VNC password auth when the host system is operating in FIPS compliance mode and the user has specified '-enable-fips' on the QEMU command line. This patch causes QEMU to emit a message to stderr when the host system is running in FIPS mode and a VNC password was specified on the commend line. If the system is not running in FIPS mode, or is running in FIPS mode but VNC password authentication was not requested, QEMU operates normally. Signed-off-by: Paul Moore <pmoore@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>