RESOLVED FIXED 132786
Triple-buffer RemoteLayerBackingStore
https://bugs.webkit.org/show_bug.cgi?id=132786
Summary Triple-buffer RemoteLayerBackingStore
Tim Horton
Reported 2014-05-10 15:09:19 PDT
From one... to two... to three. We need three buffers because we're currently unable to synchronize with the render server to swap when they're not in use, so we end up throwing surfaces away and wasting expensive work (and deleting them is not free, either!). The pool helps, but not enough (the pool is much more useful for e.g. layers that come and go, like tiles while scrolling). We'll try to keep them purgeable as much as possible so that the memory hit is not significant (but, this should also match CA when painting repeatedly). This is a three-orders-of-magnitude reduction in time spent in IOSurface::create on http://www.kevs3d.co.uk/dev/canvasmark/...
Attachments
patch (16.74 KB, patch)
2014-05-12 00:22 PDT, Tim Horton
simon.fraser: review+
Radar WebKit Bug Importer
Comment 1 2014-05-10 15:09:58 PDT
Tim Horton
Comment 2 2014-05-12 00:22:47 PDT
Tim Horton
Comment 3 2014-05-12 00:23:15 PDT
Need to build mac and sim to make sure I haven't broken anything.
WebKit Commit Bot
Comment 4 2014-05-12 00:24:40 PDT
Attachment 231275 [details] did not pass style-queue: ERROR: Source/WebKit2/Shared/mac/RemoteLayerBackingStore.h:92: The parameter name "type" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Simon Fraser (smfr)
Comment 5 2014-05-12 16:02:18 PDT
Comment on attachment 231275 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=231275&action=review > Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm:403 > + if (type == BufferType::Front && m_frontBuffer.surface && m_frontBuffer.isVolatile != isVolatile) { > + if (!isVolatile || !m_frontBuffer.surface->isInUse()) { > + IOSurface::SurfaceState previousState = m_frontBuffer.surface->setIsVolatile(isVolatile); > + m_frontBuffer.isVolatile = isVolatile; > + > + // Becoming non-volatile and the front buffer was purged, so we need to repaint. > + if (!isVolatile && (previousState == IOSurface::SurfaceState::Empty)) > + setNeedsDisplay(); > + } else > + return false; > + } else if (type == BufferType::Back && m_backBuffer.surface && m_backBuffer.isVolatile != isVolatile) { > + if (!isVolatile || !m_backBuffer.surface->isInUse()) { > + m_backBuffer.surface->setIsVolatile(isVolatile); > + m_backBuffer.isVolatile = isVolatile; > + } else > + return false; > + } else if (type == BufferType::SecondaryBack && m_secondaryBackBuffer.surface && m_secondaryBackBuffer.isVolatile != isVolatile) { > + if (!isVolatile || !m_secondaryBackBuffer.surface->isInUse()) { > + m_secondaryBackBuffer.surface->setIsVolatile(isVolatile); > + m_secondaryBackBuffer.isVolatile = isVolatile; > + } else > + return false; This logic is pretty confusing. Can you convert this to a switch(type)?
Tim Horton
Comment 6 2014-05-12 16:32:47 PDT
Note You need to log in before you can comment on or make changes to this bug.