NEW 103854
[META] Coordinated Graphics: Refactoring TextureMapper to work in an actor model
https://bugs.webkit.org/show_bug.cgi?id=103854
Summary [META] Coordinated Graphics: Refactoring TextureMapper to work in an actor model
Dongseong Hwang
Reported 2012-12-02 22:13:33 PST
Currently, LayerTreeRenderer uses GraphicsLayerTextureMapper to use TextureMapperLayer, because TextureMapperLayer does not have actor model API. If refactoring TextureMapper to work in an actor model, Coodinated Graphics does not depend on GraphicsLayerTextureMapper, so we can change features more easily. After complete, LayerTreeRenderer and GraphicsLayerTextureMapper use TextureMapperLayer in the same way: actor model.
Attachments
Not for review : prototype actor model. (66.03 KB, patch)
2013-01-14 19:55 PST, Dongseong Hwang
no flags
Not for review : prototype CoordinatedTask to reduce CoreIPC messages. (30.80 KB, patch)
2013-01-18 03:19 PST, Dongseong Hwang
no flags
WIP: Refactoring TextureMapper to work in an actor model. (96.90 KB, patch)
2013-01-28 03:10 PST, Dongseong Hwang
no flags
WIP: Refactoring TextureMapper to work in an actor model. (109.96 KB, patch)
2013-01-29 03:33 PST, Dongseong Hwang
no flags
Patch (125.27 KB, patch)
2013-02-01 04:58 PST, Dongseong Hwang
no flags
Dongseong Hwang
Comment 1 2012-12-07 01:25:14 PST
The following document explains what this meta bug will change. https://docs.google.com/document/pub?id=1u1Oif9lDmVt_MkJLxaEYbTlOuZWVJcKrM1vAxAvFrZk
Dongseong Hwang
Comment 2 2013-01-14 19:55:01 PST
Created attachment 182686 [details] Not for review : prototype actor model. post this patch to help noam's actor model implementation. This implementation changes only TextureMapperLayer API so Coordinated Graphics needs to manage similar message passing PODs. It means it is not completed patch, and noam will complete :) Note, 1. after actor model implementation, we don't need LayerTreeRenderer::m_pendingSyncBackingStores. 2. after actor model implementation, it is hard to use getters of TextureMapperLayer.
Noam Rosenthal
Comment 3 2013-01-15 01:20:29 PST
I think part of it you should already prepare, if you don't mind :) The part where we do all the syncing in GraphicsLayerTextureMapper instead of in TextureMapperLayer. If you want to prepare that and upstream I can do the other part where we use PODs instead of functional.
Dongseong Hwang
Comment 4 2013-01-15 03:38:16 PST
Comment on attachment 182686 [details] Not for review : prototype actor model. (In reply to comment #3) > I think part of it you should already prepare, if you don't mind :) > The part where we do all the syncing in GraphicsLayerTextureMapper instead of in TextureMapperLayer. If you want to prepare that and upstream I can do the other part where we use PODs instead of functional. I want the fastest way. I don't want you to wait me. Feel free to use this patch. If we can work in parallel, I can complete this patch if you want. Which is preferable? :) View in context: https://bugs.webkit.org/attachment.cgi?id=182686&action=review > Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:490 > + btw, I'm not sure which granularity is optimal. Coarse granularity makes POD big and reduces the number of dispatching message. Fine granularity makes POD small and increases the number of dispatching message. We need to find sweet point. IMO CoordinatedGraphics::syncLayerState is a bit coarse. but below is a bit fine (e.g. ContentsRectChange, MasksToBoundsChange and etc.) Do you have good solution? Or will you correct the granularity if I land this patch with this problem? 491 if (m_changeMask & ContentsRectChange) 492 m_layer->appendChange(bind(&TextureMapperLayer::setContentsRect, m_layer.get(), contentsRect())); 493 494 if (m_changeMask & MasksToBoundsChange) 495 m_layer->appendChange(bind(&TextureMapperLayer::setMasksToBounds, m_layer.get(), masksToBounds())); 496 497 if (m_changeMask & DrawsContentChange) 498 m_layer->appendChange(bind(&TextureMapperLayer::setDrawsContent, m_layer.get(), drawsContent()));
Dongseong Hwang
Comment 5 2013-01-16 00:20:24 PST
(In reply to comment #3) > I think part of it you should already prepare, if you don't mind :) > The part where we do all the syncing in GraphicsLayerTextureMapper instead of in TextureMapperLayer. If you want to prepare that and upstream I can do the other part where we use PODs instead of functional. I'm working on completing this patch. If you have other opinion, let me know :)
Noam Rosenthal
Comment 6 2013-01-16 00:23:25 PST
Actually, I think you should go ahead full speed with your approach. Using POD types in the middle would just create unnecessary copies. No'am
Dongseong Hwang
Comment 7 2013-01-16 01:19:48 PST
(In reply to comment #6) > Actually, I think you should go ahead full speed with your approach. Using POD types in the middle would just create unnecessary copies. > No'am Yes, I run.
Dongseong Hwang
Comment 8 2013-01-18 03:19:48 PST
Created attachment 183420 [details] Not for review : prototype CoordinatedTask to reduce CoreIPC messages. This patch's purpose shows how to reduce CoreIPC messages. If we choose this mechanism instead of CoreIPC Message, when adding new api (e.g. background color), we don't need to change LayerTreeCoordinator and LayerTreeCoordinatorProxy. new Task will be passed via existing LayerTreeCoordinator::flushLayerChanges(). I apply CoordinatedTask to only SyncLayerState and SetLayerChildren for explanation.
Kenneth Rohde Christiansen
Comment 9 2013-01-18 03:47:53 PST
Comment on attachment 183420 [details] Not for review : prototype CoordinatedTask to reduce CoreIPC messages. View in context: https://bugs.webkit.org/attachment.cgi?id=183420&action=review > Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:835 > + encoder << static_cast<const CoordinatdSyncLayerStateTask*>(task)->m_layerID; spelling issue... Coordinat*E*d
Noam Rosenthal
Comment 10 2013-01-27 23:28:15 PST
Seems like the main classes of coordinated graphics (CoordinatedGraphicsLayer, CoordinatedBackingStore, LayerTreeRenderer, CoordinatedSurface, CoordinatedTile, UpdateAtlas, AreaAllocator) no longer depend on anything from WebKit2. Dongsung, Do you think it's time to move them to WebCore/platform/graphics/texmap? This would ease up reviews and would leave only IPC-related code in the WebKit2 directory.
Dongseong Hwang
Comment 11 2013-01-27 23:46:35 PST
(In reply to comment #10) > Seems like the main classes of coordinated graphics (CoordinatedGraphicsLayer, CoordinatedBackingStore, LayerTreeRenderer, CoordinatedSurface, CoordinatedTile, UpdateAtlas, AreaAllocator) no longer depend on anything from WebKit2. > Dongsung, Do you think it's time to move them to WebCore/platform/graphics/texmap? Yes, I think so. how about WebCore/platform/graphics/texmap/CoordinatedGraphics? > This would ease up reviews and would leave only IPC-related code in the WebKit2 directory. Ok, I'll create patch ASAP!
Noam Rosenthal
Comment 12 2013-01-28 00:11:21 PST
(In reply to comment #11) > (In reply to comment #10) > > Seems like the main classes of coordinated graphics (CoordinatedGraphicsLayer, CoordinatedBackingStore, LayerTreeRenderer, CoordinatedSurface, CoordinatedTile, UpdateAtlas, AreaAllocator) no longer depend on anything from WebKit2. > > Dongsung, Do you think it's time to move them to WebCore/platform/graphics/texmap? > Yes, I think so. > how about WebCore/platform/graphics/texmap/CoordinatedGraphics? platform/graphics/texmap/coordinated?
Dongseong Hwang
Comment 13 2013-01-28 01:46:28 PST
(In reply to comment #12) > platform/graphics/texmap/coordinated? Ok
Dongseong Hwang
Comment 14 2013-01-28 03:10:31 PST
Created attachment 184963 [details] WIP: Refactoring TextureMapper to work in an actor model.
Dongseong Hwang
Comment 15 2013-01-28 03:13:18 PST
Comment on attachment 184963 [details] WIP: Refactoring TextureMapper to work in an actor model. Not for review patch I submit this patch to listen feedback. I need to test more and I'll refactor this patch after moving WebCore refactoring.
Noam Rosenthal
Comment 16 2013-01-28 04:44:33 PST
Comment on attachment 184963 [details] WIP: Refactoring TextureMapper to work in an actor model. View in context: https://bugs.webkit.org/attachment.cgi?id=184963&action=review > Source/WebKit2/Scripts/webkit2/messages.py:401 > + 'WebKit::CoordinatedOperationHolder': ['"CoordinatedOperation.h"'], I'd prefer to have WebCoordinatedOperation, with its own decode/encode > Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedOperation.h:87 > + virtual void execute(LayerTreeRenderer*) = 0; I don't think this is needed. I'd just have LayerTreeRenderer::handleCoordinatedGraphicsOperation(operation) with a switch statement. > Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedOperation.h:88 > + virtual TaskType type() const = 0; OperationType getOperationType() > Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedOperation.h:99 > +// To pass operation via CoreIPC. > +class CoordinatedOperationHolder { > +public: > + RefPtr<CoordinatedOperation> operation; > +}; I would wrap it with WebKit::WebCoordinatedOperation, and then we can move this to WebCore and don't need a "Holder". > Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedOperation.h:263 > + uint32_t m_atlasID; > + RefPtr<CoordinatedSurface> m_surface; Don't use m_ for public members.
Noam Rosenthal
Comment 17 2013-01-28 13:12:12 PST
Seeing your solution, I think it's artificial to call enqueue and commit and maintain a queue in the UI process. I think your previous solution of sending a vector of operations and enqueuing them in the web process is more succinct. This way you also don't need a special "holder" class, all you need is a CoordinatedGraphicsOperations class that has a Vector<RefPtr<CoordinatedGraphicsOperation> > internally.
Dongseong Hwang
Comment 18 2013-01-28 14:05:44 PST
(In reply to comment #17) > This way you also don't need a special "holder" class, all you need is a CoordinatedGraphicsOperations class that has a Vector<RefPtr<CoordinatedGraphicsOperation> > internally. Yeah, I felt like this when implementing :)
Dongseong Hwang
Comment 19 2013-01-29 03:33:11 PST
Created attachment 185213 [details] WIP: Refactoring TextureMapper to work in an actor model.
Dongseong Hwang
Comment 20 2013-01-29 03:35:06 PST
Comment on attachment 185213 [details] WIP: Refactoring TextureMapper to work in an actor model. I posted the current implementation. It runs well. I'll rebase after completing Bug 108149. I need feedback :)
Caio Marcelo de Oliveira Filho
Comment 21 2013-01-29 08:39:47 PST
(In reply to comment #20) > (From update of attachment 185213 [details]) > I posted the current implementation. > It runs well. > I'll rebase after completing Bug 108149. > > I need feedback :) It seems CoordinatedOperations.h is missing from the patch.
Noam Rosenthal
Comment 22 2013-01-29 08:41:43 PST
btw CoordinatedOperation should maybe be CoordinatedGraphicsOperation.
Dongseong Hwang
Comment 23 2013-01-29 14:32:46 PST
Comment on attachment 185213 [details] WIP: Refactoring TextureMapper to work in an actor model. View in context: https://bugs.webkit.org/attachment.cgi?id=185213&action=review > Source/WebKit2/ChangeLog:29 > + (WebKit::CoordinatedSyncLayerStateOperation::create): Could you suggest this op name? CoordinatedGraphicsSyncLayerStateOperation is a bit long.
Noam Rosenthal
Comment 24 2013-01-29 23:41:38 PST
(In reply to comment #23) > (From update of attachment 185213 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=185213&action=review > > > Source/WebKit2/ChangeLog:29 > > + (WebKit::CoordinatedSyncLayerStateOperation::create): > > Could you suggest this op name? > CoordinatedGraphicsSyncLayerStateOperation is a bit long. I think it's ok to have them as inner classes, like CoordinatedGraphicsOperation::SetLayerAnimations
Noam Rosenthal
Comment 25 2013-01-29 23:42:46 PST
Comment on attachment 185213 [details] WIP: Refactoring TextureMapper to work in an actor model. View in context: https://bugs.webkit.org/attachment.cgi?id=185213&action=review > Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:460 > m_animationsLocked = true; > - m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::SetAnimationsLocked(true)); > + enqueueCoordinatedOperation(CoordinatedSetAnimationsLockedOperation::create(true)); This doesn't make sense. lockAnimations is not a coordinated graphics operation - it should happen immediately if at all. Though I think we should just remove this feature, it's not really tested and I'm not sure if it helps anything.
Dongseong Hwang
Comment 26 2013-02-01 04:58:40 PST
Note You need to log in before you can comment on or make changes to this bug.