summaryrefslogtreecommitdiff
path: root/ui/vnc-enc-tight.c
AgeCommit message (Collapse)AuthorFilesLines
2014-03-10vnc: Fix tight_detect_smooth_image() for lossless caseMarkus Armbruster1-1/+1
VncTight member uint8_t quality is either (uint8_t)-1 for lossless or less than 10 for lossy. tight_detect_smooth_image() first promotes it to int, then compares with -1. Always unequal, so we always execute the lossy code. Reads beyond tight_conf[] and returns crap when quality is actually lossless. Compare to (uint8_t)-1 instead, like we do elsewhere. Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-03-18vnc: stop using DisplayStateGerd Hoffmann1-3/+4
Rework DisplayStateListener callbacks to not use the DisplayState any more. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-12-19misc: move include files to include/qemu/Paolo Bonzini1-1/+1
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-2/+2
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-01pixman/vnc: remove dead code.Gerd Hoffmann1-37/+27
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: remove rgb_prepare_row* functionsGerd Hoffmann1-74/+10
Let pixman do it instead. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-01pixman/vnc: use pixman images in vnc.Gerd Hoffmann1-76/+68
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>
2011-08-20Use glib memory allocation and free functionsAnthony Liguori1-6/+6
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-06-27vnc: Fix compilation with --enable-vnc-pngStefan Weil1-0/+3
Commit f26e428da505709ec03b2ed2c9eb3db82b30bd7b fixed compilation with --enable-vnc-png, but broke it with --enable-vnc-png. The breakage is caused by pngconfig.h which checks whether setjmp.h was already included and fails because qemu-common.h includes setjmp.h. The check is disabled by defining PNG_SKIP_SETJMP_CHECK. Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-06-26Fix MinGW compilation when --enable-vnc-jpeg is specifiedRoy Tam1-2/+5
Fix conflicting types for 'INT32' in basetsd.h and jmorecfg.h by including qemu-common.h first. Signed-off-by: Roy Tam <roytam@gmail.com> Acked-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-04-10vnc: tight: Fix crash after 2GB of outputMichael Tokarev1-2/+3
fix 2Gb integer overflow in in VNC tight and zlib encodings As found by Roland Dreier <roland@purestorage.com> (excellent catch!), when amount of VNC compressed data produced by zlib and sent to client exceeds 2Gb, integer overflow occurs because currently, we calculate amount of data produced at each step by comparing saved total_out with new total_out, and total_out is something which grows without bounds. Compare it with previous avail_out instead of total_out, and leave total_out alone. The same code is used in vnc-enc-tight.c and vnc-enc-zlib.c, so fix both cases. There, there's no actual need to save previous_out value, since capacity-offset (which is how that value is calculated) stays the same so it can be recalculated again after call to deflate(), but whole thing becomes less readable this way. Reported-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Corentin Chary <corentin.chary@gmail.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-02-24ui/vnc-enc-tight.c: Fix compile failure if CONFIG_VNC_JPEG not definedPeter Maydell1-0/+4
Add some missing #ifdefs to fix compilation failures in the !CONFIG_VNC_JPEG case introduced by commit ce702e93. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-23vnc: add a non-adaptive optionCorentin Chary1-1/+1
This option allow to disable adaptive behaviors in some encodings. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-23vnc: tight: tweak adaptive tight settingsCorentin Chary1-10/+10
The force_jpeg threshold was too low. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-23vnc: fix uint8_t comparisons with negative valuesCorentin Chary1-2/+2
Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-02-23vnc: tight: use the update frequency to choose between lossy and losslessCorentin Chary1-13/+62
Use the new update frequency infrastructure to use jpeg for regions with high update frequency. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-10-05Fix spelling in commentsStefan Weil1-1/+1
multifuction -> multifunction successfull -> successful. Signed-off-by: Stefan Weil <weil@mail.berlios.de>
2010-09-04vnc: use bswapNN() rather than bswap_NN()Izumi Tsutsui1-4/+4
bswap_NN() variants are not always available in CONFIG_MACHINE_BSWAP_H case and bswapNN() are public APIs in "bswap.h". Signed-off-by: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-04vnc: tight: remove unused variableSerge Ziryukin1-2/+0
Signed-off-by: Serge Ziryukin <ftrvxmtrx@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-04size_t is unsigned, change to ssize_t to handle errors from ↵Jes Sorensen1-4/+4
tight_compress_data() Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-31Initialize a variable in all casesBlue Swirl1-0/+2
Commit d167f9bc06a577d6c85b8ed6991c1efe175aae7d missed this one: /src/qemu/ui/vnc-enc-tight.c:1483: warning: 'ret' may be used uninitialized in this function Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-31Fix uint8_t comparison with negative valueBlue Swirl1-1/+1
Commit 7bccf57383cca60a778d5c543ac80c9f62d89ef2 missed this one: /src/qemu/ui/vnc-enc-tight.c: In function 'send_sub_rect': /src/qemu/ui/vnc-enc-tight.c:1527: warning: comparison is always true due to limited range of data type Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-27Fix mingw32 buildBlue Swirl1-9/+9
Fix mingw32 build errors like /src/qemu/ui/vnc-enc-tight.c: In function 'tight_detect_smooth_image24': /src/qemu/ui/vnc-enc-tight.c:119: error: 'uint' undeclared (first use in this function) Replace 'uint' with proper 'unsigned int'. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-27Initialize a variable in all casesBlue Swirl1-0/+2
Fix a warning with some GCCs: /src/qemu/ui/vnc-enc-tight.c: In function `send_sub_rect_nojpeg': /src/qemu/ui/vnc-enc-tight.c:1458: warning: `ret' might be used uninitialized in this function Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-27Fix uint8_t comparisons with negative valuesBlue Swirl1-3/+3
Fix the following warnings: /src/qemu/hw/ide/core.c: In function `ide_drive_pio_post_load': /src/qemu/hw/ide/core.c:2767: warning: comparison is always false due to limited range of data type /src/qemu/ui/vnc-enc-tight.c: In function `tight_detect_smooth_image': /src/qemu/ui/vnc-enc-tight.c:284: warning: comparison is always true due to limited range of data type /src/qemu/ui/vnc-enc-tight.c:297: warning: comparison is always true due to limited range of data type /src/qemu/ui/vnc-enc-tight.c: In function `tight_encode_indexed_rect16': /src/qemu/ui/vnc-enc-tight.c:456: warning: comparison is always false due to limited range of data type /src/qemu/ui/vnc-enc-tight.c: In function `tight_encode_indexed_rect32': /src/qemu/ui/vnc-enc-tight.c:457: warning: comparison is always false due to limited range of data type Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-07-26vnc: tight: split send_sub_rectCorentin Chary1-25/+55
Split send_sub_rect in send_sub_rect_jpeg and send_sub_rect_nojpeg to remove all these #ifdef CONFIG_JPEG. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-26vnc: tight: fix rgb_prepare_rowCorentin Chary1-5/+10
rgb_prepare_row bpp depends on the server display surface, not the client. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-26vnc: fix tight png memory leakCorentin Chary1-0/+3
The tight.png buffer was never released. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-26vnc: encapsulate encoding membersCorentin Chary1-102/+102
This will allow to implement the threaded VNC server in a more cleaner way. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-26vnc: tight: stop using qdict for palette stuffCorentin Chary1-128/+35
Profiling with callgrind seems to show that a lot of time is spent in the palette code (mostly due to memory allocation and qdict to int conversion). This patch adds a VncPalette implementation. The palette is stored in a hash table, like qdict, but which does way less memory allocations, and doesn't suffer from the QObject overhead. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-26vnc: tight: specific zlib level and filters for each compression levelCorentin Chary1-1/+18
Disable png filters for lower compression levels. This should lower the CPU consumption and reduce encoding time. This isn't in tight_conf because: * tight_conf structure must not change, because it's shared with other tight implementations (libvncserver, etc..). * it'd exceed the 80 col limit. * PNG_ macros are only defined if CONFIG_VNC_PNG is defined Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-26vnc: tight add PNG encodingCorentin Chary1-42/+274
Introduce a new encoding: VNC_ENCODING_TIGHT_PNG [1] (-269) with a new tight filter VNC_TIGHT_PNG (0x0A). When the client tells it supports the Tight PNG encoding, the server will use tight, but will always send encoding pixels using PNG instead of zlib. If the client also told it support JPEG, then the server can send JPEG, because PNG will only be used in the cases zlib was used in normal tight. This encoding was introduced to speed up HTML5 based VNC clients like noVNC [2], but can also be used on devices like iPhone where PNG can be rendered in hardware. [1] http://wiki.qemu.org/VNC_Tight_PNG [2] http://github.com/kanaka/noVNC/ Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-26vnc: tight: remove a memleak in send_jpeg_rect()Corentin Chary1-2/+3
buf was never freed. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-26vnc: tight: don't forget do at the last colorCorentin Chary1-1/+1
While using indexed colors, the last color was never added to the palette. Triggered with ubuntu livecd. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-07-26vnc: rename vnc-encoding-* vnc-enc-*Corentin Chary1-0/+1520
For the same reason that we don't use vnc-authentication-sasl.c but vnc-auth-sals.c. Because it's tooooo long. Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>