Commit Graph
20 Commits
Author SHA1 Message Date
NotAlexNoyle b584f8f5ce npapi plugin pull frame
Jihad Browser — pull the NPAPI plugin from the daemon's clock instead of sampling it.

WHY. Patch 0028 made card delivery 1:1 with the plugin but left TWO clocks running: the plugin
child re-posts its own repaint task 16 ms AFTER its work finishes, so its period is 16+work and
drifts, while the daemon ticks on its own timer. A frame landing just after maybePaint() waits a
whole tick, and since neither clock is locked to the other that wait varies frame to frame.
Device-measured with 0028 alone on a 30 fps SWF: 1:1 delivery, deferred=0, a healthy 29-32 fps
average — and a gap spread of 9-62 ms around a 33 ms target. That spread is the "smoother in the
stock browser" report, and the average cannot see it.

WHAT IT DOES. A new async parent->child JihadRequestFrame; the child answers it with its existing
JihadPalmRepaintTick(). The child's own timer stands down while host requests keep arriving, on a
LEASE rather than a latch — the daemon can stop asking at any moment (card backgrounded,
navigation, daemon stopped or crashed) and a latched plugin would then never paint again. The
daemon asks once per whole-tick grid slot and never stacks a second request while one is
outstanding. The parent exports jihad_plugin_request_frame(), weak-linked exactly like
jihad_plugin_frame_seq (0028), over a file-static list of live PluginInstanceParent actors; the
dtor leaves that list FIRST, because anything below it can spin the loop and a request delivered
to a half-destroyed actor is a use-after-free rather than a dropped frame.

MEASURED, AND IT IS NOT YET A WIN — read this before building on it. Device 2026-08-10, clean
restarts of jihad-anim.swf at JIHAD_TICK_MS=16:

                     0028 (sample)        0029 (pull)
  daemon done        29.4-31.9 fps        32.8-34.0 fps
  frame gap avg      31-34 ms             29-30 ms
  frame gap max      47-62 ms             45-55 ms
  gap hist <16 ms    1-4 of ~60           5-8 of ~68     <-- WORSE
  deferred           0                    0

Average and max improve; the HISTOGRAM gets flatter, which is the metric that matters. Two
measured reasons, and the instrumentation that found them is part of this patch:

1. THE LEASE FLAPPED. The daemon waits kJihadPluginReqTimeoutMs (250 ms) before re-asking for a
   late frame, but the lease was 150 ms — SHORTER — so one late frame dropped it and the child's
   timer restarted. The child logged HOST -> SELF -> HOST and the invalidate count split almost
   exactly in half. Fixed by an invariant rather than a tuned number: lease > request timeout +
   one grid period + margin. Verified: one "-> HOST" and no fallback for a whole run.
2. PATCH 0026's FOUNDING PREMISE IS FALSE, and this is the important one. With the lease fixed,
   1344 host requests still did not account for 2662 invalidates. Splitting the counter at the
   funnel by whether JihadPalmRepaintTick is on the stack gives hostinval ~27/s against
   plugininval ~22/s: THE PLUGIN INVALIDATES ITSELF CONSTANTLY. Three sessions believed otherwise
   because gJihadNPNInvalidateRectCalls — the counter 0026 reads — only sees calls that bind the
   NPN_InvalidateRect SYMBOL, while an ordinary NPAPI plugin calls through the NPNetscapeFuncs
   table into PluginModuleChild::_invalidaterect (:986, :1302-1310), which never touches the
   interpose. It can read 0 forever while the plugin invalidates 22 times a second.

So the remaining defect is TWO PRODUCERS BEATING, ours and Flash's, funnelled into one coalescing
path (~49 invalidates/s collapsing to ~32 draws/s). Whether this message should exist at all for a
self-invalidating plugin is open. The next experiment needs one more child-side kill switch:
JIHAD_PLUGIN_FRAME_MS=0 stops the pull but lets the lease expire and the timer take over, which is
just 0026 again.

Also here: the per-call-site draw counters (`show req:`) that made all of the above visible, and
that refuted the first hypothesis — the RecvUpdateBackground paths measured exactly zero.

Imported from build/desktop/patches/0029-npapi-plugin-pull-frame.patch.
2026-11-03 08:53:29 -05:00
NotAlexNoyle 48e5976b68 npapi plugin frame seq
Jihad Browser — export a plugin frame counter so the embedder can be 1:1 with the plugin.

WHY. The daemon's only signal that something changed is PuppetWidget's sticky dirty boolean,
and the refresh driver and ordinary page damage set the same flag, so "there is damage" cannot
answer "did the plugin draw again". With no way to tell a new plugin frame from a repeat, BOTH
publish policies are wrong, and both were measured on device 2026-08-10 with a 30 fps SWF:
publishing on every dirty tick sent ~78 card frames for ~60 plugin frames (duplicates, and
deferred 22-44 because the adapter could not drain that rate), while pacing on a fixed 33 ms
grid sent ~57 for ~68 and DROPPED frames, so the animation stepped two positions at once.

The stock webOS host never had to choose: PluginViewPalm pulls the plugin synchronously inside
the page paint, so it is 1:1 by construction. This counter is the minimum needed to get the same
property while still sampling: the daemon compares it against the value it saw at its last
publish. Measured with it: done=91 against palm draw=92, deferred=0.

Weak-linked on the daemon side exactly like jihad_offscreen_take_dirty, so a libxul without it
degrades to the old dirty-flag behaviour rather than failing to load.

Imported from build/desktop/patches/0028-npapi-plugin-frame-seq.patch.
2026-11-03 08:53:29 -05:00
NotAlexNoyle a7612a322e npapi webos plugin input
Jihad Browser — webOS NPAPI plugin INPUT, the frozen plugin YAP commands, and the frame path
that makes ANIMATED plugin content run (addons R7).

Applies on top of 0005, 0008 and 0016-0023. Supersedes the earlier 0024, which carried only the
input half.

── INPUT ───────────────────────────────────────────────────────────────────────────────────
1. npapi.h — NPEvent becomes Palm's real 48-byte event union on a headless XP_UNIX build
   instead of `typedef void*`. That typedef was not a harmless placeholder: NPRemoteEvent is a
   raw memcpy of sizeof(NPEvent), so the parent shipped four bytes of its own address space to
   the child. No event could ever have carried a payload. With a real POD the stock
   NPP_HandleEvent path carries a Palm event unmodified, with no paramtraits change.
2. nsPluginInstanceOwner.cpp — ProcessEvent gains the arm this toolkit never had. Its whole
   body was inside XP_MACOSX / XP_WIN / MOZ_X11, so on cairo-headless it reduced to
   `return eIgnore` and a windowless plugin got nothing for its entire lifetime. Mouse maps to
   npPalmPen{Down,Up,Move,Click,DoubleClick}, keys to npPalmKey{Down,Up,Press}, focus/blur to
   the npPalmSystemEvent pair, reusing the MOZ_X11 arm's plugin-local coordinate recipe and
   adding no zoom or scroll arithmetic of its own — which is what makes plugin input land where
   page content does.
3. PluginInstanceChild.{cpp,h} — drops the truncated private JihadNpPalm* mirrors for that
   NPEvent, asserts every offset against the libWebKitLuna address it was read from, and adds a
   capped input-delivery breadcrumb.
4. nsPluginHost.{cpp,h} — jihad_plugin_palm_spotlight, a MOZ_EXPORT'd C entry point (the
   jihad_offscreen_* precedent) so the daemon can deliver npPalmSpotlightStart/EndEvent for the
   frozen asyncCmdPluginSpotlight* commands. nsNPAPIPluginInstance::HandleEvent is neither
   exported nor virtual, so there is no other route.

── ANIMATION ───────────────────────────────────────────────────────────────────────────────
5. nsPluginInstanceOwner.cpp — the windowless invalidate now names the PLUGIN's box instead of
   the whole widget. 0021 invalidated nearest->GetBounds() on the reasoning that the daemon
   repainted everything anyway; once the daemon learned to repaint only damaged rows, that
   reasoning inverted and a full-viewport damage box forced the expensive path on every frame.
6. PuppetWidget.{cpp,h} — accumulate the bounding box of everything invalidated since the last
   drain, exposed as jihad_offscreen_take_dirty_rect beside the existing flag, so the daemon can
   repaint 320x240 (~2 ms) instead of the whole viewport (~38 ms).
7. PluginInstanceChild.cpp — the Palm draw event always covers the WHOLE plugin surface. The
   PGContext is built for the full surface, so pairing it with a dstBuffer offset into the
   middle of that surface made the plugin's blit run off the end — SIGBUS in the plugin child
   the moment the host started sending partial invalidations. Palm's own host never sent a
   partial rect either.
8. PluginInstanceParent.cpp — a bounded RecvShow frame-rate line, so the rate frames actually
   cross the process boundary can be compared against the rate the plugin was asked to draw.

Device-measured with a purpose-built 30fps SWF (render/goanna/test/make-anim-swf.py): the
plugin draws at 27-31 fps, every frame crosses IPC, and the card composites at 28.3 fps with an
average frame gap of 31-35 ms. Before this work the same content drew at 30 fps inside the
plugin and reached the screen 5 times in 25 seconds.

Imported from build/desktop/patches/0024-npapi-webos-plugin-input.patch.
2026-11-03 08:53:29 -05:00
NotAlexNoyle e4c5e03f09 npapi recvshow copy frameid
(no description in the patch)

Imported from build/desktop/patches/0022-npapi-recvshow-copy-frameid.patch.
2026-11-03 08:53:28 -05:00
NotAlexNoyle 83e7caff0f npapi composite without imagebridge
(no description in the patch)

Imported from build/desktop/patches/0020-npapi-composite-without-imagebridge.patch.
2026-11-03 08:53:28 -05:00
NotAlexNoyle 5c23f4cdd1 plugin headless nativehandle
dom/plugins/ipc: define a NativeWindowHandle for the headless/PGContext platform so plugin IPC compiles.

Generated as a clean diff against UXP upstream  (Pale Moon); applies
independently (distinct files) to the pristine third_party/uxp submodule.

Imported from build/desktop/patches/0008-plugin-headless-nativehandle.patch.
2026-11-03 08:53:27 -05:00
athenian200 b787af5702 Issue #1638 - Part 1: Put NPAPI code behind MOZ_ENABLE_NPAPI.
Adds --disable-npapi as an additional build option. The default is still to build in NPAPI compatibility, but with this flag, it's finally possible to build without pulling in GTK2 on systems that don't have the package.

This essentially ifdefs everything associated with NPAPI, following various Mozilla removal bugs.

Ref: BZ 1682030, BZ 1251202, BZ 1217665, BZ 1687239
2024-01-10 04:03:35 -06:00
Moonchild 1e50ffb192 Issue #1656 - Remove more vim control lines.
Vim control lines were re-introduced or not entirely cleaned up.
This nukes them again.
Removing from dom. More to come.
2023-05-04 03:33:25 +02:00
Moonchild 904af3005d Issue #21 - Follow-up: Remove some left-over telemetry plumbing. 2022-06-27 08:03:48 +00:00
Brian Smith c82b759d56 Issue #1829 - Revert "Issue #1751 -- Remove XP_MACOSX conditionals from /dom"
This reverts commit 0dd3424f77.
2022-04-26 11:24:42 -05:00
Brian Smith 9e2a89c71d Issue #1829 - Revert "Issue #1751 -- Remove XP_DARWIN"
This reverts commit 3d671e4275.
2022-04-26 11:07:23 -05:00
Moonchild ee86d3eb9c Issue #21 - Remove Telemetry plumbing and fix build.
Note this won't give working applications. Requires FE changes and
additional js module changes (next part).
2022-04-02 14:39:54 +02:00
Moonchild 3d671e4275 Issue #1751 -- Remove XP_DARWIN 2021-05-02 07:10:18 +00:00
Moonchild 0dd3424f77 Issue #1751 -- Remove XP_MACOSX conditionals from /dom 2021-04-30 21:22:08 +00:00
adeshkp 3e63479f37 Issue #80 - Include D3DMessageUtils.h in dom/plugins/ipc for Mac build
This should ideally not be needed on Mac but compilation fails due to
sizeof `DxgiAdapterDesc` not known.

Didn't face this issue on Linux though, probably due to a different include
chain which already has this file included somewhere along the way.
2020-04-24 10:27:31 -04:00
Moonchild bbdf84dd35 Issue #80 - De-unify dom/plugins/ipc 2020-04-22 20:37:34 +00:00
Matt A. Tobin 04fb9eaa6a Issue #1053 - Remove android support from NPAPI 2020-02-20 12:44:29 -05:00
wolfbeast 93cae908bc Remove all C++ telemetry autotimers 2018-09-04 09:41:24 +02:00
wolfbeast ab961aeb54 Remove all C++ Telemetry Accumulation calls.
This creates a number of stubs and leaves some surrounding code that may be irrelevant (eg. recorded time stamps, status variables).
Stub resolution/removal should be a follow-up to this.
2018-09-03 10:11:38 +02:00
Matt A. Tobin 5f8de423f1 Add m-esr52 at 52.6.0 2018-02-02 04:16:08 -05:00