Skip to contentSkip to conversation

Dynamic modes support for PV xenfb

PATCH New Pat Campbell 1 participant 1 message Dec 28, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Dynamic modes support for PV xenfb

Attached patch adds multiple frame buffer size support to the xenfb PV backend QEMU xenfb. Backend sets feature-resize and handles the resize frame buffer event.

Corresponding frontend LINUX patch is required for functionality but this patch is not dependent on it, preserving backwards compatibility.

Please apply to tip of xen-unstable

Signed- off- by: Pat Campbell <[email protected]>

tools/ioemu/hw/xenfb.c +10 -0
diff -r 1f4b29eaf7f4 tools/ioemu/hw/xenfb.c
@@ -264,6 +264,9 @@ struct xenfb *xenfb_new(int domid, Displ
 	xenfb->ds = ds;
 	xenfb_device_set_domain(&xenfb->fb, domid);
 	xenfb_device_set_domain(&xenfb->kbd, domid);
+
+	/* Indicate we have the frame buffer resize feature */
+	xenfb_xs_printf(xenfb->xsh, xenfb->fb.nodename, "feature-resize", "1");
 
 	fprintf(stderr, "FB: Waiting for KBD backend creation\n");
 	xenfb_wait_for_backend(&xenfb->kbd, xenfb_backend_created_kbd);
@@ -510,6 +513,13 @@ static void xenfb_on_fb_event(struct xen
 			}
 			xenfb_guest_copy(xenfb, x, y, w, h);
 			break;
+		case XENFB_TYPE_RESIZE:
+			w = event->resize.width;
+			h = event->resize.height;
+			xenfb->width = w;
+			xenfb->height = h;
+			dpy_resize(xenfb->ds, xenfb->width, xenfb->height);
+			break;
 		}
 	}
 	mb();			/* ensure we're done with ring contents */
xen/include/public/io/fbif.h +19 -1
diff -r 1f4b29eaf7f4 xen/include/public/io/fbif.h
@@ -50,12 +50,26 @@ struct xenfb_update
     int32_t height; /* rect height */
 };
 
+/*
+ * Framebuffer resize notification event
+ * Capable backend sets feature-resize in xenstore.
+ */
+#define XENFB_TYPE_RESIZE 3
+
+struct xenfb_resize
+{
+    uint8_t type;    /* XENFB_TYPE_RESIZE */
+    int32_t width;   /* xres */
+    int32_t height;  /* yres */
+};
+
 #define XENFB_OUT_EVENT_SIZE 40
 
 union xenfb_out_event
 {
     uint8_t type;
     struct xenfb_update update;
+    struct xenfb_resize resize;
     char pad[XENFB_OUT_EVENT_SIZE];
 };
 
@@ -111,8 +125,12 @@ struct xenfb_page
      * PAGE_SIZE / sizeof(*pd) bytes.  With PAGE_SIZE == 4096 and
      * sizeof(unsigned long) == 4, that's 4 Megs.  Two directory
      * pages should be enough for a while.
+     *
+     * Increased to 3 to support 1280x1024 resolution on a 64bit system
+     *  (1280*1024*4)/PAGE_SIZE = 1280 pages required
+     *  PAGE_SIZE/64bit long = 512 pages per page directory
      */
-    unsigned long pd[2];
+    unsigned long pd[3];
 };
 
 /*

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