yoctowaylandweston

how to launch wayland app on second display?


I have a yocto/poky build of linux using Weston/Wayland. I have 2 displays. The desktop environment is showing on both displays, but I can only launch apps on display-1 from the command line (ssh shell). I'm just trying to run weston-simple-egl.

This command works and I see the app running on display-1:

WAYLAND_DISPLAY=wayland-1 XDG_RUNTIME_DIR=/run/user/1000 /usr/bin/weston-simple-egl

But this fails:

WAYLAND_DISPLAY=wayland-2 XDG_RUNTIME_DIR=/run/user/1000 /usr/bin/weston-simple-egl

weston-simple-egl: ../weston-11.0.1/clients/simple-egl.c:1157: int main(int, char **): Assertion `display.display' failed.
Aborted

I also tried other display-ids: 0, 2, 3, 4...

Is there a way to check which display-ids are valid? Any logs I should be looking at? or other ways to debug this?

Edit: The display is currently 'extended' I can move an app from one to the other. In the XDG_RUNTIME_DIR, I see only wayland-1:

# ls /run/user/1000          
wayland-1       wayland-1.lock

Solution

  • It seems this is not possible via any weston environment variable or configuration.

    The answer was to modify the app itself, using this wayland api:

    xdg_toplevel::set_fullscreen(output: object<wl_output>)
    

    Calling set_fullscreen(NULL) will allow the compositor to fullscreen the window on a display of its choosing. But you can iterate over wl_outputs and choose one to use. I added a command line option to set the output index.

    Example for glmark2:

    - output = display_->outputs.at(0);
    + output = display_->outputs.at(NativeStateWayland::outputIndex);
    

    Example for weston-simple-egl:

    create_surface(struct window *window)
     {
        struct display *display = window->display;
    +   struct wl_output *wl_output = NULL;
    +   if (window->outputIndex != -1) {
    +       int index = 0;
    +       struct output *itr = NULL;
    +       wl_list_for_each(itr, &display->output_list, link) {
    +           if (index == window->outputIndex) {
    +               wl_output = itr->wl_output;
    +               break;
    +           }
    +           index++;
    +       }
    +   }
        ...
        ...
        if (window->fullscreen) {
    -       xdg_toplevel_set_fullscreen(window->xdg_toplevel, NULL);
    +       xdg_toplevel_set_fullscreen(window->xdg_toplevel, wl_output);
        }
    

    It was not possible to select a display without going fullscreen.

    resources: