Skip to contentSkip to conversation

stubdom: use PVFB so as to e.g. permit SDL display

PATCH In review Samuel Thibault 1 participant 2 messages Feb 27, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 stubdom: use PVFB so as to e.g. permit SDL display

This adds support in ioemu for PVFB frontend as stubdomain display. This permits for instance to use SDL in dom0 to perform the eventual display.

extras/mini-os/fbfront.c +4 -8
diff -r 2a8eaba24bf0 extras/mini-os/fbfront.c
@@ -30,13 +30,6 @@ struct kbdfront_dev {
 
     char *nodename;
     char *backend;
-
-    char *data;
-    int width;
-    int height;
-    int depth;
-    int line_length;
-    int mem_length;
 
 #ifdef HAVE_LIBC
     int fd;
@@ -316,7 +309,10 @@ struct fbfront_dev *init_fbfront(char *n
     for (i = 0; mapped < mem_length && i < max_pd; i++) {
         unsigned long *pd = (unsigned long *) alloc_page();
         for (j = 0; mapped < mem_length && j < PAGE_SIZE / sizeof(unsigned long); j++) {
-            pd[j] = virt_to_mfn((unsigned long) data + mapped);
+            /* Trigger CoW */
+            * ((char *)data + mapped) = 0;
+            barrier();
+            pd[j] = virtual_to_mfn((unsigned long) data + mapped);
             mapped += PAGE_SIZE;
         }
         for ( ; j < PAGE_SIZE / sizeof(unsigned long); j++)
extras/mini-os/include/fbfront.h +3 -0
diff -r 2a8eaba24bf0 extras/mini-os/include/fbfront.h
@@ -14,6 +14,9 @@
 #ifndef KEY_Q
 #define KEY_Q 16
 #endif
+#ifndef KEY_MAX
+#define KEY_MAX 0x1ff
+#endif
 
 
 struct kbdfront_dev;
stubdom/README +68 -29

106 lines not on this page · raw message

tools/ioemu/hw/xenfb.c +207 -3

231 lines not on this page · raw message

tools/ioemu/vl.c +4 -0
diff -r 2a8eaba24bf0 tools/ioemu/vl.c
@@ -7831,6 +7831,10 @@ int main(int argc, char **argv)
     init_ioports();
 
     /* terminal init */
+#ifdef CONFIG_STUBDOM
+    if (xenfb_pv_display_init(ds) == 0) {
+    } else
+#endif
     if (nographic) {
         dumb_display_init(ds);
     } else if (vnc_display != NULL || vncunused != 0) {
tools/ioemu/vl.h +5 -0
diff -r 2a8eaba24bf0 tools/ioemu/vl.h
@@ -1525,6 +1525,11 @@ int xenstore_vm_write(int domid, char *k
 int xenstore_vm_write(int domid, char *key, char *val);
 char *xenstore_vm_read(int domid, char *key, unsigned int *len);
 
+/* xenfb.c */
+int xenfb_pv_display_init(DisplayState *ds);
+int xenfb_connect_vkbd(const char *path);
+int xenfb_connect_vfb(const char *path);
+
 /* helper2.c */
 extern long time_offset;
 void timeoffset_get(void);
tools/ioemu/xenstore.c +31 -0
diff -r 2a8eaba24bf0 tools/ioemu/xenstore.c
@@ -238,6 +238,37 @@ void xenstore_parse_domain_config(int do
         }
     }
 
+#ifdef CONFIG_STUBDOM
+    if (pasprintf(&buf, "%s/device/vkbd", path) == -1)
+        goto out;
+
+    free(e);
+    e = xs_directory(xsh, XBT_NULL, buf, &num);
+
+    if (e) {
+        for (i = 0; i < num; i++) {
+            if (pasprintf(&buf, "%s/device/vkbd/%s", path, e[i]) == -1)
+                continue;
+            xenfb_connect_vkbd(buf);
+        }
+    }
+
+    if (pasprintf(&buf, "%s/device/vfb", path) == -1)
+        goto out;
+
+    free(e);
+    e = xs_directory(xsh, XBT_NULL, buf, &num);
+
+    if (e) {
+        for (i = 0; i < num; i++) {
+            if (pasprintf(&buf, "%s/device/vfb/%s", path, e[i]) == -1)
+                continue;
+            xenfb_connect_vfb(buf);
+        }
+    }
+#endif
+
+
     /* Set a watch for log-dirty requests from the migration tools */
     if (pasprintf(&buf, "/local/domain/0/device-model/%u/logdirty/next-active",
                   domid) != -1) {
#1 lore raw

tools/ioemu/hw/xenfb.c static int xenfb_register_console(struct · line 1187

Quoted 5 lines · Samuel Thibault, le Wed 27 Feb 2008 18:42:19 +0000, a écrit :
tools/ioemu/hw/xenfb.c +5 -0
+#define WIDTH 1024
+#define HEIGHT 768
+#define DEPTH 32
+#define LINESIZE (1280 * (DEPTH / 8))
+#define MEMSIZE (LINESIZE * HEIGHT)

Note: because the PVFB resize patch has not been integrated yet, for now the window is always set to 1024x768, and output is clipped to that.

Samuel