[PATCH 0/6] drm: Add mouse cursor hotspot support to atomic KMS

Pekka Paalanen ppaalanen at gmail.com
Mon Jun 13 07:45:29 UTC 2022

On Sat, 11 Jun 2022 17:34:50 +0200
Hans de Goede <hdegoede at redhat.com> wrote:

> Hi,
> On 6/10/22 14:53, Simon Ser wrote:
> > On Friday, June 10th, 2022 at 14:36, Gerd Hoffmann <kraxel at redhat.com> wrote:
> >   
> >> Hi,
> >>  
> >>>> As Pekka mentionned, I'd also like to have a conversation of how far we want to
> >>>> push virtualized driver features. I think KMS support is a good feature to have
> >>>> to spin up a VM and have all of the basics working. However I don't think it's
> >>>> a good idea to try to plumb an ever-growing list of fancy features
> >>>> (seamless integration of guest windows into the host, HiDPI, multi-monitor,
> >>>> etc) into KMS. You'd just end up re-inventing Wayland or RDP on top of KMS.
> >>>> Instead of re-inventing these, just use RDP or waypipe or X11 forwarding
> >>>> directly.  
> >>  
> >>>> So I think we need to draw a line somewhere, and decide e.g. that virtualized
> >>>> cursors are fine to add in KMS, but HiDPI is not.  
> >>
> >>
> >> What is the problem with HiDPI? qemu generates standard edid blobs,
> >> there should be no need to special-case virtualized drivers in any way.
> >>
> >> What is the problem with multi-monitor? That isn't much different than
> >> physical multi-monitor either.
> >>
> >> One little thing though: On physical hardware you just don't know which
> >> monitor is left and which is right until the user tells you. In case of
> >> a virtual multi-monitor setup we know how the two windows for the two
> >> virtual monitors are arranged on the host and can pass that as hint to
> >> the guest (not sure whenever that is the purpose of the
> >> suggested_{x,y} properties).  
> > 
> > The problem with suggested_x/y is described here:
> > https://lore.kernel.org/dri-devel/20220610123629.fgu2em3fto53fpfy@sirius.home.kraxel.org/T/#m119cfbbf736e43831c3105f0c91bd790da2d58fb
> > 
> > HiDPI would need a way to propagate the scale factor back-and-forth:
> > the VM viewer needs to advertise the preferred scale to the guest
> > compositor, and the guest compositor needs to indicate the scale it
> > renders with to the VM viewer.
> > 
> > Sounds familiar? Yup, that's exactly the Wayland protocol. Do we really
> > want to replicate the Wayland protocol in KMS? I'm not so sure.
> >   
> >>> It's getting a bit far off-topic, but google cros team has an out-of-tree
> >>> (at least I think it's not merged yet) wayland-virtio driver for exactly
> >>> this use-case. Trying to move towards something like that for fancy
> >>> virtualized setups sounds like the better approach indeed, with kms just
> >>> as the bare-bones fallback option.  
> >>
> >> virtio-gpu got the ability to attach uuids to objects, to allow them
> >> being identified on the host side. So it could be that wayland-virtio
> >> still uses kms for framebuffers (disclaimer: don't know how
> >> wayland-virtio works in detail). But, yes, all the scanout + cursor
> >> handling would be out of the way, virtio-gpu would "only" handle fast
> >> buffer sharing.  
> > 
> > wayland-virtio is not used with KMS. wayland-virtio proxies the Wayland
> > protocol between the host and the guest, so the guest doesn't use KMS
> > in that case.  
> It would be more correct to say: wayland clients inside the guest
> don't talk to a compositor inside the guest (but rather one
> outside the guest) and thus also don't depend (indirectly) on\
> having kms inside the guest.

Both ways may work. There are many Wayland compositors that can present
to another Wayland display.

In my mind which architecture you use depends on whether you want a root
window for the VM (with the ability to run any desktop in the guest
as-is) or whether you want root-window-less integration of VM/guest
applications into the host desktop.

> But the guest likely still needs kms for e.g. the kernel console
> to e.g. debug boot failures.

Sure. That doesn't need cursor planes at all, or anything else that
virtualised guest KMS drivers are specially adding to make specifically
a desktop experience more smooth.

> Note this could be done over a serial
> console too, so in some cases whatever "video-card" emulation
> the guest has could theoretically go away. But it is also completely
> possible for a guest to have both some emulated video-card which
> offers a kms API to userspace as well as wayland-virtio.

Of course. However the question here is, how far are we willing to
complicate, bend and even break KMS UAPI contract to make the KMS path
work in more fancy ways (likely with sub-optimal performance due to its
fundamental design) when something like wayland-virtio already exists
which allows for much more and in much better ways.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20220613/86d2d9d5/attachment.sig>

More information about the wayland-devel mailing list