Skip to contentSkip to conversation

weston-init: Use weston-launch for XWayland

PATCH In review Tom Hochstein 3 participants 8 messages Dec 1, 2015 – Dec 11, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 weston-init: Use weston-launch for XWayland

From: Prabhu Sundararaj <[email protected]>

When XWayland is configured, Weston must be started using the weston-launch utility.

---
 meta/recipes-graphics/wayland/weston-init/init | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
meta/recipes-graphics/wayland/weston-init/init +9 -1
index 2e938f4..d1e902f 100644
@@ -38,7 +38,15 @@ case "$1" in
                 chmod 0700 $XDG_RUNTIME_DIR
         fi
 
-        openvt -s weston -- $OPTARGS
+        # If weston-launch exists, we're configured for XWayland.
+        if [ -f /usr/bin/weston-launch ]; then
+            echo "Starting Weston in XWayland"
+            export XDG_CONFIG_HOME=/etc
+            openvt -v -- weston-launch -- --log=/var/log/weston.log $OPTARGS
+        else
+            echo "Starting Weston"
+            openvt -s weston -- --log=/var/log/weston.log $OPTARGS
+        fi
   ;;
 
   stop)
Signature · 1 line
2.1.4
#1 lore raw

meta/recipes-graphics/wayland/weston-init/init case "$1" in · line 43

Quoted 3 lines
meta/recipes-graphics/wayland/weston-init/init +3 -0
+        # If weston-launch exists, we're configured for XWayland.
+        if [ -f /usr/bin/weston-launch ]; then
+            echo "Starting Weston in XWayland"

Nope. XWayland support and weston-launch support are configured separately. One may be present and the other one absent, both ways.

Alex

#2 lore raw

Hi Alex,

We're wondering how best to fix this.

The Weston website seems to give the answer for a run-time solution, which is basically 'if $DISPLAY is set use weston, otherwise use weston-launch'.

http://wayland.freedesktop.org/building.html

Is that the right approach? Another possibility is to make it a build-time solution where the bsp layer sets a variable controlling the selection.

Thanks for your help.

Tom

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, December 01, 2015 4:21 PM
To: Hochstein Tom-R60874 <[email protected]>
Cc: [email protected]; Sundararaj Prabhu-B36876 <[email protected]>
Subject: Re: [OE-core] [PATCH v2] weston-init: Use weston-launch for XWayland

meta/recipes-graphics/wayland/weston-init/init case "$1" in · line 43

Quoted 3 lines
meta/recipes-graphics/wayland/weston-init/init +3 -0
+        # If weston-launch exists, we're configured for XWayland.
+        if [ -f /usr/bin/weston-launch ]; then
+            echo "Starting Weston in XWayland"

Nope. XWayland support and weston-launch support are configured separately. One may be present and the other one absent, both ways.

Alex

#3 lore raw
Quoted 9 lines · Tom Hochstein

Hi Alex,

We're wondering how best to fix this.

The Weston website seems to give the answer for a run-time solution, which is basically 'if $DISPLAY is set use weston, otherwise use weston-launch'.

http://wayland.freedesktop.org/building.html

Is that the right approach? Another possibility is to make it a build-time solution where the bsp layer sets a variable controlling the selection.

Runtime is always better, when possible.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#4 lore raw
Quoted 9 lines · Otavio Salvador
Quoted 7 lines

We're wondering how best to fix this.

The Weston website seems to give the answer for a run-time solution, which is basically 'if $DISPLAY is set use weston, otherwise use weston-launch'.

http://wayland.freedesktop.org/building.html

Is that the right approach? Another possibility is to make it a build-time solution where the bsp layer sets a variable controlling the selection.

Runtime is always better, when possible.

I guess you need to dig deeper into what weston-launch actually does, and which are the scenarios when it should be used; the documentation isn't particularly helpful here, so maybe you need to ask the upstream developers.

Also, whatever fix you come up with, it should also be provided for the situation when a native systemd unit file is used instead of the init script (a patch for that has been posted here, and should show up in master shortly).

Alex

#5 lore raw

Thanks Alex and Otavio.

I'm hopeful that I've found the guidance we need from the Weston man page:

http://manpages.ubuntu.com/manpages/saucy/man1/weston.1.html

In particular, the Examples section looks like this:

EXAMPLES
Launch Weston with the DRM backend on a VT
weston-launch

Launch Weston with the DRM backend and XWayland support
weston-launch -- --modules=xwayland.so

Launch Weston (wayland-1) nested in another Weston instance (wayland-0)
WAYLAND_DISPLAY=wayland-0 weston -Swayland-1

From an X terminal, launch Weston with the x11 backend
weston

XWayland support is specified in weston.ini, so the first two examples collapse to one case for the init script. The third example, nested Weston, is something the init script has never supported, so I propose continuing to not support it. The fourth condition I propose to support by checking for $DISPLAY. So you end up with something like this:

# There are multiple ways to start weston.
if [ "$WAYLAND_DISPLAY" ]; then
echo -e "\aError: Weston is already running."
echo "This script does not support launching Weston nested." exit 1
else if [ "$DISPLAY" ]; then
echo "Launching Weston with the x11 backend"
openvt -s weston -- --log=/var/log/weston.log $OPTARGS
else
echo "Launching Weston with the DRM backend"
export XDG_CONFIG_HOME=/etc
openvt -v -- weston-launch -- --log=/var/log/weston.log $OPTARGS
fi

I still need to test this (and apply the design in systemd), but I wanted your feedback on the approach.

Tom

-----Original Message-----
From: Alexander Kanavin [mailto:[email protected]]
Sent: Monday, December 07, 2015 8:19 AM
To: Hochstein Tom-R60874 <[email protected]>
Cc: Otavio Salvador <[email protected]>; Sundararaj Prabhu-B36876 <[email protected]>; [email protected]
Subject: Re: [OE-core] [PATCH v2] weston-init: Use weston-launch for XWayland

Quoted 9 lines · Otavio Salvador
Quoted 7 lines

We're wondering how best to fix this.

The Weston website seems to give the answer for a run-time solution, which is basically 'if $DISPLAY is set use weston, otherwise use weston-launch'.

http://wayland.freedesktop.org/building.html

Is that the right approach? Another possibility is to make it a build-time solution where the bsp layer sets a variable controlling the selection.

Runtime is always better, when possible.

I guess you need to dig deeper into what weston-launch actually does, and which are the scenarios when it should be used; the documentation isn't particularly helpful here, so maybe you need to ask the upstream developers.

Also, whatever fix you come up with, it should also be provided for the situation when a native systemd unit file is used instead of the init script (a patch for that has been posted here, and should show up in master shortly).

Alex

#6 lore raw
Quoted 14 lines · Tom Hochstein

# There are multiple ways to start weston.
if [ "$WAYLAND_DISPLAY" ]; then
echo -e "\aError: Weston is already running."
echo "This script does not support launching Weston nested." exit 1
else if [ "$DISPLAY" ]; then
echo "Launching Weston with the x11 backend"
openvt -s weston -- --log=/var/log/weston.log $OPTARGS
else
echo "Launching Weston with the DRM backend"
export XDG_CONFIG_HOME=/etc
openvt -v -- weston-launch -- --log=/var/log/weston.log $OPTARGS
fi

Quoted 1 line

I still need to test this (and apply the design in systemd), but I wanted your feedback on the approach.

I think this looks okay, but you obviously need to test that all three scenarios works as expected. Also, systemd unit file language may not support this logic (it's not a full programming language), so the above snippet probably needs to be separated into a wrapper script.

Alex

#7 lore raw
Quoted 17 lines · Alexander Kanavin
Quoted 15 lines · Tom Hochstein

# There are multiple ways to start weston.
if [ "$WAYLAND_DISPLAY" ]; then
echo -e "\aError: Weston is already running." echo "This script does not support launching Weston nested." exit 1
else if [ "$DISPLAY" ]; then
echo "Launching Weston with the x11 backend" openvt -s weston -- --log=/var/log/weston.log $OPTARGS
else
echo "Launching Weston with the DRM backend" export XDG_CONFIG_HOME=/etc
openvt -v -- weston-launch -- --log=/var/log/weston.log
$OPTARGS
fi

Quoted 8 lines
Quoted 2 lines

I still need to test this (and apply the design in systemd), but I wanted your feedback on the approach.

I think this looks okay, but you obviously need to test that all three scenarios works as expected. Also, systemd unit file language may not support this logic (it's not a full programming language), so the above snippet probably needs to be separated into a wrapper script.

Agreed; the wrapper might make easier to integrate it on both, with less work.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750