xen/xen-fbback-resize.patch

145 lines
4.6 KiB
Diff

diff -r 15cfd1f8fa38 tools/ioemu/hw/xenfb.c
--- a/tools/ioemu/hw/xenfb.c Tue Jan 08 16:45:08 2008 +0000
+++ b/tools/ioemu/hw/xenfb.c Thu Jan 10 12:20:59 2008 -0700
@@ -78,6 +78,7 @@ static void xenfb_invalidate(void *opaqu
static void xenfb_invalidate(void *opaque);
static void xenfb_screen_dump(void *opaque, const char *name);
static int xenfb_register_console(struct xenfb *xenfb);
+static int xenfb_send_resize(struct xenfb *xenfb, int width, int height);
/*
* Tables to map from scancode to Linux input layer keycode.
@@ -264,6 +265,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 +514,12 @@ static void xenfb_on_fb_event(struct xen
}
xenfb_guest_copy(xenfb, x, y, w, h);
break;
+ case XENFB_TYPE_RESIZE:
+ xenfb->width = event->resize.width;
+ xenfb->height = event->resize.height;
+ dpy_resize(xenfb->ds, xenfb->width, xenfb->height);
+ xenfb_send_resize(xenfb, xenfb->width, xenfb->height);
+ break;
}
}
mb(); /* ensure we're done with ring contents */
@@ -601,6 +611,19 @@ static int xenfb_send_motion(struct xenf
event.motion.rel_x = rel_x;
event.motion.rel_y = rel_y;
event.motion.rel_z = rel_z;
+
+ return xenfb_kbd_event(xenfb, &event);
+}
+
+/* Send a resize event to kbd driver */
+static int xenfb_send_resize(struct xenfb *xenfb, int width, int height)
+{
+ union xenkbd_in_event event;
+
+ memset(&event, 0, XENKBD_IN_EVENT_SIZE);
+ event.type = XENKBD_TYPE_RESIZE;
+ event.resize.width = width;
+ event.resize.height = height;
return xenfb_kbd_event(xenfb, &event);
}
diff -r 15cfd1f8fa38 xen/include/public/io/fbif.h
--- a/xen/include/public/io/fbif.h Tue Jan 08 16:45:08 2008 +0000
+++ b/xen/include/public/io/fbif.h Thu Jan 10 11:00:13 2008 -0700
@@ -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; /* frame buffer width in pixels */
+ int32_t height; /* frame buffer height in pixels */
+};
+
#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];
};
@@ -109,15 +123,18 @@ struct xenfb_page
* Each directory page holds PAGE_SIZE / sizeof(*pd)
* framebuffer pages, and can thus map up to PAGE_SIZE *
* 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.
+ * sizeof(unsigned long) == 4 on a 32 bit system that's 4 Megs
+ * sizeof(unsigned long) == 8 on a 64 bit system that's 2 Megs
+ * Will need 3 directory page entries to support a 5MB frame
+ * buffer which is enough for a 1280x1024 display
*/
- unsigned long pd[2];
+ unsigned long pd[3];
};
/*
- * Wart: xenkbd needs to know resolution. Put it here until a better
- * solution is found, but don't leak it to the backend.
+ * Wart: xenkbd needs to know resolution of initial frame buffer. Put
+ * it here until a better solution is found, but don't leak it to
+ * the backend.
*/
#ifdef __KERNEL__
#define XENFB_WIDTH 800
diff -r 15cfd1f8fa38 xen/include/public/io/kbdif.h
--- a/xen/include/public/io/kbdif.h Tue Jan 08 16:45:08 2008 +0000
+++ b/xen/include/public/io/kbdif.h Thu Jan 10 12:28:09 2008 -0700
@@ -44,6 +44,11 @@
* request-abs-update in xenstore.
*/
#define XENKBD_TYPE_POS 4
+/*
+ * Sent when frame buffer is resized. kbd adjusts absolute
+ * max X and Y axis values in input ptr device.
+ */
+#define XENKBD_TYPE_RESIZE 5
struct xenkbd_motion
{
@@ -68,6 +73,12 @@ struct xenkbd_position
int32_t abs_z; /* absolute Z position (wheel) */
};
+struct xenkbd_resize
+{
+ uint8_t type; /* XENKBD_TYPE_RESIZE */
+ int32_t width; /* frame buffer width in pixels */
+ int32_t height; /* frame buffer height in pixels */
+};
#define XENKBD_IN_EVENT_SIZE 40
union xenkbd_in_event
@@ -76,6 +87,7 @@ union xenkbd_in_event
struct xenkbd_motion motion;
struct xenkbd_key key;
struct xenkbd_position pos;
+ struct xenkbd_resize resize;
char pad[XENKBD_IN_EVENT_SIZE];
};