Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1063430rda; Mon, 23 Oct 2023 00:48:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGu4kPrpdC5KeDcn13WCuVmU/h6yia7yQoe5Q7uiUnrTzfJ1N+m/5rd8MJxYDpciZLUnyTK X-Received: by 2002:a05:6a20:7d8c:b0:17e:4f56:ebe3 with SMTP id v12-20020a056a207d8c00b0017e4f56ebe3mr1630567pzj.10.1698047303713; Mon, 23 Oct 2023 00:48:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698047303; cv=none; d=google.com; s=arc-20160816; b=T94hKBxG2Iw7MZeasqD+2uhLOweG8AqzSZRZv8Q8E6nIaKHMiJn7BizGGXLZQC1Wnx M7IeEbYZvfp76LOWrHY2a/lSryh7pJXLzdSvm4soMg8FLKfcwAZTCaZ+Gm941T4ekRXV BKfMr0VaCm9CuE5zURIeBjDq0PewVE9SK0lOQt/Hu3GpVjOyCe9V61Sf2o5pSSFUcrLq SNbzDC1ZK0VZ04bqTZzMYUNjDXvwLp7aYrGzF8OTDjb/XtvrasL/R0tFE/HqLfnxEeBa jIyLmiDJBz5GpMS0EOa5g5cGXsen0fBPkuqX9ol9OKqGTawjHajxdMCyMnkRgmP8O9RH SLqg== 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=E/xZBjexym1u5u7aqp8YN9N1r+zl4sR8DvaJhc8d5/Q=; fh=iOXPein6KwI+xNW54ixGY+J1K3GvRcpk6m8klmMMdY0=; b=S4S4jD8QlqF4RO3aCPXz1Bhdud9BmwNSfLRbF3HmKX4TmTq5CtAlsI27a7bpsDLR4c k2wR7LmZgJZbHpOJw/nrUjqSErZuhN+84fsqKSCojdGUWy1GiJFE6Bm5FLAX2GqgI3i0 +2Zj6keNZnVhxFfpSbJTkTIO6U/agRWMQQhNhHYbIQ7g5Kf7WA1PlRaovpKkIk77LGaZ J9qSESfkNRPQ4XGV+A870ybUZls7Oq4NdRoFdYuXSLAgk0NCOQ5jtCsra8+J6DqPluT4 qafId1eztM3cHg+Hc+KaPz4jv7Hl++u3fDk2EPI3yfp9QL8VuMl9el0UcpKw/4nLe8JS BNzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aJoOS+e1; 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 s3-20020a656443000000b00588fdd9504bsi6044834pgv.858.2023.10.23.00.48.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 00:48:23 -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=aJoOS+e1; 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 1103D80ACB7D; Mon, 23 Oct 2023 00:48:22 -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 S233634AbjJWHsT (ORCPT + 99 others); Mon, 23 Oct 2023 03:48:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233631AbjJWHsB (ORCPT ); Mon, 23 Oct 2023 03:48:01 -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 400E1D7B for ; Mon, 23 Oct 2023 00:47:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698047233; 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=E/xZBjexym1u5u7aqp8YN9N1r+zl4sR8DvaJhc8d5/Q=; b=aJoOS+e1aEDJz6F06+AiUUf5CeBQq89JkvsR4Fr71GxU4uPej+smSWSzT1F4N3Wjxd28J9 xl9OPfGBVlPewlCuxeivG1gqhrlJ8zzXL//1l14CDkjzw3PaJ3+udPRuOdOBWbpMz3BhBR frNmXq0Fse4DO4MkMV8Ts2mjoRZhVhE= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-107-bTJwXCK1NS-XcT0GMFLIfQ-1; Mon, 23 Oct 2023 03:47:07 -0400 X-MC-Unique: bTJwXCK1NS-XcT0GMFLIfQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 84BC21C06E28; Mon, 23 Oct 2023 07:47:06 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.225.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE89817312; Mon, 23 Oct 2023 07:47:01 +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 Subject: [PATCH v6 9/9] drm: Introduce documentation for hotspot properties Date: Mon, 23 Oct 2023 09:46:13 +0200 Message-ID: <20231023074613.41327-10-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=ham 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:22 -0700 (PDT) From: Michael Banack To clarify the intent and reasoning behind the hotspot properties introduce userspace documentation that goes over cursor handling in para-virtualized environments. The documentation is generic enough to not special case for any specific hypervisor and should apply equally to all. Signed-off-by: Zack Rusin --- Documentation/gpu/drm-kms.rst | 6 ++++ drivers/gpu/drm/drm_plane.c | 58 ++++++++++++++++++++++++++++++++++- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/Documentation/gpu/drm-kms.rst b/Documentation/gpu/drm-kms.rst index a0c83fc481264..158cdcc9351f9 100644 --- a/Documentation/gpu/drm-kms.rst +++ b/Documentation/gpu/drm-kms.rst @@ -577,6 +577,12 @@ Variable Refresh Properties .. kernel-doc:: drivers/gpu/drm/drm_connector.c :doc: Variable refresh properties +Cursor Hotspot Properties +--------------------------- + +.. kernel-doc:: drivers/gpu/drm/drm_plane.c + :doc: hotspot properties + Existing KMS Properties ----------------------- diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 1dc00ad4c33c3..f3f2eae83cca8 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -230,6 +230,61 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane return 0; } +/** + * DOC: hotspot properties + * + * HOTSPOT_X: property to set mouse hotspot x offset. + * HOTSPOT_Y: property to set mouse hotspot y offset. + * + * When the plane is being used as a cursor image to display a mouse pointer, + * the "hotspot" is the offset within the cursor image where mouse events + * are expected to go. + * + * Positive values move the hotspot from the top-left corner of the cursor + * plane towards the right and bottom. + * + * Most display drivers do not need this information because the + * hotspot is not actually connected to anything visible on screen. + * However, this is necessary for display drivers like the para-virtualized + * drivers (eg qxl, vbox, virtio, vmwgfx), that are attached to a user console + * with a mouse pointer. Since these consoles are often being remoted over a + * network, they would otherwise have to wait to display the pointer movement to + * the user until a full network round-trip has occurred. New mouse events have + * to be sent from the user's console, over the network to the virtual input + * devices, forwarded to the desktop for processing, and then the cursor plane's + * position can be updated and sent back to the user's console over the network. + * Instead, with the hotspot information, the console can anticipate the new + * location, and draw the mouse cursor there before the confirmation comes in. + * To do that correctly, the user's console must be able predict how the + * desktop will process mouse events, which normally requires the desktop's + * mouse topology information, ie where each CRTC sits in the mouse coordinate + * space. This is typically sent to the para-virtualized drivers using some + * driver-specific method, and the driver then forwards it to the console by + * way of the virtual display device or hypervisor. + * + * The assumption is generally made that there is only one cursor plane being + * used this way at a time, and that the desktop is feeding all mouse devices + * into the same global pointer. Para-virtualized drivers that require this + * should only be exposing a single cursor plane, or find some other way + * to coordinate with a userspace desktop that supports multiple pointers. + * If the hotspot properties are set, the cursor plane is therefore assumed to be + * used only for displaying a mouse cursor image, and the position of the combined + * cursor plane + offset can therefore be used for coordinating with input from a + * mouse device. + * + * The cursor will then be drawn either at the location of the plane in the CRTC + * console, or as a free-floating cursor plane on the user's console + * corresponding to their desktop mouse position. + * + * DRM clients which would like to work correctly on drivers which expose + * hotspot properties should advertise DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT. + * Setting this property on drivers which do not special case + * cursor planes will return EOPNOTSUPP, which can be used by userspace to + * gauge requirements of the hardware/drivers they're running on. Advertising + * DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT implies that the userspace client will be + * correctly setting the hotspot properties. + */ + /** * drm_plane_create_hotspot_properties - creates the mouse hotspot * properties and attaches them to the given cursor plane @@ -237,7 +292,8 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane * @plane: drm cursor plane * * This function enables the mouse hotspot property on a given - * cursor plane. + * cursor plane. Look at the documentation for hotspot properties + * to get a better understanding for what they're used for. * * RETURNS: * Zero for success or -errno -- 2.41.0