RESOLVED FIXED 133020
[wk2] RemoteLayerBackingStore front buffers should be purgeable when unparented
https://bugs.webkit.org/show_bug.cgi?id=133020
Summary [wk2] RemoteLayerBackingStore front buffers should be purgeable when unparented
Tim Horton
Reported 2014-05-16 18:37:39 PDT
And also purgeable front buffers for unparented layers, etc.
Attachments
preliminary (15.02 KB, patch)
2014-05-16 18:51 PDT, Tim Horton
no flags
patch (18.76 KB, patch)
2014-05-20 00:39 PDT, Tim Horton
simon.fraser: review-
patch (22.50 KB, patch)
2014-05-20 12:27 PDT, Tim Horton
no flags
patch (29.81 KB, patch)
2014-05-22 00:24 PDT, Tim Horton
simon.fraser: review+
Tim Horton
Comment 1 2014-05-16 18:51:39 PDT
Created attachment 231613 [details] preliminary
Tim Horton
Comment 2 2014-05-20 00:29:21 PDT
Tim Horton
Comment 3 2014-05-20 00:39:15 PDT
Simon Fraser (smfr)
Comment 4 2014-05-20 09:06:53 PDT
Comment on attachment 231755 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=231755&action=review > Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm:389 > + if (isVolatile) > + m_frontBuffer.surface->clearGraphicsContext(); I was confused briefly by the "clearGraphicsContext" terminology, interpreting it as "paint the clear color into the graphics context", but it's really removeGraphicsContext() right? > Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.mm:61 > + if (!m_unparentedBackingStore.contains(backingStore)) > + return; > + m_liveBackingStore.add(backingStore); > + m_unparentedBackingStore.remove(backingStore); Can't this be done with just one hash lookup in m_unparentedBackingStore.contains? > Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.mm:72 > + if (!backingStore.setBufferVolatility(RemoteLayerBackingStore::BufferType::SecondaryBack, true)) > + successfullyMadeBackingStoreVolatile = false; > + if (!backingStore.setBufferVolatility(RemoteLayerBackingStore::BufferType::Back, true)) > + successfullyMadeBackingStoreVolatile = false; > + if (!backingStore.layer()->superlayer()) { Would prefer blank lines between these statements. > Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.mm:100 > + if (m_unparentedBackingStore.contains(backingStore)) > + return; > + m_unparentedBackingStore.add(backingStore); Same. > Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.mm:118 > + successfullyMadeBackingStoreVolatile |= markBackingStoreVolatile(*backingStore, now); Don't you want &= ? successfullyMadeBackingStoreVolatile starts off true so |= won't do anything. > Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.mm:121 > + successfullyMadeBackingStoreVolatile |= markBackingStoreVolatileImmediately(*backingStore); Same. > Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm:106 > + // Drop the contents of any layers which were unparented; the Web process will re-send > + // the backing store in the commit that reparents them. > + for (auto& layerOrView : m_layers.values()) { > + CALayer *layer = asLayer(layerOrView.get()); > + if (layer.superlayer) > + continue; > + layer.contents = nullptr; > + } How should we handle disconnected subtrees? Or do we only care about this for tiles? Seems odd to consider all layers here when it's really just about tiles.
Tim Horton
Comment 5 2014-05-20 09:23:47 PDT
Comment on attachment 231755 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=231755&action=review >> Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm:389 >> + m_frontBuffer.surface->clearGraphicsContext(); > > I was confused briefly by the "clearGraphicsContext" terminology, interpreting it as "paint the clear color into the graphics context", but it's really removeGraphicsContext() right? Indeed it is. >> Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.mm:61 >> + m_unparentedBackingStore.remove(backingStore); > > Can't this be done with just one hash lookup in m_unparentedBackingStore.contains? Sure! >> Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.mm:118 >> + successfullyMadeBackingStoreVolatile |= markBackingStoreVolatile(*backingStore, now); > > Don't you want &= ? successfullyMadeBackingStoreVolatile starts off true so |= won't do anything. Indeed, good call. It would be nice if there were a way to assert that this was working correctly, but I don't think it's possible. >> Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm:106 >> + } > > How should we handle disconnected subtrees? Or do we only care about this for tiles? Seems odd to consider all layers here when it's really just about tiles. Why would this just be about tiles? This code (the purgeable front buffers of unparented layers bit) ought to work for all layers.
Tim Horton
Comment 6 2014-05-20 12:27:35 PDT
Tim Horton
Comment 7 2014-05-22 00:24:05 PDT
Tim Horton
Comment 8 2014-05-26 23:15:43 PDT
I landed just the purgeable front buffers bit without swapping aggressive tile retention on, because I have some concerns which will be addressed in another bug, but multiple patches are blocked on purgeable front buffers. http://trac.webkit.org/changeset/169370
Note You need to log in before you can comment on or make changes to this bug.