c/direct: Fix direct display RandR leased output on multi-X-Screen.

The old code assumes the HMD is always connected to a RandR
output on X-Screen 0, but this is not neccessarily the case
on multi-X-Screen setups. Use a loop to iterate over all
X-Screens outputs until the HMD output is found.

Tested on single and dual X-Screen setups, also with Oculus
Rift CV1 connected to 2nd X-Screen.

This is rather useful for porting applications from "OpenHMD Rift
on separate X-Screen for performance" to OpenXR Monado direct
mode, so one can quickly switch between Monado and OpenHMD native
without cumbersome xorg.conf + logout + login games.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
This commit is contained in:
Mario Kleiner 2021-10-22 18:57:09 +02:00 committed by Jakob Bornecrantz
parent f407536279
commit a6185490e8

View file

@ -190,9 +190,11 @@ comp_window_direct_randr_init(struct comp_target *ct)
xcb_screen_iterator_t iter = xcb_setup_roots_iterator(xcb_get_setup(connection));
w_direct->screen = iter.data;
comp_window_direct_randr_get_outputs(w_direct);
while (iter.rem > 0 && w_direct->num_displays == 0) {
w_direct->screen = iter.data;
comp_window_direct_randr_get_outputs(w_direct);
xcb_screen_next(&iter);
}
if (w_direct->num_displays == 0) {
COMP_ERROR(ct->c, "No non-desktop output available.");