Support canvas 2D API from workers (with transferables for bg image rendering/processing, etc.)
Categories
(Core :: Graphics: Canvas2D, task)
Tracking
()
People
(Reporter: brendan, Unassigned)
References
(Depends on 2 open bugs, Blocks 2 open bugs)
Details
(Keywords: dev-doc-needed, Whiteboard: [tech-p1][platform-rel-Google][platform-rel-GoogleDocs])
Attachments
(12 files, 35 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
mtseng
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
roc
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
text/x-log
|
Details | |
(deleted),
patch
|
Details | Diff | Splinter Review |
Comment 2•12 years ago
|
||
Comment 3•12 years ago
|
||
Comment 4•12 years ago
|
||
Comment 5•12 years ago
|
||
Comment 6•12 years ago
|
||
Comment 8•12 years ago
|
||
Comment 9•12 years ago
|
||
Comment 12•12 years ago
|
||
Comment 15•12 years ago
|
||
Comment 16•12 years ago
|
||
Comment 17•12 years ago
|
||
Comment 18•12 years ago
|
||
Updated•12 years ago
|
Updated•11 years ago
|
Updated•11 years ago
|
Updated•10 years ago
|
Updated•10 years ago
|
Updated•10 years ago
|
Comment 22•10 years ago
|
||
Comment 23•9 years ago
|
||
Comment 25•9 years ago
|
||
Comment 27•9 years ago
|
||
Comment 28•9 years ago
|
||
Comment 30•9 years ago
|
||
Comment 32•9 years ago
|
||
Updated•9 years ago
|
Comment 33•9 years ago
|
||
Comment 34•9 years ago
|
||
Comment 35•9 years ago
|
||
Comment 36•9 years ago
|
||
Comment 37•9 years ago
|
||
Comment 38•9 years ago
|
||
Comment 39•9 years ago
|
||
Comment 40•9 years ago
|
||
Comment 41•9 years ago
|
||
Comment 42•9 years ago
|
||
Comment 43•9 years ago
|
||
Comment 44•9 years ago
|
||
Comment 45•9 years ago
|
||
Comment 46•9 years ago
|
||
Comment 47•9 years ago
|
||
Comment 48•9 years ago
|
||
Comment 49•9 years ago
|
||
Comment 50•9 years ago
|
||
Comment 51•9 years ago
|
||
Comment 52•9 years ago
|
||
Comment 53•9 years ago
|
||
Comment 54•9 years ago
|
||
Comment 55•9 years ago
|
||
Comment 56•9 years ago
|
||
Comment 57•9 years ago
|
||
Comment 58•9 years ago
|
||
Comment 59•9 years ago
|
||
Comment 60•9 years ago
|
||
Comment 61•9 years ago
|
||
Comment 62•9 years ago
|
||
Updated•9 years ago
|
Updated•9 years ago
|
Comment 63•9 years ago
|
||
Comment 64•9 years ago
|
||
Comment 65•9 years ago
|
||
Comment 66•9 years ago
|
||
Comment 67•9 years ago
|
||
Comment 68•9 years ago
|
||
Comment 70•9 years ago
|
||
Comment 71•9 years ago
|
||
Comment 72•9 years ago
|
||
Comment 73•9 years ago
|
||
Updated•9 years ago
|
Comment 74•9 years ago
|
||
Comment 76•9 years ago
|
||
Updated•9 years ago
|
Comment 77•9 years ago
|
||
Comment 78•9 years ago
|
||
Comment 79•9 years ago
|
||
Comment 80•9 years ago
|
||
Comment 81•9 years ago
|
||
Updated•9 years ago
|
Comment 82•9 years ago
|
||
Comment 83•9 years ago
|
||
Updated•9 years ago
|
Comment 84•9 years ago
|
||
Comment 85•9 years ago
|
||
Comment 86•9 years ago
|
||
bugherder |
Comment 87•9 years ago
|
||
Comment 88•9 years ago
|
||
Comment 89•9 years ago
|
||
Updated•9 years ago
|
Comment 90•9 years ago
|
||
Comment 91•9 years ago
|
||
Updated•9 years ago
|
Comment 92•9 years ago
|
||
Comment 93•9 years ago
|
||
Comment 94•9 years ago
|
||
Comment 95•9 years ago
|
||
Comment 96•9 years ago
|
||
Comment 97•9 years ago
|
||
Comment 98•9 years ago
|
||
Updated•9 years ago
|
Updated•9 years ago
|
Comment 102•9 years ago
|
||
Comment 103•9 years ago
|
||
Updated•9 years ago
|
Comment 104•9 years ago
|
||
Updated•9 years ago
|
Comment 105•9 years ago
|
||
Comment 107•9 years ago
|
||
Comment 108•9 years ago
|
||
Comment 109•9 years ago
|
||
Updated•9 years ago
|
Comment 111•9 years ago
|
||
Updated•9 years ago
|
Comment 112•9 years ago
|
||
Updated•9 years ago
|
Comment 113•9 years ago
|
||
Updated•9 years ago
|
Comment 114•9 years ago
|
||
Updated•9 years ago
|
Comment 115•9 years ago
|
||
Updated•9 years ago
|
Comment 116•9 years ago
|
||
Updated•9 years ago
|
Comment 117•9 years ago
|
||
Updated•9 years ago
|
Comment 118•9 years ago
|
||
Comment 119•9 years ago
|
||
Comment 120•9 years ago
|
||
Comment 121•9 years ago
|
||
Comment 122•9 years ago
|
||
Updated•9 years ago
|
Comment 123•9 years ago
|
||
Comment 124•9 years ago
|
||
Comment 125•9 years ago
|
||
Comment 126•9 years ago
|
||
Comment 127•9 years ago
|
||
Comment 128•9 years ago
|
||
Comment 129•9 years ago
|
||
Comment 130•9 years ago
|
||
Comment 131•9 years ago
|
||
Updated•9 years ago
|
Comment 132•9 years ago
|
||
Comment 133•9 years ago
|
||
Comment 134•9 years ago
|
||
Comment 135•9 years ago
|
||
Comment 136•9 years ago
|
||
Comment 137•9 years ago
|
||
Comment 138•9 years ago
|
||
Comment 139•9 years ago
|
||
Comment 140•9 years ago
|
||
Comment 142•9 years ago
|
||
Comment 143•9 years ago
|
||
Comment 145•9 years ago
|
||
Updated•8 years ago
|
Updated•8 years ago
|
Updated•8 years ago
|
Comment 146•7 years ago
|
||
Comment 147•7 years ago
|
||
Updated•6 years ago
|
Comment 148•6 years ago
|
||
Comment 149•6 years ago
|
||
Updated•5 years ago
|
Updated•5 years ago
|
Comment 151•5 years ago
|
||
Does this bug track implementation of 2d
context for OffscreenCanvas
?
Comment 152•5 years ago
|
||
Is there any progress towards implenting OffscreenCanvasRenderingContext2D
?
If a use case is needed:
In Worker
fetch individual video frames or decode video, draw image onto an OffscreenCanvas
instance using drawImage()
, manipulate pixel data using getImageData()
, where the <canvas>
is media source for CanvasCaptureMediaStream
set as srcObject
at <video>
element.
Currently "bitmaprenderer"
context of OffscreenCanvas
- Does not render the image passed to
transferFromImageBitmap()
at the<canvas>
on the main thread (https://bugzilla.mozilla.org/show_bug.cgi?id=1590030)
"webgl"
context
- Does not set values to
Uint8Array
other than0
whenreadPixels()
is executed - Does not render the image passed to
texImage2d()
at the<canvas>
on the main thread
which amount to limited to no capability with respect to the specification and implementation of OffscreenCanvas
at Firefox.
Workarounds to get an ImageData
instance representing an image drawn onto a <canvas>
include
- Transfer
ArrayBuffer
orImageBitmap
to main thread, draw onto a<canvas>
, transferImageData
ofcanvas
back toWorker
(https://plnkr.co/edit/4Tb91b?p=preview) - Use
WebAssembly
and WASM to create anImageData
instance (https://github.com/kenchris/wasm-webp/) - Use Native Messaging to execute local shell scripts
which either make the point of OffscreenCanvas
being specified in order to avoid multiple transfers to and from different contexts, or moot due to the fact that though specified is only partially implemented at Firefox, Nightly, and the user targeting Firefox has no choice but to use WebAssembly
or Native Messaging or other workaround to reliably process images in a Worker
.
Note also, that when getContext("2d")
is executed an exeception is thrown, null
is not returned (https://github.com/web-platform-tests/wpt/issues/19799; https://github.com/web-platform-tests/wpt/pull/19818).
What needs to be done to implement OffscreenCanvasRenderingContext2D
(at least drawImage()
and getImageData()
) and fix ImageBitmapRenderingContext
for OffscreenCanvas
?
Or, is the implementation of OffscreenCanvas
at Mozilla dead?
Comment 153•4 years ago
|
||
I am trying to use tensorflow-js for webcam video processing. On Chrome, I can easily transfer an ImageBitmap from the <video>
to the worker thread, paint it to an OffscreenCanvas
and send it to tfjs for processing. This approach doesn't work on Firefox because OffscreenCanvas
is not supported for the 2d context. Furthermore, after switching to a traditional canvas on the main thread and instead sending an ImageData
to the worker, the Firefox implementation is incredibly slow. This is because tfjs cannot use the webgl backend, which also relies on OffscreenCanvas
. Instead it resorts to the CPU backend.
After enabling the experimental flag in about:config for OffscreenCanvas
support, Firefox just crashes. I am surprised to see this issue opened 8 years ago and still no indication of when this will be implemented.
Comment 154•4 years ago
|
||
#153 Firefox is far faster than Chromium capturing all images from a video, see https://bugs.chromium.org/p/chromium/issues/detail?id=1065675#c17, https://plnkr.co/edit/k6Itrjzzj60vT2fC.
It is possible to transfer an ImageBitmap
to Worker
thread, or get ImageBitmap
from Worker
and send to main thread at Firefox, see https://plnkr.co/edit/4Tb91b?preview.
Comment 155•4 years ago
|
||
Is OffscreenCanvas ever going to be fixed in firefox? It is effectively impossible to use webassembly threads/atomics without OffscreenCanvas for webgl apps, because main thread can't be blocked, and rendering/threadpool orchestration should be done inside worker.
Comment 156•3 years ago
|
||
Any progress on this ?
I hoped to do on the fly alteration of image while fetching them but it looks like there's no viable solution in FF.
Updated•3 years ago
|
Comment 157•3 years ago
|
||
The bug assignee didn't login in Bugzilla in the last 7 months.
:lsalzman, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•3 years ago
|
Updated•2 years ago
|
Description
•