Skip to contentSkip to conversation

Dynamic modes support for PV xenfb (2of2)

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

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Dynamic modes support for PV xenfb (2of2)

Attached patch adds multiple frame buffer size support to the QEMU xenfb PV backend. Backend indicates it supports resize by setting feature-resize attribute in vfb and vkb devices.

Corresponding frontend LINUX patch is required for functionality but this patch is not dependent on it. Change is compatible with older frontend implementations.

Please apply to tip of xen-unstable

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

tools/ioemu/hw/xenfb.c +11 -0
diff -r 1f4b29eaf7f4 tools/ioemu/hw/xenfb.c
@@ -264,6 +264,10 @@ 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");
+	xenfb_xs_printf(xenfb->xsh, xenfb->kbd.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 +514,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 +21 -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];
 };
 
 /*
@@ -120,6 +138,8 @@ struct xenfb_page
  * solution is found, but don't leak it to the backend.
  */
 #ifdef __KERNEL__
+#define XENFB_MAX_WIDTH 1024
+#define XENFB_MAX_HEIGHT 768
 #define XENFB_WIDTH 800
 #define XENFB_HEIGHT 600
 #define XENFB_DEPTH 32

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