autokap 1.3.11 → 1.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +34 -9
- package/dist/clip-capture-loop.js +6 -5
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -809,27 +809,52 @@ export class Browser {
|
|
|
809
809
|
static async forClipCapture(options, cursorScript) {
|
|
810
810
|
const instance = new Browser(options);
|
|
811
811
|
const deviceScaleFactor = normalizeDeviceScaleFactor(options.deviceScaleFactor);
|
|
812
|
-
// Enable GPU compositor on
|
|
813
|
-
//
|
|
814
|
-
// `--disable-gpu` from CHROMIUM_ARGS
|
|
815
|
-
//
|
|
816
|
-
//
|
|
817
|
-
//
|
|
818
|
-
|
|
812
|
+
// Enable GPU compositor on every platform that has a real GPU available:
|
|
813
|
+
// macOS (Metal), Windows (D3D11), and Cloud Run (NVIDIA L4 via Vulkan).
|
|
814
|
+
// Local Linux without a GPU keeps `--disable-gpu` from CHROMIUM_ARGS as
|
|
815
|
+
// a safe software fallback. Cloud Run mounts the NVIDIA driver under
|
|
816
|
+
// /usr/local/nvidia/lib64 (see cloud-runner/Dockerfile) so the userspace
|
|
817
|
+
// Vulkan loader can bind to the L4. SwiftShader was tried on Fly (v1.3.8)
|
|
818
|
+
// and crashed because Fly machines had no real GPU; with a hardware L4
|
|
819
|
+
// and the proper userspace stack the path is supported.
|
|
820
|
+
const isCloudRunner = process.env.AUTOKAP_CLOUD_RUNNER === '1';
|
|
821
|
+
const isLinuxWithGpu = process.platform === 'linux' && isCloudRunner;
|
|
822
|
+
const baseArgs = (process.platform === 'linux' && !isLinuxWithGpu)
|
|
819
823
|
? CHROMIUM_ARGS
|
|
820
824
|
: CHROMIUM_ARGS.filter(arg => arg !== '--disable-gpu' && arg !== '--disable-gpu-sandbox');
|
|
821
825
|
// Pin ANGLE to the platform's native graphics API. Chrome's default
|
|
822
826
|
// backend is OpenGL on macOS, which is far slower than Metal for the
|
|
823
827
|
// compositor (measured 4 FPS vs 32 FPS at 2880×1800 on a heavy React UI).
|
|
824
|
-
// Same story on Windows where D3D11 is the native fast path.
|
|
828
|
+
// Same story on Windows where D3D11 is the native fast path. Cloud Run
|
|
829
|
+
// L4 routes through ANGLE→OpenGL using NVIDIA's libGL/libEGL (mounted at
|
|
830
|
+
// /usr/local/nvidia/lib64). We tried `--use-angle=vulkan` first but
|
|
831
|
+
// Cloud Run does not bind-mount the NVIDIA Vulkan ICD, so vulkaninfo
|
|
832
|
+
// resolves to llvmpipe (software fallback). The OpenGL path goes through
|
|
833
|
+
// the EGL/GLX libs that ARE mounted, hitting the L4 directly.
|
|
825
834
|
const angleArg = process.platform === 'darwin' ? '--use-angle=metal'
|
|
826
835
|
: process.platform === 'win32' ? '--use-angle=d3d11'
|
|
827
|
-
:
|
|
836
|
+
: isLinuxWithGpu ? '--use-angle=gl'
|
|
837
|
+
: null;
|
|
838
|
+
// Cloud Run NVIDIA L4: GPU rasterization + zero-copy upload via the GL
|
|
839
|
+
// backend. `--ignore-gpu-blocklist` bypasses Chromium's hardcoded driver
|
|
840
|
+
// blocklist (it doesn't know about Cloud Run's mounted NVIDIA driver).
|
|
841
|
+
// These flags target the throughput wins for backdrop-filter, blur, and
|
|
842
|
+
// full-viewport repaints — the modal-open scenario that defeats software
|
|
843
|
+
// rasterization at ~1 fps.
|
|
844
|
+
const cloudGpuArgs = isLinuxWithGpu
|
|
845
|
+
? [
|
|
846
|
+
'--use-gl=angle',
|
|
847
|
+
'--ignore-gpu-blocklist',
|
|
848
|
+
'--enable-gpu-rasterization',
|
|
849
|
+
'--enable-zero-copy',
|
|
850
|
+
]
|
|
851
|
+
: [];
|
|
828
852
|
const clipArgs = [
|
|
829
853
|
...baseArgs,
|
|
830
854
|
`--force-device-scale-factor=${deviceScaleFactor}`,
|
|
831
855
|
`--window-size=${Math.round(options.viewport.width)},${Math.round(options.viewport.height)}`,
|
|
832
856
|
...(angleArg ? [angleArg] : []),
|
|
857
|
+
...cloudGpuArgs,
|
|
833
858
|
];
|
|
834
859
|
// Dedicated browser process for clip capture. Not pooled because clip
|
|
835
860
|
// capture installs context-level init scripts (cursor overlay).
|
|
@@ -35,12 +35,13 @@ export class ClipCaptureLoop {
|
|
|
35
35
|
this.framesDir = opts.framesDir;
|
|
36
36
|
this.jpegQuality = opts.jpegQuality ?? 80;
|
|
37
37
|
// Linux default is 8 fps to stay safe on 2 vCPU CI runners. Cloud runners
|
|
38
|
-
// (AUTOKAP_CLOUD_RUNNER=1, set by the
|
|
39
|
-
// flag)
|
|
40
|
-
//
|
|
38
|
+
// (AUTOKAP_CLOUD_RUNNER=1, set by the Cloud Run image and the `--cloud`
|
|
39
|
+
// CLI flag) target 30 fps now that NVIDIA L4 GPU compositing is on (AUT-79
|
|
40
|
+
// migration). macOS/Windows also target 30 since their native compositors
|
|
41
|
+
// (Metal/D3D11) sustain it. Callers can still override via opts.targetFps.
|
|
41
42
|
const isCloudRunner = process.env.AUTOKAP_CLOUD_RUNNER === '1';
|
|
42
|
-
const linuxDefault = isCloudRunner ?
|
|
43
|
-
const platformDefault = process.platform === 'linux' ? linuxDefault :
|
|
43
|
+
const linuxDefault = isCloudRunner ? 30 : 8;
|
|
44
|
+
const platformDefault = process.platform === 'linux' ? linuxDefault : 30;
|
|
44
45
|
const targetFps = Math.max(1, Math.min(30, opts.targetFps ?? platformDefault));
|
|
45
46
|
this.targetFps = targetFps;
|
|
46
47
|
this.targetFrameIntervalMs = 1000 / targetFps;
|