Skip to content

Commit

Permalink
Replaced Cog browser with a WPE launcher for running WPEWebKit
Browse files Browse the repository at this point in the history
... based on the new WPE platform API.

Updated related scripts and documentation accordingly.
  • Loading branch information
psaavedra committed Jan 23, 2025
1 parent 86bf81c commit f47cff2
Show file tree
Hide file tree
Showing 18 changed files with 65 additions and 212 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ CXX=arm-poky-linux-gnueabi-g++ ...
...
```
## Running Cog browser:
## Running WPE launcher:
* Cog with FDO backend in Weston: `/usr/bin/cog-fdo-exported-wayland https://wpewebkit.org`
* Cog with DRM backend directly in framebuffer: `/usr/bin/cog-drm-kill-weston https://wpewebkit.org`
* WPE with FDO backend in Weston: `/usr/bin/wpe-exported-wayland https://wpewebkit.org`
* WPE with DRM backend directly in framebuffer: `export WPE_DISPLAY="wpe-display-drm"; /usr/bin/wpe-exported-wayland https://wpewebkit.org`
All this commands will execute the browsers as `weston` user.
Expand Down
42 changes: 0 additions & 42 deletions recipes-browser/cog/cog_0.18.%.bbappend

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions recipes-browser/cog/files/cog-drm

This file was deleted.

3 changes: 0 additions & 3 deletions recipes-browser/cog/files/cog-drm-kill-weston

This file was deleted.

30 changes: 0 additions & 30 deletions recipes-browser/cog/files/cog-fdo

This file was deleted.

5 changes: 0 additions & 5 deletions recipes-browser/cog/files/cog-fdo-ctl

This file was deleted.

12 changes: 0 additions & 12 deletions recipes-browser/cog/files/cog-fdo-exported-wayland

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
CTL_FILE=/tmp/wpe-exported-wayland

echo "$@" > ${CTL_FILE}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#! /bin/sh

# export WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS=1
# export GST_PLUGIN_FEATURE_RANK="avdec_av1:0"
# export GST_DEBUG_DUMP_DOT_DIR=/tmp/gst-out/
# mkdir -p /tmp/gst-out
# chmod 777 /tmp/gst-out

CTL_FILE=/tmp/wpe-exported-wayland

# WebKitDMABufVideoSink sink that is able to accept decode
# dmabuf or raw data in a range of RGB-like or YUV formats.
# Bug: https://bugs.webkit.org/show_bug.cgi?id=279819
export WEBKIT_GST_DMABUF_SINK_ENABLED=1

export GST_PLUGIN_FEATURE_RANK="avdec_av1:0"

export "$(strings < /proc/"$(pidof weston-keyboard)"/environ | grep WAYLAND_DISPLAY)"
export "$(strings < /proc/"$(pidof weston-keyboard)"/environ | grep XDG_RUNTIME_DIR)"

for arg in "$@"; do
if [ "$arg" = "--maximized" ]; then
echo "maximized" > ${CTL_FILE}
fi
done

if [ "root" = "$(whoami)" ]; then
su weston -c "/usr/bin/wpe-simple-launcher ${CTL_FILE}"
else
/usr/bin/wpe-simple-launcher "${CTL_FILE}"
fi

echo "${arg}" > ${CTL_FILE}
15 changes: 14 additions & 1 deletion recipes-browser/wpe-simple-launcher/wpe-simple-launcher_git.bb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
DESCRIPTION = "Simple WPE-based web launcher"

FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=dd93f6e0496294f589c3d561f96ffee4"

Expand All @@ -7,9 +10,19 @@ inherit meson pkgconfig
DEPENDS = "glib-2.0-native wpewebkit"

SRCREV = "ca6175445ab527ab1318666536061150573adb5c"
SRC_URI = "git://[email protected]/psaavedra/wpe-simple-launcher.git;protocol=ssh;branch=main"
SRC_URI = "git://[email protected]/psaavedra/wpe-simple-launcher.git;protocol=ssh;branch=main \
file://wpe-ctl \
file://wpe-exported-wayland \
"

S = "${WORKDIR}/git"

EXTRA_OECMAKE = ""

do_install:append () {
install -d ${D}/${bindir}/
install -m 755 ${WORKDIR}/wpe-ctl ${D}/${bindir}/wpe-ctl
install -m 755 ${WORKDIR}/wpe-exported-wayland ${D}/${bindir}/wpe-exported-wayland
}

RDEPENDS:${PN} += "bash"
2 changes: 0 additions & 2 deletions recipes-core/images/core-image-weston-wpe.bb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ DESCRIPTION = "core-image-weston with WPEWebKit"
inherit image_browsers image_weston

IMAGE_INSTALL:append = " \
cog \
wpebackend-fdo \
wpewebkit \
wpe-simple-launcher \
python3-uinput \
Expand Down
4 changes: 1 addition & 3 deletions recipes-graphics/wayland/files/demo-wpe-duckduckgo
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/bash
/usr/bin/kill-demo
export COG_PLATFORM_WL_VIEW_WIDTH=$(journalctl -b | grep weston | grep current | cut -f 1 -d '@' | awk '{ print $6 }' | cut -d 'x' -f 1 | tail -n 1)
export COG_PLATFORM_WL_VIEW_HEIGHT=$(journalctl -b | grep weston | grep current | cut -f 1 -d '@' | awk '{ print $6 }' | cut -d 'x' -f 2 | tail -n 1)
export WEBKIT_SHOW_FPS=0 GALLIUM_HUD_TOGGLE_SIGNAL=10 GALLIUM_HUD_VISIBLE=0 GALLIUM_HUD=cpu+fps
/usr/bin/cog-fdo-exported-wayland https://duckduckgo.com/
/usr/bin/wpe-exported-wayland --maximized https://duckduckgo.com/
4 changes: 1 addition & 3 deletions recipes-graphics/wayland/files/demo-wpe-website
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/bash
/usr/bin/kill-demo
export COG_PLATFORM_WL_VIEW_WIDTH=$(journalctl -b | grep weston | grep current | cut -f 1 -d '@' | awk '{ print $6 }' | cut -d 'x' -f 1 | tail -n 1)
export COG_PLATFORM_WL_VIEW_HEIGHT=$(journalctl -b | grep weston | grep current | cut -f 1 -d '@' | awk '{ print $6 }' | cut -d 'x' -f 2 | tail -n 1)
export WEBKIT_SHOW_FPS=0 GALLIUM_HUD_TOGGLE_SIGNAL=10 GALLIUM_HUD_VISIBLE=0 GALLIUM_HUD=cpu+fps
/usr/bin/cog-fdo-exported-wayland https://www.wpewebkit.org
/usr/bin/wpe-exported-wayland --maximized https://www.wpewebkit.org
2 changes: 1 addition & 1 deletion recipes-graphics/wayland/files/kill-demo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/bash
/usr/bin/pkill -9 -f "cog"
/usr/bin/pkill -9 -f "wpe-simple-launcher"
/usr/bin/pkill -9 -O 1 -f "demo"

6 changes: 3 additions & 3 deletions recipes-graphics/wayland/files/weston.ini
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ path=/usr/bin/false
[launcher]
icon=/usr/share/go-next-symbolic-rtl.symbolic.png
displayname=Previous page
path=/usr/bin/cog-fdo-ctl previous
path=/usr/bin/wpe-ctl back

[launcher]
icon=/usr/share/24x24-blank.png
Expand All @@ -112,7 +112,7 @@ path=/usr/bin/false
[launcher]
icon=/usr/share/go-next-symbolic.symbolic.png
displayname=Next page
path=/usr/bin/cog-fdo-ctl next
path=/usr/bin/wpe-ctl forward

[launcher]
icon=/usr/share/24x24-blank.png
Expand All @@ -122,7 +122,7 @@ path=/usr/bin/false
[launcher]
icon=/usr/share/view-refresh-symbolic.symbolic.png
displayname=Page reload
path=/usr/bin/cog-fdo-ctl reload
path=/usr/bin/wpe-ctl reload

[launcher]
icon=/usr/share/24x24-blank.png
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import sys
import time

## vars ########################################################################
launcher = 'cog'
launcher = 'wpe-simple-launcher'
urls = 'urls.conf'

## functions ###################################################################
Expand Down Expand Up @@ -54,7 +54,8 @@ if __name__ == "__main__":
lines = f.readlines()

try:
os.system("%s %s &" % (launcher, lines[0].split()[0]))
os.system("%s /tmp/wpe-demo-run" % launcher)
os.system("echo maximized > /tmp/wpe-demo-run" % lines[0].split()[0])
except Exception as e:
print("Error parsing first line: %s" % e)
sys.exit(2)
Expand All @@ -66,7 +67,7 @@ if __name__ == "__main__":
entry = l.split()
url = entry[0]
duration = entry[1]
call("%s-ctl open %s" % (launcher, url))
call("echo %s > /tmp/wpe-demo-run" % (launcher, url))
time.sleep(int(duration))
counter += 1
except Exception as e:
Expand Down
4 changes: 1 addition & 3 deletions recipes-graphics/wayland/weston-init.bbappend
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SRC_URI += "file://weston.env \
file://wayland-1.service \
file://kill-demo \
file://toggle-gallium-hud \
file://cog-demo-run \
file://wpe-demo-run \
file://demo-wpe-website \
file://demo-wpe-duckduckgo\
file://24x24-blank.png \
Expand Down Expand Up @@ -34,7 +34,6 @@ FILES:${PN} += "\
${systemd_system_unitdir}/wayland-1.service \
${bindir}/kill-demo \
${bindir}/toggle-gallium-hud \
${bindir}/cog-demo-run \
${bindir}/demo-wpe-website \
${bindir}/demo-wpe-duckduckgo \
${datadir}/24x24-blank.png \
Expand Down Expand Up @@ -71,7 +70,6 @@ do_install:append () {

install -Dm755 ${WORKDIR}/kill-demo ${D}/${bindir}/kill-demo
install -Dm755 ${WORKDIR}/toggle-gallium-hud ${D}/${bindir}/toggle-gallium-hud
install -Dm755 ${WORKDIR}/cog-demo-run ${D}/${bindir}/cog-demo-run
install -Dm755 ${WORKDIR}/demo-wpe-website ${D}/${bindir}/demo-wpe-website
install -Dm755 ${WORKDIR}/demo-wpe-duckduckgo ${D}/${bindir}/demo-wpe-duckduckgo
install -Dm755 ${WORKDIR}/weston-terminal-configure-network ${D}/${bindir}/weston-terminal-configure-network
Expand Down

0 comments on commit f47cff2

Please sign in to comment.