From patchwork Thu Aug 9 11:46:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liran Alon X-Patchwork-Id: 10561323 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7F893174A for ; Thu, 9 Aug 2018 12:10:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CD982A450 for ; Thu, 9 Aug 2018 12:10:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 609AD2AF42; Thu, 9 Aug 2018 12:10:27 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5050D2A450 for ; Thu, 9 Aug 2018 12:10:26 +0000 (UTC) Received: from localhost ([::1]:50143 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjlp-0001U6-Ff for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 08:10:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnjQM-0005Vy-3d for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnjQJ-0007e3-FC for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:14 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:32970) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnjQJ-0007dh-5W for qemu-devel@nongnu.org; Thu, 09 Aug 2018 07:48:11 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w79BiRH0138024; Thu, 9 Aug 2018 11:48:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=qcLVbp+gOUxm8naz0Tnp6owRBdyIAarYZPcye5GMqiE=; b=BE6Mmx4T5JwemNuYWkVrx3Xp5XUezT2QTkXhckX/pmuspy5opHrmAWvvYw7Vtc4EXeDb m/vjelV6PEiQYNa8NLbr1kGTFOaCMrt11lXGYyAFvwRRdS4oRcyds/e0I+tDJSvoFGed CxgC4/sZYDBxh+FE/H3eldvNEa1YjPkXSFiEb7s9AIc1eIkp9CwsOk7TgP6upqRj7Kgy wjHmThU6ovl2t2t4+9f5MAlj4XWZ6470/vnL0mpsNHsRfCJFMlqwjjkYRKSD2EWIT7F3 aYO2eY0Nf9uCt0SORHH2NIJu+i0r8ZCs840APICwQE/Vdr87XTKAlzls4eskTig6pQkP 6w== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2kn4sq2s9q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 09 Aug 2018 11:48:10 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w79Bm7a2018736 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Aug 2018 11:48:07 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w79Bm6Ax020214; Thu, 9 Aug 2018 11:48:06 GMT Received: from liran-pc.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 09 Aug 2018 04:48:06 -0700 From: Liran Alon To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 14:46:37 +0300 Message-Id: <1533815202-11967-25-git-send-email-liran.alon@oracle.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1533815202-11967-1-git-send-email-liran.alon@oracle.com> References: <1533815202-11967-1-git-send-email-liran.alon@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8979 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808090123 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 156.151.31.85 Subject: [Qemu-devel] [PATCH 24/29] vmsvga: Add support for SVGA_FIFO_CAP_CURSOR_BYPASS_3 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: habkost@redhat.com, mtosatti@redhat.com, Liran Alon , kraxel@redhat.com, pbonzini@redhat.com, rth@twiddle.net, Leonid Shatz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Leonid Shatz This adds tracking of guest cursor position with the help of FIFO registers reporting pointing device coordindates. Signed-off-by: Leonid Shatz Reviewed-by: Darren Kenny Signed-off-by: Liran Alon --- hw/display/vmware_vga.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 49b46938207e..1db8f92f053b 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -51,6 +51,7 @@ struct vmsvga_state_s { int y; int on; } cursor; + uint32_t last_fifo_cursor_count; int index; int scratch_size; @@ -326,6 +327,7 @@ enum { #define SVGA_FIFO_CAP_FENCE (1 << 0) #define SVGA_FIFO_CAP_ACCELFRONT (1 << 1) #define SVGA_FIFO_CAP_PITCHLOCK (1 << 2) +#define SVGA_FIFO_CAP_CURSOR_BYPASS_3 (1 << 4) #define SVGA_FIFO_FLAG_NONE 0 #define SVGA_FIFO_FLAG_ACCELFRONT (1 << 0) @@ -417,6 +419,35 @@ enum { SVGA_CURSOR_ON_RESTORE_TO_FB = 3, }; +/* Update cursor position from SVGA_FIFO_CURSOR registers */ +static void cursor_update_from_fifo(struct vmsvga_state_s *s) +{ + uint32_t fifo_cursor_count; + uint32_t on_off; + + if (!s->config || !s->enable) { + return; + } + + if (s->fifo_min <= SVGA_FIFO_CURSOR_LAST_UPDATED) { + return; + } + + fifo_cursor_count = s->fifo[SVGA_FIFO_CURSOR_COUNT]; + if (fifo_cursor_count == s->last_fifo_cursor_count) + return; + + s->last_fifo_cursor_count = fifo_cursor_count; + on_off = s->fifo[SVGA_FIFO_CURSOR_ON] ? SVGA_CURSOR_ON_SHOW : SVGA_CURSOR_ON_HIDE; + s->cursor.on = on_off; + s->cursor.x = s->fifo[SVGA_FIFO_CURSOR_X]; + s->cursor.y = s->fifo[SVGA_FIFO_CURSOR_Y]; + +#ifdef HW_MOUSE_ACCEL + dpy_mouse_set(s->vga.con, s->cursor.x, s->cursor.y, s->cursor.on); +#endif +} + static inline bool vmsvga_verify_rect(DisplaySurface *surface, const char *name, int x, int y, int w, int h) @@ -1423,6 +1454,7 @@ static void vmsvga_update_display(void *opaque) vmsvga_fifo_run(s); vmsvga_update_rect_flush(s); + cursor_update_from_fifo(s); if (s->invalidated) { s->invalidated = 0; @@ -1446,6 +1478,7 @@ static void vmsvga_reset(DeviceState *dev) s->syncing = 0; s->irq_mask = 0; s->irq_status = 0; + s->last_fifo_cursor_count = 0; vga_dirty_log_start(&s->vga); } @@ -1479,6 +1512,7 @@ static int vmsvga_post_load(void *opaque, int version_id) if (version_id < 1) { s->irq_mask = 0; s->irq_status = 0; + s->last_fifo_cursor_count = 0; } return 0; @@ -1508,6 +1542,7 @@ static const VMStateDescription vmstate_vmware_vga_internal = { VMSTATE_UNUSED(4), /* was fb_size */ VMSTATE_UINT32_V(irq_mask, struct vmsvga_state_s, 1), VMSTATE_UINT32_V(irq_status, struct vmsvga_state_s, 1), + VMSTATE_UINT32_V(last_fifo_cursor_count, struct vmsvga_state_s, 1), VMSTATE_END_OF_LIST() } }; @@ -1543,7 +1578,8 @@ static void vmsvga_init(DeviceState *dev, struct vmsvga_state_s *s, &error_fatal); s->fifo = (uint32_t *)memory_region_get_ram_ptr(&s->fifo_ram); s->num_fifo_regs = SVGA_FIFO_NUM_REGS; - s->fifo[SVGA_FIFO_CAPABILITIES] = SVGA_FIFO_CAP_FENCE; + s->fifo[SVGA_FIFO_CAPABILITIES] = + SVGA_FIFO_CAP_FENCE | SVGA_FIFO_CAP_CURSOR_BYPASS_3; s->fifo[SVGA_FIFO_FLAGS] = 0; vga_common_init(&s->vga, OBJECT(dev));