Closed Bug 1173686 Opened 5 years ago Closed 5 years ago

CanvasCaptureMediaStream from 2D Canvas not visible in local video element on B2G

Categories

(Core :: Canvas: 2D, defect)

41 Branch
Unspecified
Gonk (Firefox OS)
defect
Not set

Tracking

()

RESOLVED FIXED
Tracking Status
firefox41 --- affected

People

(Reporter: pehrsons, Unassigned)

References

Details

(Whiteboard: gfx-noted)

There's a reftest for playing a CanvasCaptureMediaStream in a local video element, that fails on B2G:  https://treeherder.mozilla.org/#/jobs?repo=try&revision=a246785a7661

From bug 1169126, comment 23:
There are errors in the log for that failed test on B2G:
> 22:28:59     INFO -  06-11 04:31:58.212 I/Gecko   (  714): REFTEST TEST-LOAD | http://10.0.2.2:8888/tests/dom/canvas/test/reftest/capturestream.html | 59 / 587 (10%)
> 22:28:59     INFO -  06-11 04:32:00.321 W/AudioFlinger(   40): Thread AudioOut_1 cannot connect to the power manager service
> 22:28:59     INFO -  06-11 04:32:00.612 D/        (  841): HostConnection::get() New Host Connection established 0x4566f460, tid 860
> 22:28:59     INFO -  06-11 04:32:00.650 E/EGL_emulation(  841): tid 860: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.650 E/libEGL  (  841): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.661 E/EGL_emulation(  841): tid 860: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.661 E/libEGL  (  841): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.661 E/EGL_emulation(  841): tid 860: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.681 E/libEGL  (  841): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.681 E/EGL_emulation(  841): tid 860: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.681 E/libEGL  (  841): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.681 E/EGL_emulation(  841): tid 860: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.690 E/libEGL  (  841): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.690 E/EGL_emulation(  841): tid 860: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.690 E/libEGL  (  841): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.700 E/EGL_emulation(  841): tid 860: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.700 E/libEGL  (  841): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.700 E/EGL_emulation(  841): tid 860: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.710 E/libEGL  (  841): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.710 E/EGL_emulation(  841): tid 860: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.710 E/libEGL  (  841): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.720 E/EGL_emulation(  841): tid 860: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:00.720 E/libEGL  (  841): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 22:28:59     INFO -  06-11 04:32:01.221 W/Test Container(  841): [JavaScript Warning: "Use of Mutation Events is deprecated. Use MutationObserver instead." {file: "chrome://reftest/content/reftest-content.js" line: 593}]
> 22:28:59     INFO -  06-11 04:32:05.191 I/Gecko   (  714): RESTORE PREFERENCE pref(canvas.capturestream.enabled,false)

It appears that B2G uses SkiaGL for its canvas backend and Cairo for the content backend. From the log it looks like there's something failing on the GL side. I had a look at DrawTargetCairo and it's not discriminating the skia surface in any way, so this also suggests the issue occurs before the surface reaches the content backend.
Whiteboard: gfx-noted
It looks like we might be calling eglMakeCurrent on the wrong thread. Not sure what the issue is beyond that though.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=78aa9c377ebc

These appear to belong together:
> 02:51:40     INFO -  06-12 09:50:17.258 I/Gecko   (  826): ImageClientSingle::UpdateImage START
> 02:51:40     INFO -  06-12 09:50:17.258 I/Gecko   (  826): CairoImage::GetTextureClient
> 02:51:40     INFO -  06-12 09:50:17.268 I/Gecko   (  826): CairoImage::GetTextureClient GetAsSourceSurface
> 02:51:40     INFO -  06-12 09:50:17.278 D/        (  826): HostConnection::get() New Host Connection established 0x4564a160, tid 862
> 02:51:40     INFO -  06-12 09:50:17.278 I/Gecko   (  826): CairoImage::GetTextureClient CopySurface
> 02:51:40     INFO -  06-12 09:50:17.288 E/EGL_emulation(  826): tid 862: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 02:51:40     INFO -  06-12 09:50:17.298 E/libEGL  (  826): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
From https://treeherder.mozilla.org/#/jobs?repo=try&revision=029c844bfe66, these all seem to be from the same path.

George, Jerry, does this tell you anything useful?

> 10:56:42     INFO -  06-12 17:53:53.006 I/Gecko   (  823): ImageClientSingle::UpdateImage START
> 10:56:42     INFO -  06-12 17:53:53.006 I/Gecko   (  823): CairoImage::GetTextureClient
> 10:56:42     INFO -  06-12 17:53:53.006 I/Gecko   (  823): CairoImage::GetTextureClient GetAsSourceSurface
> 10:56:42     INFO -  06-12 17:53:53.026 D/        (  823): HostConnection::get() New Host Connection established 0x45a51810, tid 837
> 10:56:42     INFO -  06-12 17:53:53.036 I/Gecko   (  823): CairoImage::GetTextureClient CopySurface
> 10:56:42     INFO -  06-12 17:53:53.036 I/Gecko   (  823): DrawTargetCairo::GetCairoSurfaceForSurface GetDataSurface
> 10:56:42     INFO -  06-12 17:53:53.036 I/Gecko   (  823): DrawTargetCairo::GetCairoSurfaceForSurface DataSurface::Map
> 10:56:42     INFO -  06-12 17:53:53.036 I/Gecko   (  823): SourceSurfaceSkia::GetData
> 10:56:42     INFO -  06-12 17:53:53.036 I/Gecko   (  823): SkPixelRef::lockPixels SUCCEEDED
> 10:56:42     INFO -  06-12 17:53:53.056 E/EGL_emulation(  823): tid 837: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.056 E/libEGL  (  823): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.075 E/EGL_emulation(  823): tid 837: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.075 E/libEGL  (  823): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.086 E/EGL_emulation(  823): tid 837: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.086 E/libEGL  (  823): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.106 E/EGL_emulation(  823): tid 837: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.106 E/libEGL  (  823): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.106 E/EGL_emulation(  823): tid 837: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.116 E/libEGL  (  823): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.116 E/EGL_emulation(  823): tid 837: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.116 E/libEGL  (  823): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.116 E/EGL_emulation(  823): tid 837: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.126 E/libEGL  (  823): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.126 E/EGL_emulation(  823): tid 837: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.126 E/libEGL  (  823): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.145 E/EGL_emulation(  823): tid 837: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.145 E/libEGL  (  823): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.145 E/EGL_emulation(  823): tid 837: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.145 E/libEGL  (  823): eglMakeCurrent:674 error 3002 (EGL_BAD_ACCESS)
> 10:56:42     INFO -  06-12 17:53:53.226 I/Gecko   (  823): SkPixelRef::lockPixels SUCCEEDED
> 10:56:42     INFO -  06-12 17:53:53.226 I/Gecko   (  823): SourceSurfaceSkia::GetData END
> 10:56:42     INFO -  06-12 17:53:53.285 I/Gecko   (  823): CairoImage::GetTextureClient DONE
> 10:56:42     INFO -  06-12 17:53:53.326 I/Gecko   (  823): ImageClientSingle::UpdateImage END
Flags: needinfo?(hshih)
Flags: needinfo?(gwright)
Hi Andreas,

Could you tell which line of code generates the eglMakeCurrent error message?
I don't find the call stack as:

> 10:56:42     INFO -  06-12 17:53:53.036 I/Gecko   (  823): CairoImage::GetTextureClient CopySurface
> 10:56:42     INFO -  06-12 17:53:53.036 I/Gecko   (  823): DrawTargetCairo::GetCairoSurfaceForSurface GetDataSurface
> 10:56:42     INFO -  06-12 17:53:53.036 I/Gecko   (  823): DrawTargetCairo::GetCairoSurfaceForSurface DataSurface::Map
> 10:56:42     INFO -  06-12 17:53:53.036 I/Gecko   (  823): SourceSurfaceSkia::GetData
> 10:56:42     INFO -  06-12 17:53:53.036 I/Gecko   (  823): SkPixelRef::lockPixels SUCCEEDED
> 10:56:42     INFO -  06-12 17:53:53.056 E/EGL_emulation(  823): tid 837: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)
Flags: needinfo?(hshih)
(In reply to Jerry Shih[:jerry] (UTC+8) from comment #4)
> Hi Andreas,
> 
> Could you tell which line of code generates the eglMakeCurrent error message?
> I don't find the call stack as:
> 
> > 10:56:42     INFO -  06-12 17:53:53.036 I/Gecko   (  823): CairoImage::GetTextureClient CopySurface
> > 10:56:42     INFO -  06-12 17:53:53.036 I/Gecko   (  823): DrawTargetCairo::GetCairoSurfaceForSurface GetDataSurface
> > 10:56:42     INFO -  06-12 17:53:53.036 I/Gecko   (  823): DrawTargetCairo::GetCairoSurfaceForSurface DataSurface::Map
> > 10:56:42     INFO -  06-12 17:53:53.036 I/Gecko   (  823): SourceSurfaceSkia::GetData
> > 10:56:42     INFO -  06-12 17:53:53.036 I/Gecko   (  823): SkPixelRef::lockPixels SUCCEEDED
> > 10:56:42     INFO -  06-12 17:53:53.056 E/EGL_emulation(  823): tid 837: eglMakeCurrent(947): error 0x3002 (EGL_BAD_ACCESS)

I haven't found it either, but it comes from somewhere in skia. There are sub classes of SkPixelRef for SkiaGL as well as far as I could tell. The actual messages are from an egl emulation library in the android emulator (and libEGL might be from gonk?) I believe.
Flags: needinfo?(hshih)
The line of code is probably this one: http://mxr.mozilla.org/mozilla-central/source/gfx/gl/SkiaGLGlue.cpp#46
Flags: needinfo?(gwright)
See bug 1175257, we're actually facing an intermittent failure on B2G.

An observation in the log, see [0], from the unexpected-pass test in bug 1175257: there are 4 failed eglMakeCurrent calls.

In the expected-fail log per comment 3, see [1], there are 10 failed eglMakeCurrent calls.

Could it be an initialization thing?


[0] http://ftp.mozilla.org/pub/mozilla.org/b2g/tinderbox-builds/b2g-inbound-emulator/1434449004/b2g-inbound_ubuntu64_vm-b2g-emulator_test-reftest-8-bm53-tests1-linux64-build176.txt.gz
[1] http://ftp.mozilla.org/pub/mozilla.org/b2g/try-builds/pehrsons@gmail.com-029c844bfe66/try-emulator/try_ubuntu64_vm-b2g-emulator_test-reftest-7-bm54-tests1-linux64-build204.txt.gz
See Also: → 1175257
This works now per bug 1175257.
Status: NEW → RESOLVED
Closed: 5 years ago
Flags: needinfo?(hshih)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.