Commit Graph
24 Commits
Author SHA1 Message Date
NotAlexNoyleandClaude Opus 5.5 2eba4ecc5f flash: the plugin lane takes the child's own surface (T-576)
While the lane is open RecvShow makes no copy: a movie's frame cost this thread up to 6.7 ms for a fresh surface and
a copy nobody read. The child's surface is the source, and the answer waits until the lane has taken it, so the
child stays off it and a card that cannot keep up holds the player at two frames in flight. RecvShow takes 83 us;
Bubble Tanks (55 fps) reaches 39.5 frames a second, against the stock browser's 32. The floor between draws, which
was for that overload, is gone: it cost the movies the card can keep up with their frames.

At the close the frame not taken, or the rows the card shows, become the layer's image. A plugin partly off the frame
keeps the copies (mode 1): its rows would not be there to go back to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 14:12:46 -05:00
NotAlexNoyleandClaude Opus 5.5 bb1e9f023a flash: the review's findings on the frame path (T-576)
An answer to a frame sent before Destroy no longer posts a draw on a dead instance. JihadShow takes no wrap of the
shared surface when a copy fails: it answers at once and the child draws there again, so the frame is dropped. The
lane's source is this frame's copy or nothing. The floor between draws is per instance, the pump's count of posted
draws counts. The proof takes an effect as one item with its own bounds (a transformed overlay's children are in
their own coordinates) and returns where the plugin is now; jihad_offscreen_popups_open: a popup is a display root of
its own. The plugin stays silent only as the one instance on its page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 12:23:14 -05:00
NotAlexNoyleandClaude Opus 5.5 2f1a398268 flash: a plugin frame without the wait, and a way straight to the card (T-576)
Bloxorz (36 fps) ran at 12 frames a second on the GPU path, against the stock browser's 28.6. Timed per frame:
Flash's own work 27 ms, its draw 2 ms, the synchronous Show 14-17 ms, nearly all of it waiting for the daemon's
main thread; and four copies on the parent's side.

- JihadShow/JihadShowDone: Show without the wait. Two surfaces take turns, so at most two frames are in flight
  and a draw due with two out waits for the answer without blocking the player.
- The glib pump is the player's clock and its delay started when a frame's work ended: 16 ms after 20 ms of work
  capped a movie at 27 frames a second. 4 ms while a movie plays, and it stops at a posted draw, or the player ran
  its next frame with this one never drawn.
- An opaque source keeps an opaque format: as B8G8R8A8 with its alpha forced the frame was blended over a white fill.
- A floor of 28 ms between draws. Bubble Tanks at 55 fps had each frame drawn and copied 50 times a second, and the
  card fell to 24 where the stock browser holds 32.
- jihad_plugin_lane_copy, _proof, _set: the frame for the daemon's plugin lane, the display-list proof that nothing
  lies over the plugin, and the plugin's marks off while the lane is open, so that the compositor's count of
  requests means the page changed. jihad_offscreen_compositor_animating says an animation wants frames.

The timers of a frame's parts are in the 2 s readouts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 11:43:25 -05:00
NotAlexNoyle 4ea10659e1 npapi: the Palm event paths only where npapi.h defines Palm's NPEvent
The gain-focus system event (PluginInstanceChild) and the spotlight export (nsPluginHost) built
Palm's NPEvent fields unconditionally. That union exists only for the headless toolkit the device
builds; the desktop GTK build has X11's NPEvent and failed to compile. Both are now guarded the
way npapi.h is (XP_UNIX && MOZ_WIDGET_HEADLESS); the desktop spotlight export returns 0.
(Jihad T-387, cavekit-engine-update R6: the desktop engine on RB_20261006 for the desktop tests.)
2026-11-03 08:53:31 -05:00
NotAlexNoyle ebd7c20cb8 npapi: JIHAD_PLUGIN_SELF_DRIVE=0 turns the plugin child's own repaint timer off
Part of the squashed engine commit 07259a27f0 that the per-subsystem queue (0001-0030) never
carried. The daemon sets JIHAD_PLUGIN_SELF_DRIVE=0 (EngineHost.cpp) so the host pull is the only
frame clock. Regenerated 2026-10-08 so that the queue reproduces the engine branch exactly
(build/engine/patch-queue.sh --check).
2026-11-03 08:53:29 -05:00
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 03f0150408 npapi plugin repaint rate
(no description in the patch)

Imported from build/desktop/patches/0026-npapi-plugin-repaint-rate.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 e599a64797 npapi webos palm host
(no description in the patch)

Imported from build/desktop/patches/0017-npapi-webos-palm-host.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
Moonchild ddf5d6256e Whitespace fix 2026-07-03 09:24:24 +02:00
Moonchild 0eae777fd0 Issue #3132 Follow-up: only include gtk2xtbin.h on GTK targets.
PR #3133 caused build breakage on non-gtk platforms by unconditionally
including the header (because the def defaults to true in configure)

This also reorganizes the configure script to add a check for
MOZ_WIDGET_GTK (hoisted up a little) so the new configure entry is
simply ignored on non-GTK targets.
2026-07-03 09:19:54 +02:00
Basilisk-Dev 3f5b7ed020 Issue #3132 - Add GTK2 NPAPI build toggle 2026-06-26 13:09:49 -04:00
Jeremy Andrews d5e385dc73 Issue #190 - Remove UIKit conditional code. 2026-02-21 18:55:44 +01: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 734f0957fb Issue #2343 - replace MOZ_FALLTHROUGH with [[fallthrough]]
Basically a S&R. Removed the macro and adjusts IDL codegen accordingly.
2023-11-11 14:27:03 +01: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
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 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
Matt A. Tobin 04fb9eaa6a Issue #1053 - Remove android support from NPAPI 2020-02-20 12:44:29 -05:00
David Parks 74f15fb2d6 Properly detect failure in receiving plugin NPObjects.
Properly handles NPError reporting and makes sure that, in the case of
failure, it does not return junk for the NPObject.
2019-12-06 12:28:18 +01:00
Matt A. Tobin 5f8de423f1 Add m-esr52 at 52.6.0 2018-02-02 04:16:08 -05:00