Re: [libvirt] [PATCH] add fullscreen support to qemu sdl xml (via fullscreen='true' attribute for the graphics element)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 10, 2008 at 06:06:51AM -0500, Itamar Heim wrote:
> Sure - probably not a good idea to send patches at such a late hour anyway
> :)
> Attached diff.
> 
> Some more details:
> For those using SDL ("for some crazy reason" as Berrange put it in the
> original patch), there is a use for the fullscreen option, causing the
> qemu window to open in full screen, change resolution, etc.
> This patch accepts an additional attribute in the graphics element:
> <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority'
> fullscreen='true'/>
> 
> If fullscreen is true, "-full-screen" is added to the qemu command line
> (unlike the display and auth which are added as environment variables)

  Okay, to avoid having this patch forgotten in a nitpicking discussion
(I'm guilty I started :-) I commited the following which integrate the
associated changes and keep the final code in line with the existing one:
   - make the check at parse time
   - use an int to store the data
   - use yes/no as the accepted values
   - error out if the attribute value does not follow
   - drop all bool usage
   - fix docs/libvirt.rng to detail the new optional attribute and its 2
     values
   - fix docs/formatdomain.html[.in] to describe the attributes for the
     sdl display type.
   - fix the test to use the new value 'yes' in the xml

I guess this covers most of the changes needed for this patch, now you
can blame me if I forgot something :-) but this passes the tests (well
there is errors on the uml tests I didn't figured out yet but looks
unrelated.

 thanks Itamar !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/
Index: docs/formatdomain.html
===================================================================
RCS file: /data/cvs/libxen/docs/formatdomain.html,v
retrieving revision 1.13
diff -u -p -u -p -r1.13 formatdomain.html
--- docs/formatdomain.html	13 Oct 2008 15:25:38 -0000	1.13
+++ docs/formatdomain.html	11 Dec 2008 11:33:27 -0000
@@ -713,6 +713,10 @@ qemu-kvm -net nic,model=? /dev/null
         <dl><dt><code>graphics</code></dt><dd>The <code>graphics</code> element has a mandatory <code>type</code>
 	attribute which takes the value "sdl" or "vnc". The former displays
 	a window on the host desktop, while the latter activates a VNC server.
+        The former accepts 3 optional arguments: a <code>display</code>
+        attribute for the display to use, an <code>xauth</code> attribute for
+        the authentication identifier, and an optional <code>fullscreen</code>
+        attribute accepting values 'yes' or 'no'.
 	If the latter is used the <code>port</code> attribute specifies the TCP
 	port number (with -1 as legacy syntax indicating that it should be
 	auto-allocated). The <code>autoport</code> attribute is the new
Index: docs/formatdomain.html.in
===================================================================
RCS file: /data/cvs/libxen/docs/formatdomain.html.in,v
retrieving revision 1.8
diff -u -p -u -p -r1.8 formatdomain.html.in
--- docs/formatdomain.html.in	13 Oct 2008 15:25:38 -0000	1.8
+++ docs/formatdomain.html.in	11 Dec 2008 11:33:27 -0000
@@ -657,6 +657,10 @@ qemu-kvm -net nic,model=? /dev/null
       <dd>The <code>graphics</code> element has a mandatory <code>type</code>
 	attribute which takes the value "sdl" or "vnc". The former displays
 	a window on the host desktop, while the latter activates a VNC server.
+        The former accepts 3 optional arguments: a <code>display</code>
+        attribute for the display to use, an <code>xauth</code> attribute for
+        the authentication identifier, and an optional <code>fullscreen</code>
+        attribute accepting values 'yes' or 'no'.
 	If the latter is used the <code>port</code> attribute specifies the TCP
 	port number (with -1 as legacy syntax indicating that it should be
 	auto-allocated). The <code>autoport</code> attribute is the new
Index: docs/libvirt.rng
===================================================================
RCS file: /data/cvs/libxen/docs/libvirt.rng,v
retrieving revision 1.15
diff -u -p -u -p -r1.15 libvirt.rng
--- docs/libvirt.rng	10 Oct 2008 16:52:20 -0000	1.15
+++ docs/libvirt.rng	11 Dec 2008 11:33:27 -0000
@@ -638,7 +638,7 @@
 
   <!--
       A graphic description, currently in Xen only 2 types are supported:
-        - sdl without arguments
+        - sdl with optional display, xauth and fullscreen
 	- vnc with a required port and optional listen IP address, password
           and keymap
     -->
@@ -659,6 +659,14 @@
 	      <text/>
 	    </attribute>
 	  </optional>
+	  <optional>
+	    <attribute name='fullscreen'>
+	      <choice>
+		<value>yes</value>
+		<value>no</value>
+	      </choice>
+	    </attribute>
+	  </optional>
 	</group>
 	<group>
           <attribute name='type'>
Index: src/domain_conf.c
===================================================================
RCS file: /data/cvs/libxen/src/domain_conf.c,v
retrieving revision 1.44
diff -u -p -u -p -r1.44 domain_conf.c
--- src/domain_conf.c	5 Dec 2008 10:10:41 -0000	1.44
+++ src/domain_conf.c	11 Dec 2008 11:33:27 -0000
@@ -1401,6 +1401,22 @@ virDomainGraphicsDefParseXML(virConnectP
         def->data.vnc.passwd = virXMLPropString(node, "passwd");
         def->data.vnc.keymap = virXMLPropString(node, "keymap");
     } else if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
+        char *fullscreen = virXMLPropString(node, "fullscreen");
+
+        if (fullscreen != NULL) {
+            if (STREQ(fullscreen, "yes")) {
+                def->data.sdl.fullscreen = 1;
+            } else if (STREQ(fullscreen, "no")) {
+                def->data.sdl.fullscreen = 0;
+            } else {
+                virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+                             _("unknown fullscreen value '%s'"), fullscreen);
+                VIR_FREE(fullscreen);
+                goto error;
+            }
+            VIR_FREE(fullscreen);
+        } else
+            def->data.sdl.fullscreen = 0;
         def->data.sdl.xauth = virXMLPropString(node, "xauth");
         def->data.sdl.display = virXMLPropString(node, "display");
     }
@@ -2951,6 +2967,9 @@ virDomainGraphicsDefFormat(virConnectPtr
         if (def->data.sdl.xauth)
             virBufferEscapeString(buf, " xauth='%s'",
                                   def->data.sdl.xauth);
+        if (def->data.sdl.fullscreen)
+            virBufferAddLit(buf, " fullscreen='yes'");
+
         break;
     }
 
Index: src/domain_conf.h
===================================================================
RCS file: /data/cvs/libxen/src/domain_conf.h,v
retrieving revision 1.22
diff -u -p -u -p -r1.22 domain_conf.h
--- src/domain_conf.h	4 Dec 2008 22:00:14 -0000	1.22
+++ src/domain_conf.h	11 Dec 2008 11:33:27 -0000
@@ -268,6 +268,7 @@ struct _virDomainGraphicsDef {
         struct {
             char *display;
             char *xauth;
+            int fullscreen;
         } sdl;
     } data;
 };
Index: src/qemu_conf.c
===================================================================
RCS file: /data/cvs/libxen/src/qemu_conf.c,v
retrieving revision 1.109
diff -u -p -u -p -r1.109 qemu_conf.c
--- src/qemu_conf.c	28 Nov 2008 11:20:27 -0000	1.109
+++ src/qemu_conf.c	11 Dec 2008 11:33:27 -0000
@@ -1229,6 +1229,8 @@ int qemudBuildCommandLine(virConnectPtr 
             ADD_ENV(xauth);
         if (display)
             ADD_ENV(display);
+        if (vm->def->graphics->data.sdl.fullscreen)
+            ADD_ARG_LIT("-full-screen");
     }
 
     /* Add sound hardware */
Index: tests/qemuxml2argvtest.c
===================================================================
RCS file: /data/cvs/libxen/tests/qemuxml2argvtest.c,v
retrieving revision 1.34
diff -u -p -u -p -r1.34 qemuxml2argvtest.c
--- tests/qemuxml2argvtest.c	4 Dec 2008 12:02:59 -0000	1.34
+++ tests/qemuxml2argvtest.c	11 Dec 2008 11:33:27 -0000
@@ -195,6 +195,7 @@ mymain(int argc, char **argv)
     DO_TEST("disk-usb", 0);
     DO_TEST("graphics-vnc", 0);
     DO_TEST("graphics-sdl", 0);
+    DO_TEST("graphics-sdl-fullscreen", 0);
     DO_TEST("input-usbmouse", 0);
     DO_TEST("input-usbtablet", 0);
     DO_TEST("input-xen", 0);
Index: tests/qemuxml2xmltest.c
===================================================================
RCS file: /data/cvs/libxen/tests/qemuxml2xmltest.c,v
retrieving revision 1.22
diff -u -p -u -p -r1.22 qemuxml2xmltest.c
--- tests/qemuxml2xmltest.c	8 Aug 2008 15:03:00 -0000	1.22
+++ tests/qemuxml2xmltest.c	11 Dec 2008 11:33:27 -0000
@@ -98,6 +98,7 @@ mymain(int argc, char **argv)
     DO_TEST("disk-usb");
     DO_TEST("graphics-vnc");
     DO_TEST("graphics-sdl");
+    DO_TEST("graphics-sdl-fullscreen");
     DO_TEST("input-usbmouse");
     DO_TEST("input-usbtablet");
     DO_TEST("input-xen");
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]