Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1063415rda; Mon, 23 Oct 2023 00:48:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFDvUQ1GHOtZDw6SYEfehgfcwSe6nBW4aiHZDzb952ejFZojDKCorx1CvrwjIaDOs34+RhD X-Received: by 2002:a05:6359:28c5:b0:168:cf01:8232 with SMTP id qb5-20020a05635928c500b00168cf018232mr3975241rwb.9.1698047300335; Mon, 23 Oct 2023 00:48:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698047300; cv=none; d=google.com; s=arc-20160816; b=g0dqH7OVhXo8zgfvFQWnZgD3i8ajgi+g9rOJDjt5RJBZuNaKFHWA07QzCu/TOAVUuw bHeaDnHW/zYMIuxHcTp7fWoA2lG9Zas0QNp3jMZ5Z8pvb6a5v/qcL02J6546zqIplfvE 69EQCYY6eU7U0gaiOup5FeqTRo0Qsk/xk2bvrhsHrC7/Fk9PyNbPj141ACzytBEFb8Fa ifv109eTNPF1Np85xxTY0/oMK+huborKL9AppyWy6coLBhPlezbJFYQ5L1UnZdsVaj8d oGomiwWjiDw1uQomwQ6BV3mNZ0gXB3ilLoq0I8aWasl7SWfKM423+m6yXylbSUhL76VS DBDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qp0oGK3lMNWuN3geomtCKP1LRI8ilfYyc8y7jbzL1zY=; fh=Zi3KALqOO771BHK3b7i1vQIVvcTwzItcVOLgWHFKwXc=; b=BflWeZ6bxZFpqWkaJ1StMuPirXRfxByuu/jtXMup59GrlS1E96pfRMY05bW0tHaYQt yV8hXWMkgWx9SADdVsL6Px2GmKSdkr2Bp9VEMD8rX0gv5LVoSuICg+0pROWPWwAYTnn9 TbsAr+tIkNIoSXB0/SneGSqHLjOw/17pQS2TgcZvLOhFm3NijEojsCWBk46C+m3FMhxh V8c6UNHSEgVpfP4fcOVwy+bNl3Alascr4DwD+Qa5UwtqFmNm0y0liu7DQf42pUvrVly6 HO0H53HD/SNhZ5wOEodaGI0ei5YUfslOyFv6H+8Zs7pOOKxSDvgADOHzLSqDC7KzaM6U ISGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZWvn8p5d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id m29-20020a637d5d000000b005ab85a6c6besi5944406pgn.742.2023.10.23.00.48.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 00:48:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZWvn8p5d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4C3D0804C559; Mon, 23 Oct 2023 00:48:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233614AbjJWHsL (ORCPT + 99 others); Mon, 23 Oct 2023 03:48:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233608AbjJWHr4 (ORCPT ); Mon, 23 Oct 2023 03:47:56 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65FBFCC for ; Mon, 23 Oct 2023 00:47:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698047228; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qp0oGK3lMNWuN3geomtCKP1LRI8ilfYyc8y7jbzL1zY=; b=ZWvn8p5dlBRNbpOLgUH6Bz18ieJjHK2a5aPbL0IQT003O3mGv+6iS+CfBCQbX+QSFsEpwb szIvozpxACjqksGOSlY3+Bw+oGYxYHrf8AYYX+ewmDQDQFby4XjX/b6DnIhmvhegC2ytvg WrpX6QNDMXevlyzl2R7m3TkvTvuUWw8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-411-MG867VYgP8uVpqpvvUM4LA-1; Mon, 23 Oct 2023 03:47:03 -0400 X-MC-Unique: MG867VYgP8uVpqpvvUM4LA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9642B88B770; Mon, 23 Oct 2023 07:47:01 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.225.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9EAC6503B; Mon, 23 Oct 2023 07:46:56 +0000 (UTC) From: Albert Esteve To: qemu-devel@nongnu.org Cc: zackr@vmware.com, contact@emersion.fr, linux-doc@vger.kernel.org, dri-devel@lists.freedesktop.org, Maxime Ripard , iforbes@vmware.com, Maarten Lankhorst , Chia-I Wu , Thomas Zimmermann , Hans de Goede , Matt Roper , David Airlie , banackm@vmware.com, Rob Clark , javierm@redhat.com, krastevm@vmware.com, spice-devel@lists.freedesktop.org, Gurchetan Singh , Jonathan Corbet , David Airlie , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, mombasawalam@vmware.com, Daniel Vetter , ppaalanen@gmail.com, VMware Graphics Reviewers , Gerd Hoffmann , David Airlie , Pekka Paalanen Subject: [PATCH v6 8/9] drm: Introduce DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT Date: Mon, 23 Oct 2023 09:46:12 +0200 Message-ID: <20231023074613.41327-9-aesteve@redhat.com> In-Reply-To: <20231023074613.41327-1-aesteve@redhat.com> References: <20231023074613.41327-1-aesteve@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 23 Oct 2023 00:48:19 -0700 (PDT) From: Zack Rusin Virtualized drivers place additional restrictions on the cursor plane which breaks the contract of universal planes. To allow atomic modesettings with virtualized drivers the clients need to advertise that they're capable of dealing with those extra restrictions. To do that introduce DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT which lets DRM know that the client is aware of and capable of dealing with the extra restrictions on the virtual cursor plane. Setting this option to true makes DRM expose the cursor plane on virtualized drivers. The userspace is expected to set the hotspots and handle mouse events on that plane. Signed-off-by: Zack Rusin Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Acked-by: Pekka Paalanen Reviewed-by: Javier Martinez Canillas --- drivers/gpu/drm/drm_ioctl.c | 9 +++++++++ include/uapi/drm/drm.h | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index f03ffbacfe9b4..e535b58521533 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -361,6 +361,15 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv) return -EINVAL; file_priv->writeback_connectors = req->value; break; + case DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT: + if (!drm_core_check_feature(dev, DRIVER_CURSOR_HOTSPOT)) + return -EOPNOTSUPP; + if (!file_priv->atomic) + return -EINVAL; + if (req->value > 1) + return -EINVAL; + file_priv->supports_virtualized_cursor_plane = req->value; + break; default: return -EINVAL; } diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 794c1d857677d..fc0c267f3f3ed 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -842,6 +842,31 @@ struct drm_get_cap { */ #define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 5 +/** + * DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT + * + * Drivers for para-virtualized hardware (e.g. vmwgfx, qxl, virtio and + * virtualbox) have additional restrictions for cursor planes (thus + * making cursor planes on those drivers not truly universal,) e.g. + * they need cursor planes to act like one would expect from a mouse + * cursor and have correctly set hotspot properties. + * If this client cap is not set the DRM core will hide cursor plane on + * those virtualized drivers because not setting it implies that the + * client is not capable of dealing with those extra restictions. + * Clients which do set cursor hotspot and treat the cursor plane + * like a mouse cursor should set this property. + * The client must enable &DRM_CLIENT_CAP_ATOMIC first. + * + * Setting this property on drivers which do not special case + * cursor planes (i.e. non-virtualized drivers) will return + * EOPNOTSUPP, which can be used by userspace to gauge + * requirements of the hardware/drivers they're running on. + * + * This capability is always supported for atomic-capable virtualized + * drivers starting from kernel version 6.6. + */ +#define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6 + /* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ struct drm_set_client_cap { __u64 capability; -- 2.41.0