Fix Webarchy WebKit renderer on the 2720 Flip
This commit is contained in:
1 parent
d4f0134e32
commit
77d95c715c
9 files changed
+259
-18
No files matched your search
@@ -57,6 +57,7 @@ All cross-compilation scripts run inside rootless Docker (`alpine:3.24` `armv7`
|
||||
- `./scripts/prune-rootfs-packages.sh <rootfs-dir> world|purge` — removes Wayland-only, Rust-based, and retired packages from a target rootfs inside the build container.
|
||||
- `./scripts/build-bananarchy-daemons.sh` — cross-builds the three compiled ARM idle daemons (`bananarchy-lid`, `bananarchy-cover-idle`, `bananarchy-volume-keys`) from `src/bananarchy-daemons/`; `--check` validates the ARM ELF artifacts and overlay sync. No Python-based daemon runs in the idle system.
|
||||
- `./scripts/build-lk2nd-beatles.sh` — cross-builds all three beatles lk2nd images (normal, diagnostic and display; the display image is the flasher default) from the pinned upstream lk2nd commit plus `bootloader/lk2nd/nokia-beatles.patch` in rootless Docker (`--check` validates all three shipped images, `--only normal|diagnostic|display` builds one, `--force-panel-init` forces the panel replay, `--with-display` enables SPI display during boot). Offline validators: `scripts/check-lk2nd-beatles.py` and `scripts/test-lk2nd-beatles-port.py`.
|
||||
- `./scripts/test-webarchy-renderer.py` — host unit test for Webarchy's device-aware WebKit renderer profile (also run by `check-rebuild.sh`).
|
||||
- `./scripts/check-rebuild.sh` — offline preflight for a clean clone (syntax, package list, plugin artifacts, overlay sync, SMS long-message rendering guard, ignored local agent config, Docker, version helper).
|
||||
- `./scripts/sync-prebuilt-overlay.sh [--check]` — mirrors `prebuilt/` artifacts into `overlay/rootfs/`; `--check` only reports drift.
|
||||
- `./scripts/bootstrap-flash-deps.sh` — installs `pyusb` and `pyserial` into the gitignored `.flash-deps/` directory for `flash-edl.py`.
|
||||
|
||||
@@ -13,6 +13,10 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
|
||||
|
||||
Work since `a1108` has focused on reliable 2720 Flip hardware support and a reproducible boot/flash path. Earlier incremental and superseded diagnostic entries are consolidated here.
|
||||
|
||||
### Webarchy WebKit renderer
|
||||
|
||||
- **Unexpected WebKit error on the 2720 Flip**: `webarchy.so` used `setenv(..., "0")` for the WebKitGTK presence flags `WEBKIT_DISABLE_COMPOSITING_MODE`, `WEBKIT_DISABLE_DMABUF_RENDERER` and `WEBKIT_SKIA_ENABLE_CPU_RENDERING` while still requesting `WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS`. WebKitGTK treats the presence of those variables as "disable", so the WebProcess started with conflicting renderer state and died on every navigation, which WebKit reported as an "Unexpected WebKit error". `configureWebkitRenderer()` now unsets all three flags first, enables the CPU renderer only where required, and chooses `WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER` on `nokia,beatles` (and after the first WebProcess crash) while `nokia-argon` keeps `WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS` and WebGL. Create `~/.config/sxmo/webarchy_software_renderer` to force the software profile on any target. Load failures now report the GError domain/code in the browser status line instead of an opaque message. `scripts/check-rebuild.sh` guards the profile and the rebuilt `webarchy.so`.
|
||||
|
||||
### Nokia 2720 Flip hardware
|
||||
|
||||
- **Wi-Fi, Bluetooth, and modem firmware**: added `msm-firmware-loader` and its OpenRC services so the phone's signed firmware and factory NV data are loaded from the stock `modem` and `persist` partitions before udev. This fixed the missing `wcnss.mdt` failure that prevented both `wlan0` and `hci0` from appearing. Wi-Fi scanning, Bluetooth discovery, and cold-boot enumeration were verified on the phone.
|
||||
|
||||
@@ -293,6 +293,7 @@ All twenty-five phone applications are compiled as shared-object plugins (`/usr/
|
||||
21. **Webarchy Web browser (`webarchy.so` / `webarchy` / `xwebarchy`)**:
|
||||
- **Open**: select **Webarchy (Web)** from the System or Applications menu, or run `webarchy [url]` / `xwebarchy [url]`.
|
||||
- **Engine, User-Agent, encoding, fonts, and multimedia**: built on WPE / WebKit (`webkit2gtk-4.1` + `libwpe-1.0`) with Adreno 304 hardware acceleration (`WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS` and WebGL) and 512 MB RAM pressure tuning (`160 MB` WebProcess cap). Uses `UTF-8` as the primary/default encoding when a server specifies none, configures Google **Noto** (`Noto Sans`, `Noto Serif`, `Noto Sans Symbols`, `Noto Sans Math`, `Noto Color Emoji`) as the default non-monospace web fonts while keeping **Fira Code** with OpenType ligatures (`calt`, `liga`) for monospace (`code`, `pre`, `kbd`, `samp`, `tt`), enables all HTML5/GStreamer multimedia playback (`MediaSource` / MSE, WebAudio, inline `<video>`/`<audio>`, and autoplay without user gesture requirements) by default, and uses `Mozilla/5.0 (Mobile; rv:123.0) Gecko/123.0 Firefox/123.0 KAIOS/4.0` as the default User-Agent (overridable via `Menu -> User-Agent Override` across 4 presets or a custom multi-tap string persisted in `~/.config/sxmo/webarchy_ua.txt`).
|
||||
- **Renderer profile and troubleshooting**: `nokia-argon` and the other slab targets keep Adreno 304 hardware acceleration (`WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS` + WebGL). The 2720 Flip (`nokia,beatles`) starts on the CPU renderer (`WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER`) because its DMABUF/WebKit renderer cannot be initialised reliably; WebKitGTK's `WEBKIT_DISABLE_*` variables are presence flags, so they are never left set to `0`. Create `~/.config/sxmo/webarchy_software_renderer` to force the CPU profile on any target. If the WebProcess crashes on a hardware profile, Webarchy switches to software rendering once and reloads the page automatically. Load failures show the WebKit `GError` domain and code in the bottom status line, which makes an "Unexpected WebKit error" diagnosable instead of opaque.
|
||||
- **Dual navigation modes (`[LNK]` Keypad Link Mode vs `[CUR]` Mouse Cursor Emulation Mode)**:
|
||||
- **Keypad Link Mode (default)**: `Up` / `Down` scrolls vertically; `4` / `Left` and `6` / `Right` (or customizable Kopher keys in `~/.config/sxmo/smallweb_controls.tsv`) highlight the previous / next interactive element (`<a>`, `<button>`, `<input>`, `<select>`, `<textarea>`, `<video>`, `<audio>`) and display its label/URL in the bottom status bar; `5` / `Center OK` clicks the highlighted element or opens a NeoUI multi-tap text entry modal when an HTML `<input>` or `<textarea>` is selected (`Left softkey` or `Call` submits the form); `1` / `7` scrolls horizontally; `3` / `9` jumps to page top / bottom; `0` reloads; `#` cycles page zoom (`100%` / `85%` / `120%` / `70%`).
|
||||
- **Mouse Cursor Emulation Mode (optional, off by default — toggle with `*#` chord or `Menu -> Toggle Mouse Cursor`)**: renders an on-screen pointer that moves with acceleration using `D-Pad` or `2`/`4`/`6`/`8` (plus diagonals `1`/`3`/`7`/`9`), automatically scrolls the page when pushed against the viewport edges, updates the bottom status bar with `(x,y)` coordinates and the hovered DOM element, and clicks or opens multi-tap input on `5` / `Center OK`.
|
||||
|
||||
@@ -47,7 +47,7 @@ Instead of spawning slow shell scripts for everyday phone tasks, Bananarchy runs
|
||||
- **IRCv3 client (`xirc` / `irc.so`)**: multi-server IRC client (`Buffers`, `Chat`, `Servers`) with OpenSSL TLS, IRCv3 capability negotiation (`CAP LS 302`: `sasl`, `server-time`, `message-tags`, `multi-prefix`, `away-notify`, `account-notify`, `chghost`, `cap-notify`), `SASL PLAIN` authentication, slash commands, and resident background mode with highlight vibration alerts; the default network is Abjects (`irc.abjects.net`, TLS port `6697`) auto-joining `#bananarchy`.
|
||||
- **Tox / Trifa P2P messenger and audio call client (`xtox` / `tox.so`)**: encrypted P2P messenger (`Friends`, `Chat`, `My Tox ID`) built on `c-toxcore` (`libtoxcore.so.2`) with DHT + TCP relay bootstrap, friend requests, persistent message history, and `ToxAV` 48 kHz Opus voice calls integrated with `xcallscreen`.
|
||||
- **Kopher SmallWeb browser (`xkopher` / `kopher` / `xsmallweb` / `smallweb.so`)**: multi-protocol SmallWeb client for **Gopher** (`gopher://`) with optional TLS (`gophers://`), **Gemini** (`gemini://`), **Spartan** (`spartan://`), and **Nex** (`nex://`), featuring WAP-style default keypad controls from [Kopher](https://code.luxferre.top/luxferre/kopher.git), user-adjustable keybindings (`~/.config/sxmo/smallweb_controls.tsv`), 10 bookmarks, custom homepage support, and link focus that always scrolls the viewport to the focused link in both wrapped and unwrapped modes.
|
||||
- **Webarchy Web browser (`webarchy` / `xwebarchy` / `webarchy.so`)**: full-featured HTML5/CSS3/JS web browser built on WPE / WebKit (`webkit2gtk-4.1` + `libwpe-1.0`) with Adreno 304 hardware acceleration (`WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS`, WebGL, accelerated 2D canvas, and 512 MB RAM pressure tuning), default KaiOS 4.0 User-Agent (`Mozilla/5.0 (Mobile; rv:123.0) Gecko/123.0 Firefox/123.0 KAIOS/4.0`) with preset and custom User-Agent override (`~/.config/sxmo/webarchy_ua.txt`), `UTF-8` default encoding fallback, `Noto Sans` / `Noto Serif` (`font-noto` + `font-noto-emoji`) as the default non-monospace browser fonts and `Fira Code` with OpenType ligatures as the monospace font, full GStreamer multimedia (`MediaSource` / MSE, WebAudio, inline HTML5 `<video>`/`<audio>` autoplay without user gesture requirements), unobtrusive bookmarking (`*HTTPS`/`*HTTP` header badge, `*`+`0-9` save / `#`+`0-9` load chords, and bookmark manager), and dual navigation modes (keypad link-stepping mode with NeoUI multi-tap form input by default, plus an optional `*#` accelerated mouse cursor emulation mode).
|
||||
- **Webarchy Web browser (`webarchy` / `xwebarchy` / `webarchy.so`)**: full-featured HTML5/CSS3/JS web browser built on WPE / WebKit (`webkit2gtk-4.1` + `libwpe-1.0`) with Adreno 304 hardware acceleration (`WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS`, WebGL, accelerated 2D canvas, and 512 MB RAM pressure tuning), default KaiOS 4.0 User-Agent (`Mozilla/5.0 (Mobile; rv:123.0) Gecko/123.0 Firefox/123.0 KAIOS/4.0`) with preset and custom User-Agent override (`~/.config/sxmo/webarchy_ua.txt`), `UTF-8` default encoding fallback, `Noto Sans` / `Noto Serif` (`font-noto` + `font-noto-emoji`) as the default non-monospace browser fonts and `Fira Code` with OpenType ligatures as the monospace font, full GStreamer multimedia (`MediaSource` / MSE, WebAudio, inline HTML5 `<video>`/`<audio>` autoplay without user gesture requirements), unobtrusive bookmarking (`*HTTPS`/`*HTTP` header badge, `*`+`0-9` save / `#`+`0-9` load chords, and bookmark manager), and dual navigation modes (keypad link-stepping mode with NeoUI multi-tap form input by default, plus an optional `*#` accelerated mouse cursor emulation mode), and a device-aware renderer profile: the 2720 Flip uses the WebKit CPU renderer (with automatic software fallback after a WebProcess crash) while the 8110 4G keeps Adreno 304 acceleration; `~/.config/sxmo/webarchy_software_renderer` forces the CPU profile on any target.
|
||||
- **GPS reception test utility (`bananarchy-gps`) and OpenStreetMap navigator (`xgps` / `xmaps` / `xnav` / `gps.so`)**: CLI GNSS/GPS diagnostic tool (`bananarchy-gps status|enable|disable|nmea|watch`) and 3-tab NeoUI GPS navigator (`1:GPS Status`, `2:OSM Map`, `3:Nav/Search`) with live NMEA/QMI PDS satellite and 3GPP cell telemetry, interactive `240x212` OpenStreetMap slippy-map tile viewer with offline PNG tile cache (`~/.cache/sxmo/osm_tiles/`), Nominatim place search, saved waypoints, and OSRM turn-by-turn route geometry and step navigation.
|
||||
- **Themes (`xthemes`), wallpapers (`xwallpapers`), and ringtones (`xringtones`)**: installable `.Xresources` color and font themes (`~/.xthemes/*.xth`, 21 preinstalled schemes including `LynxLair.xth`) with live zero-restart reload across the entire UI, `dunst` notification popups (`bananarchy-sync-dunst-theme`), and terminal, alongside dedicated managers for desktop wallpapers and 3-tab call ringtones & notification/SMS alerts (`1:Ringtone`, `2:Notif/SMS`, `3:Settings`, supporting standard audio, tracker modules, and Nokia RTTTL `.nrt`/`.rtttl`/`.rtx`, Ericsson eMelody `.emy`, and IrDA iMelody `.imy` monophonic ringtones via `/usr/bin/bananarchy-melody`, wired into `sxmo_notifs.sh` and `sxmo_hook_notification.sh`) with 3-level vibration control.
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1102,6 +1102,30 @@ for f in overlay/rootfs/etc/os-release overlay/rootfs/usr/lib/os-release
|
||||
fi
|
||||
done
|
||||
|
||||
echo "[check] Webarchy WebKit renderer profile..."
|
||||
WEBARCHY_SRC="$BASE_DIR/src/dwm-plugins/webarchy_plugin.cpp"
|
||||
WEBARCHY_SO="$BASE_DIR/prebuilt/sxmo-x11/usr/lib/dwm/plugins/webarchy.so"
|
||||
for token in 'webarchySoftwareRendererPreferred' 'configureWebkitRenderer' \
|
||||
'WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER' 'nokia,beatles'; do
|
||||
if ! grep -qF "$token" "$WEBARCHY_SRC"; then
|
||||
fail "webarchy_plugin.cpp is missing the $token renderer fallback"
|
||||
fi
|
||||
done
|
||||
if grep -qF 'WEBKIT_DISABLE_DMABUF_RENDERER", "0"' "$WEBARCHY_SRC" || \
|
||||
grep -qF 'WEBKIT_DISABLE_COMPOSITING_MODE", "0"' "$WEBARCHY_SRC"; then
|
||||
fail "WebKit presence flags must never be defined as 0"
|
||||
fi
|
||||
if ! strings "$WEBARCHY_SO" 2>/dev/null | grep -qF 'nokia,beatles'; then
|
||||
fail "shipped webarchy.so is stale: rebuild with scripts/build-sxmo-x11.sh"
|
||||
fi
|
||||
if [ ! -x "$BASE_DIR/scripts/test-webarchy-renderer.py" ]; then
|
||||
fail "missing host unit test scripts/test-webarchy-renderer.py"
|
||||
fi
|
||||
if command -v g++ >/dev/null 2>&1 && \
|
||||
! "$BASE_DIR/scripts/test-webarchy-renderer.py" >/dev/null 2>&1; then
|
||||
fail "host webarchy renderer profile test failed"
|
||||
fi
|
||||
|
||||
if [ "$FAILURES" -ne 0 ]; then
|
||||
echo "[check] $FAILURES check(s) failed."
|
||||
exit 1
|
||||
|
||||
Executable
+146
@@ -0,0 +1,146 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Host unit test for Webarchy's WebKit renderer profile selection.
|
||||
|
||||
The plugin is cross-compiled for armv7 inside Docker. This test extracts the
|
||||
three renderer-profile functions from webarchy_plugin.cpp and compiles them on
|
||||
the host with stubbed device-tree and home paths, so the device matrix and the
|
||||
WebKit presence-flag handling can be verified without a phone.
|
||||
"""
|
||||
import pathlib
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
BASE = pathlib.Path(__file__).resolve().parent.parent
|
||||
SOURCE = BASE / "src/dwm-plugins/webarchy_plugin.cpp"
|
||||
FUNCTIONS = (
|
||||
"std::string deviceTreeCompatibles",
|
||||
"bool webarchySoftwareRendererPreferred",
|
||||
"void configureWebkitRenderer",
|
||||
)
|
||||
|
||||
|
||||
def extract(name, text):
|
||||
start = text.find("\n" + name + "(")
|
||||
if start < 0:
|
||||
raise SystemExit("missing function %s in webarchy_plugin.cpp" % name)
|
||||
start += 1
|
||||
depth = 0
|
||||
opened = False
|
||||
for pos in range(start, len(text)):
|
||||
if text[pos] == "{":
|
||||
depth += 1
|
||||
opened = True
|
||||
elif text[pos] == "}":
|
||||
depth -= 1
|
||||
if opened and depth == 0:
|
||||
return text[start:pos + 1] + "\n"
|
||||
raise SystemExit("unterminated function %s" % name)
|
||||
|
||||
|
||||
HARNESS_HEAD = r'''
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
|
||||
static const char* g_compat_path = nullptr;
|
||||
static const char* g_home = nullptr;
|
||||
|
||||
std::string getHomeDirPath() { return std::string(g_home); }
|
||||
|
||||
SOFTWARE_FLAG
|
||||
|
||||
#define CHECK(cond) do { \
|
||||
if (!(cond)) { std::fprintf(stderr, "FAIL %s:%d: %s\n", __FILE__, __LINE__, #cond); return 1; } \
|
||||
} while (0)
|
||||
|
||||
'''
|
||||
|
||||
HARNESS_MAIN = r'''
|
||||
int main(int argc, char** argv) {
|
||||
CHECK(argc == 4);
|
||||
g_compat_path = argv[1];
|
||||
g_home = argv[2];
|
||||
const int expect_software = (argv[3][0] == '1');
|
||||
std::string flag = std::string(g_home) + kSoftwareRendererFlag;
|
||||
|
||||
CHECK(webarchySoftwareRendererPreferred() == (expect_software != 0));
|
||||
::unlink(flag.c_str());
|
||||
::setenv("WEBKIT_DISABLE_DMABUF_RENDERER", "0", 1);
|
||||
::setenv("WEBKIT_DISABLE_COMPOSITING_MODE", "0", 1);
|
||||
::setenv("JSC_useJIT", "0", 1);
|
||||
configureWebkitRenderer(false);
|
||||
CHECK(::getenv("WEBKIT_DISABLE_DMABUF_RENDERER") == nullptr);
|
||||
CHECK(::getenv("WEBKIT_DISABLE_COMPOSITING_MODE") == nullptr);
|
||||
CHECK(std::string(::getenv("JSC_useJIT")) == "0");
|
||||
|
||||
FILE* f = std::fopen(flag.c_str(), "wb");
|
||||
CHECK(f != nullptr);
|
||||
std::fclose(f);
|
||||
CHECK(webarchySoftwareRendererPreferred());
|
||||
configureWebkitRenderer(true);
|
||||
CHECK(std::string(::getenv("WEBKIT_DISABLE_DMABUF_RENDERER")) == "1");
|
||||
CHECK(std::string(::getenv("WEBKIT_SKIA_ENABLE_CPU_RENDERING")) == "1");
|
||||
CHECK(std::string(::getenv("WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS")) == "1");
|
||||
CHECK(std::string(::getenv("GDK_BACKEND")) == "x11");
|
||||
return 0;
|
||||
}
|
||||
'''
|
||||
|
||||
|
||||
def main():
|
||||
text = SOURCE.read_text(encoding="utf-8")
|
||||
flag_decl = re.search(
|
||||
r'constexpr const char\* kSoftwareRendererFlag =\s*"([^"]+)";', text)
|
||||
if not flag_decl:
|
||||
raise SystemExit("missing kSoftwareRendererFlag in webarchy_plugin.cpp")
|
||||
funcs = "\n".join(extract(name, text) for name in FUNCTIONS)
|
||||
funcs = funcs.replace('"/proc/device-tree/compatible"', 'g_compat_path')
|
||||
if '"/proc/device-tree/compatible"' in funcs:
|
||||
raise SystemExit("could not redirect the device-tree path")
|
||||
harness = HARNESS_HEAD.replace(
|
||||
"SOFTWARE_FLAG",
|
||||
'constexpr const char* kSoftwareRendererFlag = "%s";' % flag_decl.group(1))
|
||||
harness += funcs + HARNESS_MAIN
|
||||
with tempfile.TemporaryDirectory(prefix="bananarchy-webarchy-") as tmp:
|
||||
root = pathlib.Path(tmp)
|
||||
src = root / "renderer_test.cpp"
|
||||
exe = root / "renderer_test"
|
||||
compat = root / "compatible"
|
||||
home = root / "home"
|
||||
(home / ".config/sxmo").mkdir(parents=True)
|
||||
flag = home / flag_decl.group(1).lstrip("/")
|
||||
src.write_text(harness, encoding="utf-8")
|
||||
build = subprocess.run(
|
||||
["g++", "-std=c++20", "-Wall", "-Wextra", "-Werror", str(src), "-o", str(exe)],
|
||||
capture_output=True, text=True)
|
||||
if build.returncode:
|
||||
sys.stderr.write(build.stderr)
|
||||
return 1
|
||||
cases = (
|
||||
("argon", b"nokia,argon\0qcom,msm8905\0", "0", False),
|
||||
("beatles", b"nokia,beatles\0nokia,argon\0qcom,msm8905\0", "1", False),
|
||||
("argon + override", b"nokia,argon\0qcom,msm8905\0", "1", True),
|
||||
)
|
||||
for label, data, expected, override in cases:
|
||||
compat.write_bytes(data)
|
||||
if override:
|
||||
flag.write_bytes(b"1\n")
|
||||
elif flag.exists():
|
||||
flag.unlink()
|
||||
probe = subprocess.run([str(exe), str(compat), str(home), expected],
|
||||
capture_output=True, text=True)
|
||||
if probe.returncode:
|
||||
sys.stderr.write("%s: %s" % (label, probe.stderr))
|
||||
return 1
|
||||
print("[ok] renderer profile: %s" % label)
|
||||
print("webarchy renderer profile: all checks passed")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -2,7 +2,9 @@
|
||||
// Webarchy Full-Featured Web Browser DWM Plugin (webarchy.so / webarchy / xwebarchy)
|
||||
// Features:
|
||||
// 1. WPE / WebKit (webkit2gtk-4.1 + libwpe-1.0 + libwpebackend-fdo-1.0) backend
|
||||
// with hardware-accelerated compositing/WebGL/2D-canvas and 512 MB RAM tuning.
|
||||
// with hardware-accelerated compositing/WebGL/2D-canvas on the 8110 4G,
|
||||
// a software renderer profile on the 2720 Flip (and on WebProcess crash),
|
||||
// and 512 MB RAM tuning on every target.
|
||||
// 2. Default KaiOS 4.0 User-Agent:
|
||||
// Mozilla/5.0 (Mobile; rv:123.0) Gecko/123.0 Firefox/123.0 KAIOS/4.0
|
||||
// with runtime preset & custom User-Agent override persisted in ~/.config/sxmo/.
|
||||
@@ -53,6 +55,53 @@ constexpr const char* kDefaultUserAgent =
|
||||
|
||||
constexpr const char* kDefaultHomepage = "https://lite.duckduckgo.com/lite/";
|
||||
|
||||
// WebKitGTK reads WEBKIT_DISABLE_* / WEBKIT_SKIA_* variables as presence flags,
|
||||
// not as booleans. Leaving them set to "0" (as older builds did) disables the
|
||||
// DMABUF/compositing renderer while the settings object still requests
|
||||
// WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS. On the 2720 Flip's Adreno 304
|
||||
// that mismatch kills the WebProcess, and WebKit reports it on every page as
|
||||
// an "Unexpected WebKit error". The 2720 therefore starts in software mode;
|
||||
// nokia-argon and the other targets keep their hardware-accelerated profile.
|
||||
constexpr const char* kSoftwareRendererFlag =
|
||||
"/.config/sxmo/webarchy_software_renderer";
|
||||
|
||||
std::string deviceTreeCompatibles() {
|
||||
FILE* f = std::fopen("/proc/device-tree/compatible", "rb");
|
||||
if (!f) return {};
|
||||
char buf[512];
|
||||
size_t n = std::fread(buf, 1, sizeof(buf), f);
|
||||
std::fclose(f);
|
||||
std::string raw(buf, n);
|
||||
std::replace(raw.begin(), raw.end(), '\0', ' ');
|
||||
return raw;
|
||||
}
|
||||
|
||||
bool webarchySoftwareRendererPreferred() {
|
||||
if (deviceTreeCompatibles().find("nokia,beatles") != std::string::npos)
|
||||
return true;
|
||||
return ::access((getHomeDirPath() + kSoftwareRendererFlag).c_str(), F_OK) == 0;
|
||||
}
|
||||
|
||||
void configureWebkitRenderer(bool software) {
|
||||
// Presence flags: never leave them defined as "0" in the plugin's environment.
|
||||
::unsetenv("WEBKIT_DISABLE_DMABUF_RENDERER");
|
||||
::unsetenv("WEBKIT_DISABLE_COMPOSITING_MODE");
|
||||
::unsetenv("WEBKIT_SKIA_ENABLE_CPU_RENDERING");
|
||||
::setenv("GDK_BACKEND", "x11", 1);
|
||||
::setenv("GTK_THEME", "Adwaita:dark", 1);
|
||||
::setenv("NO_AT_BRIDGE", "1", 1);
|
||||
::setenv("GTK_A11Y", "none", 1);
|
||||
::setenv("WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS", "1", 1);
|
||||
if (software) {
|
||||
::setenv("WEBKIT_DISABLE_DMABUF_RENDERER", "1", 1);
|
||||
::setenv("WEBKIT_SKIA_ENABLE_CPU_RENDERING", "1", 1);
|
||||
}
|
||||
// JSC options are value-based and must not override a session setting.
|
||||
if (!::getenv("JSC_useJIT")) ::setenv("JSC_useJIT", "1", 1);
|
||||
if (!::getenv("JSC_useDFGJIT")) ::setenv("JSC_useDFGJIT", "1", 1);
|
||||
if (!::getenv("JSC_useFTLJIT")) ::setenv("JSC_useFTLJIT", "0", 1);
|
||||
}
|
||||
|
||||
struct WebarchyControls {
|
||||
char keyBack = '1';
|
||||
char keyPrevLink = '2';
|
||||
@@ -612,6 +661,8 @@ struct BrowserRuntimeState {
|
||||
WebKitSettings* wkSettings = nullptr;
|
||||
Window webkitXid = None;
|
||||
bool initialized = false;
|
||||
bool softwareRenderer = false;
|
||||
bool rendererFallback = false;
|
||||
|
||||
std::string currentUrl = kDefaultHomepage;
|
||||
std::string currentTitle = "Webarchy";
|
||||
@@ -780,8 +831,13 @@ gboolean onLoadFailed(WebKitWebView* webView,
|
||||
auto* st = static_cast<BrowserRuntimeState*>(userData);
|
||||
if (st) {
|
||||
st->isLoading = false;
|
||||
if (error && error->message) {
|
||||
st->statusMsg = std::string("Load failed: ") + error->message;
|
||||
if (error) {
|
||||
std::ostringstream oss;
|
||||
oss << "Load failed: " << (error->message ? error->message : "WebKit error");
|
||||
if (error->domain)
|
||||
oss << " [" << g_quark_to_string(error->domain) << "/" << error->code << "]";
|
||||
if (st->softwareRenderer) oss << " (software renderer)";
|
||||
st->statusMsg = oss.str();
|
||||
} else if (failingUri) {
|
||||
st->statusMsg = std::string("Failed: ") + failingUri;
|
||||
} else {
|
||||
@@ -798,7 +854,21 @@ gboolean onWebProcessTerminated(WebKitWebView* webView,
|
||||
auto* st = static_cast<BrowserRuntimeState*>(userData);
|
||||
if (st) {
|
||||
st->isLoading = false;
|
||||
st->statusMsg = "Web process restarted";
|
||||
if (!st->softwareRenderer && st->wkSettings && st->webView) {
|
||||
// A crashed WebProcess on a GPU profile is the same failure class as
|
||||
// the 2720's "Unexpected WebKit error": retry once on the CPU renderer
|
||||
// instead of leaving the user on a dead page.
|
||||
st->softwareRenderer = true;
|
||||
st->rendererFallback = true;
|
||||
configureWebkitRenderer(true);
|
||||
webkit_settings_set_hardware_acceleration_policy(
|
||||
st->wkSettings, WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER);
|
||||
st->statusMsg = "GPU renderer failed; retrying with software rendering";
|
||||
if (!st->currentUrl.empty())
|
||||
webkit_web_view_load_uri(st->webView, st->currentUrl.c_str());
|
||||
} else {
|
||||
st->statusMsg = "Web process restarted";
|
||||
}
|
||||
}
|
||||
(void)webView;
|
||||
return TRUE;
|
||||
@@ -824,18 +894,12 @@ void ensureAlsaMultimediaRouting() {
|
||||
bool initBrowserEngine(BrowserRuntimeState& st, const std::string& userAgent) {
|
||||
if (st.initialized) return true;
|
||||
|
||||
// Hardware acceleration & Cortex-A7 / 512 MB RAM environment tuning
|
||||
::setenv("GDK_BACKEND", "x11", 1);
|
||||
::setenv("GTK_THEME", "Adwaita:dark", 1);
|
||||
::setenv("NO_AT_BRIDGE", "1", 1);
|
||||
::setenv("GTK_A11Y", "none", 1);
|
||||
::setenv("WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS", "1", 1);
|
||||
::setenv("WEBKIT_DISABLE_COMPOSITING_MODE", "0", 0);
|
||||
::setenv("WEBKIT_DISABLE_DMABUF_RENDERER", "0", 0);
|
||||
::setenv("WEBKIT_SKIA_ENABLE_CPU_RENDERING", "0", 0);
|
||||
::setenv("JSC_useJIT", "1", 0);
|
||||
::setenv("JSC_useDFGJIT", "1", 0);
|
||||
::setenv("JSC_useFTLJIT", "0", 0);
|
||||
// Hardware acceleration & Cortex-A7 / 512 MB RAM environment tuning.
|
||||
// The renderer profile is chosen per device (and can be forced by the user
|
||||
// with ~/.config/sxmo/webarchy_software_renderer). It is also switched to
|
||||
// software after the first WebProcess crash, see onWebProcessTerminated().
|
||||
st.softwareRenderer = webarchySoftwareRendererPreferred();
|
||||
configureWebkitRenderer(st.softwareRenderer);
|
||||
|
||||
// Touch libwpe symbol so linker keeps libwpe-1.0 loaded for WPE backend support
|
||||
(void)wpe_loader_get_loaded_implementation_library_name();
|
||||
@@ -940,7 +1004,8 @@ bool initBrowserEngine(BrowserRuntimeState& st, const std::string& userAgent) {
|
||||
webkit_settings_set_minimum_font_size(s, 9);
|
||||
|
||||
webkit_settings_set_hardware_acceleration_policy(
|
||||
s, WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS);
|
||||
s, st.softwareRenderer ? WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER
|
||||
: WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS);
|
||||
webkit_settings_set_enable_webgl(s, TRUE);
|
||||
webkit_settings_set_enable_smooth_scrolling(s, FALSE);
|
||||
webkit_settings_set_enable_page_cache(s, TRUE);
|
||||
|
||||
Reference in new issue
Block a user