Re: [PATCH] drm/hyperv: Fix double mouse pointers

From: Deepak Rawat
Date: Thu Sep 16 2021 - 13:04:50 EST


HI Dexuan, thanks for confirming. Could you please add this as a
comment to the function.

Reviewed-by: Deepak Rawat <drawat.floss@xxxxxxxxx>

On Tue, Sep 14, 2021 at 11:59 PM Dexuan Cui <decui@xxxxxxxxxxxxx> wrote:
>
> > From: Deepak Rawat <drawat.floss@xxxxxxxxx>
> > Sent: Tuesday, September 14, 2021 8:59 AM
> > ...
> > > +/* 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.
>
> According to my test, "is_visible = 0" doesn't work, i.e. can't hide the
> unwanted HW mouse poiner. It looks like the field is for some very old
> legacy Windows VMs like Windows Vista.
>
> Haiyang also replied in another email, saying "is_visible = 0" doesn't
> work.
>
> > > + msg.ptr_pos.video_output = 0;
> > > + msg.ptr_pos.image_x = 0;
> > > + msg.ptr_pos.image_y = 0;
> > > + hyperv_sendpacket(hdev, &msg);
> > > +
> > > + memset(&msg, 0, sizeof(struct synthvid_msg));
> > > + msg.vid_hdr.type = SYNTHVID_POINTER_SHAPE;
> > > + msg.vid_hdr.size = sizeof(struct synthvid_msg_hdr) +
> > > + sizeof(struct synthvid_pointer_shape);
> > > + msg.ptr_shape.part_idx = SYNTHVID_CURSOR_COMPLETE;
> > > + msg.ptr_shape.is_argb = 1;
> > > + msg.ptr_shape.width = 1;
> > > + msg.ptr_shape.height = 1;
> > > + msg.ptr_shape.hot_x = 0;
> > > + msg.ptr_shape.hot_y = 0;
> > > + msg.ptr_shape.data[0] = 0;
> > > + msg.ptr_shape.data[1] = 1;
> > > + msg.ptr_shape.data[2] = 1;
> > > + msg.ptr_shape.data[3] = 1;
> > > + hyperv_sendpacket(hdev, &msg);
> > > +
> >
> > Is it necessary to send SYNTHVID_POINTER_SHAPE here? Perhaps we should
>
> According to my test, yes. If I don't send a SYNTHVID_POINTER_SHAPE message,
> the unwanted mouse pointer can't be hidden. As we know, the protocol between
> the VSC and the VSP is not well documented to us. I can ask Hyper-V
> team for some clarification on this, but it's probably we can just use the current
> version of hiding the mouse pointer as-is -- this has been used for 10+ years
> in the hyperv_fb driver without any issue. :-)
>
> > separate SYNTHVID_POINTER_POSITION and SYNTHVID_POINTER_SHAPE into
> > different functions.
>
> Since the 2 messages are only used here, I suggest we keep it as-is.
>
> Thanks,
> -- Dexuan