Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Issue 2026803002: Avoid GPU readback in tex(Sub)Image2D(ImageBitmap) (Closed)

Created:
4 years, 6 months ago by xidachen
Modified:
4 years, 6 months ago
CC:
chromium-reviews, blink-reviews-platform-graphics_chromium.org, dshwang, eae+blinkwatch, fs, dcheng, kouhei+svg_chromium.org, rwlbuis, krit, drott+blinkwatch_chromium.org, szager+layoutwatch_chromium.org, Rik, jchaffraix+rendering, blink-reviews, gyuyoung2, pdr+svgwatchlist_chromium.org, ajuma+watch_chromium.org, zoltan1, blink-reviews-layout_chromium.org, jbroman, pdr+graphicswatchlist_chromium.org, haraken, danakj+watch_chromium.org, pdr+renderingwatchlist_chromium.org, leviw+renderwatch, f(malita), Stephen Chennney
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Avoid GPU readback in tex(Sub)Image2D(ImageBitmap) At this moment, if an ImageBitmap is texture backed, texImage2D will do a GPU read back which is expensive. The solution is to prepare a mailbox for the ImageBitmap, and use the WebGL context to consume it and then do a GPU-GPU texture copy. BUG=613411, 613409 CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_optional_gpu_tests_rel;tryserver.chromium.mac:mac_optional_gpu_tests_rel Committed: https://crrev.com/0bed6ac0177c01b7aa2719ecbb5f80143ccaa4ef Cr-Commit-Position: refs/heads/master@{#401903}

Patch Set 1 #

Patch Set 2 : should work #

Patch Set 3 : fix compile error #

Patch Set 4 : layout tests and conformances tests pass #

Patch Set 5 : should work #

Total comments: 12

Patch Set 6 : address comments #

Total comments: 4

Patch Set 7 : rebase #

Total comments: 23

Patch Set 8 : address comments #

Patch Set 9 : staticbitmapimage does not keep provider anymore #

Total comments: 25

Patch Set 10 : address comments #

Patch Set 11 : change function name, layout still broken, DONOT COMMIT THIS PS #

Total comments: 3

Patch Set 12 : layout test timeout in a strange way #

Total comments: 2

Patch Set 13 : address fmalita's comments, an extra function for WebGL #

Patch Set 14 : rebase #

Patch Set 15 : layout tests pass, needs a bit more clean up #

Patch Set 16 : almost identical to 15 #

Patch Set 17 : takes care of TexSubImage2D(3D) #

Patch Set 18 : should work #

Total comments: 1

Patch Set 19 : address junov@'s comments #

Total comments: 10

Patch Set 20 : address kbr@'s comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+218 lines, -60 lines) Patch
M third_party/WebKit/Source/core/frame/ImageBitmap.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/frame/ImageBitmap.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLCanvasElement.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLImageElement.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLImageElement.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +16 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLVideoElement.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/html/canvas/CanvasImageSource.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DUsageTrackingTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 chunks +7 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 9 chunks +68 lines, -41 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +12 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 4 chunks +91 lines, -11 lines 0 comments Download

Messages

Total messages: 49 (14 generated)
xidachen
PTAL. Most of the changes are in WebGL and StaticBitmapImage class. Changes to the other ...
4 years, 6 months ago (2016-06-01 20:39:22 UTC) #4
Ken Russell (switch to Gerrit)
The high-level direction is good, but it looks to me like there are some issues. ...
4 years, 6 months ago (2016-06-01 22:55:10 UTC) #5
xidachen
https://codereview.chromium.org/2026803002/diff/80001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp (right): https://codereview.chromium.org/2026803002/diff/80001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode4170 third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:4170: GLint level, GLint internalformat, GLenum type, GLint xoffset, GLint ...
4 years, 6 months ago (2016-06-02 13:52:52 UTC) #6
Stephen White
Justin should definitely take a look at this when he gets back. In general, I'm ...
4 years, 6 months ago (2016-06-03 17:59:14 UTC) #7
Ken Russell (switch to Gerrit)
Please ping when this is ready for re-review. I'm guessing it's waiting for the refactoring ...
4 years, 6 months ago (2016-06-07 06:02:51 UTC) #9
xidachen
junov@: PTAL
4 years, 6 months ago (2016-06-07 14:14:04 UTC) #10
Justin Novosad
https://codereview.chromium.org/2026803002/diff/120001/third_party/WebKit/Source/core/frame/ImageBitmap.cpp File third_party/WebKit/Source/core/frame/ImageBitmap.cpp (right): https://codereview.chromium.org/2026803002/diff/120001/third_party/WebKit/Source/core/frame/ImageBitmap.cpp#newcode471 third_party/WebKit/Source/core/frame/ImageBitmap.cpp:471: return (!m_image->hasSkImage() || m_image->hasContext3DProvider()); This is hard to read. ...
4 years, 6 months ago (2016-06-07 15:11:07 UTC) #11
xidachen
https://codereview.chromium.org/2026803002/diff/120001/third_party/WebKit/Source/core/frame/ImageBitmap.cpp File third_party/WebKit/Source/core/frame/ImageBitmap.cpp (right): https://codereview.chromium.org/2026803002/diff/120001/third_party/WebKit/Source/core/frame/ImageBitmap.cpp#newcode471 third_party/WebKit/Source/core/frame/ImageBitmap.cpp:471: return (!m_image->hasSkImage() || m_image->hasContext3DProvider()); On 2016/06/07 15:11:07, Justin Novosad ...
4 years, 6 months ago (2016-06-07 17:49:54 UTC) #12
Justin Novosad
On 2016/06/07 17:49:54, xidachen wrote: > https://codereview.chromium.org/2026803002/diff/120001/third_party/WebKit/Source/core/frame/ImageBitmap.cpp > File third_party/WebKit/Source/core/frame/ImageBitmap.cpp (right): > > https://codereview.chromium.org/2026803002/diff/120001/third_party/WebKit/Source/core/frame/ImageBitmap.cpp#newcode471 > ...
4 years, 6 months ago (2016-06-07 18:51:26 UTC) #13
Justin Novosad
> > > > Also, I think in our previous discussion, we mentioned that when ...
4 years, 6 months ago (2016-06-07 19:04:34 UTC) #14
xidachen
> > But if I put this method in StaticBitmapImage, it should look like this, ...
4 years, 6 months ago (2016-06-07 19:10:49 UTC) #15
xidachen
On 2016/06/07 19:04:34, Justin Novosad wrote: > > > > > > Also, I think ...
4 years, 6 months ago (2016-06-07 19:16:13 UTC) #16
Justin Novosad
On 2016/06/07 19:16:13, xidachen wrote: > On 2016/06/07 19:04:34, Justin Novosad wrote: > > > ...
4 years, 6 months ago (2016-06-07 19:34:41 UTC) #17
xidachen
On 2016/06/07 19:34:41, Justin Novosad wrote: > On 2016/06/07 19:16:13, xidachen wrote: > > On ...
4 years, 6 months ago (2016-06-07 19:41:19 UTC) #18
Justin Novosad
On 2016/06/07 19:41:19, xidachen wrote: > On 2016/06/07 19:34:41, Justin Novosad wrote: > > On ...
4 years, 6 months ago (2016-06-07 20:04:36 UTC) #19
xidachen
PTAL https://codereview.chromium.org/2026803002/diff/160001/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp File third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp (right): https://codereview.chromium.org/2026803002/diff/160001/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp#newcode142 third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp:142: { The reason I put a lot of ...
4 years, 6 months ago (2016-06-09 15:09:54 UTC) #20
Justin Novosad
https://codereview.chromium.org/2026803002/diff/160001/third_party/WebKit/Source/core/frame/ImageBitmap.cpp File third_party/WebKit/Source/core/frame/ImageBitmap.cpp (right): https://codereview.chromium.org/2026803002/diff/160001/third_party/WebKit/Source/core/frame/ImageBitmap.cpp#newcode469 third_party/WebKit/Source/core/frame/ImageBitmap.cpp:469: // This function is used in WebGL's texImage, if ...
4 years, 6 months ago (2016-06-09 20:21:30 UTC) #21
xidachen
https://codereview.chromium.org/2026803002/diff/160001/third_party/WebKit/Source/core/frame/ImageBitmap.cpp File third_party/WebKit/Source/core/frame/ImageBitmap.cpp (right): https://codereview.chromium.org/2026803002/diff/160001/third_party/WebKit/Source/core/frame/ImageBitmap.cpp#newcode469 third_party/WebKit/Source/core/frame/ImageBitmap.cpp:469: // This function is used in WebGL's texImage, if ...
4 years, 6 months ago (2016-06-10 15:36:09 UTC) #22
Justin Novosad
https://codereview.chromium.org/2026803002/diff/160001/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp File third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp (right): https://codereview.chromium.org/2026803002/diff/160001/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp#newcode113 third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp:113: bool StaticBitmapImage::prepareMailboxForSkImage(WebGraphicsContext3DProvider* provider) Could we call this switchStorageToMailbox, and ...
4 years, 6 months ago (2016-06-10 17:50:40 UTC) #23
xidachen
https://codereview.chromium.org/2026803002/diff/160001/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp File third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp (right): https://codereview.chromium.org/2026803002/diff/160001/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp#newcode113 third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp:113: bool StaticBitmapImage::prepareMailboxForSkImage(WebGraphicsContext3DProvider* provider) On 2016/06/10 17:50:40, Justin Novosad wrote: ...
4 years, 6 months ago (2016-06-14 18:09:41 UTC) #25
bsalomon
https://codereview.chromium.org/2026803002/diff/200001/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp File third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp (right): https://codereview.chromium.org/2026803002/diff/200001/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp#newcode150 third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp:150: if (contextProvider) { On 2016/06/14 18:09:40, xidachen wrote: > ...
4 years, 6 months ago (2016-06-14 18:25:22 UTC) #27
Justin Novosad
https://codereview.chromium.org/2026803002/diff/160001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp (right): https://codereview.chromium.org/2026803002/diff/160001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode4283 third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:4283: GLint level, GLint internalformat, GLenum type, GLint xoffset, GLint ...
4 years, 6 months ago (2016-06-14 19:30:53 UTC) #28
xidachen
https://codereview.chromium.org/2026803002/diff/160001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp (right): https://codereview.chromium.org/2026803002/diff/160001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode4283 third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:4283: GLint level, GLint internalformat, GLenum type, GLint xoffset, GLint ...
4 years, 6 months ago (2016-06-15 12:18:48 UTC) #29
f(malita)
https://codereview.chromium.org/2026803002/diff/220001/third_party/WebKit/Source/platform/graphics/Image.h File third_party/WebKit/Source/platform/graphics/Image.h (right): https://codereview.chromium.org/2026803002/diff/220001/third_party/WebKit/Source/platform/graphics/Image.h#newcode143 third_party/WebKit/Source/platform/graphics/Image.h:143: virtual PassRefPtr<SkImage> imageForCurrentFrame(WebGraphicsContext3DProvider* = nullptr) = 0; Looks like ...
4 years, 6 months ago (2016-06-15 12:39:32 UTC) #30
Justin Novosad
On 2016/06/15 12:18:48, xidachen wrote: > On 2016/06/14 19:30:53, Justin Novosad wrote: > > Instead ...
4 years, 6 months ago (2016-06-15 14:22:34 UTC) #31
xidachen
ping, this CL is ready for re-review now.
4 years, 6 months ago (2016-06-23 14:37:38 UTC) #32
Justin Novosad
lgtm with nit. Wait for lgtm from a WebGL reviewer. https://codereview.chromium.org/2026803002/diff/340001/third_party/WebKit/Source/core/html/canvas/CanvasImageSource.h File third_party/WebKit/Source/core/html/canvas/CanvasImageSource.h (right): https://codereview.chromium.org/2026803002/diff/340001/third_party/WebKit/Source/core/html/canvas/CanvasImageSource.h#newcode71 ...
4 years, 6 months ago (2016-06-23 14:48:43 UTC) #33
Ken Russell (switch to Gerrit)
I'm not so clear on the management of the various objects in StaticBitmapImage, but if ...
4 years, 6 months ago (2016-06-24 01:25:10 UTC) #34
xidachen
https://codereview.chromium.org/2026803002/diff/360001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp File third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp (right): https://codereview.chromium.org/2026803002/diff/360001/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp#newcode4265 third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp:4265: // FIXME: Implement GPU-to-GPU path for WebGL 2 and ...
4 years, 6 months ago (2016-06-24 14:36:07 UTC) #35
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2026803002/380001
4 years, 6 months ago (2016-06-24 14:36:44 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2026803002/380001
4 years, 6 months ago (2016-06-24 15:53:12 UTC) #41
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/244900)
4 years, 6 months ago (2016-06-24 16:41:23 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2026803002/380001
4 years, 6 months ago (2016-06-24 16:42:18 UTC) #45
commit-bot: I haz the power
Committed patchset #20 (id:380001)
4 years, 6 months ago (2016-06-24 17:55:46 UTC) #47
commit-bot: I haz the power
4 years, 6 months ago (2016-06-24 17:57:27 UTC) #49
Message was sent while issue was closed.
Patchset 20 (id:??) landed as
https://crrev.com/0bed6ac0177c01b7aa2719ecbb5f80143ccaa4ef
Cr-Commit-Position: refs/heads/master@{#401903}

Powered by Google App Engine
This is Rietveld 408576698