New issue
Advanced search Search tips
Starred by 2 users
Status: Fixed
Owner:
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 563816



Sign in to add a comment
Offscreencanvas commit have flickering
Project Member Reported by xidac...@chromium.org, Oct 21 2016 Back to list
Using the attached example, we get flickering with the following error message:
[140882:140882:1021/095454:ERROR:gles2_cmd_decoder.cc(16763)] [.DisplayCompositor-0x3fe329408e00]GL ERROR :GL_INVALID_OPERATION : glCreateAndConsumeTextureCHROMIUM: invalid mailbox name
[140882:140882:1021/095454:ERROR:gles2_cmd_decoder.cc(9395)] [.DisplayCompositor-0x3fe329408e00]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.
 
offscreen-webgl.html
2.3 KB View Download
Blocking: 563816
Components: Blink>Canvas
Making this block shipping.
Project Member Comment 2 by bugdroid1@chromium.org, Nov 9 2016
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5717f6e18242d06a01cab340f086624b8f55cad6

commit 5717f6e18242d06a01cab340f086624b8f55cad6
Author: xidachen <xidachen@chromium.org>
Date: Wed Nov 09 04:46:33 2016

Refactor AcceleratedStaticBitmapImage

This CL solves this problems:
Calling OffscreenCanvas's transferToImageBitmap changes WebGL's
DepthTest states.

The cause is that in the method DrawingBuffer::transferToStaticBitmapImage(),
it calls SkImage::MakeFromAdoptedTexture(). The first parameter that
we passed to MakeFromAdoptedTexture method is WebGL's GrContext,
and can change all kinds of WebGL states.

To solve this, we should not using a SkImage to wrap up WebGL's mailbox
and syncToken. But the problem is: how are we going to keep them alive.

So this CL refactors the AcceleratedStaticBitmapImage class. In particular,
we designed an abstract class TextureHolder, which has two sub-classes:
SkiaTextureHolder, MailboxTextureHolder. Then AcceleratedStaticBitmapImage
holds an instance of TextureHolder. Being a SkiaTextureHolder means that
the AcceleratedStaticBitmapImage is created from a texture-backed SkImage.
Being a MailboxTextureHolder means that the AcceleratedStaticBitmapImage
is created by passing in WebGL's mailbox, syncToken and associated texture
Id to keep the texture alive.

This CL also fixes the problem where WebGL's commit have flickering. The cause
of the flickering is that in dispatchFrame() function call which takes a
StaticBitmapImage |image|, we accidentally called verifyImageSize(image->imageForCurrentFrame())),
the image->imageForCurrentFrame() consumes the mailbox and convert the mailbox into a
texture-backed SkImage, then when we prepare transferable resources from the image,
we call image->ensureMailbox() which converts the SkImage back to GPU texture again.
This is totally un-necessary. The fix is just let verifyImageSize take image->size().

This CL also fixes a crash on releaseImageThreadSafe method.
Currently in the AcceleratedStaticBitmapImage class, it keeps a pointer
m_imageThread which stores the thread where m_image is created. Then in
the method releaseImageThreadSafe(), it calls m_imageThread->getWebTaskRunner()
to release the m_image on the original thread where it was created. It
could crash in this case: when m_image was created on a worker thread,
and then transferred to the main thread, when releaseImageThreadSafe()
is invoked on the main thread, the worker thread is already out of scope.
So at this moment, calling m_imageThread->getWebTaskRunner() results in
a crash.

The fix of it is to store a clone of the WebTaskRunner for m_imageThread.

BUG= 657975 ,  661614 ,  658251 

Review-Url: https://codereview.chromium.org/2455983005
Cr-Commit-Position: refs/heads/master@{#430865}

[add] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/LayoutTests/fast/canvas/webgl/offscreenCanvas-APIs-NOT-alter-webgl-states.html
[modify] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/LayoutTests/fast/canvas/webgl/offscreenCanvas-transferToImageBitmap-texImage2D.html
[modify] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/Source/platform/BUILD.gn
[modify] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp
[modify] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h
[add] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/Source/platform/graphics/MailboxTextureHolder.cpp
[add] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/Source/platform/graphics/MailboxTextureHolder.h
[modify] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
[modify] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.h
[add] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.cpp
[add] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/Source/platform/graphics/SkiaTextureHolder.h
[modify] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
[modify] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h
[add] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/Source/platform/graphics/TextureHolder.h
[add] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp
[add] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.h
[add] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/Source/platform/graphics/WebGraphicsContext3DProviderWrapper.h
[modify] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
[modify] https://crrev.com/5717f6e18242d06a01cab340f086624b8f55cad6/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h

Status: Fixed
Sign in to add a comment