From nobody Sun Nov 24 23:21:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1719487153; cv=none; d=zohomail.com; s=zohoarc; b=C20jwtdt3erOQH0OnonSTYTZYxMOSDZfe7cLbX7Ah2+1lLTP/Up5tuhvcJlIN43sGXSsHo+YP7JH8oWgk9vwXuMlD/nEg4XCPBSHroupkVJQ8Sv7utmkOQZuiqRzj8j8k7wQ3tnARDgPBVpaNlHvBkOGK4AO/gl2jEwXmdAeiak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719487153; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+0MBOmhbtz1lyAbOdZb3RFV2v8aK9qDzLjqTtuOILhg=; b=Z0ohk0WDiRKLWLPB7uF0ujzU2E1henMwzdPQ08XB8SkSm+mg5vooqqH1Yxpw10u9VAxw7VP8B79pX+BHyufuPiBIWFuXOe4fCTRyKgr3n5bV28/p7zVfxG7JphZEtbIbhng72bt13UGboLFO9PYFzKYai9y6pjgFNELUZ41O+jU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719487153283974.9389160798614; Thu, 27 Jun 2024 04:19:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMn8Q-0004Dj-A6; Thu, 27 Jun 2024 07:17:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMn8N-0004DM-QE for qemu-devel@nongnu.org; Thu, 27 Jun 2024 07:17:47 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMn8M-0000SE-6N for qemu-devel@nongnu.org; Thu, 27 Jun 2024 07:17:47 -0400 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1fa0f143b85so41940585ad.3 for ; Thu, 27 Jun 2024 04:17:45 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1faac8f5a93sm10960755ad.77.2024.06.27.04.17.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 04:17:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719487065; x=1720091865; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=+0MBOmhbtz1lyAbOdZb3RFV2v8aK9qDzLjqTtuOILhg=; b=aVpESaxCtpddr3pqSDHFwTEH6CLXmB+h0HLfUCtiXmn7ZjfAjz1nLKdALGhXXybfYw ganTfEIIvtZWsCLxEWCHWmnf6VXQQc2ZmH9vb9N/VWg7lQpU42/Nu9JIHMthOpf5PHbV UIOB59vBO79lxdhZ3jI9z0IWCUbuoAa8wz6De+N6AN+Fv9XP4V4sjuRV76pOHt81Osh6 GrRUN5eVwt9BKnrZKKrSUih9RoEUfEGcXV5yOyxosUMZuSWYSzMFfp7zKEyYiGERHnuh ge+vyls9STdwGwSGZgrqbwAFbMwDR/SvBfzrNJShITUQRn8rGZ5kiiCcHnqv0TJJroFE V5bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719487065; x=1720091865; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+0MBOmhbtz1lyAbOdZb3RFV2v8aK9qDzLjqTtuOILhg=; b=DAXbWuF87idr3ehccPFgQ9aikrb/Y0O67oeF/9xEnGHW6jnTqRNx+QZ7Eedp+QKkOJ hZ+LeZPjhdNB7jvJTO0NBKha3ISXGE2wmJ8xea2IbJ3TSV2zmn/Mrc5OJqwh4yg7xaTp yaHsONBjMgKR1c52tdPdnxl5Cy4CioysdVRx/R0e1R+2nVQHT9kxD4hPtVEiCSoMU3+T X124pmLooC4X5ztS+qC6g09Hpu4SOHiIO5gOGhvDY7iqApoKNxwlrICQ/V8W/5n9vMwy eB/PNPR3rNLSqCFfinxl8i8wMoQp+wb8dSordkxLaNMIDoG/vGlUXS3emUuC++DFivT9 l2Pw== X-Gm-Message-State: AOJu0YxqqIcgZpkU1Nd77fh5VfkJ12kKYGLxNIeo0rmQS0QkQTQmZzqc CKH5TtifYOgt5M/ml0/vXtGcnldlwXjvJb2zGUrNlEGfSbZXFboDJ9sbWXq7Ap0= X-Google-Smtp-Source: AGHT+IHZoBPxo8wvKyYnk+m0uKlaX+bMxaB2yPURoUti6HmVmC1MoQYITT1XeX5mbLU+PBUKrcRZXA== X-Received: by 2002:a17:902:f611:b0:1fa:a50c:def9 with SMTP id d9443c01a7336-1faa50ce0b7mr23427225ad.57.1719487064821; Thu, 27 Jun 2024 04:17:44 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 20:17:33 +0900 Subject: [PATCH v2 1/4] ui/cocoa: Release CGColorSpace MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240627-cursor-v2-1-c3cd3ee35616@daynix.com> References: <20240627-cursor-v2-0-c3cd3ee35616@daynix.com> In-Reply-To: <20240627-cursor-v2-0-c3cd3ee35616@daynix.com> To: Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , Gerd Hoffmann , Dmitry Fleytman , Phil Dennis-Jordan Cc: qemu-devel@nongnu.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::635; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x635.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1719487154077100001 CGImageCreate | Apple Developer Documentation https://developer.apple.com/documentation/coregraphics/1455149-cgimagecreate > The color space is retained; on return, you may safely release it. Signed-off-by: Akihiko Odaki Reviewed-by: Phil Dennis-Jordan Tested-by: Phil Dennis-Jordan --- ui/cocoa.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 981615a8b925..908454a434c5 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -299,6 +299,7 @@ @interface QemuCocoaView : NSView BOOL isMouseGrabbed; BOOL isAbsoluteEnabled; CFMachPortRef eventsTap; + CGColorSpaceRef colorspace; } - (void) switchSurface:(pixman_image_t *)image; - (void) grabMouse; @@ -360,6 +361,7 @@ - (id)initWithFrame:(NSRect)frameRect [trackingArea release]; screen.width =3D frameRect.size.width; screen.height =3D frameRect.size.height; + colorspace =3D CGColorSpaceCreateWithName(kCGColorSpaceSRGB); #if MAC_OS_X_VERSION_MAX_ALLOWED >=3D MAC_OS_VERSION_14_0 [self setClipsToBounds:YES]; #endif @@ -380,6 +382,7 @@ - (void) dealloc CFRelease(eventsTap); } =20 + CGColorSpaceRelease(colorspace); [super dealloc]; } =20 @@ -456,7 +459,7 @@ - (void) drawRect:(NSRect) rect DIV_ROUND_UP(bitsPerPixel, 8) * 2, //bitsPerComponent bitsPerPixel, //bitsPerPixel stride, //bytesPerRow - CGColorSpaceCreateWithName(kCGColorSpaceSRGB), //colorspace + colorspace, //colorspace kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst, //bit= mapInfo dataProviderRef, //provider NULL, //decode --=20 2.45.2 From nobody Sun Nov 24 23:21:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1719487158; cv=none; d=zohomail.com; s=zohoarc; b=IjG3gNszmmA11jku+k/YGZSVuPG/hYE1TpkdnGfity80ycRWn0tbVK3tu5AAZ1l5dgngqIvirn46L/jmExV+JXw2DFn+mV+JMn+00IxjgX4BvjQvMLDp8qnXDvSISnaeSZtjQVzY8GBYtS935fAqDhMpx/i5DM/UCPyBNg2nFRo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719487158; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oFLR/melq8E/lYXPe0hD5jcfD1lx+Z5rrqeeVGFauMo=; b=RICkmzeK9ZcO/fBzpJRj2ovW/2Ol++xThcTPVk/U8ET4peauCZK8X0+DJrT4AsjOg2/71WsoZHn1gc1zdXUs3Of9jpDphbpPd/2LEfmammzuszBZ6lbjhrLQbEFCsDTalLMdopcmUhpb7bphleNPVX8WskC5EWrlt98fFtWoIBQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719487158385690.493487353781; Thu, 27 Jun 2024 04:19:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMn8V-0004E6-7j; Thu, 27 Jun 2024 07:17:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMn8T-0004Dw-Ah for qemu-devel@nongnu.org; Thu, 27 Jun 2024 07:17:54 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMn8R-0000SO-9e for qemu-devel@nongnu.org; Thu, 27 Jun 2024 07:17:53 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1f9e2affc8cso50128115ad.2 for ; Thu, 27 Jun 2024 04:17:49 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1faac99acc8sm10909695ad.222.2024.06.27.04.17.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 04:17:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719487069; x=1720091869; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=oFLR/melq8E/lYXPe0hD5jcfD1lx+Z5rrqeeVGFauMo=; b=PTg284MhKi4FGshhhoBvRpRiAMnRkBmF50PG1HQs0E7UXyuC/1NOY96lcrwqbyH+Yj R7/ZQoyDt5cKxAXIf2rs9A/ojRftBG/M6CP9hKNRf+zziCCTW1U+h1siZD1HpqqGSIPP l3Z4KfLRD8RTO1M7ectqRehLfHmFjQrPP5IfZj+o+tcqd3VuypDcxzNk/w7XizDLzCh2 yo3TSQ2hdj+3DmPG45BJkg0maOmVO7JxYYnbFAoBdBYoLWd6Z/6Wvg+W1Sir2AU2gb04 EXjIk3JrTedcm8wE7XHo9heHQ6KsDoJuXahPaKavqJ25CxKnKwgqqIshESYzj7ybjZYO fNww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719487069; x=1720091869; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oFLR/melq8E/lYXPe0hD5jcfD1lx+Z5rrqeeVGFauMo=; b=G46mFPhOA13UTq2fzBVG+QJvZO1JO/mM+R5D2PtSjeebw2C46RD5J/EJEKgaWJS1YD EWpmVRtjhhNMwTlYWDpeSb6OcrWl04XqAt1qHF/zKl4g6MEnvi0yGHTFu35TYP2pi3Bj qQsVptWPJFwHOfQRYgRFoj4p1cC657LYH0Uv6tWRE7DiRGulaY/qsil8YQ05GGPW7YCT 7ZLEE2R3IOizGh94C0xy3RpKZw+KyRCv9kC+k5Qwatfd/8oNewKtG3C/aeBZeWMeksVV 3Ktxan/fSFcX7g/z//GhFr5qZv+e+M1GjGUgNTL1cpl3VaQ2gn0TKV3rRCjir7Ct0mTf 2Zgg== X-Gm-Message-State: AOJu0Yx16tfrXr5YYWCfiEkWNvFCI5S2jzhmKOBI8w7uZmsMv336lxao Rtvj00c/fx3NQzErfuN5vyGb9oVfRKf1wRDnSoUmqyAfGz7POjxP6+/n/UkDftgIP3YqD/F3bsp vDLo= X-Google-Smtp-Source: AGHT+IGQbIBEtNrngfdyLKMh0viCu6q0Qj0+3Z6o+DH7k06pc2u/lhD1idsL9QBqHyiQ5bcVupY1zw== X-Received: by 2002:a17:902:d489:b0:1fa:4b9:cffc with SMTP id d9443c01a7336-1fa2347d495mr136115165ad.0.1719487068815; Thu, 27 Jun 2024 04:17:48 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 20:17:34 +0900 Subject: [PATCH v2 2/4] ui/console: Convert mouse visibility parameter into bool MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240627-cursor-v2-2-c3cd3ee35616@daynix.com> References: <20240627-cursor-v2-0-c3cd3ee35616@daynix.com> In-Reply-To: <20240627-cursor-v2-0-c3cd3ee35616@daynix.com> To: Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , Gerd Hoffmann , Dmitry Fleytman , Phil Dennis-Jordan Cc: qemu-devel@nongnu.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::629; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x629.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1719487159944100003 Signed-off-by: Akihiko Odaki Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Phil Dennis-Jordan Tested-by: Phil Dennis-Jordan --- include/ui/console.h | 4 ++-- hw/display/ati.c | 2 +- hw/display/virtio-gpu.c | 3 +-- hw/display/vmware_vga.c | 2 +- ui/console.c | 5 +++-- ui/dbus-listener.c | 2 +- ui/gtk.c | 2 +- ui/sdl2.c | 4 ++-- ui/spice-display.c | 11 ++++++----- ui/vnc.c | 2 +- 10 files changed, 19 insertions(+), 18 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index a208a68b8886..82b573e68082 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -233,7 +233,7 @@ typedef struct DisplayChangeListenerOps { =20 /* optional */ void (*dpy_mouse_set)(DisplayChangeListener *dcl, - int x, int y, int on); + int x, int y, bool on); /* optional */ void (*dpy_cursor_define)(DisplayChangeListener *dcl, QEMUCursor *cursor); @@ -322,7 +322,7 @@ void dpy_gfx_replace_surface(QemuConsole *con, void dpy_text_cursor(QemuConsole *con, int x, int y); void dpy_text_update(QemuConsole *con, int x, int y, int w, int h); void dpy_text_resize(QemuConsole *con, int w, int h); -void dpy_mouse_set(QemuConsole *con, int x, int y, int on); +void dpy_mouse_set(QemuConsole *con, int x, int y, bool on); void dpy_cursor_define(QemuConsole *con, QEMUCursor *cursor); bool dpy_cursor_define_supported(QemuConsole *con); bool dpy_gfx_check_format(QemuConsole *con, diff --git a/hw/display/ati.c b/hw/display/ati.c index 8d2501bd8210..b1f94f5b767d 100644 --- a/hw/display/ati.c +++ b/hw/display/ati.c @@ -742,7 +742,7 @@ static void ati_mm_write(void *opaque, hwaddr addr, if (!s->cursor_guest_mode && (s->regs.crtc_gen_cntl & CRTC2_CUR_EN) && !(t & BIT(31))) { dpy_mouse_set(s->vga.con, s->regs.cur_hv_pos >> 16, - s->regs.cur_hv_pos & 0xffff, 1); + s->regs.cur_hv_pos & 0xffff, true); } break; } diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index d60b1b2973af..3281842bfe1b 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -109,8 +109,7 @@ static void update_cursor(VirtIOGPU *g, struct virtio_g= pu_update_cursor *cursor) s->cursor.pos.x =3D cursor->pos.x; s->cursor.pos.y =3D cursor->pos.y; } - dpy_mouse_set(s->con, cursor->pos.x, cursor->pos.y, - cursor->resource_id ? 1 : 0); + dpy_mouse_set(s->con, cursor->pos.x, cursor->pos.y, cursor->resource_i= d); } =20 struct virtio_gpu_simple_resource * diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 1c0f9d9a991d..512f224b9f58 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -1167,7 +1167,7 @@ static void vmsvga_reset(DeviceState *dev) s->enable =3D 0; s->config =3D 0; s->svgaid =3D SVGA_ID; - s->cursor.on =3D 0; + s->cursor.on =3D false; s->redraw_fifo_last =3D 0; s->syncing =3D 0; =20 diff --git a/ui/console.c b/ui/console.c index 1b2cd0c7365d..0ec70cb50ce6 100644 --- a/ui/console.c +++ b/ui/console.c @@ -49,7 +49,8 @@ typedef struct QemuGraphicConsole { uint32_t head; =20 QEMUCursor *cursor; - int cursor_x, cursor_y, cursor_on; + int cursor_x, cursor_y; + bool cursor_on; } QemuGraphicConsole; =20 typedef QemuConsoleClass QemuGraphicConsoleClass; @@ -957,7 +958,7 @@ void dpy_text_resize(QemuConsole *con, int w, int h) } } =20 -void dpy_mouse_set(QemuConsole *c, int x, int y, int on) +void dpy_mouse_set(QemuConsole *c, int x, int y, bool on) { QemuGraphicConsole *con =3D QEMU_GRAPHIC_CONSOLE(c); DisplayState *s =3D c->ds; diff --git a/ui/dbus-listener.c b/ui/dbus-listener.c index 54900880433e..a54123acea7d 100644 --- a/ui/dbus-listener.c +++ b/ui/dbus-listener.c @@ -726,7 +726,7 @@ static void dbus_gfx_switch(DisplayChangeListener *dcl, } =20 static void dbus_mouse_set(DisplayChangeListener *dcl, - int x, int y, int on) + int x, int y, bool on) { DBusDisplayListener *ddl =3D container_of(dcl, DBusDisplayListener, dc= l); =20 diff --git a/ui/gtk.c b/ui/gtk.c index 93b13b7a30ff..bc29f7a1b4f7 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -446,7 +446,7 @@ static GdkDevice *gd_get_pointer(GdkDisplay *dpy) } =20 static void gd_mouse_set(DisplayChangeListener *dcl, - int x, int y, int visible) + int x, int y, bool visible) { VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); GdkDisplay *dpy; diff --git a/ui/sdl2.c b/ui/sdl2.c index 0a0eb5a42d58..98ed97437171 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -49,7 +49,7 @@ static int gui_grab_code =3D KMOD_LALT | KMOD_LCTRL; static SDL_Cursor *sdl_cursor_normal; static SDL_Cursor *sdl_cursor_hidden; static int absolute_enabled; -static int guest_cursor; +static bool guest_cursor; static int guest_x, guest_y; static SDL_Cursor *guest_sprite; static Notifier mouse_mode_notifier; @@ -729,7 +729,7 @@ void sdl2_poll_events(struct sdl2_console *scon) } =20 static void sdl_mouse_warp(DisplayChangeListener *dcl, - int x, int y, int on) + int x, int y, bool on) { struct sdl2_console *scon =3D container_of(dcl, struct sdl2_console, d= cl); =20 diff --git a/ui/spice-display.c b/ui/spice-display.c index 8a8472d0294e..c794ae06498b 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -254,7 +254,7 @@ static void qemu_spice_create_update(SimpleSpiceDisplay= *ssd) static SimpleSpiceCursor* qemu_spice_create_cursor_update(SimpleSpiceDisplay *ssd, QEMUCursor *c, - int on) + bool on) { size_t size =3D c ? c->width * c->height * 4 : 0; SimpleSpiceCursor *update; @@ -448,7 +448,8 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd, qemu_mutex_lock(&ssd->lock); if (ssd->cursor) { g_free(ssd->ptr_define); - ssd->ptr_define =3D qemu_spice_create_cursor_update(ssd, ssd->curs= or, 0); + ssd->ptr_define =3D + qemu_spice_create_cursor_update(ssd, ssd->cursor, false); } qemu_mutex_unlock(&ssd->lock); } @@ -476,7 +477,7 @@ void qemu_spice_cursor_refresh_bh(void *opaque) ssd->mouse_x =3D -1; ssd->mouse_y =3D -1; qemu_mutex_unlock(&ssd->lock); - dpy_mouse_set(ssd->dcl.con, x, y, 1); + dpy_mouse_set(ssd->dcl.con, x, y, true); } else { qemu_mutex_unlock(&ssd->lock); } @@ -747,7 +748,7 @@ static void display_refresh(DisplayChangeListener *dcl) } =20 static void display_mouse_set(DisplayChangeListener *dcl, - int x, int y, int on) + int x, int y, bool on) { SimpleSpiceDisplay *ssd =3D container_of(dcl, SimpleSpiceDisplay, dcl); =20 @@ -774,7 +775,7 @@ static void display_mouse_define(DisplayChangeListener = *dcl, g_free(ssd->ptr_move); ssd->ptr_move =3D NULL; g_free(ssd->ptr_define); - ssd->ptr_define =3D qemu_spice_create_cursor_update(ssd, c, 0); + ssd->ptr_define =3D qemu_spice_create_cursor_update(ssd, c, false); qemu_mutex_unlock(&ssd->lock); qemu_spice_wakeup(ssd); } diff --git a/ui/vnc.c b/ui/vnc.c index dd530f04e579..dae5d51210be 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -981,7 +981,7 @@ int vnc_send_framebuffer_update(VncState *vs, int x, in= t y, int w, int h) } =20 static void vnc_mouse_set(DisplayChangeListener *dcl, - int x, int y, int visible) + int x, int y, bool visible) { /* can we ask the client(s) to move the pointer ??? */ } --=20 2.45.2 From nobody Sun Nov 24 23:21:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1719487124; cv=none; d=zohomail.com; s=zohoarc; b=IA+E5tU3IU0jURgQN8ALnL2PbPjlcUaevF5Fz2EvivuZqopBqgJrqkOkp+Rm9ASsE0KcR4sPuJjlNv830+cB9socmPFwyq+GRec6ERrm0aYzWCPX+0p+CprXhJS2eH4BrC37Zucgrt1H/QhJ95P7YmNXqT/EFzJFJB+/WuHxUl8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719487124; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7M6buw52eZMZE8chSs+8yqu1mcRqVq2tRe1GuSt0QPw=; b=YOZCIo6Vm5qTvj23Askxn1AByC6o8ChPXRlrzOdZ+drM8UiKg1njyCEOeCBwtZmiehl/qSBf/lDijikgcO1r095csTmZ/vmaYHvkz8MTfylRcP880oShUn+oOdxcvSSJCxVBeM9ytDgeeduUNkk9wanSX/h+iMesiE2jHuzkn5s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719487124917911.3520745562712; Thu, 27 Jun 2024 04:18:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMn8b-0004Ei-0H; Thu, 27 Jun 2024 07:18:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMn8X-0004EU-67 for qemu-devel@nongnu.org; Thu, 27 Jun 2024 07:17:57 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMn8V-0000Sc-Ao for qemu-devel@nongnu.org; Thu, 27 Jun 2024 07:17:56 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1f9b364faddso62604395ad.3 for ; Thu, 27 Jun 2024 04:17:54 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1faac8df839sm10992895ad.52.2024.06.27.04.17.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 04:17:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719487073; x=1720091873; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=7M6buw52eZMZE8chSs+8yqu1mcRqVq2tRe1GuSt0QPw=; b=ENhlH3lFFVMznk990+gpmD/A+Dld4jV89yrb+uVEfQxjH1CA2X/6bHNtHzUXYXl0rX qplit2tiJqBTpC1dFkDoLE5CsaQVlouU5kZG935NbCZ9uVTb2L/uWJeIBS84+Ed4GI+D a32Jk0cslYBNcCzk5pSv2XDep1I11J4kC8IrOiZYB9RCVDt0MgBjq0a7zaGxqnW5Zhw9 ubZY6MgOB0un4V/b0dIJHLY0cd1/qtHD7G4Tqt3Z9PxIO2k7tM/c6m/Sg7EiOW2TeyxX hok0T0ov0rHbOEbD2ecLZZFhvL7GI+u5ni+JUXrKo3/cz8wmSGVcpMSd+CUyHloBCT/2 HVKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719487073; x=1720091873; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7M6buw52eZMZE8chSs+8yqu1mcRqVq2tRe1GuSt0QPw=; b=XIvQF0l/x/0kMukiwkPOddjqVos/t40T8thF5zm4Gxo7p8JCgNZfhGTDLrCJQIKBqN yqHLVU/F8DK1IveXBs72YxvLOe8OzQazz3q3ybAkdIypDzsPquLIUzsvO1CfwlPwZN3e Z5LI20nGB7J+b5VgMO/76yxNLkwDphprYcx4NJMKYXlP/pARm4U/pTNKhLGKkg0w8G5r 3+gltDtwgKFInea5VL3VqGn2RMt190JweX3k9KUfDuPKc0V1Lp0sub1f7UwyLKroa+yb THRjkFbANCu1/R8KxDNir24DqAUvC6PSFz8EFGIs5uh+dH27VpuO9OCsi7E4lNFhIFLG DoaA== X-Gm-Message-State: AOJu0YwvnN44SzMZANtQlNsSQ8sIF7960RdAlVRtrepUW+ustlSI0l8Z m9YyI9j29P4s+S2pnLA8DqF4xQXpJLcVVCRaG/fwuJf8mgNtPWXNrwEufNN9hJTQUe4u8fhah3U AEbw= X-Google-Smtp-Source: AGHT+IGr3FR59n6Xaeo/BB3X3NuDgvjAscr5jqWPD62MeN1pL0Kl7F/Hsb9R5XRcH/7kFpeyQYLPhA== X-Received: by 2002:a17:902:e5c1:b0:1f9:df83:8ab2 with SMTP id d9443c01a7336-1fa240c518bmr164304535ad.58.1719487073353; Thu, 27 Jun 2024 04:17:53 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 20:17:35 +0900 Subject: [PATCH v2 3/4] ui/cocoa: Add cursor composition MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240627-cursor-v2-3-c3cd3ee35616@daynix.com> References: <20240627-cursor-v2-0-c3cd3ee35616@daynix.com> In-Reply-To: <20240627-cursor-v2-0-c3cd3ee35616@daynix.com> To: Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , Gerd Hoffmann , Dmitry Fleytman , Phil Dennis-Jordan Cc: qemu-devel@nongnu.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::62c; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x62c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1719487126119100001 Add accelerated cursor composition to ui/cocoa. This does not only improve performance for display devices that exposes the capability to the guest according to dpy_cursor_define_supported(), but fixes the cursor display for devices that unconditionally expects the availability of the capability (e.g., virtio-gpu). The common pattern to implement accelerated cursor composition is to replace the cursor and warp it so that the replaced cursor is shown at the correct position on the guest display for relative pointer devices. Unfortunately, ui/cocoa cannot do the same because warping the cursor position interfers with the mouse input so it uses CALayer instead; although it is not specialized for cursor composition, it still can compose images with hardware acceleration. Co-authored-by: Phil Dennis-Jordan Signed-off-by: Akihiko Odaki Reviewed-by: Phil Dennis-Jordan Tested-by: Phil Dennis-Jordan --- meson.build | 3 +- ui/cocoa.m | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 101 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 638660714455..59cc1fb8bcfc 100644 --- a/meson.build +++ b/meson.build @@ -1041,7 +1041,8 @@ if get_option('attr').allowed() endif endif =20 -cocoa =3D dependency('appleframeworks', modules: ['Cocoa', 'CoreVideo'], +cocoa =3D dependency('appleframeworks', + modules: ['Cocoa', 'CoreVideo', 'QuartzCore'], required: get_option('cocoa')) =20 vmnet =3D dependency('appleframeworks', modules: 'vmnet', required: get_op= tion('vmnet')) diff --git a/ui/cocoa.m b/ui/cocoa.m index 908454a434c5..0dcd1923bfb3 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -25,6 +25,7 @@ #include "qemu/osdep.h" =20 #import +#import #include =20 #include "qemu/help-texts.h" @@ -79,12 +80,16 @@ static void cocoa_switch(DisplayChangeListener *dcl, DisplaySurface *surface); =20 static void cocoa_refresh(DisplayChangeListener *dcl); +static void cocoa_mouse_set(DisplayChangeListener *dcl, int x, int y, int = on); +static void cocoa_cursor_define(DisplayChangeListener *dcl, QEMUCursor *cu= rsor); =20 static const DisplayChangeListenerOps dcl_ops =3D { .dpy_name =3D "cocoa", .dpy_gfx_update =3D cocoa_update, .dpy_gfx_switch =3D cocoa_switch, .dpy_refresh =3D cocoa_refresh, + .dpy_mouse_set =3D cocoa_mouse_set, + .dpy_cursor_define =3D cocoa_cursor_define, }; static DisplayChangeListener dcl =3D { .ops =3D &dcl_ops, @@ -300,6 +305,11 @@ @interface QemuCocoaView : NSView BOOL isAbsoluteEnabled; CFMachPortRef eventsTap; CGColorSpaceRef colorspace; + CALayer *cursorLayer; + QEMUCursor *cursor; + int mouseX; + int mouseY; + bool mouseOn; } - (void) switchSurface:(pixman_image_t *)image; - (void) grabMouse; @@ -365,6 +375,12 @@ - (id)initWithFrame:(NSRect)frameRect #if MAC_OS_X_VERSION_MAX_ALLOWED >=3D MAC_OS_VERSION_14_0 [self setClipsToBounds:YES]; #endif + [self setWantsLayer:YES]; + cursorLayer =3D [[CALayer alloc] init]; + [cursorLayer setAnchorPoint:CGPointMake(0, 1)]; + [cursorLayer setAutoresizingMask:kCALayerMaxXMargin | + kCALayerMinYMargin]; + [[self layer] addSublayer:cursorLayer]; =20 } return self; @@ -383,6 +399,8 @@ - (void) dealloc } =20 CGColorSpaceRelease(colorspace); + [cursorLayer release]; + cursor_unref(cursor); [super dealloc]; } =20 @@ -426,6 +444,72 @@ - (void) unhideCursor [NSCursor unhide]; } =20 +- (void)setMouseX:(int)x y:(int)y on:(bool)on +{ + CGPoint position; + + mouseX =3D x; + mouseY =3D y; + mouseOn =3D on; + + position.x =3D mouseX; + position.y =3D screen.height - mouseY; + + [CATransaction begin]; + [CATransaction setDisableActions:YES]; + [cursorLayer setPosition:position]; + [cursorLayer setHidden:!mouseOn]; + [CATransaction commit]; +} + +- (void)setCursor:(QEMUCursor *)given_cursor +{ + CGDataProviderRef provider; + CGImageRef image; + CGRect bounds =3D CGRectZero; + + cursor_unref(cursor); + cursor =3D given_cursor; + + if (!cursor) { + return; + } + + cursor_ref(cursor); + + bounds.size.width =3D cursor->width; + bounds.size.height =3D cursor->height; + + provider =3D CGDataProviderCreateWithData( + NULL, + cursor->data, + cursor->width * cursor->height * 4, + NULL + ); + + image =3D CGImageCreate( + cursor->width, //width + cursor->height, //height + 8, //bitsPerComponent + 32, //bitsPerPixel + cursor->width * 4, //bytesPerRow + colorspace, //colorspace + kCGBitmapByteOrder32Little | kCGImageAlphaFirst, //bitmapInfo + provider, //provider + NULL, //decode + 0, //interpolate + kCGRenderingIntentDefault //intent + ); + + CGDataProviderRelease(provider); + [CATransaction begin]; + [CATransaction setDisableActions:YES]; + [cursorLayer setBounds:bounds]; + [cursorLayer setContents:(id)image]; + [CATransaction commit]; + CGImageRelease(image); +} + - (void) drawRect:(NSRect) rect { COCOA_DEBUG("QemuCocoaView: drawRect\n"); @@ -2003,6 +2087,21 @@ static void cocoa_refresh(DisplayChangeListener *dcl) [pool release]; } =20 +static void cocoa_mouse_set(DisplayChangeListener *dcl, int x, int y, bool= on) +{ + dispatch_async(dispatch_get_main_queue(), ^{ + [cocoaView setMouseX:x y:y on:on]; + }); +} + +static void cocoa_cursor_define(DisplayChangeListener *dcl, QEMUCursor *cu= rsor) +{ + dispatch_async(dispatch_get_main_queue(), ^{ + BQL_LOCK_GUARD(); + [cocoaView setCursor:qemu_console_get_cursor(dcl->con)]; + }); +} + static void cocoa_display_init(DisplayState *ds, DisplayOptions *opts) { NSAutoreleasePool * pool =3D [[NSAutoreleasePool alloc] init]; --=20 2.45.2 From nobody Sun Nov 24 23:21:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1719487132; cv=none; d=zohomail.com; s=zohoarc; b=UYcJaTQ0M9tjmrYF+LZgxIwMRx0tShdwTnzZcbhIcIEfvKiR/ICSQn4o/FzMunxpak0blY4NTXxRO3GGXJHkUY9vOm8m1RE2LnqOeSAJ2h/G6zv9zwdpEzs2d07E8Tk/K24slRgdW2XH8xiajnoyAdUoP0Iuszi+8fXkYyMX7Y4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1719487132; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Gud/N2WVB/hJEuBntpHZ3OPjTaafW+GXbIrsPuTc5jQ=; b=ew1rjdR9h1h56ohEq4ZjCUZzFTbJQWsC6ct4Quju1LbC7xcfbnU2Ep3TuiYd2D4tcePxCOALyyY397YFZR0Aklh2zNZZnPwjcqvRrX1yjuhYHQD7tRlI5ZRPWN1JSTrLZeEaExXZze/d8ByDJ8fFYPviXFBEnUS/CmgRjD+gz7c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1719487132242204.8738811864216; Thu, 27 Jun 2024 04:18:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMn8f-0004FV-G6; Thu, 27 Jun 2024 07:18:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMn8b-0004Ep-3c for qemu-devel@nongnu.org; Thu, 27 Jun 2024 07:18:01 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMn8Z-0000TL-9Q for qemu-devel@nongnu.org; Thu, 27 Jun 2024 07:18:00 -0400 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1f4c7b022f8so66223085ad.1 for ; Thu, 27 Jun 2024 04:17:58 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1faac8e0525sm11203855ad.55.2024.06.27.04.17.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jun 2024 04:17:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1719487078; x=1720091878; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Gud/N2WVB/hJEuBntpHZ3OPjTaafW+GXbIrsPuTc5jQ=; b=bavLiXh/V1+0Ct8MkpiQQDPTjL/L7uk2Bl1lSIGvB9UC4oksZDuAVTETTaG2d7sCVJ 0/1DcTkSGb9/brUiXr5mCxSEGSSklOsgZ0xTTgyw+Scy5cYD9dXw8Ch5Y1I5xeaZ6LEi Kp8ieik/T/gicTrDCW4J72MYU46tpRqBBlhSVjOVY3AMXubC/lLpIteVfnu7bvifS1q0 Q6I7l75imC2x9b+GdIMTpnqe1vGwM98wzd3ZHvY80IxaxHKEiV5I/bBuiOOJ+xVDCyWG yINK/KOFVyTwgs1lJryhheED9Fc593rl7K5S88E5+V1nZNeapa5Nl+zxRqLF0cyFfZCm kysg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719487078; x=1720091878; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Gud/N2WVB/hJEuBntpHZ3OPjTaafW+GXbIrsPuTc5jQ=; b=RclAjh8ZtCJ3ACdQCeRDbMVK1nmw8jwTMSemCrzrWQXF/024OuIXmyNXtEBkIae0Rc i6saT5se3xFEJzUbW/wRsfKSVJ/ICME3cxofRSQSkNUyU7fwstJyLGT1uGkv7ReHdk9m vgVsGvBD0OfW58wKXIIh5LgY9kPdhObjixGBEpFKKDuqwjxx49pG5tlPJqFNphTGeJwV FcAtzfauAnUe0aMjNQ136pZdjOaybmG6WoFyqczKM0Xwk9UIeoKM+WIKdSKCcccfQlFl tgxDprox9aLkqBOEZ0jekQOKXPr769itJDhvGzaF/9GaXx/f/UDnrplNP4rqUHssXxKs rFqA== X-Gm-Message-State: AOJu0Yx5QcRFsD3k2bBB5faBJ8qLRprZRqtdu6YwFOuHw1tdB6tP3xcS 73eNhKMvfPVRKrye+6NWXwTh98cBr5UA2cdKPvn6wU+fAI7ENdL6MDQ4Jff5+Kg= X-Google-Smtp-Source: AGHT+IGf5XUgSugWXJu45YD6yrMw+Gjb4x190DGqJN7lNYdIrbtmsgylBHkFuSGBpqlywr9XRkz6FA== X-Received: by 2002:a17:902:650e:b0:1f7:174e:354d with SMTP id d9443c01a7336-1fa23ef7ef4mr102771625ad.48.1719487077980; Thu, 27 Jun 2024 04:17:57 -0700 (PDT) From: Akihiko Odaki Date: Thu, 27 Jun 2024 20:17:36 +0900 Subject: [PATCH v2 4/4] ui/console: Remove dpy_cursor_define_supported() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240627-cursor-v2-4-c3cd3ee35616@daynix.com> References: <20240627-cursor-v2-0-c3cd3ee35616@daynix.com> In-Reply-To: <20240627-cursor-v2-0-c3cd3ee35616@daynix.com> To: Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , Gerd Hoffmann , Dmitry Fleytman , Phil Dennis-Jordan Cc: qemu-devel@nongnu.org, Akihiko Odaki X-Mailer: b4 0.14-dev-fd6e3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::629; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x629.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1719487134018100006 Remove dpy_cursor_define_supported() as it brings no benefit today and it has a few inherent problems. All graphical displays except egl-headless support cursor composition without DMA-BUF, and egl-headless is meant to be used in conjunction with another graphical display, so dpy_cursor_define_supported() always returns true and meaningless. Even if we add a new display without cursor composition in the future, dpy_cursor_define_supported() will be problematic as a cursor display fix for it because some display devices like virtio-gpu cannot tell the lack of cursor composition capability to the guest and are unable to utilize the value the function returns. Therefore, all non-headless graphical displays must actually implement cursor composition for correct cursor display. Another problem with dpy_cursor_define_supported() is that it returns true even if only some of the display listeners support cursor composition, which is wrong unless all display listeners that lack cursor composition is headless. Signed-off-by: Akihiko Odaki Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Phil Dennis-Jordan Tested-by: Phil Dennis-Jordan --- include/ui/console.h | 1 - hw/display/qxl-render.c | 4 ---- hw/display/vmware_vga.c | 6 ++---- ui/console.c | 13 ------------- 4 files changed, 2 insertions(+), 22 deletions(-) diff --git a/include/ui/console.h b/include/ui/console.h index 82b573e68082..fa986ab97e3b 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -324,7 +324,6 @@ void dpy_text_update(QemuConsole *con, int x, int y, in= t w, int h); void dpy_text_resize(QemuConsole *con, int w, int h); void dpy_mouse_set(QemuConsole *con, int x, int y, bool on); void dpy_cursor_define(QemuConsole *con, QEMUCursor *cursor); -bool dpy_cursor_define_supported(QemuConsole *con); bool dpy_gfx_check_format(QemuConsole *con, pixman_format_code_t format); =20 diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c index ec99ec887a6e..837d2446cd52 100644 --- a/hw/display/qxl-render.c +++ b/hw/display/qxl-render.c @@ -307,10 +307,6 @@ int qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt= *ext) return 1; } =20 - if (!dpy_cursor_define_supported(qxl->vga.con)) { - return 0; - } - if (qxl->debug > 1 && cmd->type !=3D QXL_CURSOR_MOVE) { fprintf(stderr, "%s", __func__); qxl_log_cmd_cursor(qxl, cmd, ext->group_id); diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 512f224b9f58..3db3ff98f763 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -904,10 +904,8 @@ static uint32_t vmsvga_value_read(void *opaque, uint32= _t address) caps |=3D SVGA_CAP_RECT_FILL; #endif #ifdef HW_MOUSE_ACCEL - if (dpy_cursor_define_supported(s->vga.con)) { - caps |=3D SVGA_CAP_CURSOR | SVGA_CAP_CURSOR_BYPASS_2 | - SVGA_CAP_CURSOR_BYPASS; - } + caps |=3D SVGA_CAP_CURSOR | SVGA_CAP_CURSOR_BYPASS_2 | + SVGA_CAP_CURSOR_BYPASS; #endif ret =3D caps; break; diff --git a/ui/console.c b/ui/console.c index 0ec70cb50ce6..33976446425e 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1001,19 +1001,6 @@ void dpy_cursor_define(QemuConsole *c, QEMUCursor *c= ursor) } } =20 -bool dpy_cursor_define_supported(QemuConsole *con) -{ - DisplayState *s =3D con->ds; - DisplayChangeListener *dcl; - - QLIST_FOREACH(dcl, &s->listeners, next) { - if (dcl->ops->dpy_cursor_define) { - return true; - } - } - return false; -} - QEMUGLContext dpy_gl_ctx_create(QemuConsole *con, struct QEMUGLParams *qparams) { --=20 2.45.2