Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Introduce wlr_drm_lease_v1 #1730

Closed
wants to merge 3 commits into from
Closed

Introduce wlr_drm_lease_v1 #1730

wants to merge 3 commits into from

Conversation

ddevault
Copy link
Member

@ddevault ddevault commented Jun 20, 2019

Still deep in the trenches on this patch, but opening it in case anyone is curious or has early feedback.

  • meson rigging
  • Protocol state management
  • Create & transfer the lease
  • DRM backend updates
  • Example client
  • Rebase
  • Withdraw connector offers when a lease is issued
  • Reissue connector offers when lease terminates
  • Address known issues
  • Rootston support
  • Consensus on protocol

Related ticket: #1723

Test client: https://git.sr.ht/~sircmpwn/kmscube (./kmscube -l)

I don't intend to merge this until this protocol makes it through review on wayland-devel:

https://lists.freedesktop.org/archives/wayland-devel/2019-June/040672.html

@ddevault ddevault force-pushed the drm-lease branch 3 times, most recently from 3030f87 to 77b74a7 Compare June 20, 2019 19:03
@mv0
Copy link

mv0 commented Jun 26, 2019

Hi,

Sorry to barge in, but any reason not posting the protocol on wayland-dev ML? I think there might be others which would like to take a look, and this shouldn't be (a) compositor specific protocol.

@ddevault
Copy link
Member Author

I prefer to have a working implementation to demonstrate the protocol before I submit it for others to consider. Writing an implementation often turns up defects in the protocol, which I would rather hear about before it's standardized than after.

@ddevault
Copy link
Member Author

ddevault commented Jun 27, 2019

Test client: https://git.sr.ht/~sircmpwn/kmscube

Run ./kmscube -l

@ddevault
Copy link
Member Author

This is basically ready for review. Known issues:

  • I hardcoded which output I want to lease for testing purposes, later this will be replaced with automatically offering non-desktop outputs and a lease option in the config
  • Needs to be rebased

The DRM changes and lease manager implementation should be in good shape, though, and if you want to test it you can update the hardcoded output name to some other output for leasing.

@@ -649,6 +654,8 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
enum wl_output_transform transform,
int32_t hotspot_x, int32_t hotspot_y, bool update_texture) {
struct wlr_drm_connector *conn = get_drm_connector_from_output(output);
assert((conn->state != WLR_DRM_CONN_LEASED || texture == NULL)
&& "Use of leased connector is a programming error");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This texture == NULL exception is necessary because when the output is destroyed, its cursors are destroyed as well.

@ddevault ddevault force-pushed the drm-lease branch 5 times, most recently from e6a886c to f49c3a4 Compare July 2, 2019 19:09
@ddevault ddevault changed the title [WIP] Introduce wlr_drm_lease_v1 Introduce wlr_drm_lease_v1 Jul 2, 2019
@ddevault ddevault force-pushed the drm-lease branch 3 times, most recently from ecab581 to 7bf72b4 Compare July 9, 2019 15:37
@ddevault ddevault force-pushed the drm-lease branch 4 times, most recently from ad7fd82 to fc352aa Compare July 30, 2019 15:39
@computer-whisperer
Copy link

This doesn't seem to work for me at the moment.

Here is a log from starting sway, running kmscube -l, and immediately closing sway.
https://gist.github.com/57beb710b04f7800e560a78cd6ea5779

Sway config file:
https://gist.github.com/17b45e21e1f23086fbc9c147aa882041

Here is a relevant snippet starting at line 1833:

00:00:17.683 [DEBUG] [backend/drm/drm.c:1718] Issuing DRM lease with the 4 objects:
00:00:17.683 [DEBUG] [backend/drm/drm.c:1725] connector: 59 crtc: 57 primary plane: 40
00:00:17.683 [DEBUG] [backend/drm/drm.c:1728] cursor plane: 56
00:00:17.683 [ERROR] [types/wlr_drm_lease_v1.c:118] drm_create_lease failed: Invalid argument

System configuration info:
Arch Linux
Linux 5.7.2-2 w/ ck patches
libdrm 2.4.102-1
Discrete AMD gpu
Integrated Intel gpu
Valve Index as DP-2 (plugged into AMD gpu)

I am using the following patches:
https://github.com/swaywm/sway/pull/4289.diff
https://github.com/swaywm/wlroots/pull/1730.diff
https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/248.diff

@ddevault
Copy link
Member Author

No support whatsoever is provided for these patchsets, you'll have to investigate the problem yourself and send an updated patch.

@optlink
Copy link

optlink commented Aug 12, 2020

If anyone has an idea on where I should start hacking away here is where I am at:

I am trying to get DRM leasing with SteamVR and a Valve Index working. Apparently SteamVR tries to identify the HMD output by the available output modes. Running xrandr with these patches applied gives a "non-desktop" XWAYLAND1 output with no modes. SteamVR then ignores that output and carries on until it realizes there's no display for it to use. I can manually add modes using the xrandr tool but that's not quite enough. SteamVR requires the "preferred mode" to be exactly 2880x1600. I have not yet found a way set which mode is preferred externally. Does anyone know if this is something that should be handled by wlroots or sway? Shouldn't wlroots pass the supported modes onto xwayland even if it's a non-desktop output?

@ddevault
Copy link
Member Author

You need my Xwayland patches for this to work.

@optlink
Copy link

optlink commented Aug 12, 2020

This patch? I am running it already on master.

@michaelnew
Copy link

michaelnew commented Aug 12, 2020

@optlink I tried this out today with a similar setup (Valve Index, SteamVR, and in my case a Vega 64). I applied the xwayland patch to the xserver master branch, but for sway and wlroots I just built the drm-lease branches rather than apply them as patches to master.

If I run xrandr I see XWAYLAND0 and XWAYLAND1 (the Index), with about a dozen modes listed. If I start up Steam and launch VR (I'm using the Steam beta and the SteamVR beta) everything works great, but XWAYLAND1 disappears from the xrandr output. Once I quit VR, XWAYLAND1 is still gone, and I then see XWAYLAND2, but no modes listed. And from that point if I launch SteamVR it tries to output to my main display, and eventually quits. Exiting and relaunching Sway fixes things.

@optlink
Copy link

optlink commented Aug 13, 2020

@michaelnew The differences between our setups that I can see are:

  1. RX 5700 XT vs Vega 64
  2. I applied the wlroots patches to wlroots 0.11
  3. I am using sway 1.5 with a slightly modified patch because it did not apply cleanly

I suspect the problem is with 3 since I do not fully understand the impact of the changes that were made for sway 1.5.
The main symptom is that xrandr returns no modes at all for XWAYLAND1, even before taking a lease. Running SteamVR anyway fails pretty spectacularly.

@optlink
Copy link

optlink commented Aug 13, 2020

I rebuilt sway and wlroots from their respective drm-lease branches and I get the exact same result. There must be something else wrong.

Update: the kmscube demo works, though the eyes are swapped. The problem is with Xwayland then?

@optlink
Copy link

optlink commented Aug 14, 2020

It turns out that the Xwayland patches are broken on master currently. Building from the merge request branch works but you will need a fix for the GLX issue caused by recent changes to libglvnd: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1032

@emersion
Copy link
Member

Superseded by #2929

@emersion emersion closed this Jul 22, 2021
@emersion emersion deleted the drm-lease branch July 22, 2021 20:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants