From patchwork Thu Jun 2 15:42:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zack Rusin X-Patchwork-Id: 12867975 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 3A6CCC43334 for ; Thu, 2 Jun 2022 15:43:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 176E1112FF4; Thu, 2 Jun 2022 15:43:02 +0000 (UTC) Received: from letterbox.kde.org (letterbox.kde.org [46.43.1.242]) by gabe.freedesktop.org (Postfix) with ESMTPS id D97F7112FEE; Thu, 2 Jun 2022 15:42:59 +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 D6490335FF4; Thu, 2 Jun 2022 16:42:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kde.org; s=users; t=1654184578; bh=/2nOGYCqYZn6MDWS8jS8EFfA23N2p+fn+QlogboYpGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O1dRAS4x1uCt2dvb5s5Raft8p5+7kZi48REZDM+7mccQLroVLl10bycdSF3ctx4rf NBNcm8Wq8hWcUgQ+80dq4yn1g/U7GJq3voGRhyX3RqVpmanPcqqihbbc977RYW14A4 n8h/YeabBcWZTXPcIDO90anOenjBFcT0ecFGQZ1xONi5EjBM+2PlvavhoEG2I65ORw 8zRZGaFVpCD96AyI3stKswLFrzIuXJXtmvQ8QnxelXROzAN7JsOYAtoMqoSIrxLdW5 Byyf6Tsio0RPT/MD+zLQlNp9e4fl8E0ahWZLXY7a6wd9Nq9cQ0HvNrgRYRiEpkhQSn JTnh8FvX1D7ag== From: Zack Rusin To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/6] drm/qxl: Create mouse hotspot properties on cursor planes Date: Thu, 2 Jun 2022 11:42:40 -0400 Message-Id: <20220602154243.1015688-4-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: mombasawalam@vmware.com, virtualization@lists.linux-foundation.org, krastevm@vmware.com, Gerd Hoffmann , spice-devel@lists.freedesktop.org, Dave Airlie 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: Dave Airlie Cc: Gerd Hoffmann Cc: Daniel Vetter Cc: virtualization@lists.linux-foundation.org Cc: spice-devel@lists.freedesktop.org Reported-by: kernel test robot Reported-by: kernel test robot --- drivers/gpu/drm/qxl/qxl_display.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c index 9a64fa4c7530..4b578f9960cd 100644 --- a/drivers/gpu/drm/qxl/qxl_display.c +++ b/drivers/gpu/drm/qxl/qxl_display.c @@ -508,8 +508,8 @@ static int qxl_primary_apply_cursor(struct qxl_device *qdev, cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release); cmd->type = QXL_CURSOR_SET; - cmd->u.set.position.x = plane_state->crtc_x + fb->hot_x; - cmd->u.set.position.y = plane_state->crtc_y + fb->hot_y; + cmd->u.set.position.x = plane_state->crtc_x + plane_state->hotspot_x; + cmd->u.set.position.y = plane_state->crtc_y + plane_state->hotspot_y; cmd->u.set.shape = qxl_bo_physical_address(qdev, qcrtc->cursor_bo, 0); @@ -552,8 +552,8 @@ static int qxl_primary_move_cursor(struct qxl_device *qdev, cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release); cmd->type = QXL_CURSOR_MOVE; - cmd->u.position.x = plane_state->crtc_x + fb->hot_x; - cmd->u.position.y = plane_state->crtc_y + fb->hot_y; + cmd->u.position.x = plane_state->crtc_x + plane_state->hotspot_x; + cmd->u.position.y = plane_state->crtc_y + plane_state->hotspot_y; qxl_release_unmap(qdev, release, &cmd->release_info); qxl_release_fence_buffer_objects(release); @@ -849,8 +849,8 @@ static int qxl_plane_prepare_fb(struct drm_plane *plane, struct qxl_bo *old_cursor_bo = qcrtc->cursor_bo; qcrtc->cursor_bo = qxl_create_cursor(qdev, user_bo, - new_state->fb->hot_x, - new_state->fb->hot_y); + new_state->hotspot_x, + new_state->hotspot_y); qxl_free_cursor(old_cursor_bo); } @@ -1002,6 +1002,7 @@ static int qdev_crtc_init(struct drm_device *dev, int crtc_id) qxl_crtc->index = crtc_id; drm_crtc_helper_add(&qxl_crtc->base, &qxl_crtc_helper_funcs); + drm_plane_create_hotspot_properties(cursor); return 0; clean_cursor: