RE: [PATCH] drm/hyperv: Fix double mouse pointers
From: Haiyang Zhang <haiyangz@microsoft.com>
Date: 2021-09-14 16:05:58
Also in:
dri-devel, lkml
-----Original Message----- From: Deepak Rawat <redacted> Sent: Tuesday, September 14, 2021 11:59 AM To: Dexuan Cui <decui@microsoft.com> Cc: Haiyang Zhang <haiyangz@microsoft.com>; David Airlie [off-list ref]; Daniel Vetter [off-list ref]; Thomas Zimmermann [off-list ref]; dri-devel@lists.freedesktop.org; linux- hyperv@vger.kernel.org; linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/hyperv: Fix double mouse pointers Thanks Dexuan, for the patch. A minor comment below. On Mon, Sep 13, 2021 at 11:27 AM Dexuan Cui [off-list ref] wrote:quoted
It looks like Hyper-V supports a hardware cursor feature. It is notusedquoted
by Linux VM, but the Hyper-V host still draws a point as an extramousequoted
pointer, which is unwanted, especially when Xorg is running. The hyperv_fb driver uses synthvid_send_ptr() to hide the unwantedpointer.quoted
When the hyperv_drm driver was developed, the functionsynthvid_send_ptr()quoted
was not copied from the hyperv_fb driver. Fix the issue by adding the function into hyperv_drm. Fixes: 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv syntheticvideo device")quoted
Signed-off-by: Dexuan Cui <decui@microsoft.com> Cc: Deepak Rawat <redacted> Cc: Haiyang Zhang <haiyangz@microsoft.com> --- drivers/gpu/drm/hyperv/hyperv_drm.h | 1 + drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 1 + drivers/gpu/drm/hyperv/hyperv_drm_proto.c | 39++++++++++++++++++++-quoted
3 files changed, 40 insertions(+), 1 deletion(-)diff --git a/drivers/gpu/drm/hyperv/hyperv_drm.hb/drivers/gpu/drm/hyperv/hyperv_drm.hquoted
index 886add4f9cd0..27bfd27c05be 100644--- a/drivers/gpu/drm/hyperv/hyperv_drm.h +++ b/drivers/gpu/drm/hyperv/hyperv_drm.h@@ -46,6 +46,7 @@ int hyperv_mode_config_init(struct hyperv_drm_device*hv);quoted
int hyperv_update_vram_location(struct hv_device *hdev, phys_addr_tvram_pp);quoted
int hyperv_update_situation(struct hv_device *hdev, u8 active, u32bpp,quoted
u32 w, u32 h, u32 pitch); +int hyperv_send_ptr(struct hv_device *hdev); int hyperv_update_dirt(struct hv_device *hdev, struct drm_rect *rect); int hyperv_connect_vsp(struct hv_device *hdev);diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_modeset.cb/drivers/gpu/drm/hyperv/hyperv_drm_modeset.cquoted
index 3aaee4730ec6..e21c82cf3326 100644--- a/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +++ b/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c@@ -101,6 +101,7 @@ static void hyperv_pipe_enable(structdrm_simple_display_pipe *pipe,quoted
struct hyperv_drm_device *hv = to_hv(pipe->crtc.dev); struct drm_shadow_plane_state *shadow_plane_state =to_drm_shadow_plane_state(plane_state);quoted
+ hyperv_send_ptr(hv->hdev); hyperv_update_situation(hv->hdev, 1, hv->screen_depth, crtc_state->mode.hdisplay, crtc_state->mode.vdisplay,diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_proto.cb/drivers/gpu/drm/hyperv/hyperv_drm_proto.cquoted
index 6d4bdccfbd1a..1ea7a0432320 100644--- a/drivers/gpu/drm/hyperv/hyperv_drm_proto.c +++ b/drivers/gpu/drm/hyperv/hyperv_drm_proto.c@@ -299,6 +299,40 @@ int hyperv_update_situation(struct hv_device*hdev, u8 active, u32 bpp,quoted
return 0; } +/* Send mouse pointer info to host */ +int hyperv_send_ptr(struct hv_device *hdev) +{ + struct synthvid_msg msg; + + memset(&msg, 0, sizeof(struct synthvid_msg)); + msg.vid_hdr.type = SYNTHVID_POINTER_POSITION; + msg.vid_hdr.size = sizeof(struct synthvid_msg_hdr) + + sizeof(struct synthvid_pointer_position); + msg.ptr_pos.is_visible = 1;"is_visible" should be 0 since you want to hide the pointer. Maybe better, accept these from the caller.
I believe I tried is_visible = 0 during my implementation of the hyperv_fb. It still have the host cursor visible... So I had to set the cursor color's alpha value = 0 to make it transparent. But you may try is_visible = 0 again. Thanks, - Haiyang