Bug 86275

Summary: [Chromium] Support for direct GPU texture copy between Canvas2D and WebGL Textures
Product: WebKit Reporter: Jeff Timanus <twiz>
Component: WebGLAssignee: Jeff Timanus <twiz>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, bsalomon, cc-bugs, dglazkov, fishd, gman, gustavo, jamesr, junov, kbr, philn, senorblanco, tkent+wkapi, twiz, webkit.review.bot, xan.lopez, zmo
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 89494    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Archive of layout-test-results from ec2-cr-linux-04
none
Patch
none
Archive of layout-test-results from ec2-cr-linux-04
none
Patch
none
Patch
none
Archive of layout-test-results from ec2-cr-linux-03
none
Patch
none
Archive of layout-test-results from ec2-cr-linux-04
none
Patch none

Jeff Timanus
Reported 2012-05-11 17:05:43 PDT
Calls to WebGL's texImage2D interface with Canvas2D elements incur a costly software read-back for hardware accelerated instances of Canvas2D. A fast path should be implemented, allowing for a direct copy between the GPU textures. The GL_CHROMIUM_copy_texture extension was designed for this purpose. (crrev.com/133213) Issue tracked also at crbug.com/101051
Attachments
Patch (17.11 KB, patch)
2012-05-11 17:42 PDT, Jeff Timanus
no flags
Patch (16.43 KB, patch)
2012-05-14 12:32 PDT, Jeff Timanus
no flags
Patch (17.79 KB, patch)
2012-05-17 13:49 PDT, Jeff Timanus
no flags
Archive of layout-test-results from ec2-cr-linux-04 (622.75 KB, application/zip)
2012-05-17 14:44 PDT, WebKit Review Bot
no flags
Patch (18.62 KB, patch)
2012-05-17 14:57 PDT, Jeff Timanus
no flags
Archive of layout-test-results from ec2-cr-linux-04 (491.14 KB, application/zip)
2012-05-17 16:09 PDT, WebKit Review Bot
no flags
Patch (15.47 KB, patch)
2012-06-20 12:26 PDT, Jeff Timanus
no flags
Patch (17.31 KB, patch)
2012-06-20 13:09 PDT, Jeff Timanus
no flags
Archive of layout-test-results from ec2-cr-linux-03 (697.15 KB, application/zip)
2012-06-20 17:25 PDT, WebKit Review Bot
no flags
Patch (17.31 KB, patch)
2012-06-21 13:48 PDT, Jeff Timanus
no flags
Archive of layout-test-results from ec2-cr-linux-04 (649.58 KB, application/zip)
2012-06-21 20:15 PDT, WebKit Review Bot
no flags
Patch (18.63 KB, patch)
2012-06-22 11:12 PDT, Jeff Timanus
no flags
Jeff Timanus
Comment 1 2012-05-11 17:42:39 PDT
Jeff Timanus
Comment 2 2012-05-11 18:10:22 PDT
Comment on attachment 141535 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=141535&action=review I've had this patch percolating for a while. It uses the GL_CHROMIUM_copy_texture extension to enable the copy of a texture from a BGRA-backed Ganesh instance. I think that some of the details will still need some work. See in-line comments. Please comment on the general structure of the approach. There is still a problem with this change. Essentially the code path invokes the following sequence of operations, when copying to a texture, followed by generation of mip-maps. 1. Construct a texture, A. -> Done from WebGL 2. Bind A as TEXTURE_2D. 3. gl.texImage2D(..., canvas2D) 1. glTexImage2D(canvas.size, format,.... NULL). -> Done from GL_CHROMIUM_copy_texture 2. Bind texture, A, as backing store for a fbo. 3. glDrawArrays on the fbo. 4. gl.generateMipmaps(TEXTURE_2D) -> Called from WebGL In both ANGLE, and desktop-gl, the mip-map generation is clearing the texture contents that were rendered via the framebuffer. I am presently writing a webgl sample that demonstrates this problem. My haunch is that the mip-map generation code is not behaving properly for textures that have never been initialized with pixel data from a texImage2D call. > Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:2205 > +{ The name of this routine, and the use of an int for internalFormat may be worth changing. Also, is there a preference for reference vs pointer arguments? > Source/WebCore/html/canvas/WebGLRenderingContext.cpp:3599 > + WebGLTexture* texture = validateTextureBinding("texImage2D", target, true); The extension only works for TEXTURE_2D targets. This can be extended, but this is a first pass, to get part of the canvas2d-webgl path accelerated. This entire chunk of code could use some re-working, to unify this path and the existing path in texImage2DBase. > Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp:671 > + SkGpuRenderTarget* renderTarget = m_canvas->getDevice()->accessRenderTarget(); At present, this is the only way to get to the backing texture. A cleaner accessor needs to be added to SkDevice.
Kenneth Russell
Comment 3 2012-05-11 18:22:22 PDT
+gman who might have ideas or experience about the glGenerateMipmaps problem
Gregg Tavares
Comment 4 2012-05-12 00:23:58 PDT
Is the texture NPOT? You can't generate mips on an NPOT texture from WebGL
Gregg Tavares
Comment 5 2012-05-12 00:25:06 PDT
Also you can't render an NPOT texture from WebGL unless you set wrapping to CLAMP and choose filtering modes that don't use MIPS. If you don't follow those restrictions it will render in black.
Jeff Timanus
Comment 6 2012-05-14 07:40:50 PDT
(In reply to comment #4) > Is the texture NPOT? You can't generate mips on an NPOT texture from WebGL The sample that generates the failure is a the following site: http://www.spoonofdeath.com/delph/webgltext.html The texture is 512x512, so it is NPOT. (In reply to comment #5) > Also you can't render an NPOT texture from WebGL unless you set wrapping to CLAMP and choose filtering modes that don't use MIPS. > > If you don't follow those restrictions it will render in black. The demo works fine without my change, and GL_CHROMIUM_copy_texture_2d should be restoring the clamp/filtering settings. I'll extend the existing test cases, just to triple check.
Jeff Timanus
Comment 7 2012-05-14 07:43:04 PDT
(In reply to comment #6) > (In reply to comment #4) > > Is the texture NPOT? You can't generate mips on an NPOT texture from WebGL > > The sample that generates the failure is a the following site: http://www.spoonofdeath.com/delph/webgltext.html > > The texture is 512x512, so it is NPOT. Correction: It IS POT. > > (In reply to comment #5) > > Also you can't render an NPOT texture from WebGL unless you set wrapping to CLAMP and choose filtering modes that don't use MIPS. > > > > If you don't follow those restrictions it will render in black. > > The demo works fine without my change, and GL_CHROMIUM_copy_texture_2d should be restoring the clamp/filtering settings. I'll extend the existing test cases, just to triple check.
Jeff Timanus
Comment 8 2012-05-14 12:32:44 PDT
Jeff Timanus
Comment 9 2012-05-14 12:38:04 PDT
(In reply to comment #8) > Created an attachment (id=141767) [details] > Patch This patch rebaselines the change to wk rev 116969.
Stephen White
Comment 10 2012-05-14 13:14:25 PDT
Comment on attachment 141767 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=141767&action=review > Source/WebCore/html/canvas/CanvasRenderingContext.h:60 > + virtual bool copyToWebGLTexture(GraphicsContext3D& context, WebGLTexture& texture, int internalFormat) { return false; } Out of curiosity, does this optimization make sense to do on WebGL as well? i.e., can you draw from one WebGL canvas to another via texImage2D? > Source/WebCore/html/canvas/WebGLRenderingContext.cpp:3598 > +#if 0 This should go away, obviously. > Source/WebCore/platform/graphics/GraphicsContext.h:35 > +#include "GraphicsTypes3D.h" I'm not sure that adding dependencies on WebGL objects to GraphicsContext is a great idea. At a minimum, perhaps we should keep the dependencies to just Platform3DObject, rather than WebGLTexture if possible (it looks like they are already, perhaps just the forward declaration is wrong). And perhaps we should name the function a little more generically, perhaps something like copyBackingStoreToTexture() or something. In fact, perhaps this should be on the ImageBuffer, rather than the GraphicsContext. Another approach might be to provide a way to get the backing store texture ID out of ImageBuffer, and do all the copying up in CanvasRenderingContext[2D], rather than down in PlatformContextSkia. I'm not certain which approach is best to be honest. > Source/WebCore/platform/graphics/GraphicsContext.h:132 > + class WebGLTexture; Spurious forward declaration? > Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp:677 > + if (!context.makeContextCurrent()) > + return false; Do we need to restore the current context? (Don't think so, since I think all GC3D stubs now set the context, but I could be wrong).
WebKit Review Bot
Comment 11 2012-05-15 10:01:31 PDT
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
WebKit Review Bot
Comment 12 2012-05-15 10:02:09 PDT
Attachment 141767 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/Platform/ChangeLog', u'Source/Platf..." exit_code: 1 Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp:47: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 1 in 17 files If any of these errors are false positives, please file a bug against check-webkit-style.
Early Warning System Bot
Comment 13 2012-05-15 10:06:16 PDT
Build Bot
Comment 14 2012-05-15 10:08:26 PDT
Early Warning System Bot
Comment 15 2012-05-15 10:09:35 PDT
Build Bot
Comment 16 2012-05-15 10:09:44 PDT
Gyuyoung Kim
Comment 17 2012-05-15 10:10:23 PDT
Jeff Timanus
Comment 18 2012-05-16 08:39:11 PDT
(In reply to comment #10) > (From update of attachment 141767 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=141767&action=review > > > Source/WebCore/html/canvas/CanvasRenderingContext.h:60 > > + virtual bool copyToWebGLTexture(GraphicsContext3D& context, WebGLTexture& texture, int internalFormat) { return false; } > > Out of curiosity, does this optimization make sense to do on WebGL as well? i.e., can you draw from one WebGL canvas to another via texImage2D? Yes, the WebGL-WebGL path is currently slow as it performs a read-back. To allow the fast-path between WebGL contexts, WebGLRenderingContext would need to override the copyToWebGLTexture(...) method. This path only provides the implementation for Canvas2D. There is also the issue that WebGL contexts share resources with the compositor, but not necessarily with each-other. This extension assumes resource sharing. Al Patrick is working on a similar extension that could be used for the WebGL case: http://codereview.chromium.org/10106015/ > > > Source/WebCore/html/canvas/WebGLRenderingContext.cpp:3598 > > +#if 0 > > This should go away, obviously. Leftover debugging code. Fixed. > > > Source/WebCore/platform/graphics/GraphicsContext.h:35 > > +#include "GraphicsTypes3D.h" > > I'm not sure that adding dependencies on WebGL objects to GraphicsContext is a great idea. At a minimum, perhaps we should keep the dependencies to just Platform3DObject, rather than WebGLTexture if possible (it looks like they are already, perhaps just the forward declaration is wrong). And perhaps we should name the function a little more generically, perhaps something like copyBackingStoreToTexture() or something. I'll make the function name more generic, as I agree that the name is currently not appropriate. Yes, there is no need to pass WebGLTexture instances, when Platform3DObject types are suitable. > > In fact, perhaps this should be on the ImageBuffer, rather than the GraphicsContext. Another approach might be to provide a way to get the backing store texture ID out of ImageBuffer, and do all the copying up in CanvasRenderingContext[2D], rather than down in PlatformContextSkia. I'm not certain which approach is best to be honest. Now that I have the patch fully working, I'll implement this alternative and upload a patch so we can pick & choose the best impl. > > > Source/WebCore/platform/graphics/GraphicsContext.h:132 > > + class WebGLTexture; > > Spurious forward declaration? Spurious. Removed. > > > Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp:677 > > + if (!context.makeContextCurrent()) > > + return false; > > Do we need to restore the current context? (Don't think so, since I think all GC3D stubs now set the context, but I could be wrong). Ganesh resets the current context on all GL calls, but I'm not certain if the GC3D calls will enforce the correct context. WebGraphicsContext3DInProcessCommandBufferImpl::ClearContext() is called by most routines, but it is presently a no-op. (In reply to comment #10) > (From update of attachment 141767 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=141767&action=review > > > Source/WebCore/html/canvas/CanvasRenderingContext.h:60 > > + virtual bool copyToWebGLTexture(GraphicsContext3D& context, WebGLTexture& texture, int internalFormat) { return false; } > > Out of curiosity, does this optimization make sense to do on WebGL as well? i.e., can you draw from one WebGL canvas to another via texImage2D? > > > Source/WebCore/html/canvas/WebGLRenderingContext.cpp:3598 > > +#if 0 > > This should go away, obviously. > > > Source/WebCore/platform/graphics/GraphicsContext.h:35 > > +#include "GraphicsTypes3D.h" > > I'm not sure that adding dependencies on WebGL objects to GraphicsContext is a great idea. At a minimum, perhaps we should keep the dependencies to just Platform3DObject, rather than WebGLTexture if possible (it looks like they are already, perhaps just the forward declaration is wrong). And perhaps we should name the function a little more generically, perhaps something like copyBackingStoreToTexture() or something. > > In fact, perhaps this should be on the ImageBuffer, rather than the GraphicsContext. Another approach might be to provide a way to get the backing store texture ID out of ImageBuffer, and do all the copying up in CanvasRenderingContext[2D], rather than down in PlatformContextSkia. I'm not certain which approach is best to be honest. > > > Source/WebCore/platform/graphics/GraphicsContext.h:132 > > + class WebGLTexture; > > Spurious forward declaration? > > > Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp:677 > > + if (!context.makeContextCurrent()) > > + return false; > > Do we need to restore the current context? (Don't think so, since I think all GC3D stubs now set the context, but I could be wrong).
Jeff Timanus
Comment 19 2012-05-17 13:49:49 PDT
Jeff Timanus
Comment 20 2012-05-17 13:56:13 PDT
Comment on attachment 142544 [details] Patch I believe that this patch is close to how the final version of this path will operate. Note that the gen-mips issue is still present, so this is still not 100% ready for prime-time. However, I'm marking for review, because the gen-mips issue could be related to ANGLE or the Chromium GPU-command buffer, and the fix will likely not be related to these changes.
James Robinson
Comment 21 2012-05-17 13:58:23 PDT
Comment on attachment 142544 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=142544&action=review > Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:73 > +#if PLATFORM(CHROMIUM) > +#include "LayerChromium.h" > +#endif is this #include being used? it's a bit odd for the cross-platform CanvasRenderingContext2D to know about the chromium compositor implementation details > Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.h:67 > + virtual GraphicsContext3D* graphicsContext3D() OVERRIDE; I've got another patch pending on Canvas2DLayerChromium that I was planning to land today. I don't want to slow you down and I'm happy to take care of any merge headaches - do you think that generally this patch is ready to land now-ish, or it needs some more iterations / rolls?
Build Bot
Comment 22 2012-05-17 14:03:06 PDT
James Robinson
Comment 23 2012-05-17 14:06:59 PDT
Comment on attachment 142544 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=142544&action=review > Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp:207 > + m_data.m_canvas->flush(); > + m_data.m_platformLayer->graphicsContext3D()->flush(); Does the canvas context have to be made current before flush()ing the SkCanvas? I don't think it is safe to reach in and touch the back texture like this in the non-double-buffered multi-threaded case since the compositor thread might be using this texture. Look at the layerWillDraw() logic inside Canvas2DLayerChromium. Rather than reaching in by hand and grabbing the layer's texture, I think it'd be better to have the layer (or some other class) be responsible for making sure that this texture can be provided. As I mentioned I have another refactor in this area planned. I can make sure to provide an API that'll make a texture representing the current state of this canvas is available, if that's what this wants. > Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp:209 > + if (!context.makeContextCurrent()) Is there a strong reason for doing this on the webgl context vs doing it on the canvas context and flushing? Seems like a bit of a tossup since we have to make both current and flush 'em both, but hmmmm.. > Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp:212 > + Extensions3D* extensions = context.getExtensions(); do we expose this extension on the webgl context?
Jeff Timanus
Comment 24 2012-05-17 14:13:43 PDT
(In reply to comment #21) > (From update of attachment 142544 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=142544&action=review > > > Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:73 > > +#if PLATFORM(CHROMIUM) > > +#include "LayerChromium.h" > > +#endif > > is this #include being used? it's a bit odd for the cross-platform CanvasRenderingContext2D to know about the chromium compositor implementation details Yes, that's a leftover include. I'll drop it. > > > Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.h:67 > > + virtual GraphicsContext3D* graphicsContext3D() OVERRIDE; > > I've got another patch pending on Canvas2DLayerChromium that I was planning to land today. I don't want to slow you down and I'm happy to take care of any merge headaches - do you think that generally this patch is ready to land now-ish, or it needs some more iterations / rolls? I think it needs some more iterations. The mip-maps problem essentially blocks this change, because the common usage pattern is to render to the canvas, copy it to WebGL, and then immediately gen a mip-chain. This patch is smallish, so I can easily cope with merge issues - you can move forward with your changes without blocking me too much.
Stephen White
Comment 25 2012-05-17 14:15:53 PDT
Comment on attachment 142544 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=142544&action=review > Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:2278 > +bool CanvasRenderingContext2D::copyToPlatformTexture(GraphicsContext3D& destinationContext, Platform3DObject texture, int internalFormat) > +{ > +#if PLATFORM(CHROMIUM) > + return canvas()->buffer()->copyToPlatformTexture(destinationContext, texture, internalFormat); > +#else Since we can't do WebGL->WebGL copies yet, could we move this code into WebGLRenderingContext instead and remove the virtual override for now? It feels a little weird to have WebGL types in CanvasRenderingContext2D, while I think WebGL already knows about the Canvas2D types you need (ImageBuffer).
Early Warning System Bot
Comment 26 2012-05-17 14:15:55 PDT
Early Warning System Bot
Comment 27 2012-05-17 14:17:16 PDT
Jeff Timanus
Comment 28 2012-05-17 14:23:40 PDT
Comment on attachment 142544 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=142544&action=review >> Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp:207 >> + m_data.m_platformLayer->graphicsContext3D()->flush(); > > Does the canvas context have to be made current before flush()ing the SkCanvas? I don't think it is safe to reach in and touch the back texture like this in the non-double-buffered multi-threaded case since the compositor thread might be using this texture. Look at the layerWillDraw() logic inside Canvas2DLayerChromium. Rather than reaching in by hand and grabbing the layer's texture, I think it'd be better to have the layer (or some other class) be responsible for making sure that this texture can be provided. > > As I mentioned I have another refactor in this area planned. I can make sure to provide an API that'll make a texture representing the current state of this canvas is available, if that's what this wants. The canvas context does not need to be made current. All of the Ganesh calls to GL make the context current. We could add extra make-current calls here for clarity, though. You are right that there is the potential to race with the compositor when invoking the flush. I'll make the change to use layerWillDraw, or the new equivalent to prevent this problem. >> Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp:209 >> + if (!context.makeContextCurrent()) > > Is there a strong reason for doing this on the webgl context vs doing it on the canvas context and flushing? Seems like a bit of a tossup since we have to make both current and flush 'em both, but hmmmm.. The issue is that the copy has to respect the pixel-storage settings that are current in the WebGL context. (Flip-y, pre-multiply alpha). It could be done in the canvas context, but then we would have to manage this state. >> Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp:212 >> + Extensions3D* extensions = context.getExtensions(); > > do we expose this extension on the webgl context? That's a good question. I will have to double check if this is exposed to WebGL.
Kenneth Russell
Comment 29 2012-05-17 14:34:39 PDT
Comment on attachment 142544 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=142544&action=review >>> Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp:212 >>> + Extensions3D* extensions = context.getExtensions(); >> >> do we expose this extension on the webgl context? > > That's a good question. I will have to double check if this is exposed to WebGL. No, this extension isn't exposed to WebGL.
WebKit Review Bot
Comment 30 2012-05-17 14:44:44 PDT
Comment on attachment 142544 [details] Patch Attachment 142544 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/12725233 New failing tests: http/tests/security/webgl-remote-read-remote-image-allowed-with-credentials.html fast/canvas/webgl/tex-image-and-uniform-binding-bugs.html fast/canvas/webgl/tex-sub-image-2d-bad-args.html platform/chromium/virtual/gpu/fast/canvas/webgl/tex-sub-image-2d-bad-args.html http/tests/security/webgl-remote-read-remote-image-allowed.html platform/chromium/virtual/gpu/fast/canvas/webgl/gl-teximage.html fast/canvas/webgl/texture-active-bind.html platform/chromium/virtual/gpu/fast/canvas/webgl/tex-image-and-uniform-binding-bugs.html fast/canvas/webgl/gl-teximage.html fast/canvas/webgl/canvas-2d-webgl-texture.html platform/chromium/virtual/gpu/fast/canvas/webgl/texture-active-bind.html fast/canvas/webgl/texture-complete.html
WebKit Review Bot
Comment 31 2012-05-17 14:44:53 PDT
Created attachment 142557 [details] Archive of layout-test-results from ec2-cr-linux-04 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-04 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Gyuyoung Kim
Comment 32 2012-05-17 14:54:38 PDT
Jeff Timanus
Comment 33 2012-05-17 14:57:53 PDT
Jeff Timanus
Comment 34 2012-05-17 15:00:29 PDT
Comment on attachment 142562 [details] Patch This patch addresses previous comments, including calling layerWillDraw(...) before flushing the canvas. James, please don't hold up your work for this change. I need to fix the mip issue, and associated layout failures. As long as you provide a means to access the texture backing the canvas in a safe way, then I'm good to go. I presume you will need this feature anyway for canvas-canvas draws.
Build Bot
Comment 35 2012-05-17 16:07:35 PDT
WebKit Review Bot
Comment 36 2012-05-17 16:09:36 PDT
Comment on attachment 142562 [details] Patch Attachment 142562 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/12727164 New failing tests: fast/canvas/webgl/premultiplyalpha-test.html fast/canvas/webgl/tex-image-and-uniform-binding-bugs.html fast/canvas/webgl/tex-sub-image-2d-bad-args.html platform/chromium/virtual/gpu/fast/canvas/webgl/premultiplyalpha-test.html platform/chromium/virtual/gpu/fast/canvas/webgl/tex-sub-image-2d-bad-args.html http/tests/security/webgl-remote-read-remote-image-allowed.html platform/chromium/virtual/gpu/fast/canvas/webgl/gl-teximage.html fast/canvas/webgl/texture-active-bind.html fast/canvas/webgl/gl-teximage.html http/tests/security/webgl-remote-read-remote-image-allowed-with-credentials.html platform/chromium/virtual/gpu/fast/canvas/webgl/texture-active-bind.html fast/canvas/webgl/texture-complete.html fast/canvas/webgl/canvas-2d-webgl-texture.html
WebKit Review Bot
Comment 37 2012-05-17 16:09:43 PDT
Created attachment 142580 [details] Archive of layout-test-results from ec2-cr-linux-04 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-04 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Early Warning System Bot
Comment 38 2012-05-17 16:14:34 PDT
Early Warning System Bot
Comment 39 2012-05-17 16:29:09 PDT
Jeff Timanus
Comment 40 2012-06-20 12:26:19 PDT
Jeff Timanus
Comment 41 2012-06-20 13:09:08 PDT
Jeff Timanus
Comment 42 2012-06-20 13:45:21 PDT
Comment on attachment 148637 [details] Patch This should be close to the last revision of this change. The copy is now performed by the ImageBuffer class, which accesses the backing store texture of the canvas via the Canvas2DLayerBridge. Points of note: - I added the plumbing for the flipy and pre-multiplied-alpha GL command buffer extensions. Note that the WebGLRenderingContext does NOT forward these settings to the graphics context. The flipy and premultiply alpha settings cached on the WebGLRenderingContext instance are used just as they were previously: When performing texture uploads via the software read-back path. The settings are used on the GraphicsContext side only when invoking ImageBuffer::copyToPlatformTexture. - The mips issue is still present in this version of the patch. The problem is not related to this change, and can reproduced in WebGL. See tracking issue: crbug.com/132641 - The fast gpu path causes a text difference in fast/canvas/webgl/gltex-image/. See tracking bug for new rebaseline: wkbug.com/89494
James Robinson
Comment 43 2012-06-20 16:12:54 PDT
Comment on attachment 148637 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=148637&action=review > Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp:162 > + if (m_canvas) > + m_canvas->flush(); does this end up calling SkDeferredCanvas::DeviceContext::prepareForDraw() under the scenes? If we're in deferred mode single-buffered mode we need to make sure to let the compositor know that we're messing with its texture.
WebKit Review Bot
Comment 44 2012-06-20 17:25:30 PDT
Comment on attachment 148637 [details] Patch Attachment 148637 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/13019037 New failing tests: platform/chromium/virtual/gpu/fast/canvas/webgl/tex-sub-image-2d-bad-args.html
WebKit Review Bot
Comment 45 2012-06-20 17:25:36 PDT
Created attachment 148689 [details] Archive of layout-test-results from ec2-cr-linux-03 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-03 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Kenneth Russell
Comment 46 2012-06-20 17:27:35 PDT
Comment on attachment 148637 [details] Patch This looks good to me. Thanks for pushing it through. It's great to see the first highly optimized texture upload path to WebGL from other DOM elements. I'll defer the r+ to James, given apparent interactions with the threaded compositor. Also it looks like there is still at least one layout test failure to iron out.
Jeff Timanus
Comment 47 2012-06-21 12:20:15 PDT
Comment on attachment 148637 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=148637&action=review >> Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp:162 >> + m_canvas->flush(); > > does this end up calling SkDeferredCanvas::DeviceContext::prepareForDraw() under the scenes? If we're in deferred mode single-buffered mode we need to make sure to let the compositor know that we're messing with its texture. Yes, is invoked. I just confirmed this behaviour with Justin. A SkDeferredCanvas will always have an associated SkDeferredCanvas::DeferredDevice, and flush on this class will invoke prepareForDraw() if a device context has been installed on the device. Justin also confirms that in webkit, a device context is always bound on deferred canvasses.
Jeff Timanus
Comment 48 2012-06-21 12:39:22 PDT
(In reply to comment #46) > (From update of attachment 148637 [details]) > This looks good to me. Thanks for pushing it through. It's great to see the first highly optimized texture upload path to WebGL from other DOM elements. > > I'll defer the r+ to James, given apparent interactions with the threaded compositor. Also it looks like there is still at least one layout test failure to iron out. Thanks for the review, Ken. This change should make it very straight-forward to hardware accelerate other paths to WebGL textures. The remaining layout test failure does not repro on my Linux or Windows boxes. I'll investigate why it's failing on the bot.
James Robinson
Comment 49 2012-06-21 13:25:44 PDT
OK cool! The compositor-ish changes seem fine, then.
Jeff Timanus
Comment 50 2012-06-21 13:48:44 PDT
WebKit Review Bot
Comment 51 2012-06-21 20:15:35 PDT
Comment on attachment 148880 [details] Patch Attachment 148880 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/13027347 New failing tests: platform/chromium/virtual/gpu/fast/canvas/webgl/tex-sub-image-2d-bad-args.html
WebKit Review Bot
Comment 52 2012-06-21 20:15:40 PDT
Created attachment 148949 [details] Archive of layout-test-results from ec2-cr-linux-04 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-04 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Jeff Timanus
Comment 53 2012-06-22 08:44:47 PDT
(In reply to comment #48) > (In reply to comment #46) > > (From update of attachment 148637 [details] [details]) > > This looks good to me. Thanks for pushing it through. It's great to see the first highly optimized texture upload path to WebGL from other DOM elements. > > > > I'll defer the r+ to James, given apparent interactions with the threaded compositor. Also it looks like there is still at least one layout test failure to iron out. > > Thanks for the review, Ken. This change should make it very straight-forward to hardware accelerate other paths to WebGL textures. > > The remaining layout test failure does not repro on my Linux or Windows boxes. I'll investigate why it's failing on the bot. The layout test failure is not related to my change. Running DRT at chromium rev 143420 I do not observe any failures. The webkit chromium deps is at 142842. At this revision I can reproduce the failure. Should I also roll chromium deps with my change?
Kenneth Russell
Comment 54 2012-06-22 10:48:28 PDT
(In reply to comment #53) > The layout test failure is not related to my change. Running DRT at chromium rev 143420 I do not observe any failures. > > The webkit chromium deps is at 142842. At this revision I can reproduce the failure. It's great news that your patch is OK! > Should I also roll chromium deps with my change? Sure, that sounds fine. Can you regenerate the patch?
Jeff Timanus
Comment 55 2012-06-22 11:12:33 PDT
Jeff Timanus
Comment 56 2012-06-22 12:16:04 PDT
Comment on attachment 149064 [details] Patch This time is the charm. Rolling chromium deps resolved the failing unit test.
Kenneth Russell
Comment 57 2012-06-22 12:49:38 PDT
Comment on attachment 149064 [details] Patch Fantastic! Great work!
WebKit Review Bot
Comment 58 2012-06-22 13:46:08 PDT
Comment on attachment 149064 [details] Patch Clearing flags on attachment: 149064 Committed r121055: <http://trac.webkit.org/changeset/121055>
WebKit Review Bot
Comment 59 2012-06-22 13:46:26 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.