Closed
Bug 1307342
Opened 8 years ago
Closed 1 month ago
Fast path seems not used for video rendering on WebGL
Categories
(Core :: Graphics: CanvasWebGL, defect, P2)
Core
Graphics: CanvasWebGL
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
firefox52 | --- | wontfix |
People
(Reporter: sotaro, Unassigned)
References
Details
Attachments
(1 file)
21.06 KB,
patch
|
Details | Diff | Splinter Review |
It was implemented by Bug 814524. It was implemented as WebGLTexture::TexImageFromVideoElement(), but the function was removed by Bug 1221822. In WebGLTexture::TexOrSubImage(), nsLayoutUtils::SurfaceFromElement() is called to get a surface. nsLayoutUtils::SurfaceFromElement() always return "result.mIsPremultiplied = true". It caused to skip fast path in TexUnpackImage::TexOrSubImage(), then mImage->GetAsSourceSurface() is called. The GetAsSourceSurface() internally does yuv-rgb convert or readback. https://dxr.mozilla.org/mozilla-central/source/dom/canvas/TexUnpackBlob.cpp#499
Reporter | ||
Comment 1•8 years ago
|
||
Used the following to check comment 0. http://mdn.github.io/webgl-examples/tutorial/sample8/
Comment 2•8 years ago
|
||
I'll try to fix it first before looking into bug 1246410.
Assignee: nobody → ethlin
Comment 3•8 years ago
|
||
The fast path was blocked by mismatch premultiply alpha, though the alpha value for video should be 1.0. I let GLBlitHelper can handle premultiply/unpremultply to fix the problem.
Attachment #8798355 -
Flags: review?(jgilbert)
Comment 4•8 years ago
|
||
(In reply to Ethan Lin[:ethlin] from comment #3) > Created attachment 8798355 [details] [diff] [review] > Make GLBlitHelper accept mismatched premultiply alpha > > The fast path was blocked by mismatch premultiply alpha, though the alpha > value for video should be 1.0. I let GLBlitHelper can handle > premultiply/unpremultply to fix the problem. Wait, why is the video being decoded into RGBA? Are you sure it's not RGB/RGBX?
Flags: needinfo?(ethlin)
Comment 5•8 years ago
|
||
Video is decoded into ycbcr. If I do something like "gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, video)", gecko will converts the ycbcr data to RGBA texture with GPU(fast path) or CPU. BTW, currently image element also has the same problem due to the premultiply checking.
Flags: needinfo?(ethlin)
Comment 6•8 years ago
|
||
(In reply to Ethan Lin[:ethlin] from comment #5) > Video is decoded into ycbcr. If I do something like > "gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, > video)", gecko will converts the ycbcr data to RGBA texture with GPU(fast > path) or CPU. > BTW, currently image element also has the same problem due to the > premultiply checking. Premultiply mismatches are something we should continue to warn about. Why does YCbCr coerce into RGBA instead of RGB(X)?
Updated•8 years ago
|
Flags: needinfo?(ethlin)
Comment 7•8 years ago
|
||
Sorry for the late reply. The destination format should be specified by texImage2D's 'internal format'. So if user set the 'internal format' to RGBA, then we'll convert YCbCr to RGBA texture.
Flags: needinfo?(ethlin)
Comment 8•8 years ago
|
||
(In reply to Ethan Lin[:ethlin] from comment #7) > Sorry for the late reply. The destination format should be specified by > texImage2D's 'internal format'. So if user set the 'internal format' to > RGBA, then we'll convert YCbCr to RGBA texture. I also checked the webgl spec. I didn't see the limitation of the texture format for HTMLVideoElement, so the destination format should respect texImage2D's internal format.
Comment 9•8 years ago
|
||
(In reply to Ethan Lin[:ethlin] from comment #7) > Sorry for the late reply. The destination format should be specified by > texImage2D's 'internal format'. So if user set the 'internal format' to > RGBA, then we'll convert YCbCr to RGBA texture. My question is why we're receiving RGBA from (conceptually) the decoder/converter. Regardless, it's conceptually 'fine' if we get RGBA, we just need to have *some* fast path choice an app can make to incur no conversion. I'm less interested in making conversion fast than I am in enabling zero-conversion operations.
Flags: needinfo?(ethlin)
Comment 10•8 years ago
|
||
Per discussion with jgilbert, we should check (srcHasAlpha && dstHasAlpha && srcPremultAlpha != dstPremultAlpha) before BlitImageToFramebuffer. Actually my patch checks the format, but currently BlitImageToFramebuffer doesn't work with D3D11ShareHandleImage and MacIOSurface(2vuy). We should fix it.
Flags: needinfo?(ethlin)
Updated•8 years ago
|
Attachment #8798355 -
Flags: review?(jgilbert)
Comment 11•7 years ago
|
||
Assign myself first to find someone to work on it.
Assignee: ethlin → howareyou322
Comment 12•7 years ago
|
||
Too late for firefox 52, mass-wontfix.
Updated•5 years ago
|
Priority: -- → P2
Comment 13•2 years ago
|
||
The bug assignee didn't login in Bugzilla in the last 7 months.
:jgilbert, could you have a look please?
For more information, please visit auto_nag documentation.
Assignee: howareyou322 → nobody
Flags: needinfo?(jgilbert)
Updated•2 years ago
|
Severity: normal → S3
Comment 14•1 month ago
|
||
I suspect this was fixed at some point, but give a shout if not!
Status: NEW → RESOLVED
Closed: 1 month ago
Flags: needinfo?(jgilbert)
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•