Closed Bug 1543621 Opened 6 years ago Closed 6 years ago

WebGL is rendered as upside down on android

Categories

(Core :: Graphics: WebRender, defect)

Unspecified
Android
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: sotaro, Assigned: sotaro)

References

Details

(Whiteboard: [wr-amvp][wr-q2])

Attachments

(1 file)

On WebGL, a rotation info is delivered by GeckoSurfaceTexture. It is not handled yet with WebRender.

Bug 1507076 is related.

Assignee: nobody → sotaro.ikeda.g
OS: Unspecified → Android
Whiteboard: [wr-amvp][wr-q2]

SurfaceTexture is expected to be used with SurfaceTexture.getTransformMatrix(). With the matrix, SurfaceTexture's gl texture worked as bottom left origin. But current WebRender does not use the getTransformMatrix(). Then the gl texture worked as top left origin. Then WebGL rendering was flipped. Then Bug 1507076 is related.

On android, GLConsumer::computeTransformMatrix() calculate a matrix for the getTransformMatrix(). If there is no transform, it jut multiply y-flip.
http://androidxref.com/9.0.0_r3/xref/frameworks/native/libs/gui/GLConsumer.cpp#866
https://developer.android.com/reference/android/graphics/SurfaceTexture

On android, SurfaceTextureImage is created as gl::OriginPos::BottomLeft. The origin is not handled by WebRender. But it does not cause rendering problem, since getTransformMatrix() is also not handled and texture origin effectively worked as gl::OriginPos::TopLeft.

https://searchfox.org/mozilla-central/source/dom/media/platforms/android/RemoteDataDecoder.cpp#283

On android WebGL, y-flip is handled by nsDisplayCanvas::CreateWebRenderCommands(). But with WebRender, the getTransformMatrix() is not handled yet. Gl texture of SurfaceTexture is rendered as top left origin, then texture rendering result became y-flipped.
https://searchfox.org/mozilla-central/source/layout/generic/nsHTMLCanvasFrame.cpp#178

If SurfaceTexture usage is only Video decoding and WebGL, it is not necessary to handle getTransformMatrix() for now.

Long term solution is going to be handled by Bug 1507076.

Pushed by sikeda@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b2a8685b55e1
Move Y flip handling to AsyncImagePipelineManager::ApplyAsyncImageForPipeline() r=nical
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: