From: "Pat Campbell" Subject: [PATCH][IOEMU] Dynamic modes support for PV xenfb (2 of 2) Date: Tue, 08 Jan 2008 08:34:44 -0700 Message-ID: <47833544.3E48.0018.0@novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part3016F904.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --=__Part3016F904.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Attached patch adds multiple frame buffer size support to the xenfb PV=20 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 --=__Part3016F904.0__= Content-Type: text/plain; name="xen-fbback-resize.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="xen-fbback-resize.patch" diff -r 2491691e3e69 tools/ioemu/hw/xenfb.c --- a/tools/ioemu/hw/xenfb.c Sat Dec 29 17:57:47 2007 +0000 +++ b/tools/ioemu/hw/xenfb.c Mon Jan 07 12:38:25 2008 -0700 @@ -53,6 +53,7 @@ struct xenfb { int abs_pointer_wanted; /* Whether guest supports absolute pointer = */ int button_state; /* Last seen pointer button state */ char protocol[64]; /* frontend protocol */ + int fixevdev_abs; /* Descale abs pos so evdev scales = properly */ }; =20 /* Functions for frontend/backend state machine*/ @@ -233,6 +234,7 @@ struct xenfb *xenfb_new(int domid, Displ struct xenfb *xenfb =3D qemu_malloc(sizeof(struct xenfb)); int serrno; int i; + int val; =20 if (xenfb =3D=3D NULL) return NULL; @@ -264,6 +266,19 @@ struct xenfb *xenfb_new(int domid, Displ xenfb->ds =3D ds; xenfb_device_set_domain(&xenfb->fb, domid); xenfb_device_set_domain(&xenfb->kbd, domid); + + /* See if we need to fix abs ptr for guests evdev */ + if (xenfb_xs_scanf1(xenfb->xsh, xenfb->fb.nodename, "vnc-fixevdev-a= bs", + "%d", &val) < 0) + val =3D 0; + xenfb->fixevdev_abs =3D val; + + /* Indicate we have the frame buffer resize feature if resizable = allowed */ + if (xenfb_xs_scanf1(xenfb->xsh, xenfb->fb.nodename, "vncresizable-p= vfb", + "%d", &val) < 0) + val =3D 0; + if (val) + xenfb_xs_printf(xenfb->xsh, xenfb->fb.nodename, "xenfb-feat= ure-resize", "1"); =20 fprintf(stderr, "FB: Waiting for KBD backend creation\n"); xenfb_wait_for_backend(&xenfb->kbd, xenfb_backend_created_kbd); @@ -510,6 +525,11 @@ static void xenfb_on_fb_event(struct xen } xenfb_guest_copy(xenfb, x, y, w, h); break; + case XENFB_TYPE_RESIZE: + xenfb->width =3D event->resize.width; + xenfb->height =3D event->resize.height; + dpy_resize(xenfb->ds, xenfb->width, xenfb->height);= + break; } } mb(); /* ensure we're done with ring contents */ @@ -605,11 +625,22 @@ static int xenfb_send_motion(struct xenf return xenfb_kbd_event(xenfb, &event); } =20 +/* Descale abs pos for older evdev_drv without AbsoluteScreen option */ +static inline int xenfb_descale_for_evdev(float fb_width, float screen_wid= th, float pos) +{ + return(((fb_width/screen_width) * pos) + 0.5); +} + /* Send an absolute mouse movement event */ static int xenfb_send_position(struct xenfb *xenfb, int abs_x, int abs_y, = int abs_z) { union xenkbd_in_event event; =20 + if (xenfb->fixevdev_abs) { + struct xenfb_page *page =3D xenfb->fb.page; + abs_x =3D xenfb_descale_for_evdev(page->width, xenfb->width= , abs_x); + abs_y =3D xenfb_descale_for_evdev(page->height, xenfb->heig= ht, abs_y); + } memset(&event, 0, XENKBD_IN_EVENT_SIZE); event.type =3D XENKBD_TYPE_POS; event.pos.abs_x =3D abs_x; diff -r 2491691e3e69 tools/python/xen/xend/server/vfbif.py --- a/tools/python/xen/xend/server/vfbif.py Sat Dec 29 17:57:47 2007 = +0000 +++ b/tools/python/xen/xend/server/vfbif.py Sun Jan 06 12:35:21 2008 = -0700 @@ -7,7 +7,8 @@ import os =20 CONFIG_ENTRIES =3D ['type', 'vncdisplay', 'vnclisten', 'vncpasswd', = 'vncunused', 'display', 'xauthority', 'keymap', - 'uuid', 'location', 'protocol'] + 'uuid', 'location', 'protocol',=20 + 'vncresizable-pvfb', 'vnc-fixevdev-abs' ] =20 class VfbifController(DevController): """Virtual frame buffer controller. Handles all vfb devices for a = domain. diff -r 2491691e3e69 tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Sat Dec 29 17:57:47 2007 +0000 +++ b/tools/python/xen/xm/create.py Sun Jan 06 12:34:38 2008 -0700 @@ -485,6 +485,14 @@ gopts.var('vnclisten', val=3D'', fn=3Dset_value, default=3DNone, use=3D"""Address for VNC server to listen on.""") =20 +gopts.var('vncresizable-pvfb', val=3D'no|yes', + fn=3Dset_bool, default=3D0, + use=3D"""Allow resizable VNC PVFB if supported.""") + +gopts.var('vnc-fixevdev-abs', val=3D'no|yes', + fn=3Dset_bool, default=3D0, + use=3D"""Correct resizable abs pointer positioning for = evdev.""") + gopts.var('vncunused', val=3D'', fn=3Dset_bool, default=3D1, use=3D"""Try to find an unused port for the VNC server. @@ -620,7 +628,8 @@ def configure_vfbs(config_devs, vals): d['type'] =3D 'sdl' for (k,v) in d.iteritems(): if not k in [ 'vnclisten', 'vncunused', 'vncdisplay', = 'display', - 'xauthority', 'type', 'vncpasswd' ]: + 'xauthority', 'type', 'vncpasswd', + 'vncresizable-pvfb', 'vnc-fixevdev-abs' ]: err("configuration option %s unknown to vfbs" % k) config.append([k,v]) if not d.has_key("keymap"): diff -r 2491691e3e69 xen/include/public/io/fbif.h --- a/xen/include/public/io/fbif.h Sat Dec 29 17:57:47 2007 +0000 +++ b/xen/include/public/io/fbif.h Sat Jan 05 11:10:07 2008 -0700 @@ -50,12 +50,26 @@ struct xenfb_update int32_t height; /* rect height */ }; =20 +/* + * 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 =20 union xenfb_out_event { uint8_t type; struct xenfb_update update; + struct xenfb_resize resize; char pad[XENFB_OUT_EVENT_SIZE]; }; =20 @@ -111,8 +125,12 @@ struct xenfb_page * PAGE_SIZE / sizeof(*pd) bytes. With PAGE_SIZE =3D=3D 4096 and * sizeof(unsigned long) =3D=3D 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 =3D 1280 pages required + * PAGE_SIZE/64bit long =3D 512 pages per page directory */ - unsigned long pd[2]; + unsigned long pd[3]; }; =20 /* --=__Part3016F904.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part3016F904.0__=--