From nobody Sun Feb 8 11:18:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496928018676996.2713897255707; Thu, 8 Jun 2017 06:20:18 -0700 (PDT) Received: from localhost ([::1]:49567 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIxMG-0006wk-NX for importer@patchew.org; Thu, 08 Jun 2017 09:20:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40568) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIxJD-0004L5-G8 for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:17:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIxJA-0002Do-6d for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:17:07 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:14895) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1dIxJA-0002D2-01 for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:17:04 -0400 X-IronPort-AV: E=Sophos;i="5.39,315,1493683200"; d="scan'208";a="435636363" From: Owen Smith To: Date: Thu, 8 Jun 2017 13:15:31 +0000 Message-ID: <1496927734-29174-2-git-send-email-owen.smith@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1496927734-29174-1-git-send-email-owen.smith@citrix.com> References: <1496927734-29174-1-git-send-email-owen.smith@citrix.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.63 Subject: [Qemu-devel] [PATCH 1/4] xenfb: Add feature-vkbd-standalone X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: anthony.perard@citrix.com, xen-devel@lists.xenproject.org, sstabellini@kernel.org, kraxel@redhat.com, Owen Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Advertise "feature-vkbd-standalone" to indicate the backend can connect without a vfb device connection. When "request-vkbd-standalone" is set to 1, the backend does not wait for a QemuConsole to be setup before connecting the=20 vkbd device. This also means that absolute coordinates cannot be scaled to the non-existent QemuConsole's sizes, and remain unscaled, in the range [0, 0x7FFF]. Signed-off-by: Owen Smith Reviewed-by: Stefano Stabellini --- hw/display/xenfb.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c index e76c0d8..2ebc81b 100644 --- a/hw/display/xenfb.c +++ b/hw/display/xenfb.c @@ -52,6 +52,7 @@ struct common { struct XenInput { struct common c; int abs_pointer_wanted; /* Whether guest supports absolute pointer */ + int vkbd_standalone; /* Guest supports vkbd without vfb device */ int button_state; /* Last seen pointer button state */ int extended; QEMUPutMouseEntry *qmouse; @@ -306,18 +307,22 @@ static void xenfb_mouse_event(void *opaque, int dx, int dy, int dz, int button_state) { struct XenInput *xenfb =3D opaque; - DisplaySurface *surface =3D qemu_console_surface(xenfb->c.con); - int dw =3D surface_width(surface); - int dh =3D surface_height(surface); - int i; + int i, x, y; + if (xenfb->c.con !=3D NULL) { + DisplaySurface *surface =3D qemu_console_surface(xenfb->c.con); + int dw =3D surface_width(surface); + int dh =3D surface_height(surface); + x =3D dx * (dh - 1) / 0x7fff; + y =3D dy * (dw - 1) / 0x7fff; + } else { + x =3D dx; + y =3D dy; + } =20 trace_xenfb_mouse_event(opaque, dx, dy, dz, button_state, xenfb->abs_pointer_wanted); if (xenfb->abs_pointer_wanted) - xenfb_send_position(xenfb, - dx * (dw - 1) / 0x7fff, - dy * (dh - 1) / 0x7fff, - dz); + xenfb_send_position(xenfb, x, y, dz); else xenfb_send_motion(xenfb, dx, dy, dz); =20 @@ -336,6 +341,7 @@ static void xenfb_mouse_event(void *opaque, static int input_init(struct XenDevice *xendev) { xenstore_write_be_int(xendev, "feature-abs-pointer", 1); + xenstore_write_be_int(xendev, "feature-vkbd-standalone", 1); return 0; } =20 @@ -345,8 +351,14 @@ static int input_initialise(struct XenDevice *xendev) int rc; =20 if (!in->c.con) { - xen_pv_printf(xendev, 1, "ds not set (yet)\n"); - return -1; + if (xenstore_read_fe_int(xendev, "request-vkbd-standalone", + &in->vkbd_standalone) =3D=3D -1) { + in->vkbd_standalone =3D 0; + } + if (in->vkbd_standalone =3D=3D 0) { + xen_pv_printf(xendev, 1, "ds not set (yet)\n"); + return -1; + } } =20 rc =3D common_bind(&in->c); --=20 2.1.4 From nobody Sun Feb 8 11:18:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496927905850922.1999163690577; Thu, 8 Jun 2017 06:18:25 -0700 (PDT) Received: from localhost ([::1]:49563 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIxKS-00054r-1p for importer@patchew.org; Thu, 08 Jun 2017 09:18:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIxJD-0004L3-Fa for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:17:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIxJA-0002Dz-G8 for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:17:07 -0400 Received: from smtp.citrix.com ([66.165.176.89]:9025) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1dIxJA-0002D1-9t for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:17:04 -0400 X-IronPort-AV: E=Sophos;i="5.39,315,1493683200"; d="scan'208";a="427076192" From: Owen Smith To: Date: Thu, 8 Jun 2017 13:15:32 +0000 Message-ID: <1496927734-29174-3-git-send-email-owen.smith@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1496927734-29174-1-git-send-email-owen.smith@citrix.com> References: <1496927734-29174-1-git-send-email-owen.smith@citrix.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.89 Subject: [Qemu-devel] [PATCH 2/4] xenfb: Activate mouse handler X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: anthony.perard@citrix.com, xen-devel@lists.xenproject.org, sstabellini@kernel.org, kraxel@redhat.com, Owen Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Mouse events are only delivered to the first handler in the chain. Activating the xenfb mouse event handler so that mouse events can be passed over the shared ring protocol. Note: The keyboard handler is activated internally by the add call. Signed-off-by: Owen Smith --- hw/display/xenfb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c index 2ebc81b..b0a5726 100644 --- a/hw/display/xenfb.c +++ b/hw/display/xenfb.c @@ -385,6 +385,7 @@ static void input_connected(struct XenDevice *xendev) in->qmouse =3D qemu_add_mouse_event_handler(xenfb_mouse_event, in, in->abs_pointer_wanted, "Xen PVFB Mouse"); + qemu_activate_mouse_event_handler(in->qmouse); } =20 static void input_disconnect(struct XenDevice *xendev) --=20 2.1.4 From nobody Sun Feb 8 11:18:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496928022669853.3102846646271; Thu, 8 Jun 2017 06:20:22 -0700 (PDT) Received: from localhost ([::1]:49568 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIxMJ-0006y1-82 for importer@patchew.org; Thu, 08 Jun 2017 09:20:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIxJF-0004M6-4Y for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:17:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIxJA-0002EK-V8 for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:17:09 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:14895) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1dIxJA-0002D2-Pi for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:17:04 -0400 X-IronPort-AV: E=Sophos;i="5.39,315,1493683200"; d="scan'208";a="435636366" From: Owen Smith To: Date: Thu, 8 Jun 2017 13:15:33 +0000 Message-ID: <1496927734-29174-4-git-send-email-owen.smith@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1496927734-29174-1-git-send-email-owen.smith@citrix.com> References: <1496927734-29174-1-git-send-email-owen.smith@citrix.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.63 Subject: [Qemu-devel] [PATCH 3/4] ui/input: Add activate/remove for keyboard handlers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: anthony.perard@citrix.com, xen-devel@lists.xenproject.org, sstabellini@kernel.org, kraxel@redhat.com, Owen Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Adds missing functions to activate and remove keyboard handlers * qemu_activate_kbd_event_handler * qemu_remove_kbd_event_handler Signed-off-by: Owen Smith --- include/ui/console.h | 2 ++ ui/input-legacy.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/ui/console.h b/include/ui/console.h index 7262bef..f5045e1 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -55,6 +55,8 @@ typedef struct QEMUPutLEDEntry QEMUPutLEDEntry; =20 QEMUPutKbdEntry *qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque); +void qemu_remove_kbd_event_handler(QEMUPutKbdEntry *entry); +void qemu_activate_kbd_event_handler(QEMUPutKbdEntry *entry); QEMUPutMouseEntry *qemu_add_mouse_event_handler(QEMUPutMouseEvent *func, void *opaque, int absolute, const char *name); diff --git a/ui/input-legacy.c b/ui/input-legacy.c index 7159747..fbe1ce7 100644 --- a/ui/input-legacy.c +++ b/ui/input-legacy.c @@ -142,6 +142,18 @@ QEMUPutKbdEntry *qemu_add_kbd_event_handler(QEMUPutKBD= Event *func, void *opaque) return entry; } =20 +void qemu_activate_kbd_event_handler(QEMUPutKbdEntry *entry) +{ + qemu_input_handler_activate(entry->s); +} + +void qemu_remove_kbd_event_handler(QEMUPutKbdEntry *entry) +{ + qemu_input_handler_unregister(entry->s); + + g_free(entry); +} + static void legacy_mouse_event(DeviceState *dev, QemuConsole *src, InputEvent *evt) { --=20 2.1.4 From nobody Sun Feb 8 11:18:29 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496928158250187.49145703193096; Thu, 8 Jun 2017 06:22:38 -0700 (PDT) Received: from localhost ([::1]:49582 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIxOW-0000YP-Ku for importer@patchew.org; Thu, 08 Jun 2017 09:22:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIxJG-0004NK-Ch for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:17:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIxJA-0002EA-Lx for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:17:10 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:14895) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1dIxJA-0002D2-EW for qemu-devel@nongnu.org; Thu, 08 Jun 2017 09:17:04 -0400 X-IronPort-AV: E=Sophos;i="5.39,315,1493683200"; d="scan'208";a="435636365" From: Owen Smith To: Date: Thu, 8 Jun 2017 13:15:34 +0000 Message-ID: <1496927734-29174-5-git-send-email-owen.smith@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1496927734-29174-1-git-send-email-owen.smith@citrix.com> References: <1496927734-29174-1-git-send-email-owen.smith@citrix.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.63 Subject: [Qemu-devel] [PATCH 4/4] xenfb: Fix leak by adding/removing keyboard handler X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: anthony.perard@citrix.com, xen-devel@lists.xenproject.org, sstabellini@kernel.org, kraxel@redhat.com, Owen Smith Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Calls qemu_remove_kbd_event_handler that frees its memory, instead of adding (and allocating some memory) a new NULL handler. Signed-off-by: Owen Smith --- hw/display/xenfb.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c index b0a5726..570ecdb 100644 --- a/hw/display/xenfb.c +++ b/hw/display/xenfb.c @@ -55,6 +55,7 @@ struct XenInput { int vkbd_standalone; /* Guest supports vkbd without vfb device */ int button_state; /* Last seen pointer button state */ int extended; + QEMUPutKbdEntry *qkbd; QEMUPutMouseEntry *qmouse; }; =20 @@ -365,7 +366,6 @@ static int input_initialise(struct XenDevice *xendev) if (rc !=3D 0) return rc; =20 - qemu_add_kbd_event_handler(xenfb_key_event, in); return 0; } =20 @@ -378,10 +378,14 @@ static void input_connected(struct XenDevice *xendev) in->abs_pointer_wanted =3D 0; } =20 + if (in->qkbd) { + qemu_remove_kbd_event_handler(in->qkbd); + } if (in->qmouse) { qemu_remove_mouse_event_handler(in->qmouse); } trace_xenfb_input_connected(xendev, in->abs_pointer_wanted); + in->qkbd =3D qemu_add_kbd_event_handler(xenfb_key_event, in); in->qmouse =3D qemu_add_mouse_event_handler(xenfb_mouse_event, in, in->abs_pointer_wanted, "Xen PVFB Mouse"); @@ -392,11 +396,14 @@ static void input_disconnect(struct XenDevice *xendev) { struct XenInput *in =3D container_of(xendev, struct XenInput, c.xendev= ); =20 + if (in->qkbd) { + qemu_remove_kbd_event_handler(in->qkbd); + in->qkbd =3D NULL; + } if (in->qmouse) { qemu_remove_mouse_event_handler(in->qmouse); in->qmouse =3D NULL; } - qemu_add_kbd_event_handler(NULL, NULL); common_unbind(&in->c); } =20 --=20 2.1.4