From patchwork Thu Jun 2 15:42:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zack Rusin X-Patchwork-Id: 12867976 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 35A6BCCA478 for ; Thu, 2 Jun 2022 15:43:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 68845112FF5; Thu, 2 Jun 2022 15:43:04 +0000 (UTC) Received: from letterbox.kde.org (letterbox.kde.org [46.43.1.242]) by gabe.freedesktop.org (Postfix) with ESMTPS id EF606112FEF for ; Thu, 2 Jun 2022 15:43:01 +0000 (UTC) Received: from vertex.vmware.com (pool-108-36-85-85.phlapa.fios.verizon.net [108.36.85.85]) (Authenticated sender: zack) by letterbox.kde.org (Postfix) with ESMTPSA id DD0C0335F74; Thu, 2 Jun 2022 16:42:59 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kde.org; s=users; t=1654184580; bh=aNgM1bG6gCYOguM+hclLWxnZEtUIWi3csatRAcJHk0o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mbIq/2kuW9Ub7uwGeC1bZvG9o/yLdeC46um51EhFApSbrtUV04GdA3TiJLl3Cs4g3 ePIjHdRT0U3I3bsp9onL8taoe6N2wWjWSJUwaBZKcY2M1nBzvlztn3lFDt+a1arXN5 ygXvtRfMjWlGpSmiFpgzli9xnJ622PKisRFpkbDQ9OyPNNUBGdFo0gL969nigTSWei Yeejz0aUN1sGKj38K1TMFhaJHnzaiq0h0iZUwhVbmifaJdMpFRhj2d3Ji5IlltKZPf 7eR658sd/n3/GMF5o1ZtrrKzDYbRAiz3t+ulY9UcYO5h3pTP47Z8Ulh7Kon9qwXJf1 OxzhbbWt5913Q== From: Zack Rusin To: dri-devel@lists.freedesktop.org Subject: [PATCH 5/6] drm/virtio: Create mouse hotspot properties on cursor planes Date: Thu, 2 Jun 2022 11:42:42 -0400 Message-Id: <20220602154243.1015688-6-zack@kde.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602154243.1015688-1-zack@kde.org> References: <20220602154243.1015688-1-zack@kde.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Zack Rusin Cc: David Airlie , Gurchetan Singh , krastevm@vmware.com, mombasawalam@vmware.com, virtualization@lists.linux-foundation.org, Gerd Hoffmann Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Zack Rusin Atomic modesetting got support for mouse hotspots via the hotspot properties. Drivers need to create those properties on cursor planes which require the mouse hotspot coordinates. Add the code creating hotspot properties and port away from old legacy hotspot API. The legacy hotspot paths have an implementation that works with new atomic properties so there's no reason to keep them and it makes sense to unify both paths. Signed-off-by: Zack Rusin Cc: David Airlie Cc: Gerd Hoffmann Cc: Gurchetan Singh Cc: Chia-I Wu Cc: Daniel Vetter Cc: virtualization@lists.linux-foundation.org --- drivers/gpu/drm/virtio/virtgpu_display.c | 1 + drivers/gpu/drm/virtio/virtgpu_plane.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index f73352e7b832..848ac2314399 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -288,6 +288,7 @@ static int vgdev_output_init(struct virtio_gpu_device *vgdev, int index) drm_connector_attach_encoder(connector, encoder); drm_connector_register(connector); + drm_plane_create_hotspot_properties(cursor); return 0; } diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index 6d3cc9e238a4..21c8adf51c6c 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -331,16 +331,16 @@ static void virtio_gpu_cursor_plane_update(struct drm_plane *plane, DRM_DEBUG("update, handle %d, pos +%d+%d, hot %d,%d\n", handle, plane->state->crtc_x, plane->state->crtc_y, - plane->state->fb ? plane->state->fb->hot_x : 0, - plane->state->fb ? plane->state->fb->hot_y : 0); + plane->state->hotspot_x, + plane->state->hotspot_y); output->cursor.hdr.type = cpu_to_le32(VIRTIO_GPU_CMD_UPDATE_CURSOR); output->cursor.resource_id = cpu_to_le32(handle); if (plane->state->fb) { output->cursor.hot_x = - cpu_to_le32(plane->state->fb->hot_x); + cpu_to_le32(plane->state->hotspot_x); output->cursor.hot_y = - cpu_to_le32(plane->state->fb->hot_y); + cpu_to_le32(plane->state->hotspot_y); } else { output->cursor.hot_x = cpu_to_le32(0); output->cursor.hot_y = cpu_to_le32(0);