From patchwork Tue Sep 26 14:43:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Owen Smith X-Patchwork-Id: 9972245 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4E27E60365 for ; Tue, 26 Sep 2017 14:50:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 440F928F17 for ; Tue, 26 Sep 2017 14:50:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38F8228F18; Tue, 26 Sep 2017 14:50:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AF0CC28748 for ; Tue, 26 Sep 2017 14:50:46 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dwrAD-0006H4-TD; Tue, 26 Sep 2017 14:48:45 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dwrAC-0006Gw-2z for xen-devel@lists.xenproject.org; Tue, 26 Sep 2017 14:48:44 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id EF/EF-02226-BC86AC95; Tue, 26 Sep 2017 14:48:43 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprNIsWRWlGSWpSXmKPExsXitHSDve6JjFO RBgtOWlt83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBn9fx+zFHRKVGz8OZ+5gfGWYBcjJ4eEgL/E nM+bGUFsNgENiRmdi1lAbBEBP4nDzbfYQWxmgSSJRaevgNnCAg4SX34uZgaxWQRUJX593ATWy yvgKvFo9SQWiJlyEueP/wSq4eDgFHCTePEvFCQsBFQyf0U3E4StJPFt8QtmiFZBiZMzn7BArJ KQOPjiBfMERt5ZSFKzkKQWMDKtYlQvTi0qSy3SNdJLKspMzyjJTczM0TU0MNbLTS0uTkxPzUl MKtZLzs/dxAgMnHoGBsYdjKeanQ8xSnIwKYnyKsqdihTiS8pPqcxILM6ILyrNSS0+xCjDwaEk wWsKDEQhwaLU9NSKtMwcYAjDpCU4eJREeBlB0rzFBYm5xZnpEKlTjJYcHTfv/mHi2AQmN3x/8 IdJiCUvPy9VSpxXAKRBAKQhozQPbhwszi4xykoJ8zIyMDAI8RSkFuVmlqDKv2IU52BUEuYVBJ nCk5lXArf1FdBBTEAH9U49AXJQSSJCSqqB0XXRXBH+vi/1Il03Ll34vbWcL1DkfP2Wq1cDlrB sSZHo7ZnVVaZzZp5yxfsPDDN3no56OdvO/99l1r1uJ8vvF5jtfMs7x2TxxgNatoIB0tml0oor jp3cwhHusHqbynR9zw0NJb0STe4zfJkmf5qj82qR6pqN8dWvJiTOOfrAp2yJTK62XW2YpBJLc UaioRZzUXEiALQ9EEeuAgAA X-Env-Sender: prvs=435739c2e=owen.smith@citrix.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1506437318!116600000!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 1721 invoked from network); 26 Sep 2017 14:48:40 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-3.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 26 Sep 2017 14:48:40 -0000 X-IronPort-AV: E=Sophos;i="5.42,441,1500940800"; d="scan'208";a="449270648" From: Owen Smith To: , , Date: Tue, 26 Sep 2017 14:43:39 +0000 Message-ID: <1506437019-17946-4-git-send-email-owen.smith@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1506437019-17946-1-git-send-email-owen.smith@citrix.com> References: <1506437019-17946-1-git-send-email-owen.smith@citrix.com> MIME-Version: 1.0 Cc: xen-devel@lists.xenproject.org, qemu-devel@nongnu.org, Owen Smith Subject: [Xen-devel] [PATCH 3/3 v4] xenfb: Add [feature|request]-raw-pointer X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Writes "feature-raw-pointer" during init to indicate the backend can pass raw unscaled values for absolute axes to the frontend. Frontends set "request-raw-pointer" to indicate the backend should not attempt to scale absolute values to console size. "request-raw-pointer" is only valid if "request-abs-pointer" is also set. Raw unscaled pointer values are in the range [0, 0x7fff] Signed-off-by: Owen Smith --- hw/display/xenfb.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c index 33361b4..29428ae 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 raw_pointer_wanted; /* Whether guest supports raw (unscaled) pointer */ QemuInputHandlerState *qkbd; QemuInputHandlerState *qmou; int mouse_axes[INPUT_AXIS__MAX]; @@ -264,21 +265,23 @@ static void xenfb_mouse_sync(DeviceState *dev) in->abs_pointer_wanted); if (in->abs_pointer_wanted) { - QemuConsole *con = qemu_console_lookup_by_index(0); - DisplaySurface *surface; - int dw, dh; - - if (!con) { - xen_pv_printf(&in->c.xendev, 0, "No QEMU console available"); - return; - } + if (!in->raw_pointer_wanted) { + QemuConsole *con = qemu_console_lookup_by_index(0); + DisplaySurface *surface; + int dw, dh; + + if (!con) { + xen_pv_printf(&in->c.xendev, 0, "No QEMU console available"); + return; + } - surface = qemu_console_surface(con); - dw = surface_width(surface); - dh = surface_height(surface); + surface = qemu_console_surface(con); + dw = surface_width(surface); + dh = surface_height(surface); - dx = dx * (dw - 1) / 0x7fff; - dy = dy * (dh - 1) / 0x7fff; + dx = dx * (dw - 1) / 0x7fff; + dy = dy * (dh - 1) / 0x7fff; + } xenfb_send_position(in, dx, dy, dz); } else { @@ -312,6 +315,7 @@ static QemuInputHandler xenfb_rel_mouse = { static int input_init(struct XenDevice *xendev) { xenstore_write_be_int(xendev, "feature-abs-pointer", 1); + xenstore_write_be_int(xendev, "feature-raw-pointer", 1); return 0; } @@ -335,6 +339,13 @@ static void input_connected(struct XenDevice *xendev) &in->abs_pointer_wanted) == -1) { in->abs_pointer_wanted = 0; } + if (xenstore_read_fe_int(xendev, "request-raw-pointer", + &in->raw_pointer_wanted) == -1) { + in->raw_pointer_wanted = 0; + } + if (in->raw_pointer_wanted && !in->abs_pointer_wanted) { + xen_pv_printf(xendev, 0, "raw pointer set without absolute pointer."); + } if (in->qkbd) { qemu_input_handler_unregister(in->qkbd);