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

Re: [Xen-devel] [PATCH 12 of 13] fix xenfb frontend and backend



Stefano Stabellini wrote:
Due to the DisplayState changes the initialization order is changed
as well.
Now graphic devices are the first to be initialized and only after them
any display frontend is initialized.
Obviously this change has a direct consequence on the xenfb backend and
frontend and this patch takes care of adapting them to the new
initialization order.

Does anything here need to be merged into the pvops kernel xenfb frontend?

   J
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

---

diff -r 8aa8f3293ab9 hw/vga.c
--- a/hw/vga.c  Mon Mar 02 16:06:01 2009 +0000
+++ b/hw/vga.c  Mon Mar 02 16:06:41 2009 +0000
@@ -2497,7 +2497,7 @@
xen_vga_state->vram_ptr = vram;
 #ifdef CONFIG_STUBDOM
-    xenfb_pv_display_start(vram);
+    xenfb_pv_display_vram(vram);
 #endif
 }
@@ -2539,13 +2539,13 @@
     s->get_offsets = vga_get_offsets;
     s->get_resolution = vga_get_resolution;
+ s->ds = graphic_console_init(vga_update_display, vga_invalidate_display,
+                                 vga_screen_dump, vga_update_text, s);
+
     if (!restore) {
         xen_vga_populate_vram(VRAM_RESERVED_ADDRESS, s->vram_size);
         s->vram_gmfn = VRAM_RESERVED_ADDRESS;
     }
-
-    s->ds = graphic_console_init(vga_update_display, vga_invalidate_display,
-                                 vga_screen_dump, vga_update_text, s);
vga_bios_init(s);
     switch (vga_retrace_method) {
diff -r 8aa8f3293ab9 hw/xen_backend.h
--- a/hw/xen_backend.h  Mon Mar 02 16:06:01 2009 +0000
+++ b/hw/xen_backend.h  Mon Mar 02 16:06:41 2009 +0000
@@ -89,6 +89,6 @@
 extern struct XenDevOps xen_kbdmouse_ops;     /* xen_framebuffer.c */
 extern struct XenDevOps xen_framebuffer_ops;  /* xen_framebuffer.c */
-void xen_set_display(int domid, DisplayState *ds);
+void xen_set_display(int domid);
#endif /* QEMU_HW_XEN_BACKEND_H */
diff -r 8aa8f3293ab9 hw/xen_machine_pv.c
--- a/hw/xen_machine_pv.c       Mon Mar 02 16:06:01 2009 +0000
+++ b/hw/xen_machine_pv.c       Mon Mar 02 16:06:41 2009 +0000
@@ -68,7 +68,7 @@
     xen_be_register("vfb", &xen_framebuffer_ops);
/* setup framebuffer */
-    xen_set_display(xen_domid, ds);
+    xen_set_display(xen_domid);
 }
QEMUMachine xenpv_machine = {
diff -r 8aa8f3293ab9 hw/xenfb.c
--- a/hw/xenfb.c        Mon Mar 02 16:06:01 2009 +0000
+++ b/hw/xenfb.c        Mon Mar 02 16:06:41 2009 +0000
@@ -86,7 +86,6 @@
     int               feature_update;
     int               refresh_period;
     int               bug_trigger;
-    int               have_console;
struct {
        int x,y,w,h;
@@ -347,12 +346,6 @@
 {
     struct XenInput *in = container_of(xendev, struct XenInput, c.xendev);
- if (!in->c.ds) {
-        /* xen_set_display() below will set that and trigger us again */
-        xen_be_printf(xendev, 1, "ds not set (yet)\n");
-       return -1;
-    }
-
     xenstore_write_be_int(xendev, "feature-abs-pointer", 1);
     return 0;
 }
@@ -702,6 +695,9 @@
     int i;
     struct DisplayChangeListener *l;
+ if (!xenfb->width || !xenfb->height)
+        return;
+
     if (xenfb->feature_update) {
 #ifdef XENFB_TYPE_REFRESH_PERIOD
         int period = 99999999;
@@ -841,12 +837,6 @@
 {
     struct XenFB *fb = container_of(xendev, struct XenFB, c.xendev);
- if (!fb->c.ds) {
-        /* xen_set_display() below will set that and trigger us again */
-       xen_be_printf(xendev, 1, "ds not set (yet)\n");
-       return -1;
-    }
-
     fb->refresh_period = -1;
#ifdef XENFB_TYPE_RESIZE
@@ -879,15 +869,6 @@
     rc = xenfb_map_fb(fb);
     if (0 != rc)
        return rc;
-
-    if (!fb->have_console) {
-        fb->c.ds = graphic_console_init(xenfb_update,
-                                        xenfb_invalidate,
-                                        NULL,
-                                        NULL,
-                                        fb);
-        fb->have_console = 1;
-    }
if (-1 == xenstore_read_fe_int(xendev, "feature-update", &fb->feature_update))
        fb->feature_update = 0;
@@ -977,8 +958,16 @@
     xen_be_check_state(xendev);
 }
-void xen_set_display(int domid, DisplayState *ds)
+void xen_set_display(int domid)
 {
+    struct XenDevice *xendev = xen_be_find_xendev("vfb", domid, 0);
+    struct XenFB *fb = container_of(xendev, struct XenFB, c.xendev);
+    DisplayState *ds = graphic_console_init(xenfb_update,
+            xenfb_invalidate,
+            NULL,
+            NULL,
+            fb);
+
     xen_set_display_type(domid, "vkbd", ds);
     xen_set_display_type(domid, "vfb", ds);
 }
diff -r 8aa8f3293ab9 qemu-xen.h
--- a/qemu-xen.h        Mon Mar 02 16:06:01 2009 +0000
+++ b/qemu-xen.h        Mon Mar 02 16:06:41 2009 +0000
@@ -101,7 +101,7 @@
/* xenfbfront.c */
 int xenfb_pv_display_init(DisplayState *ds);
-int xenfb_pv_display_start(void *vram_start);
+int xenfb_pv_display_vram(void *vram_start);
 int xenfb_connect_vkbd(const char *path);
 int xenfb_connect_vfb(const char *path);
diff -r 8aa8f3293ab9 xenfbfront.c
--- a/xenfbfront.c      Mon Mar 02 16:06:01 2009 +0000
+++ b/xenfbfront.c      Mon Mar 02 16:06:41 2009 +0000
@@ -14,13 +14,14 @@
     struct semaphore kbd_sem;
     struct kbdfront_dev *kbd_dev;
     struct fbfront_dev *fb_dev;
-    void *vga_vram, *nonshared_vram;
+    void *nonshared_vram;
     DisplayState *ds;
 } XenFBState;
XenFBState *xs; static char *kbd_path, *fb_path;
+static void *vga_vram;
static unsigned char linux2scancode[KEY_MAX + 1];
 static DisplayChangeListener *dcl;
@@ -58,7 +59,7 @@
     if (!fb_dev)
         return;
     if (!(ds->surface->flags & QEMU_ALLOCATED_FLAG))
-        offset = ((void *) ds_get_data(ds)) - xs->vga_vram;
+        offset = ((void *) ds_get_data(ds)) - vga_vram;
     else
         offset = vga_ram_size;
     fbfront_resize(fb_dev, ds_get_width(ds), ds_get_height(ds), 
ds_get_linesize(ds), ds_get_bits_per_pixel(ds), offset);
@@ -68,7 +69,7 @@
 {
     XenFBState *xs = ds->opaque;
     struct fbfront_dev *fb_dev = xs->fb_dev;
-    int offset = ((void *) ds_get_data(ds)) - xs->vga_vram;
+    int offset = ((void *) ds_get_data(ds)) - vga_vram;
     if (!fb_dev)
         return;
     fbfront_resize(fb_dev, ds_get_width(ds), ds_get_height(ds), 
ds_get_linesize(ds), ds_get_bits_per_pixel(ds), offset);
@@ -216,6 +217,13 @@
int xenfb_pv_display_init(DisplayState *ds)
 {
+    struct fbfront_dev *fb_dev;
+    int kbd_fd, fb_fd;
+    unsigned long *mfns;
+    int offset = 0;
+    int i;
+    int n = vga_ram_size / PAGE_SIZE;
+
     if (!fb_path || !kbd_path)
         return -1;
@@ -238,27 +246,10 @@
     dcl->dpy_setdata = xenfb_pv_setdata;
     dcl->dpy_refresh = xenfb_pv_refresh;
     register_displaychangelistener(ds, dcl);
-    return 0;
-}
-int xenfb_pv_display_start(void *data)
-{
-    DisplayState *ds;
-    struct fbfront_dev *fb_dev;
-    int kbd_fd, fb_fd;
-    int offset = 0;
-    unsigned long *mfns;
-    int n = vga_ram_size / PAGE_SIZE;
-    int i;
-
-    if (!fb_path || !kbd_path)
-        return 0;
-
-    ds = xs->ds;
-    xs->vga_vram = data;
     mfns = malloc(2 * n * sizeof(*mfns));
     for (i = 0; i < n; i++)
-        mfns[i] = virtual_to_mfn(xs->vga_vram + i * PAGE_SIZE);
+        mfns[i] = virtual_to_mfn(vga_vram + i * PAGE_SIZE);
     for (i = 0; i < n; i++)
         mfns[n + i] = virtual_to_mfn(xs->nonshared_vram + i * PAGE_SIZE);
@@ -271,7 +262,7 @@
     free(fb_path);
if (!(ds->surface->flags & QEMU_ALLOCATED_FLAG)) {
-        offset = (void*) ds_get_data(ds) - xs->vga_vram;
+        offset = (void*) ds_get_data(ds) - vga_vram;
     } else {
         offset = vga_ram_size;
     }
@@ -290,3 +281,9 @@
     xs->fb_dev = fb_dev;
     return 0;
 }
+
+int xenfb_pv_display_vram(void *data)
+{
+    vga_vram = data;
+}
+


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.