On Wed, Mar 06, 2019 at 02:50:36PM +0100, BALATON Zoltan wrote: > On Wed, 6 Mar 2019, Gerd Hoffmann wrote: > > On Wed, Mar 06, 2019 at 12:48:59AM +0100, BALATON Zoltan wrote: > > > On Tue, 5 Mar 2019, Gerd Hoffmann wrote: > > > > Use dpy_cursor_define(). > > > > > > I've done that but it's not working very well. The mouse pointer is quite > > > jumpy with this and there are some problems updating the pointer image > > > when > > > the guest changes image data in video ram without changing registers. > > > (Like > > > > When using a relative pointing device (i.e. mouse instead of tablet) you > > also need dpy_mouse_set(), to update the host mouse position when the > > guest moves the cursor sprite around. > > Sure, I figured that out otherwise the mouse pointer would not move. > > > Is it possible to figure where the cursor hotspot is? > > Not sure what you mean. I call dpy_mouse_set() on writing the reg that > contains mouse position. Hot spot is always top left of sprite (or I don't > know where it's set). I'll submit a v5 after adding some more checks to make > it a bit safer then you can have a look.
Well, paravirtual graphics devices propagate the hot-spot information from the guest to the host. But on real hardware you typically don't have registers for that information as the GPU doesn't need to know the hotspot for cursor display. The guest driver can simply take the hotspot location into account when programming the cursor position into the hardware registers. So, the suggestion to use dpy_cursor_define() wasn't a good one after all. I totally forgot about the hotspot issue as I work with paravirtual graphics devices most of the time. Sorry for that. > > > least doing hw cursor like this works somewhat but I note that the other > > > version with cursor_invalidate and cursor_draw_line callbacks worked much > > > smoother, alas I've found that cannot work with shared_surface. > > > > There is a VGAComminState->force_shadow ... > > Yes, but that would also make things slower so I like to keep advantage of > shared_surface and try to fix the jumpy mouse we get with define_cursor > instead if possible. Its not so much a performance issue. But you need a round-trip to the guest to update the cursor position, which adds noticeable latency to mouse moves ... Either that, or live with the offset due to the missing hotspot location. Which typically isn't that much of a problem with the left pointer where the hotspot is close to the upper left corner. With the caret (typically used in text fields) the offset is very noticable though. cheers, Gerd