RESOLVED FIXED 107099
Coordinated Graphics: Remove m_pendingSyncBackingStores in LayerTreeRenderer.
https://bugs.webkit.org/show_bug.cgi?id=107099
Summary Coordinated Graphics: Remove m_pendingSyncBackingStores in LayerTreeRenderer.
Dongseong Hwang
Reported 2013-01-16 23:34:46 PST
LayerTreeRenderer difficultly uses m_pendingSyncBackingStores to set a backing store to TextureMapperLayer, although LayerTreeRenderer easily sets a direct composited image to TextureMapperLayer. It is because LayerTreeRenderer directly set a backing store to TextureMapperLayer, instead of GraphicsLayerTextureMapper. This patch makes LayerTreeRenderer set a backing store to GraphicsLayerTextureMapper and then GraphicsLayerTextureMapper will set a backing store to TextureMapperLayer like other members.
Attachments
Patch (14.03 KB, patch)
2013-01-16 23:42 PST, Dongseong Hwang
no flags
Patch (16.34 KB, patch)
2013-01-17 02:17 PST, Dongseong Hwang
no flags
Patch (18.30 KB, patch)
2013-01-17 17:43 PST, Dongseong Hwang
no flags
Patch (18.34 KB, patch)
2013-01-17 18:02 PST, Dongseong Hwang
no flags
Patch (18.25 KB, patch)
2013-01-24 21:45 PST, Dongseong Hwang
no flags
Patch (18.74 KB, patch)
2013-01-25 02:02 PST, Dongseong Hwang
no flags
Patch (18.70 KB, patch)
2013-01-28 17:38 PST, Dongseong Hwang
no flags
Patch (18.59 KB, patch)
2013-01-28 22:59 PST, Dongseong Hwang
no flags
Patch (20.58 KB, patch)
2013-01-29 21:54 PST, Dongseong Hwang
no flags
Patch (18.12 KB, patch)
2013-01-29 22:56 PST, Dongseong Hwang
no flags
Patch for landing (18.12 KB, patch)
2013-01-29 23:38 PST, Dongseong Hwang
no flags
Dongseong Hwang
Comment 1 2013-01-16 23:42:07 PST
Dongseong Hwang
Comment 2 2013-01-17 02:17:28 PST
Dongseong Hwang
Comment 3 2013-01-17 17:43:40 PST
Dongseong Hwang
Comment 4 2013-01-17 18:02:40 PST
Noam Rosenthal
Comment 5 2013-01-24 02:36:29 PST
Please put it up for review when it applies :)
Dongseong Hwang
Comment 6 2013-01-24 21:45:17 PST
Dongseong Hwang
Comment 7 2013-01-25 02:02:44 PST
Dongseong Hwang
Comment 8 2013-01-25 06:02:20 PST
(In reply to comment #5) > Please put it up for review when it applies :) Now could you review? :)
Noam Rosenthal
Comment 9 2013-01-25 06:12:34 PST
Comment on attachment 184704 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=184704&action=review I'm fine with this, needs a WK2 owner to review; they might want more explanations... > Source/WebKit2/ChangeLog:15 > + LayerTreeRenderer difficultly uses m_pendingSyncBackingStores to set a backing > + store to TextureMapperLayer, although LayerTreeRenderer easily sets a direct > + composited image to TextureMapperLayer. It is because LayerTreeRenderer directly > + set a backing store to TextureMapperLayer, instead of GraphicsLayerTextureMapper. > + > + This patch makes LayerTreeRenderer set a backing store to GraphicsLayerTextureMapper > + and then GraphicsLayerTextureMapper will set a backing store to TextureMapperLayer > + like other members. Allow me to propose an alternative wording for the explanation :) Instead of queuing the setting of backing stores in LayerTreeRenderer, and then setting them directly to TextureMapperLayer, we allow GraphicsLayerTextureMapper's existing queuing mechanism to handle that. Instead of a m_pendingSyncBackingStores queue, we have a m_backingStores queue which can be applied much more easily to the layer tree.
Dongseong Hwang
Comment 10 2013-01-28 17:38:49 PST
Dongseong Hwang
Comment 11 2013-01-28 17:47:19 PST
(In reply to comment #9) > (From update of attachment 184704 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=184704&action=review > > I'm fine with this, needs a WK2 owner to review; they might want more explanations... Thank you for your favor as well as review! I'll ask WK2 owner. Now this bug depends on Bug 105787.
Dongseong Hwang
Comment 12 2013-01-28 22:59:48 PST
Benjamin Poulain
Comment 13 2013-01-29 14:58:47 PST
Comment on attachment 185169 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=185169&action=review I am okay with this for WebKit2, with comments. Noam, your call for the r+. > Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h:159 > - RefPtr<TextureMapperBackingStore> m_backingStore; > + TextureMapperBackingStore* m_backingStore; Just a comment: For this, you must have a strong guarantee that TextureMapperBackingStore always outlive TextureMapperLayer. Here the guarantee is m_releasedCoordinatedBackingStores. I think the ownership is too convoluted. > Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:414 > + CoordinatedBackingStore* backingStore = 0; > + BackingStoreMap::iterator it = m_backingStores.find(graphicsLayer); > + if (it != m_backingStores.end()) > backingStore = it->value.get(); > return backingStore; This is what HashMap::get() is for.
Dongseong Hwang
Comment 14 2013-01-29 21:11:41 PST
(In reply to comment #13) > (From update of attachment 185169 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=185169&action=review > > I am okay with this for WebKit2, with comments. > > Noam, your call for the r+. Thank you for review! > > Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h:159 > > - RefPtr<TextureMapperBackingStore> m_backingStore; > > + TextureMapperBackingStore* m_backingStore; > > Just a comment: For this, you must have a strong guarantee that TextureMapperBackingStore always outlive TextureMapperLayer. > Here the guarantee is m_releasedCoordinatedBackingStores. I think the ownership is too convoluted. m_releasedCoordinatedBackingStores is already existing and this bug uses it. I agree that m_releasedCoordinatedBackingStores is convoluted, so I will remove this twisted lifecycle management after Bug 103854. It is because Bug 103854 will remove the time gap between setting platform layer and flushing layer scene info. > > Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:414 > > + CoordinatedBackingStore* backingStore = 0; > > + BackingStoreMap::iterator it = m_backingStores.find(graphicsLayer); > > + if (it != m_backingStores.end()) > > backingStore = it->value.get(); > > return backingStore; > > This is what HashMap::get() is for. Oh, I had put lots of above redundant code. someday I'll get rid of all. Thank you.
Dongseong Hwang
Comment 15 2013-01-29 21:54:57 PST
Dongseong Hwang
Comment 16 2013-01-29 21:55:49 PST
(In reply to comment #13) > (From update of attachment 185169 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=185169&action=review > > I am okay with this for WebKit2, with comments. > > Noam, your call for the r+. Noam, could you review this bug?
Benjamin Poulain
Comment 17 2013-01-29 22:05:58 PST
Comment on attachment 185396 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=185396&action=review > Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:420 > + if (m_backingStores.get(graphicsLayer)) To test if a key exists in a HashMap/HashSet, the correct thing to do is HashMap::contains(). > Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:435 > + if (!m_backingStores.get(graphicsLayer)) > return; > - } > > - if (!layer->backingStore()) > - return; // The layer has no backing store (and no pending addition). > - > - ASSERT(!m_pendingSyncBackingStores.contains(layer)); > - m_pendingSyncBackingStores.add(layer, 0); > + m_releasedCoordinatedBackingStores.append(m_backingStores.take(graphicsLayer)); > + toGraphicsLayerTextureMapper(graphicsLayer)->setBackingStore(0); This particular code should be using iterators. Otherwise you are doing get() twice.
Dongseong Hwang
Comment 18 2013-01-29 22:56:14 PST
Dongseong Hwang
Comment 19 2013-01-29 22:59:25 PST
(In reply to comment #17) > (From update of attachment 185396 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=185396&action=review > To test if a key exists in a HashMap/HashSet, the correct thing to do is HashMap::contains(). > This particular code should be using iterators. Otherwise you are doing get() twice. Oh, you are right! Done. (In reply to comment #13) > (From update of attachment 185169 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=185169&action=review > Just a comment: For this, you must have a strong guarantee that TextureMapperBackingStore always outlive TextureMapperLayer. > Here the guarantee is m_releasedCoordinatedBackingStores. I think the ownership is too convoluted. After rethinking, I understand this patch does not need to use m_releasedCoordinatedBackingStores. TextureMapperLayer still have RefPtr<TextureMapperBackingStore>. As I mentioned, m_releasedImageBackings is still alive and I'll kill in Bug 108296.
Noam Rosenthal
Comment 20 2013-01-29 23:34:43 PST
Comment on attachment 185400 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=185400&action=review Some nitpick in the changelog, otherwise good to go. Also seems that you have addressed all of Benjamin's concerns. > Source/WebCore/ChangeLog:12 > + because of dead code now. because of dead code now -> because they are no longer used.
Dongseong Hwang
Comment 21 2013-01-29 23:38:45 PST
Created attachment 185407 [details] Patch for landing
WebKit Review Bot
Comment 22 2013-01-30 00:24:30 PST
Comment on attachment 185407 [details] Patch for landing Clearing flags on attachment: 185407 Committed r141232: <http://trac.webkit.org/changeset/141232>
WebKit Review Bot
Comment 23 2013-01-30 00:24:36 PST
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.