From patchwork Mon Apr 10 06:25:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksandr Andrushchenko X-Patchwork-Id: 9672005 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 765B160231 for ; Mon, 10 Apr 2017 06:28:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6557127D29 for ; Mon, 10 Apr 2017 06:28:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5850F28066; Mon, 10 Apr 2017 06:28:00 +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=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 4F77727D29 for ; Mon, 10 Apr 2017 06:27:59 +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 1cxSli-00087i-5t; Mon, 10 Apr 2017 06:25:42 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cxSlg-000877-Vy for xen-devel@lists.xenproject.org; Mon, 10 Apr 2017 06:25:41 +0000 Received: from [85.158.137.68] by server-11.bemta-3.messagelabs.com id AD/98-23940-4652BE85; Mon, 10 Apr 2017 06:25:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrDIsWRWlGSWpSXmKPExsVyMbThoG6y6us IgxtfxS2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oympSdYC/alVdzctISpgbHZu4uRi0NIYAaj xN+pjxlBHBaBlywSt543s4M4EgL9rBI3755i62LkBHJiJF7t2MUOYVdI3L7dwQRiCwkoSnx9N h3KXsUkcXynLIjNJmAksfzGDxYQW0RASeLeqslMIEOZBa4zSXR3fAdrEBawk2g49IAZxGYRUJ Vo/7gY6AwODl4BJ4kT7xkhdslJ3DzXCVbCKeAscXLSdTaIXU4SnVcfME9gFFjAyLCKUaM4tag stUjXyFwvqSgzPaMkNzEzR9fQwFgvN7W4ODE9NScxqVgvOT93EyMwtOoZGBh3MLbs9TvEKMnB pCTKy1r7IkKILyk/pTIjsTgjvqg0J7X4EKMMB4eSBK+qyusIIcGi1PTUirTMHGCQw6QlOHiUR Hh/KwOleYsLEnOLM9MhUqcYLTleXH7/nonj3dIPQPLJyh/vmYRY8vLzUqXEeftB5gmANGSU5s GNg0XiJUZZKWFeRgYGBiGegtSi3MwSVPlXjOIcjErCvFEgU3gy80rgtr4COogJ6KAzu16CHFS SiJCSamAUebzL6dD2HPPCyhnfX6SkCwW8ZbbYOfEfr07H1MaXL9hXz3t3zkip5uj9xFOJRhdb 36uX6UwOT2O3CHBUXXSZc3Gu/59V7vqexk6q8zfr8Bgd9Xo++Vte+eXK2VOF4mT6JXZ7Bj5pf J24dkri/t7uDxLHT15ZL97WZmfCWz1tUarI6VmBos5KLMUZiYZazEXFiQA/g+d+vwIAAA== X-Env-Sender: andr2000@gmail.com X-Msg-Ref: server-15.tower-31.messagelabs.com!1491805539!90957593!1 X-Originating-IP: [209.85.128.193] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.12; banners=-,-,- X-VirusChecked: Checked Received: (qmail 48341 invoked from network); 10 Apr 2017 06:25:39 -0000 Received: from mail-wr0-f193.google.com (HELO mail-wr0-f193.google.com) (209.85.128.193) by server-15.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 10 Apr 2017 06:25:39 -0000 Received: by mail-wr0-f193.google.com with SMTP id l28so2904868wre.0 for ; Sun, 09 Apr 2017 23:25:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=idizsFx5AdSKQyjh0YJQ6Ln9Iko5UQfWKXBgTman5Zw=; b=DTO8Kj3BC8m00clgQsYs+sUU/vqIeLUgefVDVCYviZCs3wuBi80jifhnYF0YLSlm3B 6aYoYUh+plPAyETSWiLdRAVb9H3QVwlxAWqvtxqi+ATvD0AmlrXDgSmMnpL2UDVcTtFz 3pkrd9UGcboAnprEPM/I87LeMPR44NfuYKbZpr0S0s/0zOc9+S5hpefebHPA/CYi9yFl 2dDxEbshYBpHHPYfztqkvN4kcPUKYUg2EsmvSXWwjVTfMuxNKBhiGR+74b5GjRZ1Wf3/ kfHxTnZRWbMUaEcMVeusIyweBlMWjukvp/rRRRlNrvYSSdTtBxwAPjqhK+5d9OieCoiL okZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=idizsFx5AdSKQyjh0YJQ6Ln9Iko5UQfWKXBgTman5Zw=; b=P+ys4Q5qAwcU5PbeyBq8iGAy1743nGa/YhR2X87v264LfF1NGlv48EAwn1KKO0+Hch QByzQ/vCc67RStr1b6PnnZIgVk0YskjVIWENQPWVxm7/0TS5iZoHf4VwT2tbxI8cIRZx rDDt0EUS7gtzJb4inwlfEukOFrTqsSdAUXcPvdJpFLdl4RQRJMXPXvNBw5qgozrCiaH6 lGEfLGxj331wQmSVmM+b1nojdqKpYwAgKEQN9Bt01HiN9JoMq5FyEFII0Q/wIIxGRUJK Gwz7q8sYlup0fRGg4MioT2T5SudtpGs8ja76NgnCCFNZedWff4E5I0V66UnFMjspYv2f aZgA== X-Gm-Message-State: AN3rC/5zdCEhb57Bc1yj9DbucrgjuhhGGVVUXDnHxVvxzRGseDeM+jMe4PZert0zSmLcag== X-Received: by 10.223.164.2 with SMTP id d2mr4539442wra.194.1491805538773; Sun, 09 Apr 2017 23:25:38 -0700 (PDT) Received: from a2k-HP-ProDesk-600-G2-SFF.kyiv.epam.com (ll-55.209.223.85.sovam.net.ua. [85.223.209.55]) by smtp.gmail.com with ESMTPSA id m14sm16118556wrb.13.2017.04.09.23.25.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 09 Apr 2017 23:25:38 -0700 (PDT) From: Oleksandr Andrushchenko To: xen-devel@lists.xenproject.org Date: Mon, 10 Apr 2017 09:25:27 +0300 Message-Id: <1491805529-20603-3-git-send-email-andr2000@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491805529-20603-1-git-send-email-andr2000@gmail.com> References: <1491805529-20603-1-git-send-email-andr2000@gmail.com> Cc: jgross@suse.com, lars.kurth@citrix.com, sstabellini@kernel.org, vlad.babchuk@gmail.com, linux-kernel@vger.kernel.org, Oleksandr Andrushchenko , julien.grall@arm.com, andrii.anisov@gmail.com, olekstysh@gmail.com, andr2000@gmail.com, al1img@gmail.com, joculator@gmail.com Subject: [Xen-devel] [For Linux v1 2/4] xen/kbdif: add multi-touch support 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Oleksandr Andrushchenko Multi-touch fields re-use the page that is used by the other features which means that you can interleave multi-touch, motion, and key events. Acked-by: Juergen Gross Signed-off-by: Oleksandr Andrushchenko --- include/xen/interface/io/kbdif.h | 210 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 210 insertions(+) diff --git a/include/xen/interface/io/kbdif.h b/include/xen/interface/io/kbdif.h index 7adfb15fec9d..2a9510ade701 100644 --- a/include/xen/interface/io/kbdif.h +++ b/include/xen/interface/io/kbdif.h @@ -57,6 +57,12 @@ * Backends, which support reporting of absolute coordinates for pointer * device should set this to 1. * + * feature-multi-touch + * Values: + * + * Backends, which support reporting of multi-touch events + * should set this to 1. + * *------------------------- Pointer Device Parameters ------------------------ * * width @@ -87,6 +93,11 @@ * Request backend to report absolute pointer coordinates * (XENKBD_TYPE_POS) instead of relative ones (XENKBD_TYPE_MOTION). * + * request-multi-touch + * Values: + * + * Request backend to report multi-touch events. + * *----------------------- Request Transport Parameters ----------------------- * * event-channel @@ -106,6 +117,25 @@ * * OBSOLETE, not recommended for use. * PFN of the shared page. + * + *----------------------- Multi-touch Device Parameters ----------------------- + * + * multi-touch-num-contacts + * Values: + * + * Number of simultaneous touches reported. + * + * multi-touch-width + * Values: + * + * Width of the touch area to be used by the frontend + * while reporting input events, pixels, [0; UINT32_MAX]. + * + * multi-touch-height + * Values: + * + * Height of the touch area to be used by the frontend + * while reporting input events, pixels, [0; UINT32_MAX]. */ /* @@ -116,6 +146,16 @@ #define XENKBD_TYPE_RESERVED 2 #define XENKBD_TYPE_KEY 3 #define XENKBD_TYPE_POS 4 +#define XENKBD_TYPE_MTOUCH 5 + +/* Multi-touch event sub-codes */ + +#define XENKBD_MT_EV_DOWN 0 +#define XENKBD_MT_EV_UP 1 +#define XENKBD_MT_EV_MOTION 2 +#define XENKBD_MT_EV_SYN 3 +#define XENKBD_MT_EV_SHAPE 4 +#define XENKBD_MT_EV_ORIENT 5 /* * CONSTANTS, XENSTORE FIELD AND PATH NAME STRINGS, HELPERS. @@ -124,11 +164,16 @@ #define XENKBD_DRIVER_NAME "vkbd" #define XENKBD_FIELD_FEAT_ABS_POINTER "feature-abs-pointer" +#define XENKBD_FIELD_FEAT_MTOUCH "feature-multi-touch" #define XENKBD_FIELD_REQ_ABS_POINTER "request-abs-pointer" +#define XENKBD_FIELD_REQ_MTOUCH "request-multi-touch" #define XENKBD_FIELD_RING_GREF "page-gref" #define XENKBD_FIELD_EVT_CHANNEL "event-channel" #define XENKBD_FIELD_WIDTH "width" #define XENKBD_FIELD_HEIGHT "height" +#define XENKBD_FIELD_MT_WIDTH "multi-touch-width" +#define XENKBD_FIELD_MT_HEIGHT "multi-touch-height" +#define XENKBD_FIELD_MT_NUM_CONTACTS "multi-touch-num-contacts" /* OBSOLETE, not recommended for use */ #define XENKBD_FIELD_RING_REF "page-ref" @@ -245,6 +290,170 @@ struct xenkbd_position { int32_t rel_z; }; +/* + * Multi-touch event and its sub-types + * + * All multi-touch event packets have common header: + * + * 0 1 2 3 octet + * +----------------+----------------+----------------+----------------+ + * | _TYPE_MTOUCH | event_type | contact_id | reserved | 4 + * +----------------+----------------+----------------+----------------+ + * | reserved | 8 + * +----------------+----------------+----------------+----------------+ + * + * event_type - unt8_t, multi-touch event sub-type, XENKBD_MT_EV_??? + * contact_id - unt8_t, ID of the contact + * + * Touch interactions can consist of one or more contacts. + * For each contact, a series of events is generated, starting + * with a down event, followed by zero or more motion events, + * and ending with an up event. Events relating to the same + * contact point can be identified by the ID of the sequence: contact ID. + * Contact ID may be reused after XENKBD_MT_EV_UP event and + * is in the [0; XENKBD_FIELD_NUM_CONTACTS - 1] range. + * + * For further information please refer to documentation on Wayland [1], + * Linux [2] and Windows [3] multi-touch support. + * + * [1] https://cgit.freedesktop.org/wayland/wayland/tree/protocol/wayland.xml + * [2] https://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt + * [3] https://msdn.microsoft.com/en-us/library/jj151564(v=vs.85).aspx + * + * + * Multi-touch down event - sent when a new touch is made: touch is assigned + * a unique contact ID, sent with this and consequent events related + * to this touch. + * 0 1 2 3 octet + * +----------------+----------------+----------------+----------------+ + * | _TYPE_MTOUCH | _MT_EV_DOWN | contact_id | reserved | 4 + * +----------------+----------------+----------------+----------------+ + * | reserved | 8 + * +----------------+----------------+----------------+----------------+ + * | abs_x | 12 + * +----------------+----------------+----------------+----------------+ + * | abs_y | 16 + * +----------------+----------------+----------------+----------------+ + * | reserved | 20 + * +----------------+----------------+----------------+----------------+ + * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| + * +----------------+----------------+----------------+----------------+ + * | reserved | 40 + * +----------------+----------------+----------------+----------------+ + * + * abs_x - int32_t, absolute X position, in pixels + * abs_y - int32_t, absolute Y position, in pixels + * + * Multi-touch contact release event + * 0 1 2 3 octet + * +----------------+----------------+----------------+----------------+ + * | _TYPE_MTOUCH | _MT_EV_UP | contact_id | reserved | 4 + * +----------------+----------------+----------------+----------------+ + * | reserved | 8 + * +----------------+----------------+----------------+----------------+ + * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| + * +----------------+----------------+----------------+----------------+ + * | reserved | 40 + * +----------------+----------------+----------------+----------------+ + * + * Multi-touch motion event + * 0 1 2 3 octet + * +----------------+----------------+----------------+----------------+ + * | _TYPE_MTOUCH | _MT_EV_MOTION | contact_id | reserved | 4 + * +----------------+----------------+----------------+----------------+ + * | reserved | 8 + * +----------------+----------------+----------------+----------------+ + * | abs_x | 12 + * +----------------+----------------+----------------+----------------+ + * | abs_y | 16 + * +----------------+----------------+----------------+----------------+ + * | reserved | 20 + * +----------------+----------------+----------------+----------------+ + * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| + * +----------------+----------------+----------------+----------------+ + * | reserved | 40 + * +----------------+----------------+----------------+----------------+ + * + * abs_x - int32_t, absolute X position, in pixels, + * abs_y - int32_t, absolute Y position, in pixels, + * + * Multi-touch input synchronization event - shows end of a set of events + * which logically belong together. + * 0 1 2 3 octet + * +----------------+----------------+----------------+----------------+ + * | _TYPE_MTOUCH | _MT_EV_SYN | contact_id | reserved | 4 + * +----------------+----------------+----------------+----------------+ + * | reserved | 8 + * +----------------+----------------+----------------+----------------+ + * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| + * +----------------+----------------+----------------+----------------+ + * | reserved | 40 + * +----------------+----------------+----------------+----------------+ + * + * Multi-touch shape event - touch point's shape has changed its shape. + * Shape is approximated by an ellipse through the major and minor axis + * lengths: major is the longer diameter of the ellipse and minor is the + * shorter one. Center of the ellipse is reported via + * XENKBD_MT_EV_DOWN/XENKBD_MT_EV_MOTION events. + * 0 1 2 3 octet + * +----------------+----------------+----------------+----------------+ + * | _TYPE_MTOUCH | _MT_EV_SHAPE | contact_id | reserved | 4 + * +----------------+----------------+----------------+----------------+ + * | reserved | 8 + * +----------------+----------------+----------------+----------------+ + * | major | 12 + * +----------------+----------------+----------------+----------------+ + * | minor | 16 + * +----------------+----------------+----------------+----------------+ + * | reserved | 20 + * +----------------+----------------+----------------+----------------+ + * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| + * +----------------+----------------+----------------+----------------+ + * | reserved | 40 + * +----------------+----------------+----------------+----------------+ + * + * major - unt32_t, length of the major axis, pixels + * minor - unt32_t, length of the minor axis, pixels + * + * Multi-touch orientation event - touch point's shape has changed + * its orientation: calculated as a clockwise angle between the major axis + * of the ellipse and positive Y axis in degrees, [-180; +180]. + * 0 1 2 3 octet + * +----------------+----------------+----------------+----------------+ + * | _TYPE_MTOUCH | _MT_EV_ORIENT | contact_id | reserved | 4 + * +----------------+----------------+----------------+----------------+ + * | reserved | 8 + * +----------------+----------------+----------------+----------------+ + * | orientation | reserved | 12 + * +----------------+----------------+----------------+----------------+ + * | reserved | 16 + * +----------------+----------------+----------------+----------------+ + * |/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/| + * +----------------+----------------+----------------+----------------+ + * | reserved | 40 + * +----------------+----------------+----------------+----------------+ + * + * orientation - int16_t, clockwise angle of the major axis + */ + +struct xenkbd_mtouch { + uint8_t type; /* XENKBD_TYPE_MTOUCH */ + uint8_t event_type; /* XENKBD_MT_EV_??? */ + uint8_t contact_id; + uint8_t reserved[5]; /* reserved for the future use */ + union { + struct { + int32_t abs_x; /* absolute X position, pixels */ + int32_t abs_y; /* absolute Y position, pixels */ + } pos; + struct { + uint32_t major; /* length of the major axis, pixels */ + uint32_t minor; /* length of the minor axis, pixels */ + } shape; + int16_t orientation; /* clockwise angle of the major axis */ + } u; +}; + #define XENKBD_IN_EVENT_SIZE 40 union xenkbd_in_event { @@ -252,6 +461,7 @@ union xenkbd_in_event { struct xenkbd_motion motion; struct xenkbd_key key; struct xenkbd_position pos; + struct xenkbd_mtouch mtouch; char pad[XENKBD_IN_EVENT_SIZE]; };