[RFC] Wayland driver development - June 2021 update

Arkadiusz Hiler ahiler at codeweavers.com
Mon Jun 28 07:54:10 CDT 2021


Hey Alexandros,

On Mon, Jun 07, 2021 at 08:10:11PM +0300, Alexandros Frantzis wrote:
> The Wayland driver now exposes multiple monitors to Wine and supports
> dynamic addition and removal of monitors. It also supports changing the
> application-perceived resolution of each monitor (through compositor
> scaling, see previous update [2]) to implement per-monitor mode changes.

FWIW there's something similar in Proton for winex11.drv - the "full
screen hack"[0]. It provides much better and more consistent user
experience with games than allowing them doing true modesets.

[0]: https://github.com/ValveSoftware/wine/blob/eef39a6e9c0a9b939521c7a5119225b4823b83cc/dlls/winex11.drv/fs.c

As of GPU creation:

--------------------------- dispay.c ---------------------------

/* TODO: Support multiple GPUs. Note that wayland doesn't currently expose GPU info. */
if (!wayland_init_gpu(gpu_devinfo, &gpu, gpu_index, gpu_guidW, driverW, &gpu_luid))
    goto done;

----------------------------------------------------------------

Having LUIDs assigned to every GPU is important for Vulkan <-> DXGI
interop and some games do depend on them just being present (e.g. Forza
Horizon 4). That interop is also important for making sure that the
correct GPU is being used across DX-on-Vulkan libraries (e.g. DXVK's
DXGIAdapter used by VKD3D-Proton).

See VkPhysicalDeviceProperties2() and VkPhysicalDeviceIDProperties + how
those are used by DXVK and VKD3D-Proton.

winex11.drv tries to use vkGetRandROutputDisplayEXT() to map
outputs/providers to a vulkan device. This doesn't work particularly
well when a GPU has no outputs connected (e.g. PRIME setups) or on
Wayland where XRandR reports no providers.

Proton experimental improves on the situation a bit[1].

My suggestion is to do something similar to Proton in winewayland.drv:

    gpus = vkEnumeratePhysicalDevices()
    if gpus:
      first one: primary, has all the outputs
      remaining: outputless
    else:
      create the faux one

We can also be smarter by trying to present to each wl_output from each
device, but I believe we are going to be able to present from most GPUs
to most outputs and I don't think it's worth spending time on yet.

[1]: https://github.com/ValveSoftware/wine/blob/50015f7e0bcd/dlls/winex11.drv/xrandr.c#L819

I don't expect a protocol that would help with vulkan device<->output
mapping to be welcomed in Wayland. What Wine is doing is conceptually
much closer to a full-blown compositor, and since we are just a client
we have to resort to faking / stubbing things out and applying clever
heuristics... and IMO that's okay.

It's not that X11 is perfect here either. It also requires quite a bit
of wrangling in many areas, e.g. to map X11 focus behavior to Win32
concepts. X11's security holes^W^Wfeatures allow us to implement a few
more things, that's true, and I'll miss them as a Wine developer, but
with my "windowing" hat on I think it is a change for the better.

Personally, I am looking forward to winewayland.drv maturing :-)

-- 
Cheers,
Arek



More information about the wine-devel mailing list