forked from upstream/atlas-wpe-backend
Compare commits
8
Commits
pre3-lowmem
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5904d54340 | ||
|
|
59ede96a15 | ||
|
|
273d1f7e05 | ||
|
|
40cf1e4fbe | ||
|
|
3a58c0b504 | ||
|
|
8c444f2676 | ||
|
|
34848ff8ad | ||
|
|
27d2a4defd |
No files matched your search
@@ -78,6 +78,45 @@ fully offscreen (`EGL_KHR_surfaceless_context` + FBO, or a pbuffer). This decide
|
||||
surfaceless/FBO is strongly preferred; if WebKit insists on a window surface we provide a 1x1
|
||||
pbuffer-config window or the device fbdev native window and still read back via an FBO.
|
||||
|
||||
## The "GPU wedge" (atlas-wpe-env#3) — root cause, fixed 2026-08-23
|
||||
|
||||
The hang tracked as [atlas-wpe-env#3](https://github.com/Herrie82/atlas-wpe-env/issues/3) — after
|
||||
GPU-heavy work (site menus, rotation, a few minutes of navigation) no page ever loads again, the
|
||||
BrowserServer main thread sits in `futex_wait_queue_me` / `__skb_recv_datagram`, the WPEWebProcess is
|
||||
idle — was never a GPU hang. It was three bugs on the UIProcess (BrowserServer) side — two in this file's
|
||||
**frame channel**, one in BrowserPageWPE.cpp:
|
||||
|
||||
1. **Stale close of the fd handed to WebKit.** `view_get_renderer_host_fd()` returns one end of a
|
||||
`socketpair`. WebKit wraps the return value `UnixFileDescriptor::Adopt` (`PageClientImpl::
|
||||
hostFileDescriptor()`), ships it to the WebProcess and **closes it** — on another thread, within
|
||||
milliseconds. The backend kept the number and closed it again when the first frame arrived. By then
|
||||
the number had been reused (strace on-device: the very next `socketpair` got it back 80 ms later),
|
||||
so that close hit a live fd — another channel's `sock_ui`, or a WebKit IPC socket. The channel's
|
||||
`g_unix_fd_add` source then polled a foreign socket: a blocking `recv()` racing the IPC thread parks
|
||||
the main loop in `__skb_recv_datagram`; a stolen IPC datagram leaves a sync reply that never comes
|
||||
(`futex_wait_queue_me`); a closed IPC socket looks to WebKit like a crashed WebProcess, so it spawns
|
||||
replacements while BS stays stuck. Fix: the returned end is WebKit's — never touched again; the
|
||||
channel is reaped on HUP/EOF; `recv()` is `MSG_DONTWAIT`.
|
||||
2. **Unread FRAME_ACK backlog.** The UIProcess answered every frame with an ack that the WebProcess
|
||||
never read. Unread datagrams stay charged to the *sender's* socket buffer, so after a few hundred
|
||||
frames on one page (an animated menu, a video, a long scroll session) the blocking `send(ack)`
|
||||
parked the main loop forever — right after a perfectly good frame, which is exactly how the wedge
|
||||
presented. Fix: the WebProcess drains acks before each FRAME_READY and the ack send is
|
||||
`MSG_DONTWAIT`.
|
||||
|
||||
3. **SIGUSR1 stolen from JavaScriptCore** (`BrowserPageWPE.cpp`, not this file). A debug trigger for
|
||||
the autonomous scroll test did `g_unix_signal_add(SIGUSR1, …)` once a page was live. WTF/JSC uses
|
||||
SIGUSR1 (`sigThreadSuspendResume`) to suspend threads for conservative GC stack scanning, and glib's
|
||||
`sigaction` replaced WTF's handler. The next concurrent GC of the UIProcess JSC VM (the one behind
|
||||
`webkit_web_view_evaluate_javascript`'s JSCValues) then hung the collector in `Thread::suspend →
|
||||
sem_wait(globalSemaphoreForSuspendResume)` waiting for a handler that no longer ran, and the main
|
||||
thread's next heap entry parked in `JSC::Heap::acquireAccessSlow` — the `futex_wait_queue_me` wedge
|
||||
caught on-device 2026-08-23 *after* fixes 1+2 were in. Fix: the SIGUSR1 hook is gone (the
|
||||
`/tmp/atlas_scrolltest` file trigger remains). Nothing else in the engine may take SIGUSR1; if it ever
|
||||
must, set `JSC_SIGNAL_FOR_GC=<signo>` in the boot wrapper instead.
|
||||
|
||||
None of this needs the watchdog that used to abort+respawn the engine; that watchdog is off (0.9.10).
|
||||
|
||||
## Build
|
||||
|
||||
`libWPEBackend-atlas.so`, linked against `libwpe-1.0`, `libEGL`/`libGLESv2` (stubs at build,
|
||||
|
||||
+48
-16
@@ -22,7 +22,6 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/fb.h>
|
||||
#include <sys/time.h>
|
||||
#include <glib-unix.h> // g_unix_signal_add — SIGUSR1 kicks the autonomous scroll test
|
||||
#include <sys/socket.h> // atlas-sensord Unix-socket client (DeviceOrientation/Motion)
|
||||
#include <sys/un.h>
|
||||
#include <cstring>
|
||||
@@ -131,8 +130,7 @@ static inline bool bpwpe_dead(BrowserPageWPE* p) { return g_livePages.find(p) ==
|
||||
struct ScrollTestState { bool active; int cy, dir, step, maxCy, steps, renders, uncovered; long maxStallMs; guint tick; };
|
||||
static ScrollTestState g_st = {false,0,1,120,0,0,0,0,0,0};
|
||||
static BrowserPageWPE* g_testablePage = nullptr; // last page to attach buffers = the scroll-test target
|
||||
static gboolean on_sigusr1(gpointer); // fwd
|
||||
static gboolean scrolltest_poll(gpointer); // fwd — file trigger (app-spawned BS masks SIGUSR1)
|
||||
static gboolean scrolltest_poll(gpointer); // fwd — file trigger for the autonomous tests
|
||||
|
||||
BrowserPageWPE::BrowserPageWPE(BrowserServer* server, YapProxy* proxy)
|
||||
: m_server(server), m_proxy(proxy), m_identifier(0)
|
||||
@@ -895,6 +893,27 @@ void BrowserPageWPE::ensureWebView()
|
||||
WLOG("ensureWebView layout %dx%d -> render %dx%d (screen=%d contentZoom=%.3f)",
|
||||
renderW, renderH, m_renderWidth, m_renderHeight, screenW, (double)m_renderWidth/renderW);
|
||||
|
||||
/* VIEWPORT vs PAN BUFFER. renderH above is a PAINT extent (~4 screens) that the adapter pans
|
||||
* within — it is not what the user can see. WebKit, left alone, uses the view height as the initial
|
||||
* containing block, so a quirks-mode `height: 100%` layout (the classic centring table, e.g.
|
||||
* home.jonandnic.com) resolves 100% to ~3072px and puts its "centred" content about a screen and a
|
||||
* half below the fold. That is the "pages load halfway down" bug.
|
||||
*
|
||||
* Tell the WebProcess the real screen height so it can cap the ICB to one screen while still
|
||||
* painting the whole buffer (WebCore/rendering/RenderView.cpp, atlasICBHeightCap()). Only meaningful
|
||||
* when the buffer is actually taller than the screen; mult=1 needs no cap.
|
||||
*
|
||||
* setenv, not IPC: the WebProcess inherits our environment at spawn, and the engine runs
|
||||
* WEBKIT_USE_SINGLE_WEB_PROCESS=1, so this is read once by the one process that matters. screenH
|
||||
* comes from luna.conf DisplayHeight, which does not change on rotate (only the width does), so the
|
||||
* value stays correct for the life of the process. */
|
||||
if (screenH > 0 && renderH > screenH) {
|
||||
char icb[16];
|
||||
snprintf(icb, sizeof(icb), "%d", screenH);
|
||||
setenv("ATLAS_ICB_HEIGHT", icb, 1);
|
||||
WLOG("ICB height capped to screen: ATLAS_ICB_HEIGHT=%d (buffer %d)", screenH, renderH);
|
||||
}
|
||||
|
||||
m_viewBackend = wpe_atlas_view_backend_create(renderW, renderH, scaledW, scaledH,
|
||||
&BrowserPageWPE::onFrame, this);
|
||||
WebKitWebViewBackend* vb = webkit_web_view_backend_new(m_viewBackend, nullptr, nullptr);
|
||||
@@ -918,12 +937,15 @@ void BrowserPageWPE::ensureWebView()
|
||||
}
|
||||
|
||||
/* This page has a live WebView -> it's the scroll-test target (NOT a startPage/tab that only
|
||||
* attached buffers with screenH=0). Install the trigger once (poll works despite masked SIGUSR1). */
|
||||
* attached buffers with screenH=0). Install the file-trigger poll once. NO SIGUSR1 hook here:
|
||||
* WTF/JSC uses SIGUSR1 to suspend threads for conservative GC scanning, and g_unix_signal_add()
|
||||
* replaced that handler — the collector then waited forever for the main thread to answer and the
|
||||
* main thread deadlocked on the heap (JSC::Heap::acquireAccessSlow). That was one of the two
|
||||
* "GPU wedge" (#3) mechanisms. */
|
||||
g_testablePage = this;
|
||||
static bool s_testInstalled = false;
|
||||
if (!s_testInstalled) {
|
||||
s_testInstalled = true;
|
||||
g_unix_signal_add(SIGUSR1, on_sigusr1, nullptr);
|
||||
g_timeout_add(700, scrolltest_poll, nullptr);
|
||||
}
|
||||
|
||||
@@ -2380,22 +2402,14 @@ void BrowserPageWPE::updateContentsSize()
|
||||
-1, nullptr, nullptr, nullptr, &BrowserPageWPE::onContentHeight, this);
|
||||
}
|
||||
|
||||
/* ===================== autonomous scroll test (SIGUSR1) ===================== */
|
||||
/* ===================== autonomous scroll test (file trigger) ===================== */
|
||||
static gboolean scrolltest_tick(gpointer)
|
||||
{
|
||||
if (!g_testablePage || g_livePages.find(g_testablePage) == g_livePages.end()) { g_st.active = false; return G_SOURCE_REMOVE; }
|
||||
return g_testablePage->scrollTestStep() ? G_SOURCE_CONTINUE : G_SOURCE_REMOVE;
|
||||
}
|
||||
static gboolean on_sigusr1(gpointer)
|
||||
{
|
||||
if (g_testablePage && g_livePages.find(g_testablePage) != g_livePages.end() && !g_st.active)
|
||||
g_testablePage->startScrollTest();
|
||||
else
|
||||
WLOG("SIGUSR1: no testable page (or a test is already running)");
|
||||
return G_SOURCE_CONTINUE; /* keep the handler for repeated runs */
|
||||
}
|
||||
/* File trigger: the host `touch`es /tmp/atlas_scrolltest; polled on the glib loop (which is clearly
|
||||
* dispatching — frames render), so it works even though the app-spawned BS has SIGUSR1 masked. */
|
||||
/* File trigger: the host `touch`es /tmp/atlas_scrolltest; polled on the glib loop. (There used to be a
|
||||
* SIGUSR1 trigger too — removed: SIGUSR1 belongs to JSC's GC thread-suspend, see ensureWebView.) */
|
||||
static gboolean scrolltest_poll(gpointer)
|
||||
{
|
||||
if (access("/tmp/atlas_scrolltest", F_OK) == 0) {
|
||||
@@ -2747,6 +2761,24 @@ static gboolean atlas_img_decide_dest(WebKitDownload* dl, gchar*, gpointer ud) {
|
||||
webkit_download_set_destination(dl, static_cast<AtlasImgDl*>(ud)->dest.c_str()); return TRUE;
|
||||
}
|
||||
|
||||
/* Clear the resource caches of every live page. Replaces QWebSettings::clearMemoryCaches(), which
|
||||
* does not exist in this port (QtWebKit is headers-only here, so the call linked to address 0 and
|
||||
* crashed). WPE 2.0 routes cache clearing through the network session's website-data manager. */
|
||||
void BrowserPageWPE::clearAllCaches()
|
||||
{
|
||||
for (BrowserPageWPE* p : g_livePages) {
|
||||
if (!p || !p->m_webView) continue;
|
||||
WebKitNetworkSession* session = webkit_web_view_get_network_session(p->m_webView);
|
||||
if (!session) continue;
|
||||
WebKitWebsiteDataManager* mgr = webkit_network_session_get_website_data_manager(session);
|
||||
if (!mgr) continue;
|
||||
webkit_website_data_manager_clear(mgr,
|
||||
static_cast<WebKitWebsiteDataTypes>(WEBKIT_WEBSITE_DATA_MEMORY_CACHE | WEBKIT_WEBSITE_DATA_DISK_CACHE),
|
||||
0, nullptr, nullptr, nullptr);
|
||||
}
|
||||
WLOG("clearAllCaches: cleared memory+disk cache for %zu live page(s)", g_livePages.size());
|
||||
}
|
||||
|
||||
void BrowserPageWPE::saveImageAtPointAsync(int32_t queryNum, int32_t x, int32_t y, const char* dir)
|
||||
{
|
||||
m_saveImgQuery = queryNum;
|
||||
|
||||
@@ -158,6 +158,11 @@ public:
|
||||
* the image asynchronously and answer via m_server->msgHitTestResponse / msgSaveImageAtPointResponse. */
|
||||
void hitTestAsync(int32_t queryNum, int32_t cx, int32_t cy);
|
||||
void saveImageAtPointAsync(int32_t queryNum, int32_t x, int32_t y, const char* dir);
|
||||
/* BrowserServer::clearCache() used QWebSettings::clearMemoryCaches(), a QtWebKit call with no
|
||||
* library behind it in the WPE port - it linked to address 0 and SIGSEGV'd the engine. Reached
|
||||
* from Preferences > Clear Cache, the asyncCmdClearCache IPC, AND automatically on a device
|
||||
* locale change. Clears every live page's caches through the WPE 2.0 website-data manager. */
|
||||
static void clearAllCaches();
|
||||
void respondSaveImage(int32_t query, bool ok, const char* path); // Feature 9: called from the image-download callback
|
||||
/* A payload starting with \x02 is an AUTOFILL request ("\x02" user "\x02" pass), routed through this
|
||||
* existing command to avoid new IPC. Otherwise it's a plain InsertText into the focused field. */
|
||||
|
||||
@@ -1,8 +1,27 @@
|
||||
#!/bin/bash
|
||||
# Cross-compile the Atlas WPE backend to libWPEBackend-atlas.so (musl/ARM softfp).
|
||||
set -e
|
||||
WPE=/home/herrie/webos/wpe; . "${WPE_ENV:-$WPE/env-glibc-gcc125.sh}"
|
||||
cd "$WPE/backend-atlas"
|
||||
# Toolchain env. Honour an already-sourced cross environment (STAGING/CC/TARGET exported); otherwise
|
||||
# source one. WPE_ENV overrides; the default sits next to this checkout so the script works from any
|
||||
# clone rather than only from the tree it was written in.
|
||||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
if [ -z "${STAGING:-}" ] || [ -z "${CC:-}" ]; then
|
||||
ENV_SH="${WPE_ENV:-$SCRIPT_DIR/../atlas-wpe-env/env-atlas-cross.sh}"
|
||||
[ -f "$ENV_SH" ] || { echo "build.sh: no cross env found at $ENV_SH - source it first or set WPE_ENV" >&2; exit 1; }
|
||||
. "$ENV_SH"
|
||||
fi
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
# pkg-config: wpe-1.0/egl/glesv2/glib live in the staged webkitdeps tree (Debian multiarch layout),
|
||||
# not in $STAGING/lib/pkgconfig, so the plain cross env does not resolve them. Mirror what
|
||||
# cmake/atlas-arm-toolchain.cmake sets so this builds against exactly what WebKit built against -
|
||||
# and never against the host's /usr.
|
||||
if ! pkg-config --exists wpe-1.0 2>/dev/null; then
|
||||
WKDEPS="${ATLAS_WEBKITDEPS:-$STAGING/webkitdeps}"
|
||||
export PKG_CONFIG_SYSROOT_DIR="$WKDEPS"
|
||||
export PKG_CONFIG_LIBDIR="$WKDEPS/usr/lib/arm-linux-gnueabihf/pkgconfig:$WKDEPS/usr/share/pkgconfig:$STAGING/lib/pkgconfig"
|
||||
unset PKG_CONFIG_PATH
|
||||
fi
|
||||
PKGS="wpe-1.0 glib-2.0 egl glesv2"
|
||||
CF=$(pkg-config --cflags $PKGS)
|
||||
LF=$(pkg-config --libs $PKGS)
|
||||
@@ -17,6 +36,12 @@ echo " exports _wpe_loader_interface: $($TARGET-nm -D libWPEBackend-atlas.so |
|
||||
echo " NEEDED: $($TARGET-readelf -d libWPEBackend-atlas.so | grep -oE '\[lib[^]]+\]' | tr '\n' ' ')"
|
||||
|
||||
echo "=== building frame-dump test harness ==="
|
||||
# Optional: needs wpe-webkit-2.0 + libpng16 staged. The backend itself is the deliverable, so a
|
||||
# missing harness dependency must not fail the build.
|
||||
if ! pkg-config --exists wpe-webkit-2.0 libpng16 2>/dev/null; then
|
||||
echo " skipped (wpe-webkit-2.0/libpng16 not in PKG_CONFIG_LIBDIR)"
|
||||
exit 0
|
||||
fi
|
||||
HCF=$(pkg-config --cflags wpe-webkit-2.0 wpe-1.0 glib-2.0 libpng16)
|
||||
HLF=$(pkg-config --libs wpe-webkit-2.0 glib-2.0 libpng16)
|
||||
$CC $CFLAGS -std=gnu11 -Wall $HCF \
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
--- a/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp
|
||||
+++ b/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp
|
||||
@@ ogg block closing brace, before "if (matroskaSupported)" @@
|
||||
if (auto result = factories.hasElementForMediaType(ElementFactories::Type::VideoDecoder, "video/x-theora"_s)) {
|
||||
m_decoderMimeTypeSet.add("video/ogg"_s);
|
||||
m_decoderCodecMap.add("theora"_s, result);
|
||||
@@ -687,6 +687,24 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,3 +23,5 @@
|
||||
+ }
|
||||
+
|
||||
if (matroskaSupported) {
|
||||
m_decoderMimeTypeSet.add("video/x-matroska"_s);
|
||||
|
||||
+32
-25
@@ -104,7 +104,7 @@ static struct atlas_view* g_atlas_views = NULL; /* P2 wpe->view registry (few
|
||||
* (which stalled loads with "bad SETUP" after a cross-site jump). Lives until its process exits. */
|
||||
struct atlas_conn {
|
||||
struct atlas_view* v;
|
||||
int sock_ui, sock_web;
|
||||
int sock_ui; /* our end. The peer end is handed to WebKit in view_get_renderer_host_fd and is not ours */
|
||||
guint io_source;
|
||||
};
|
||||
|
||||
@@ -192,46 +192,49 @@ static int view_get_renderer_host_fd(void* data)
|
||||
}
|
||||
struct atlas_conn* c = (struct atlas_conn*)calloc(1, sizeof(*c));
|
||||
if (!c) { close(sv[0]); close(sv[1]); return -1; }
|
||||
c->v = v; c->sock_ui = sv[0]; c->sock_web = sv[1];
|
||||
c->v = v; c->sock_ui = sv[0];
|
||||
|
||||
/* tell THIS WebProcess where the shared frame buffer is (+ the fit-to-screen output size) */
|
||||
struct atlas_msg m = { .type = MSG_SETUP, .shmid = (uint32_t)v->shmid,
|
||||
.width = v->width, .height = v->height, .slot = 0,
|
||||
.swidth = v->swidth, .sheight = v->sheight };
|
||||
if (send(c->sock_ui, &m, sizeof(m), 0) != (ssize_t)sizeof(m))
|
||||
if (send(c->sock_ui, &m, sizeof(m), MSG_NOSIGNAL) != (ssize_t)sizeof(m))
|
||||
ATLAS_LOG("send(SETUP) failed: %s", strerror(errno));
|
||||
|
||||
/* receive THIS process's MSG_FRAME_READY on the UIProcess main loop */
|
||||
c->io_source = g_unix_fd_add(c->sock_ui, G_IO_IN | G_IO_HUP | G_IO_ERR, atlas_view_on_readable, c);
|
||||
c->io_source = g_unix_fd_add(c->sock_ui, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL, atlas_view_on_readable, c);
|
||||
|
||||
/* Keep OUR sock_web open for now — WebKit dup()s the returned fd for the WebProcess
|
||||
* (asynchronously), so closing it here would hand the process a dead fd (kills even the 1st
|
||||
* load). It's dropped in atlas_view_on_readable on the process's FIRST message (which proves the
|
||||
* dup already happened), so the socketpair can then HUP on process exit and reap the conn. */
|
||||
return c->sock_web;
|
||||
/* sv[1] now belongs to WebKit: PageClientImpl::hostFileDescriptor() ADOPTS it, sends it to the
|
||||
* WebProcess and closes it (another thread, within ms). Closing it here later — as the old
|
||||
* "close sock_web on first frame" did — closed whatever had since reused the number (another
|
||||
* channel's sock_ui, a WebKit IPC socket): the main loop then parked in recv()/a lost IPC reply.
|
||||
* That was the GPU "wedge" (atlas-wpe-env#3). The pair still HUPs when the WebProcess exits. */
|
||||
return sv[1];
|
||||
}
|
||||
|
||||
static gboolean atlas_view_on_readable(gint fd, GIOCondition cond, gpointer data)
|
||||
{
|
||||
struct atlas_conn* c = (struct atlas_conn*)data;
|
||||
struct atlas_view* v = c->v;
|
||||
if (cond & (G_IO_HUP | G_IO_ERR)) { /* this WebProcess exited — drop its channel */
|
||||
if (c->sock_ui >= 0) close(c->sock_ui);
|
||||
if (c->sock_web >= 0) close(c->sock_web);
|
||||
if (cond & G_IO_NVAL) { free(c); return G_SOURCE_REMOVE; } /* fd already closed — not ours to close again */
|
||||
|
||||
/* Drain what is readable first (a HUP can arrive together with the last frame), never blocking
|
||||
* the UI main loop; drop the channel on EOF/error, or on HUP/ERR once nothing is left to read. */
|
||||
struct atlas_msg m;
|
||||
ssize_t n = recv(fd, &m, sizeof(m), MSG_DONTWAIT);
|
||||
if (n < 0 && (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)) {
|
||||
if (!(cond & (G_IO_HUP | G_IO_ERR))) return G_SOURCE_CONTINUE;
|
||||
n = 0; /* HUP with the queue drained: treat as EOF */
|
||||
}
|
||||
if (n <= 0) { /* this WebProcess exited (or the fd is bad) */
|
||||
int e = n < 0 ? errno : 0;
|
||||
if (e) ATLAS_LOG("frame channel fd %d: %s — dropping channel", fd, strerror(e));
|
||||
if (e != EBADF) close(c->sock_ui);
|
||||
free(c);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
struct atlas_msg m;
|
||||
ssize_t n = recv(fd, &m, sizeof(m), 0);
|
||||
if (n != (ssize_t)sizeof(m)) return G_SOURCE_CONTINUE;
|
||||
|
||||
/* First real message proves WebKit already dup'd sock_web into the WebProcess, so drop OUR ref
|
||||
* to it now (race-free: the process has its own copy). Without this the kept-open sock_web pins
|
||||
* the socketpair so it never HUPs -> the conn (FD + io_source) leaks on every cross-site PSON
|
||||
* spawn; this lets the pair HUP when the process exits, reaping the channel. */
|
||||
if (c->sock_web >= 0) { close(c->sock_web); c->sock_web = -1; }
|
||||
|
||||
if (m.type == MSG_FRAME_READY && v->shm && v->handler) {
|
||||
uint32_t slot = m.slot % SLOTS;
|
||||
/* Slot addressing uses the LAYOUT size (allocation granularity); the frame's ACTUAL size
|
||||
@@ -244,7 +247,7 @@ static gboolean atlas_view_on_readable(gint fd, GIOCondition cond, gpointer data
|
||||
wpe_view_backend_dispatch_frame_displayed(v->wpe);
|
||||
|
||||
struct atlas_msg ack = { .type = MSG_FRAME_ACK, 0, 0, 0, slot };
|
||||
send(fd, &ack, sizeof(ack), 0);
|
||||
send(fd, &ack, sizeof(ack), MSG_DONTWAIT | MSG_NOSIGNAL);
|
||||
}
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
@@ -459,6 +462,7 @@ static void target_destroy(void* d)
|
||||
{
|
||||
struct atlas_target* t = (struct atlas_target*)d;
|
||||
if (t->shm && t->shm != (void*)-1) shmdt(t->shm);
|
||||
if (t->host_fd >= 0) close(t->host_fd); /* ours: WebKit passed hostFD.release() */
|
||||
free(t->scratch);
|
||||
free(t->ds_scratch);
|
||||
free(t);
|
||||
@@ -1283,12 +1287,15 @@ static void target_frame_rendered(void* d)
|
||||
rw, rh, _rb, _iv, _iv ? 1000000.0 / _iv : 0.0, s_bgra_readback);
|
||||
} _pn++; }
|
||||
_plast = _pt1;
|
||||
/* Drain the UIProcess's FRAME_ACKs. Nobody waits on them, but unread datagrams stay charged
|
||||
* to the SENDER's buffer, so left alone they fill it after a few hundred frames and the
|
||||
* BrowserServer's ack send() would block its main loop forever (the "wedge after a good frame"). */
|
||||
{ struct atlas_msg a; while (recv(t->host_fd, &a, sizeof(a), MSG_DONTWAIT) > 0) {} }
|
||||
struct atlas_msg m = { .type = MSG_FRAME_READY, .width = rw, .height = rh, .slot = t->cur_slot };
|
||||
send(t->host_fd, &m, sizeof(m), 0);
|
||||
send(t->host_fd, &m, sizeof(m), MSG_NOSIGNAL);
|
||||
t->cur_slot = (t->cur_slot + 1) % SLOTS;
|
||||
}
|
||||
/* let WebKit proceed to the next frame (into the other slot). With double-buffering we don't
|
||||
* wait for the UIProcess ack here; drain acks opportunistically for flow control if needed. */
|
||||
/* let WebKit proceed to the next frame (into the other slot); we don't wait for the ack. */
|
||||
wpe_renderer_backend_egl_target_dispatch_frame_complete(t->wpe);
|
||||
}
|
||||
static void target_deinitialize(void* d) { (void)d; }
|
||||
|
||||
Reference in new issue
Block a user