[PATCH 0/6] drm: Add mouse cursor hotspot support to atomic KMS
Simon Ser
contact at emersion.fr
Sun Jun 5 07:30:03 UTC 2022
On Friday, June 3rd, 2022 at 20:31, Zack Rusin <zackr at vmware.com> wrote:
> > > > > > My proposal was:
> > > > > >
> > > > > > - Introduce DRM_CLIENT_CAP_CURSOR_PLANE_NO_POSITION (or a better name). Only
> > > > > > user-space which supports the hotspot props will enable it.
> > > > > > - By default, don't expose a cursor plane, because current user-space doesn't
> > > > > > support it (Weston might put a window in the cursor plane, and nobody can
> > > > > > report hotspot).
> > > > > > - If the KMS client enables the cap, advertise the cursor
> > > > > > plane, and make it so the plane doesn't have the CRTC_X/CRTC_Y properties
> > > > > > since the driver will pick the position.
> > > > > >
> > > > > > That way both old and new user-space are fixed.
> > > > >
> > > > > I don’t think I see how that fixes anything. In particular I don’t see a way
> > > > > of fixing the old user space at all. We require hotspot info, old user space
> > > > > doesn’t set it because there’s no way of setting it on atomic kms.
> > > >
> > > > Old atomic user-space is fixed by removing the cursor plane. Then old
> > > > atomic user-space will fallback to drawing the cursor itself, e.g. via
> > > > OpenGL.
> > >
> > > But it’s not fixed, because the driver is still on a deny-list and
> > > nothing implements this. You’re saying you could potentially “fix” by
> > > implementing client side cursor handling in all kms clients? That’s a
> > > hard sell if the user space can just put the virtualized driver on
> > > deny-lists and fallback to use old kms which supports hotspots.
> >
> > What deny-list are you referring to?
> >
> > All compositors I know of implement a fallback when no cursor plane is
> > usable.
>
> I put the links in the first email in the
> series:
> https://gitlab.gnome.org/GNOME/mutter/-/blob/main/src/backends/native/meta-kms-impl-device-atomic.c#L1188
> https://invent.kde.org/plasma/kwin/-/blob/master/src/backends/drm/drm_gpu.cpp#L156
I was not aware of these lists. Having to work-around drivers in user-space is
really not great.
But regardless, that doesn't really change anything. With my proposal:
- Old user-space with hacky deny-lists (Mutter, KWin) still goes through the
legacy uAPI.
- Old user-space without the hacky deny-lists (Weston, wlroots) uses software
cursors and is not broken anymore.
- New user-space can report hotspot and is not broken.
> Also, let me point this out because it also seems to be a fundamental
> misunderstanding, user space implementing software cursor doesn’t fix
> anything. Just leaves everything broken in different ways. The reason
> virtualized drivers went away from software cursors is because it makes it
> impossible to make it work with a bunch of interesting and desirable
> scenarios, e.g. unity mode where the guest might have a terminal and browser
> open and then the virtual machine software creates windows out of those, so
> you don’t have the entire desktop of the guest but instead native looking
> windows with the apps. In that case guest has no way of knowing when the
> cursor leaves the window, so to make seemless cursors work you’d need to
> implement irc or backdoors that send that information from the host to the
> guest, then have virtualized drivers create some sort of uevent, to send to
> the userspace to let it know to hide the cursor because it actually left the
> window. That’s a trivial scenario and there’s a lot more with mice that are
> remoted themselves, guests with singular or maybe many apps exported,
> possibly overlapping on the host but all within a desktop in the guest, etc.
Are you saying that the current broken behavior is better than software
cursors?
> > > > New user-space supports setting the hotspot prop, and is aware that it can't
> > > > set the cursor plane position, so the cursor plane can be exposed again when
> > > > the cap is enabled.
> > >
> > > But we still use cursor plane position. Hotspots are offsets from
> > > cursor plane positions. Both are required.
> >
> > No, VM drivers don't need and disregard the cursor position AFAIK. They
> > replace it with the host cursor's position.
>
> Iirc they all use it.
What do they use it for?
The whole point of this discussion is to be able to display the guest's cursor
image on the host's cursor, so that latency is reduced? When the VM software
does this, why does it need to use CRTC_X/CRTC_Y, since these are thrown away
by the host?
> I guess we could repurpose src_x|y to mean mouse hotspots and write patches
> for userspace to use that instead of explicit properties
That sounds like a terrible idea.
More information about the wayland-devel
mailing list