From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LU1CA-0000kD-Oz for qemu-devel@nongnu.org; Mon, 02 Feb 2009 10:58:46 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LU1C9-0000j3-Ae for qemu-devel@nongnu.org; Mon, 02 Feb 2009 10:58:45 -0500 Received: from [199.232.76.173] (port=51774 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LU1C8-0000io-Gr for qemu-devel@nongnu.org; Mon, 02 Feb 2009 10:58:44 -0500 Received: from savannah.gnu.org ([199.232.41.3]:41951 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LU1C8-0008VK-59 for qemu-devel@nongnu.org; Mon, 02 Feb 2009 10:58:44 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LU1C7-0007El-Jp for qemu-devel@nongnu.org; Mon, 02 Feb 2009 15:58:43 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LU1C7-0007Ec-Dx for qemu-devel@nongnu.org; Mon, 02 Feb 2009 15:58:43 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Mon, 02 Feb 2009 15:58:43 +0000 Subject: [Qemu-devel] [6496] Add some tight awareness to vnc.c (Alexander Graf) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6496 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6496 Author: aliguori Date: 2009-02-02 15:58:43 +0000 (Mon, 02 Feb 2009) Log Message: ----------- Add some tight awareness to vnc.c (Alexander Graf) This patch enables the vnc server to understand fundamental tight extensions. It changes from a "Hextile or not" scheme when sending framebuffer updates to a "preferred encoding", namely the last one set. While this is not perfect, as actually a list of "preferred encodings" should be kept, it's good enough for now. Signed-off-by: Alexander Graf Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/vnc.c Modified: trunk/vnc.c =================================================================== --- trunk/vnc.c 2009-02-02 15:58:38 UTC (rev 6495) +++ trunk/vnc.c 2009-02-02 15:58:43 UTC (rev 6496) @@ -103,6 +103,10 @@ int last_x; int last_y; + uint32_t vnc_encoding; + uint8_t tight_quality; + uint8_t tight_compression; + int major; int minor; @@ -450,10 +454,14 @@ static void send_framebuffer_update(VncState *vs, int x, int y, int w, int h) { - if (vnc_has_feature(vs, VNC_FEATURE_HEXTILE)) + switch(vs->vnc_encoding) { + case VNC_ENCODING_HEXTILE: send_framebuffer_update_hextile(vs, x, y, w, h); - else + break; + default: send_framebuffer_update_raw(vs, x, y, w, h); + break; + } } static void vnc_copy(DisplayState *ds, int src_x, int src_y, int dst_x, int dst_y, int w, int h) @@ -1164,6 +1172,9 @@ unsigned int enc = 0; vs->features = 0; + vs->vnc_encoding = 0; + vs->tight_compression = 9; + vs->tight_quality = 9; vs->absolute = -1; dcl->dpy_copy = NULL; @@ -1171,12 +1182,14 @@ enc = encodings[i]; switch (enc) { case VNC_ENCODING_RAW: + vs->vnc_encoding = enc; break; case VNC_ENCODING_COPYRECT: dcl->dpy_copy = vnc_copy; break; case VNC_ENCODING_HEXTILE: vs->features |= VNC_FEATURE_HEXTILE_MASK; + vs->vnc_encoding = enc; break; case VNC_ENCODING_DESKTOPRESIZE: vs->features |= VNC_FEATURE_RESIZE_MASK; @@ -1193,6 +1206,12 @@ case VNC_ENCODING_WMVi: vs->features |= VNC_FEATURE_WMVI_MASK; break; + case VNC_ENCODING_COMPRESSLEVEL0 ... VNC_ENCODING_COMPRESSLEVEL0 + 9: + vs->tight_compression = (enc & 0x0F); + break; + case VNC_ENCODING_QUALITYLEVEL0 ... VNC_ENCODING_QUALITYLEVEL0 + 9: + vs->tight_quality = (enc & 0x0F); + break; default: VNC_DEBUG("Unknown encoding: %d (0x%.8x): %d\n", i, enc, enc); break;