New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 794706 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Mar 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

Merge CopyToPlatformTexture function variants into one single function

Project Member Reported by xlai@chromium.org, Dec 13 2017

Issue description

Currently, we have

ImageBuffer::CopyToPlatformTexture (will be moved out of ImageBuffer after  crbug.com/776806  is done)
DrawingBuffer::CopyToPlatformTexture
AcceleratedStaticBitmapImage::CopyToTexture

The contents of these functions look similar: they all invoke 
gpu::gles2::GLES2Interface::CopySubTextureChromium. But they cater to different 
scenarios. As too much code duplication is evil, we hope to find an ideal place to write
a single function that copies an accelerated texture to a webgl target, and replaces all
these variants.

 

Comment 1 by zmo@chromium.org, Dec 13 2017

Labels: -Pri-3 Pri-2
I like this idea very much! Look forward to your CLs.

Comment 2 by xlai@chromium.org, Dec 15 2017

One more subtle TODO item in this issue:

If the gl synchronization in DrawingBuffer::CopyToPlatformTexture is done correctly. There should be no need to call gl->Flush() before using
DrawingBuffer::CopyToPlatformTexture as what is currently done in
CopyRenderingResultsFromDrawingBuffer today. 

Comment 3 by xlai@chromium.org, Dec 15 2017

Several gl->Flush() calls in these Copy functions might need to be replaced with ShallowFlushCHROMIUM.

These are all marked as TODO in https://chromium-review.googlesource.com/c/chromium/src/+/824437
Project Member

Comment 4 by bugdroid1@chromium.org, Jan 5 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8d804a372fd8adc4e6114e8762274558d3ac4d00

commit 8d804a372fd8adc4e6114e8762274558d3ac4d00
Author: xlai <xlai@chromium.org>
Date: Fri Jan 05 16:45:08 2018

Merge ImageBitmapImage::CopyImageToTexture to CopyToTexture

Bug:  794706 
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: If231400815bce200675645816d9045ce54e1bf5f
Reviewed-on: https://chromium-review.googlesource.com/849372
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Olivia Lai <xlai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#527296}
[modify] https://crrev.com/8d804a372fd8adc4e6114e8762274558d3ac4d00/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
[modify] https://crrev.com/8d804a372fd8adc4e6114e8762274558d3ac4d00/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
[modify] https://crrev.com/8d804a372fd8adc4e6114e8762274558d3ac4d00/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp
[modify] https://crrev.com/8d804a372fd8adc4e6114e8762274558d3ac4d00/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h
[modify] https://crrev.com/8d804a372fd8adc4e6114e8762274558d3ac4d00/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
[modify] https://crrev.com/8d804a372fd8adc4e6114e8762274558d3ac4d00/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h

Comment 5 by xlai@chromium.org, Jan 5 2018

Status: Started (was: Assigned)
Project Member

Comment 6 by bugdroid1@chromium.org, Jan 9 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6f61bf10548c22928b17cbd83c677d71d20681ef

commit 6f61bf10548c22928b17cbd83c677d71d20681ef
Author: xlai <xlai@chromium.org>
Date: Tue Jan 09 15:37:23 2018

Do not manipulate flip-Y in WebGL::texImage2D from ImageBitmap

Bug:  794706 
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I801f0b4ef778c27f02b85d6dcdd6972b51458d53
Reviewed-on: https://chromium-review.googlesource.com/854506
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Olivia Lai <xlai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#528001}
[modify] https://crrev.com/6f61bf10548c22928b17cbd83c677d71d20681ef/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Comment 7 by xlai@chromium.org, Jan 16 2018

The two texture copying function in ImageBuffer(later moved to StaticBitmapImage) and AcceleratedStaticBitmapImage have now been merged.

When I look at the third texture copying function "DrawingBuffer::CopyToPlatformTexture", the purpose of this function is quite different from the other two--it directly copy from texture to texture without
going through a StaticBitmapImage and it serves as a helper function for some other webgl functions like MakeImageSnapshot,  CopyRenderingResultsFromDrawingBuffer (which is in turn used by GetImage) and 
TexImageCanvasByGPU. I find it not a feasible plan to merge this function with
the other two.

However, a curious discovery during my code search is why webgl has more than one functions to extract a StaticBitmapImage:

scoped_refptr<StaticBitmapImage> WebGLRenderingContextBase::GetImage
scoped_refptr<StaticBitmapImage> WebGLRenderingContextBase::MakeImageSnapshot

Will continue checking whether this is another code duplication case.

Comment 8 by kbr@chromium.org, Jan 16 2018

I don't know all the reasons for those entry points but it looks like GetImage is a necessary override from CanvasRenderingContext. It looks like MakeImageSnapshot is a private helper used by both GetStaticBitmapImage and GetImage.

Project Member

Comment 9 by bugdroid1@chromium.org, Mar 2 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/eb1fd7c74bda230a1983164bc82c963a84bb6c37

commit eb1fd7c74bda230a1983164bc82c963a84bb6c37
Author: xlai <xlai@chromium.org>
Date: Fri Mar 02 16:38:59 2018

Remove code duplication in WebGLRenderingContextBase::GetImage

By doing a detailed dig-in, it was found that both the copy image operation in
main thread and worker thread will call CopyToPlatformTexture and pass in the
same set of parameters wrapped in different classes. This CL abandons one of
these routes that uses MakeImageSnapshot() and adopt the other route that use
our latest one-stop resource manager class--CanvasResourceProvider, as well as
using ContextProviderWrapper as a unified context provider for both main and
worker thread.

Bug:  794706 
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Idb5b64d0d10b95abde14cab0680695348505e811
Reviewed-on: https://chromium-review.googlesource.com/943761
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Olivia Lai <xlai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#540534}
[modify] https://crrev.com/eb1fd7c74bda230a1983164bc82c963a84bb6c37/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Project Member

Comment 10 by bugdroid1@chromium.org, Mar 3 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/da8c644e5580077d7b2b0640532b363cf658b159

commit da8c644e5580077d7b2b0640532b363cf658b159
Author: xlai <xlai@chromium.org>
Date: Sat Mar 03 02:16:17 2018

Clean up duplicate function WebGLRenderingContextBase::MakeImagesnapshot()

A follow-up CL to do more cleaning on code duplication in WebGL rendering context,
after https://chromium-review.googlesource.com/943761.

Bug:  794706 
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I8c9de02c113a36b4c6b95bb1dd3af25079b4c4d3
Reviewed-on: https://chromium-review.googlesource.com/946899
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Olivia Lai <xlai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#540721}
[modify] https://crrev.com/da8c644e5580077d7b2b0640532b363cf658b159/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
[modify] https://crrev.com/da8c644e5580077d7b2b0640532b363cf658b159/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h

Comment 11 by xlai@chromium.org, Mar 7 2018

Status: Fixed (was: Started)

Sign in to add a comment