From nobody Sat Dec 28 09:59:23 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1721021220; cv=none; d=zohomail.com; s=zohoarc; b=iy0l/50bVg5K9GAjV1c78IE4tSkACNcXjpNPdA5oHqo7fnIKEeqAlKAcjH3lBzr0u2GjnjGfdyxljJbC2kTmjq+1L9TpYk2wKHWgr5Crz+1Wpd1iLgupCp/neu6oyREMTwd286WrwLJb9VV+Bsh41lELCdu6rdDcaRQVEaHBgOs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721021220; 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=ZFkKq/AYFbP1nhs8BcE0hhSFScS/T8p6YkOLZvLOSgg=; b=L0tC3hm7hRcxW5egvImdG3FBmKsyMZRQ5D7UFNxZOKrmRTcYA+yiXtIXPIYXvcPeQp6SE+UVRY99Ypd1fwTD1eV/cn6e6lLPFULnTIvr58HP6lVJX05B1UFajcpYG2Se/fiQbmOmVDkffhkdrz3QG5wwJ/qWlNy8A2zDvtwpIoY= 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+importer2=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 172102122041291.50411430253087; Sun, 14 Jul 2024 22:27:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTEDy-0001lJ-Rd; Mon, 15 Jul 2024 01:26:10 -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 1sTEDw-0001ek-W4 for qemu-devel@nongnu.org; Mon, 15 Jul 2024 01:26:09 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTEDv-0000cU-79 for qemu-devel@nongnu.org; Mon, 15 Jul 2024 01:26:08 -0400 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-7163489149eso2850616a12.1 for ; Sun, 14 Jul 2024 22:26:06 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1fc0bc3c768sm32580055ad.233.2024.07.14.22.26.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 14 Jul 2024 22:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1721021166; x=1721625966; 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=ZFkKq/AYFbP1nhs8BcE0hhSFScS/T8p6YkOLZvLOSgg=; b=B39YuR48wYg5x+UqddZnqafw/g7ocI7313t8jmrB4R/DrDwCugzvF4LyWv1TzjIzG4 yJNUkakcAx/VgU9b2rpGR6Fu85H3NH/3+hPc3j2PjHVpmtqnNmECQGHXw9kRHwq+lI1C MZMdzuHphGCcmUzIgWw41Kg343EpI+JndmPQLMkXnMk6LtKt8nNnxtzRtCmVlZoX80on Oafs2JtzX3AitgpEgZlrVVudILyF1OoRnIw6Uj5mDVmRMmRry2/vVzi4DyOlhpbhZbYF O6xIkYUEfHwEY3ZfPyusdhEkv50nxhnz+RGqH5Oqn1cWeUkf0iSwBHMyW7bkYwNbNPyX GPKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721021166; x=1721625966; 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=ZFkKq/AYFbP1nhs8BcE0hhSFScS/T8p6YkOLZvLOSgg=; b=K026Hqwhyb/E3SbGcEXGafH82XBETg6GHYyP9Mrku7W9VlBUPwyiEUjpD1+1ZO2Pts 1RIC/jZNjXKEUroyfizFOhZ1zrGitIy/hc8JCe6EJ464zflvO6JARvVa1l0FNDwjoEmc oOGv8sEl3P6rcNasoKy8akdEQ13KlPMz7FrjuU2WBUf4XEh+gq5LvqsvoO+PpSckyJek uJTbBHdYURvDtLD7RH7knnb5wuHUh63e/uFGKWxSewAFeC9hvEa8UWHcbWv2swEa7FMU s9B7cw2krlg3p9iiBCRnplMSTE0RhvpyCHJ6VZ7wybjC5OzaqXZQcz6RjR4/tfAxJOtI O5XA== X-Gm-Message-State: AOJu0YwT77c6TgkhAbl6ro7lNzOg/HY/mrrjES3uDcJL8tJ7jQ0x+9b0 GBNFhtHmVZWurnRSY0oQ0ajyMV+ecukanQYu0HlNlckxyaDnyoSlrnUyizVRaLs= X-Google-Smtp-Source: AGHT+IGZKmvxNVMzMR1/cDVyYE1jnjsAKt5pFh4eDQmFv+FGb598OxvFvjW3keiaZuIQvb7px6yDTA== X-Received: by 2002:a05:6a21:9997:b0:1c2:92ad:3331 with SMTP id adf61e73a8af0-1c2980f943dmr24235367637.2.1721021165862; Sun, 14 Jul 2024 22:26:05 -0700 (PDT) From: Akihiko Odaki Date: Mon, 15 Jul 2024 14:25:42 +0900 Subject: [PATCH v3 1/4] ui/cocoa: Release CGColorSpace MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240715-cursor-v3-1-afa5b9492dbf@daynix.com> References: <20240715-cursor-v3-0-afa5b9492dbf@daynix.com> In-Reply-To: <20240715-cursor-v3-0-afa5b9492dbf@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::532; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x532.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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1721021221355116300 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 Tested-by: Phil Dennis-Jordan Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 Sat Dec 28 09:59:23 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1721021244; cv=none; d=zohomail.com; s=zohoarc; b=QAbtXhIW3x++G9SdALcBFd5iuHKCEHBMFJVoGickxBjbhSDY7/kcC/5K2SDqgKsckwEJllwty9cdT+KP6v7UYR3IsQLbiXzj9iAoQMQAK54GaahVAULEa+YMuyf0S6o7OSu8GYfPkt2HLEKnmaOwIgJpwhgShFFgGBygtRimgvc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721021244; 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=eynKNkc/q/6cUVvIvz9V6xDySPK0lqiqrd2y5gmcTLs=; b=dVdec+ORHmCNSQAwbCZ49smVhmVhtB0ZPtKYCf381WlZ/ndHoXDLjCXlqlK61va7bz1NYxqbvrZ4BkTqz8uiHN5huFiVkSkgoTX9TBIcLA/UG8r9q4bjhmIpR91cdvTQXW7DNvwShCetcXQ67LuQOWBfD5S2d4xtnoqg5IBGZtw= 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+importer2=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 1721021244863834.4031917620894; Sun, 14 Jul 2024 22:27:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTEE4-00026D-34; Mon, 15 Jul 2024 01:26:16 -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 1sTEE1-0001vx-Ab for qemu-devel@nongnu.org; Mon, 15 Jul 2024 01:26:14 -0400 Received: from mail-oi1-x229.google.com ([2607:f8b0:4864:20::229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTEDz-0000fa-G8 for qemu-devel@nongnu.org; Mon, 15 Jul 2024 01:26:13 -0400 Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-3dab3b85623so965203b6e.2 for ; Sun, 14 Jul 2024 22:26:11 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id 41be03b00d2f7-78e34864b3esm2682982a12.42.2024.07.14.22.26.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 14 Jul 2024 22:26:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1721021170; x=1721625970; 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=eynKNkc/q/6cUVvIvz9V6xDySPK0lqiqrd2y5gmcTLs=; b=CwAfsYf/9HqQJ67/5oYMtjtUpQIKKq2KMr+CbQZ/DdTNym8CBeq7wengqq6Phvj8Hb xhXu+GWNH+XXvmD1iZQvA5SZEZ5j2AX7kRx1/wJHFHZFonUr5D/hqKNYg0yYFOOCtI7y UsPaqf8N1cZ3gm48TVjo0r0uNRryuxqX4ThZby8z4V/Ga6niI8+N2mXlN00U854fKhnp qfKnLcspPMFTtvClpQoJ0kyAzWNHh89qAmv+Y3Q9atXkNI3Ud5LNKyg+/myg89nfdS0o hrlYMkIY7LGLAx5cIJeUicJJ4KCM7O64x6lWyPXLDW4gd/v6fUIyyfYjITKa1Vvmmn7g Y+bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721021170; x=1721625970; 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=eynKNkc/q/6cUVvIvz9V6xDySPK0lqiqrd2y5gmcTLs=; b=RVc5YensdYoXATktIwkY6cCUOtLcLNI/PnQau8IEVsZE+zcT3PqZKaZaZhM3Q3F7Y3 DsX9+dnPeZ3jd+whL8xkH7JiiN+M9HPEMkPYmxgqqetbkLadbRtUrJfoJV4EzTrI9P+e FU5LsAyq8072SHR76PdW8X8BBByNjKtNIVagXLvJ+EmZyh5fx5FyMLvJKb3jYJaAsqv6 tYbs5Zjk/DdCLybOmZkwKhVbRXtGTY0DIpsrWBuR71H7jcUzE0nObPkbX0CH3Km5/73I lRmh5/VaJzFKqRi3NxhaJeK76a6nOSVuFXaJ97IlX7htseEWspWsm77N6f6XHJITMWOP itlQ== X-Gm-Message-State: AOJu0YzkPmPtwg7kZ/23dakYd7Sjh7wC+DMPgQHAyxazprs6eOYlDf5F oxyoHdriaCY+qJVETnRv0sH0jupPONbyXJHXY86ClmSVeT3Y27b+Qyg6fdr2xl0= X-Google-Smtp-Source: AGHT+IELWKKMOQjG9sJiQZ+X8XveJoxLWPg34gKUuERTzYog4xi9QzXYkFjGTr1+gNvRI9VjNu8ZPg== X-Received: by 2002:a05:6808:1306:b0:3d9:324a:3db with SMTP id 5614622812f47-3d93bdd181bmr22802771b6e.6.1721021170212; Sun, 14 Jul 2024 22:26:10 -0700 (PDT) From: Akihiko Odaki Date: Mon, 15 Jul 2024 14:25:43 +0900 Subject: [PATCH v3 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: <20240715-cursor-v3-2-afa5b9492dbf@daynix.com> References: <20240715-cursor-v3-0-afa5b9492dbf@daynix.com> In-Reply-To: <20240715-cursor-v3-0-afa5b9492dbf@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::229; envelope-from=akihiko.odaki@daynix.com; helo=mail-oi1-x229.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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1721021245346116300 Reviewed-by: Marc-Andr=C3=A9 Lureau Tested-by: Phil Dennis-Jordan Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 Sat Dec 28 09:59:23 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1721021209; cv=none; d=zohomail.com; s=zohoarc; b=JUf8jpGjMkAdq38PjCFXP1xYOk7GJiXpqO/ourcDIEKX+feNXFC6LjjXQneZBqA8b0EHb8Pw58uEtt/SRbKPdKApE8sjVM2LjWvBwNWL2SUgpsigleZTsciXvvOTzGqMCCNYRSm1xU13Bs+HZWvc6L0J0mlbFTZNpsNtO9k9iug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721021209; 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=HyblI6J8nHcgpLCqw/BWLjpJpAxCOF36i19GG8sv7lM=; b=QPLFO8/RAKc5ZATmVjdGynx2F5Yr9gfZEF68yOuHa1SFKHiUP5BrVkxkCSi6SK8qruS3TAGWzLCsC7M5ZPqpAQ+L9epM0hOziX+7cgWKfJ9bQLvhxVEGUQuqtREjl0zBxUea1klncMo57mx8syqX+ngm0mzD6M6Jv9m756ov/sc= 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+importer2=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 1721021209663487.4682693826353; Sun, 14 Jul 2024 22:26:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTEEB-0002WT-0C; Mon, 15 Jul 2024 01:26:23 -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 1sTEE9-0002Sj-Vq for qemu-devel@nongnu.org; Mon, 15 Jul 2024 01:26:21 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTEE3-0000fu-M4 for qemu-devel@nongnu.org; Mon, 15 Jul 2024 01:26:21 -0400 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1fb1ff21748so23037695ad.3 for ; Sun, 14 Jul 2024 22:26:15 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-1fc0bb6fe47sm31660865ad.49.2024.07.14.22.26.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 14 Jul 2024 22:26:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1721021174; x=1721625974; 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=HyblI6J8nHcgpLCqw/BWLjpJpAxCOF36i19GG8sv7lM=; b=sqJg/Uq3v1Mtj5llX7QXC1CPbza4NoAaTVQrxr9cBjfnGg+6ESYfcdJCzFy9BFfRta He0qVFkDPxCab8wBRQvzkh/pkRDbOI0NDsrQKNzQXbL+cS/BZtBVOMH9mHI65mrH0Knc obaf8CUtIhk73jurQ7+GwlZcAhlbahl1AhDDIPCozr55KNUUT1DC9bo8dJwk0n4gQmxv ybW5F3GW9B7jkkQZ/y0CTKctGMhHF4QNIHQH7T6LY1A5fxdKzOnoHBN6oZN15ChNHvjz s9LMVeLEAwpU9Dk853M7UmvLtY2c33bXATDBy5/C77S/byiyGMmhy0wxKs/1TWYzSRaw tDhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721021174; x=1721625974; 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=HyblI6J8nHcgpLCqw/BWLjpJpAxCOF36i19GG8sv7lM=; b=n9CR1mdvrp+hwhG47+jJdIdea/Bch13yVW4p71hCrz323lS7jUQJt2fhPt52Km5ATs 8aSNTBkO/38pUtYVaHTXDCcOA2bXkkj+xzLEEotqy+VBTtg3+d9oOuhF3QUsRnz/hDNX oHAOydfFbHFySB2rZAEbT4Ad5s5h9HsXZCdl52kDQ19Z6vJibf78jcA4ZjrA2MPt/UUK seRIaHG3Cd5EKWqtG+Fp7MqNjp4EXErVfVIyV9+lla4+HMfhQsY/YUNpHg8JywVT1NIj cOOtcXnZys+YZExNMsytIBEVtETJA2H3qLJsnxNOMEQiFml/rBjsYZe32OStGUR7bXqu u4ag== X-Gm-Message-State: AOJu0YwWfYfCnASUjN7/6QGbTDOqlGLl7dwoOR882BGAPxEH4ftn3V+E R0DLJlZE5tXzVDRVz5W3ub0nMN7YTJdw54qErYGNAJg4+pv2KRw0QKAdT/nJXTc= X-Google-Smtp-Source: AGHT+IHDkdivwGRLEIBJutOl4xE56xLlI1/bXDCfZ5YEIxvWpoUnO5VUijOS61umFJtNDdpAN0DhOw== X-Received: by 2002:a17:902:760f:b0:1fb:3474:9525 with SMTP id d9443c01a7336-1fbb6d4dc4cmr76802695ad.29.1721021174306; Sun, 14 Jul 2024 22:26:14 -0700 (PDT) From: Akihiko Odaki Date: Mon, 15 Jul 2024 14:25:44 +0900 Subject: [PATCH v3 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: <20240715-cursor-v3-3-afa5b9492dbf@daynix.com> References: <20240715-cursor-v3-0-afa5b9492dbf@daynix.com> In-Reply-To: <20240715-cursor-v3-0-afa5b9492dbf@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::62a; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x62a.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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1721021211350116300 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 Tested-by: Phil Dennis-Jordan Signed-off-by: Akihiko Odaki --- 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..0f52cf0de934 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, bool= 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 Sat Dec 28 09:59:23 2024 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1721021228; cv=none; d=zohomail.com; s=zohoarc; b=JercmzL5PDAoWCYndkCuBmaz+lLHth/KTchEt9yt0QC5GlhTzMjhb4M8nYcjJwINN9GjJRz+1+H/GQVluaQ9Ac0F3R494HMkAZthfps8yzibfzOtyZag6pCiQ8/rec+Bjl+Rxwaj7ec3sAp3Qi8y4YFME2R1RHYF22ZP81xRqOc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721021228; 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=A5DQvwhNUSdfuiyr6xdA4cBcty39lESgP6o5nYgfKFY=; b=SiUZidTULHahQL49t8TWlCD2yGHUdyBhjDoMCP2ZHpNN7iZz640FD8lEu6tp62HqA1MNGl7vtFuQIvbwxOmjpq02SreJgdMWOp/LEyrp2XFY2nA64vdmg0sP1zLQpbT/Cf1zkFO1aVny5t+VcQS6Elr9s1TZh6u4HBLBFviTg+U= 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+importer2=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 1721021228522527.2525763123905; Sun, 14 Jul 2024 22:27:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTEEO-0003Wz-6m; Mon, 15 Jul 2024 01:26:36 -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 1sTEEM-0003MN-2K for qemu-devel@nongnu.org; Mon, 15 Jul 2024 01:26:34 -0400 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sTEE8-0000gA-Hx for qemu-devel@nongnu.org; Mon, 15 Jul 2024 01:26:33 -0400 Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-78cc22902dcso731858a12.0 for ; Sun, 14 Jul 2024 22:26:20 -0700 (PDT) Received: from localhost ([157.82.204.135]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-2caedcac045sm3370440a91.57.2024.07.14.22.26.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 14 Jul 2024 22:26:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1721021179; x=1721625979; 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=A5DQvwhNUSdfuiyr6xdA4cBcty39lESgP6o5nYgfKFY=; b=jzA9XsY45Lav5cpWrR8OB1v5DY8cEjsFMSvX//hRdRHg8qLI637+f7yAyDKYRz1VSX zhiZREyMQOvM/yDoiQDIs3vdTOrDX4TK/klXHYowVuj9qdfoUqLvp9Ts0I1C918aARFU bN+yQTUKAN/2LXLHc1Y6adQHS5L99Ybw2q79pN+YKKoPA0Klx1wcVqP9bddiqllRWFEe F8xU8bFeuP+128zQ4U3CrpY2peSfLfgHj19sTtA6mY41pm4ZZ1FI2cFH06jj6IEiVNxV gKw6MtxbXNy8RxHyE35UCLeXiAwcINVBydJZNEqvGEmpqm6yZpKP5y/vNN1hgxr1mRFl KeLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721021179; x=1721625979; 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=A5DQvwhNUSdfuiyr6xdA4cBcty39lESgP6o5nYgfKFY=; b=uHf8Mgsqy34yLv02qW0KP2gcR1ujgTrMBOHZNOKA94FB/NKHg++bekKkTyqm6DEFpW zIOqcY1NEHGyleBPCT16Ms3Snzsf+tUh6aoPQnJT+h3BxO6pzRnNBK21ZTra4UvbzNI4 3a5tQw8HxKQyw5T0MetNEQdrWbJzZsb1D5jjiB4FkD3TmeFi3v/bN9QthkkelKFG8eme C/E1mXGD6MMdeZ6655SHMF6LjIiPbekTCmTimirnF43rxIis0FcsGzBBi+UykneiAswW Wn9xKQLAT9r3FwETbNKNq/wHBVQlPTFLMhWcOCF8A/2douOlpu9lWnp7238QZFDeIZtu k32A== X-Gm-Message-State: AOJu0Yxm33bnw4CLmudo6JytlPlTtwj/EhISrryCS5hS+z7Xvqd0/3yB c06kLt4tM/r1AghE7iaME/gwLjtNfzHEh5y/PowSRUsSCJBCJahnLlLu1ocgW4hELfUc/eLGVdU sFw8= X-Google-Smtp-Source: AGHT+IG6ZTJyiWSpAJyCixANZSAj85vvDwMcslX2xfCRjN5x4MOMWqxorowMIRKWniFs7t2fkNIKtQ== X-Received: by 2002:a05:6a20:4328:b0:1c3:3436:a225 with SMTP id adf61e73a8af0-1c33436aef4mr14010262637.21.1721021179097; Sun, 14 Jul 2024 22:26:19 -0700 (PDT) From: Akihiko Odaki Date: Mon, 15 Jul 2024 14:25:45 +0900 Subject: [PATCH v3 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: <20240715-cursor-v3-4-afa5b9492dbf@daynix.com> References: <20240715-cursor-v3-0-afa5b9492dbf@daynix.com> In-Reply-To: <20240715-cursor-v3-0-afa5b9492dbf@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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: none client-ip=2607:f8b0:4864:20::52e; envelope-from=akihiko.odaki@daynix.com; helo=mail-pg1-x52e.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, 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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1721021229215116300 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. Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Phil Dennis-Jordan Signed-off-by: Akihiko Odaki --- 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