Skip to contentSkip to conversation

Qemu vnc WMVi support

PATCH Stefano Stabellini 3 participants 4 messages Feb 13, 2008 – Feb 14, 2008

lore
Share & tools
lore
#0 lore raw

Hi all,
the patch "qemu-vnc-wmvi.patch" adds support for the WMVi pseudoencoding in qemu vnc server. If the client implements it, it is supposed to be able to change colour depth when receiving a WMVi message.

Since I didn't know any client that supports it and I wanted to test the implementation before submitting any patch I also modified vncviewer to support WMVi. The patch "vncviewer-wmvi.patch" is meant to be applied to the realvnc vncviewer unix client version 4.1.2, using patch -p1.
Try executing vncviewer with FullColour=1 AutoSelect=0.

Regards,

Stefano Stabellini

tools/ioemu/vl.c +0 -9
diff -r e85399173769 tools/ioemu/vl.c
@@ -154,7 +154,6 @@ int nographic;
 int nographic;
 int vncviewer;
 int vncunused;
-int vncswitchbpp;
 const char* keyboard_layout = NULL;
 int64_t ticks_per_sec;
 char *boot_device = NULL;
@@ -6560,7 +6559,6 @@ void help(void)
 	   "-vnc display    start a VNC server on display\n"
            "-vncviewer      start a vncviewer process for this domain\n"
            "-vncunused      bind the VNC server to an unused port\n"
-           "-vnc-switch-bpp VNC server closes connections when the guest OS changes colour depth\n"
 #ifndef NO_DAEMONIZE
 	   "-daemonize      daemonize QEMU after initializing\n"
 #endif
@@ -6662,7 +6660,6 @@ enum {
     QEMU_OPTION_acpi,
     QEMU_OPTION_vncviewer,
     QEMU_OPTION_vncunused,
-    QEMU_OPTION_vncswitchbpp,
     QEMU_OPTION_pci,
 };
 
@@ -6746,7 +6743,6 @@ const QEMUOption qemu_options[] = {
     { "vnc", HAS_ARG, QEMU_OPTION_vnc },
     { "vncviewer", 0, QEMU_OPTION_vncviewer },
     { "vncunused", 0, QEMU_OPTION_vncunused },
-    { "vnc-switch-bpp", 0, QEMU_OPTION_vncswitchbpp },
 
     /* temporary options */
     { "usb", 0, QEMU_OPTION_usb },
@@ -7164,7 +7160,6 @@ int main(int argc, char **argv)
     nographic = 0;
     vncviewer = 0;
     vncunused = 0;
-    vncswitchbpp = 0;
     kernel_filename = NULL;
     kernel_cmdline = "";
 #ifndef CONFIG_DM
@@ -7595,9 +7590,6 @@ int main(int argc, char **argv)
             case QEMU_OPTION_vncunused:
                 vncunused++;
                 break;
-            case QEMU_OPTION_vncswitchbpp:
-                vncswitchbpp++;
-                break;
             case QEMU_OPTION_pci:
                 direct_pci = optarg;
                 break;
@@ -7830,7 +7822,6 @@ int main(int argc, char **argv)
     } else if (vnc_display != NULL || vncunused != 0) {
 	int vnc_display_port;
 	char password[20];
-        ds->switchbpp = vncswitchbpp;
 	vnc_display_init(ds);
 	xenstore_read_vncpasswd(domid, password, sizeof(password));
 	vnc_display_password(ds, password);
tools/ioemu/vnc.c +66 -40

154 lines not on this page · raw message

vnc-4_1_2-unixsrc-new/common/rfb/CMsgReaderV3.cxx renamed from common/rfb/CMsgReaderV3.cxx +7 -0
diff -upr vnc-4_1_2-unixsrc/common/rfb/CMsgReaderV3.cxx ../vnc-4_1_2-unixsrc-new/common/rfb/CMsgReaderV3.cxx
@@ -74,6 +74,13 @@ void CMsgReaderV3::readMsg()
     case pseudoEncodingDesktopSize:
       handler->setDesktopSize(w, h);
       break;
+    case pseudoEncodingWMVi:
+    {
+      PixelFormat pf;
+      pf.read(is);
+      handler->setPixelFormat(pf);
+    }
+      break;
     case pseudoEncodingCursor:
       readSetCursor(w, h, Point(x,y));
       break;
vnc-4_1_2-unixsrc-new/common/rfb/CMsgWriter.cxx renamed from common/rfb/CMsgWriter.cxx +2 -0
diff -upr vnc-4_1_2-unixsrc/common/rfb/CMsgWriter.cxx ../vnc-4_1_2-unixsrc-new/common/rfb/CMsgWriter.cxx
@@ -64,6 +64,8 @@ void CMsgWriter::writeSetEncodings(int p
     encodings[nEncodings++] = pseudoEncodingCursor;
   if (cp->supportsDesktopResize)
     encodings[nEncodings++] = pseudoEncodingDesktopSize;
+  if (cp->supportsWMVi)
+    encodings[nEncodings++] = pseudoEncodingWMVi;
   if (Decoder::supported(preferredEncoding)) {
     encodings[nEncodings++] = preferredEncoding;
   }
vnc-4_1_2-unixsrc-new/common/rfb/ConnParams.cxx renamed from common/rfb/ConnParams.cxx +3 -0
diff -upr vnc-4_1_2-unixsrc/common/rfb/ConnParams.cxx ../vnc-4_1_2-unixsrc-new/common/rfb/ConnParams.cxx
@@ -88,6 +88,7 @@ void ConnParams::setEncodings(int nEncod
   useCopyRect = false;
   supportsLocalCursor = false;
   supportsDesktopResize = false;
+  supportsWMVi = false;
   currentEncoding_ = encodingRaw;
 
   for (int i = nEncodings-1; i >= 0; i--) {
@@ -99,6 +100,8 @@ void ConnParams::setEncodings(int nEncod
       supportsLocalCursor = true;
     else if (encodings[i] == pseudoEncodingDesktopSize)
       supportsDesktopResize = true;
+    else if (encodings[i] == pseudoEncodingWMVi)
+      supportsWMVi = true;
     else if (encodings[i] <= encodingMax && Encoder::supported(encodings[i]))
       currentEncoding_ = encodings[i];
   }
vnc-4_1_2-unixsrc-new/common/rfb/ConnParams.h renamed from common/rfb/ConnParams.h +1 -0
diff -upr vnc-4_1_2-unixsrc/common/rfb/ConnParams.h ../vnc-4_1_2-unixsrc-new/common/rfb/ConnParams.h
@@ -71,6 +71,7 @@ namespace rfb {
 
     bool supportsLocalCursor;
     bool supportsDesktopResize;
+    bool supportsWMVi;
 
   private:
 
vnc-4_1_2-unixsrc-new/common/rfb/encodings.h renamed from common/rfb/encodings.h +1 -0
diff -upr vnc-4_1_2-unixsrc/common/rfb/encodings.h ../vnc-4_1_2-unixsrc-new/common/rfb/encodings.h
@@ -31,6 +31,7 @@ namespace rfb {
 
   const unsigned int pseudoEncodingCursor = 0xffffff11;
   const unsigned int pseudoEncodingDesktopSize = 0xffffff21;
+  const unsigned int pseudoEncodingWMVi = 0x574D5669;
 
   int encodingNum(const char* name);
   const char* encodingName(unsigned int num);
vnc-4_1_2-unixsrc-new/unix/vncviewer/CConn.cxx renamed from unix/vncviewer/CConn.cxx +12 -0
diff -upr vnc-4_1_2-unixsrc/unix/vncviewer/CConn.cxx ../vnc-4_1_2-unixsrc-new/unix/vncviewer/CConn.cxx
@@ -75,6 +75,7 @@ CConn::CConn(Display* dpy_, int argc_, c
     autoSelect = false;
   }
   cp.supportsDesktopResize = true;
+  cp.supportsWMVi = true;
   cp.supportsLocalCursor = useLocalCursor;
   initMenu();
 
@@ -260,6 +261,17 @@ void CConn::setDesktopSize(int w, int h)
   }
 }
 
+// setPixelFormat is called upon receving a WMVi message
+void CConn::setPixelFormat(const PixelFormat &pf) {
+  cp.setPF(pf);
+  if (desktop) {
+    char str[256];
+    desktop->setPF(pf);
+    desktop->getPF().print(str, 256);
+    vlog.info("Using pixel format %s",str);
+   }
+ }
+
 // framebufferUpdateEnd() is called at the end of an update.
 // For each rectangle, the FdInStream will have timed the speed
 // of the connection, allowing us to select format and encoding
vnc-4_1_2-unixsrc-new/unix/vncviewer/CConn.h renamed from unix/vncviewer/CConn.h +2 -0
diff -upr vnc-4_1_2-unixsrc/unix/vncviewer/CConn.h ../vnc-4_1_2-unixsrc-new/unix/vncviewer/CConn.h
@@ -26,6 +26,7 @@
 #include <rfb/Exception.h>
 #include <rfb/UserPasswdGetter.h>
 #include <rdr/FdInStream.h>
+#include <rfb/PixelFormat.h>
 #include <list>
 
 #include "TXWindow.h"
@@ -74,6 +75,7 @@ public:
   rfb::CSecurity* getCSecurity(int secType);
   void serverInit();
   void setDesktopSize(int w, int h);
+  void setPixelFormat(const rfb::PixelFormat& pf);
   void setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs);
   void bell();
   void serverCutText(const char* str, int len);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 7 lines · Stefano Stabellini

Hi all,
the patch "qemu-vnc-wmvi.patch" adds support for the WMVi pseudoencoding in qemu vnc server. If the client implements it, it is supposed to be able to change colour depth when receiving a WMVi message.

Since I didn't know any client that supports it and I wanted to test the implementation before submitting any patch I also modified vncviewer to support WMVi. The patch "vncviewer-wmvi.patch" is meant to be applied to the realvnc vncviewer unix client version 4.1.2, using patch -p1.
Try executing vncviewer with FullColour=1 AutoSelect=0.

Please submit this patch to the qemu-devel. I'll help make sure it gets picked up. I was hoping you'd do a patch for gtk-vnc but I can add support for it if you can't.

gtk-vnc is what's used by virt-manager FWIW.

Regards,

Anthony Liguori

Quoted 13 lines

Regards,

Stefano Stabellini

------------------------------------------------------------------------

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
Quoted 14 lines · Anthony Liguori
Quoted 6 lines · Stefano Stabellini

Hi all,
the patch "qemu-vnc-wmvi.patch" adds support for the WMVi pseudoencoding in qemu vnc server.
If the client implements it, it is supposed to be able to change colour depth when receiving a WMVi message.

Quoted 6 lines

Since I didn't know any client that supports it and I wanted to test the implementation before submitting any patch I also modified vncviewer to support WMVi.
The patch "vncviewer-wmvi.patch" is meant to be applied to the realvnc vncviewer unix client version 4.1.2, using patch -p1.
Try executing vncviewer with FullColour=1 AutoSelect=0.

Quoted 5 lines

Please submit this patch to the qemu-devel. I'll help make sure it gets picked up. I was hoping you'd do a patch for gtk-vnc but I can add support for it if you can't.

gtk-vnc is what's used by virt-manager FWIW.

And the new standard GNOME VNC client, Vinagre

Dan.

Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
#3 lore raw
In reply to Anthony Liguori
Quoted 10 lines · Anthony Liguori
Quoted 7 lines · Stefano Stabellini

Hi all,
the patch "qemu-vnc-wmvi.patch" adds support for the WMVi pseudoencoding in qemu vnc server. If the client implements it, it is supposed to be able to change colour depth when receiving a WMVi message.

Since I didn't know any client that supports it and I wanted to test the implementation before submitting any patch I also modified vncviewer to support WMVi. The patch "vncviewer-wmvi.patch" is meant to be applied to the realvnc vncviewer unix client version 4.1.2, using patch -p1.
Try executing vncviewer with FullColour=1 AutoSelect=0.

Please submit this patch to the qemu-devel. I'll help make sure it gets picked up.

We are currently working on a merge with qemu 0.9.1, there is still a lot of work to do, but you should be able to see the results soon enough.

Quoted 3 lines

I was hoping you'd do a patch for gtk-vnc but I can add support for it if you can't.

gtk-vnc is what's used by virt-manager FWIW.

I modified vncviewer first because I am more familiar with its code than with any other vnc client. Of course I can help implement it on gtk-vnc too, I just need some more time.
Implementing WMVi support on the client side is very simple if the client is already able to do colour conversions.