GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: Linux support by triniwiz · Pull Request #189 · NativeScript/canvas

Conversation

@triniwiz

@triniwiz triniwiz commented Nov 7, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Adds NativeScript Linux (GTK 4) support to canvas and its plugins, through the Node-API modules the Windows port uses.

Packages

  • canvas
    • A GTK 4 widget drives the canvasnative.node Node-API module.
    • 2D, WebGL and WebGL2 run on EGL using GDK's display. Offscreen surfaces use pbuffers, and transferred OffscreenCanvas is supported.
    • WebGPU runs on Vulkan. Its frames are shared with GL through exported memory.
  • canvas-svg: a GTK 4 view.
  • canvas-media: video and audio play through GStreamer.
  • audio-context: works through its Node-API module.
  • canvas-gamepad:
    • Reads evdev devices through gilrs, which uses SDL's mapping database. Hot-plug is watched through udev.
    • Reports the standard 17-button / 4-axis layout.
    • Reading /dev/input/event* requires read access. Desktop sessions normally grant it to gamepads.
  • canvas-polyfill:
    • fetch works for local files.
    • Blob-URL Workers work on Node-API hosts.
    • The window size is taken from the app window.
  • canvas-chartjs: Linux V8 ships without ICU data, so the Intl polyfills are forced on there.
  • The x64 and arm64 .node modules are committed under each package's platforms/linux/lib/<arch>. They're built by tools/scripts/build-linux.sh, which needs libudev-dev on the build machine. The arm64 ones were built on Ubuntu 22.04 arm64 (glibc 2.35, GTK 4.6, clang 18) and load in Node 22 on arm64, but haven't been run in a GTK app on arm64 hardware yet.

Cross-platform fixes found along the way

  • WebGL:
    • clearBuffer* now takes the buffer enum.
    • bindTransformFeedback now binds the transform feedback.
    • bindVertexArrayOES(null) now unbinds.
  • WebGPU: subgroups are no longer advertised, because naga can't enable them yet. WGSL compile errors are now logged.
  • 2D:
    • Non-finite values for lineDashOffset, globalAlpha, miterLimit and lineWidth are now ignored.
    • createImageBitmap accepts Blob-like sources.
  • Images: an image that fails to decode now fires error.
  • Node-API: Windows-only methods are now in their own impl blocks, so the module builds on other hosts.

GPU video frames

  • Display: canvas-media decodes into GL textures (glupload ! glcolorconvert) in a GStreamer GL context that shares GDK's, and GTK shows them as GdkGLTextures. If the GL path isn't available it falls back to CPU memory; NS_CANVAS_MEDIA_CPU=1 forces the fallback.
  • WebGL: texImage2D / texImage3D with a video does a GPU blit through an EGLImage, guarded by an EGL fence.
  • WebGPU: importExternalTexture and copyExternalImageToTexture(video) read Vulkan images that GL imports and fills on the GPU, synchronised by exported semaphores, as on Windows.
    • wgpu's Vulkan backend has no external textures, so texture_external is emulated by binding the frame as a texture_2d<f32>.
  • Software decode: mapped frames go to WebGL / WebGPU natively and are uploaded once.
  • VA-API: disable-vpp on vaapidecodebin fixes H.264 producing no frames on the Intel iHD driver.

1080p, process CPU:

Scenario GL path CPU path
H.264 playback ~11–16% ~28–35%
VP9 playback, VA-API decode ~11% ~44%

WebGL texImage2D(video): 0.19 ms per call, down from ~3.9 ms.

Not done: displaying DMABuf frames with GdkDmabufTexture (needs GTK 4.14+) and importing them straight into Vulkan. Both are TODOs.

Tests: media.video 9/9 on both paths, webgpu 19/19, webgl 83/83.

Depends on

  • feat: Linux platform (GTK 4) NativeScript#11620: core with the Linux platform.
  • feat: linux nativescript-cli#6202: the CLI copies .node modules from a plugin's platforms/linux/lib/<arch>.
  • The Linux runtime is not published yet. apps/demo and apps/demo-linux point at a local runtime pack in tools/linux/ (gitignored).

Known gaps

  • Draco decoding in a Worker (three)
  • webgpu_backdrop renders black
  • an error in the webgpu_cube sample
  • gamepad tested only with no controller attached

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
triniwiz added 18 commits November 7, 2026 04:15
@triniwiz
fix(webgl): clearBuffer* take the buffer enum, bindTransformFeedback …
12e37d8
…binds the transform feedback, bindVertexArrayOES(null) unbinds
@triniwiz
fix(webgpu): stop advertising subgroups, which naga cannot enable yet…
4994da0
…; log WGSL compile errors
@triniwiz
fix(canvas): ignore non-finite lineDashOffset, globalAlpha, miterLimi…
e91cb7d
…t and lineWidth; createImageBitmap takes Blob-like sources
@triniwiz
fix(polyfill): images that fail to decode fire error; window.name; bl…
f922bca
…ob URL Workers on Node-API hosts
@triniwiz
fix(napi): Windows-only methods in their own impl blocks, so the modu…
da8028a
…le builds on other hosts
@triniwiz
fix(demo): phaser breakout constructs its game, three's compute parti…
30bc244
…cles skip the DOM-only inspector, phaser-ce's accelerometer is Android/Apple only
@triniwiz
feat(linux): EGL contexts on GDK's display, pbuffers for offscreen su…
7498d4e
…rfaces and present hooks
@triniwiz
feat(linux): 2D, WebGL and transferred OffscreenCanvas surfaces
3c18514
@triniwiz
feat(linux): WebGPU on Vulkan, frames shared with GL through exported…
a0db50e
… memory
@triniwiz
feat(linux): @nativescript/canvas on NativeScript Linux, a GTK 4 widg…
6366a5b
…et driven by the Node-API module
@triniwiz
feat(linux): canvas-polyfill file and http, fetch of local files, win…
cc868af
…dow size from the app window
@triniwiz
fix(chartjs): replace Intl on Linux, where V8 has no ICU data
d24a83d
@triniwiz
feat(linux): canvas-svg view on GTK 4
8d69131
@triniwiz
feat(linux): canvas-media video and audio on GStreamer
3f6a2db
@triniwiz
feat(linux): audio-context through its Node-API module
f3ee2fb
@triniwiz
feat(linux): canvas-gamepad on evdev through gilrs, with hot-plug
eb0967c
@triniwiz
feat(linux): run apps/demo on NativeScript Linux; apps/demo-linux smo…
23f8415
…ke app
@triniwiz
chore(linux): x64 Node-API modules for canvas, canvas-svg, canvas-med…
8f13bdb
…ia, canvas-gamepad and audio-context
@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b9fbcc04-d80e-4704-a1ac-70e7d619f416

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

  • X
  • Mastodon
  • Reddit
  • LinkedIn
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

triniwiz added 4 commits November 7, 2026 06:25
@triniwiz
feat(linux): canvas-media video as GL textures shared with GDK and ca…
c9333e3
…nvas

GStreamer's GL context shares GDK's on its EGL display: glupload ! glcolorconvert
makes RGBA textures, shown as GdkGLTextures and handed to canvas as
NSCVideoFrame descriptors (an EGLImage for WebGL, a blit into WebGPU's
exportable Vulkan image synchronized with its semaphores). videoconvert to
memory stays the fallback (NS_CANVAS_MEDIA_CPU=1, no GDK EGL, GL errors).

vaapidecodebin runs without vaapipostproc, whose NV12 buffers fail to map on
iHD (H.264 showed no frames), and the preroll frame is delivered.
@triniwiz
feat(linux): WebGL and WebGPU take canvas-media frames on the GPU
694f2e3
__texImageVideoFrame copies a GL frame through its EGLImage into the bound
texture (texImage2D/3D, sub-images, flipY) or uploads a memory frame once.
WebGPU imports frames into an exportable Vulkan image per video, waiting on
the producer's semaphore and signalling release (devices enable
VK_KHR_external_semaphore_fd); __getAdapterLuid gives the device UUID key.
Vulkan lacks EXTERNAL_TEXTURE: external textures bind their plane as a
texture_2d<f32> that shader modules use in place of texture_external.
@triniwiz
feat(linux): Video hands frames to WebGL and WebGPU natively
f693159
getCurrentFrame and the texImage3D hooks go through __texImageVideoFrame;
supportsGPUFrames/getGPUFrameTexture return NSCVideoFrame descriptors (GPU on
the same device, else memory). importExternalTexture closes frames the import
copies (Linux, Windows) instead of holding them until collected.
@triniwiz
chore(linux): x64 canvas and canvas-media modules with GPU video frames
46d19b2
@triniwiz triniwiz mentioned this pull request Nov 7, 2026
feat(napi): texImage2D and texSubImage2D take a WebGPU canvas #191
Merged
@triniwiz
chore(linux): arm64 Node-API modules
7d8237e
canvas, canvas-svg, canvas-media, canvas-gamepad and audio-context, built with tools/scripts/build-linux.sh on Ubuntu 22.04 arm64 (glibc 2.35, GTK 4.6, clang 18).
@triniwiz triniwiz assigned Copilot and unassigned Copilot Nov 7, 2026
@triniwiz
triniwiz merged commit 8f008ff into master Nov 7, 2026
14 of 23 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@triniwiz
triniwiz deleted the feat/linux branch November 7, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@triniwiz
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.