Bug 227585
Summary: | For large WebGL contexts, WebGL is spending a lot of time in allocating new Metal textures for default frame buffer backing store | ||
---|---|---|---|
Product: | WebKit | Reporter: | Kimmo Kinnunen <kkinnunen> |
Component: | WebGL | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | dino, kbr, kkinnunen, kpiddington, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | WebKit Local Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Bug Depends on: | 227582 | ||
Bug Blocks: |
Kimmo Kinnunen
For large WebGL contexts, WebGL is spending a lot of time in allocating new Metal textures for default frame buffer backing store
Conditions:
1. Somewhat large WebGL context (e.g. fullscreen MacBookPro19,1 3072x1920)
2. Somewhat non-trivial amount of WebGL drawing (e.g. converting 4K video to texture via texImage2D and drawing it)
Causes a scenario where somehow WindowServer does not let the WebGL display buffers go, e.g. the IOSurface IsInUse property remains false when WebGL tries to obtain a new drawing buffer.
This causes WebGL to allocate a new drawing buffer.
Allocating the IOSurface seems to be fast, but then creating a Metal texture out of it seems to be slow.
Sampling reveals a lot of samples in [MTL...Device newTextureWithDescriptor:iosurface:plane:]
Reproable for example in 4k 360 YouTube:
- https://www.youtube.com/watch?v=HKNI658SKJ4
- Let it load and observe sharp rendering
- Stop the video
- Rotate the video around with WASD keys
- Vary the window size: small sized windows are smooth, large sized windows start to skip frames
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/80024974>
Kimmo Kinnunen
Reproducible at least on MacBookPro19,1 Intel/AMD.
Metal selects Intel always.
Kimmo Kinnunen
Sample Count, Samples %, Normalized CPU %, Symbol
1367, 8.7%, 1.8%, WebCore::Document::prepareCanvasesForDisplayIfNeeded() (in WebCore)
1234, 7.8%, 1.6%, WebCore::GraphicsContextGLOpenGL::prepareForDisplay() (in WebCore)
1100, 7.0%, 1.4%, WebCore::GraphicsContextGLOpenGL::allocateAndBindDisplayBufferBacking() (in WebCore)
1100, 7.0%, 1.4%, EGL_BindTexImage (in libANGLE-shared.dylib)
1100, 7.0%, 1.4%, egl::Surface::bindTexImage(gl::Context*, gl::Texture*, int) (in libANGLE-shared.dylib)
1063, 6.7%, 1.4%, rx::IOSurfaceSurfaceMtl::bindTexImage(gl::Context const*, gl::Texture*, int) (in libANGLE-shared.dylib)
1054, 6.7%, 1.4%, rx::IOSurfaceSurfaceMtl::ensureColorTextureCreated(gl::Context const*) (in libANGLE-shared.dylib)
1004, 6.4%, 1.3%, -[MTL..AccelDevice newTextureWithDescriptor:iosurface:plane:] (in ....)