Changeset 220742 in webkit
- Timestamp:
- Aug 15, 2017 7:16:29 AM (7 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r220741 r220742 1 2017-08-15 Michael Catanzaro <mcatanzaro@igalia.com> 2 3 Unreviewed, rolling out r220700. 4 5 Broke debug bot 6 7 Reverted changeset: 8 9 "[CoordGraphics] Simplify CoordinatedGraphicsScene state 10 updates" 11 https://bugs.webkit.org/show_bug.cgi?id=175528 12 http://trac.webkit.org/changeset/220700 13 1 14 2017-08-15 Carlos Garcia Campos <cgarcia@igalia.com> 2 15 -
trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp
r220700 r220742 78 78 } 79 79 80 void CoordinatedGraphicsScene:: applyStateChanges(const Vector<CoordinatedGraphicsState>& states)80 void CoordinatedGraphicsScene::paintToCurrentGLContext(const TransformationMatrix& matrix, float opacity, const FloatRect& clipRect, const Color& backgroundColor, bool drawsBackground, const FloatPoint& contentPosition, TextureMapper::PaintFlags PaintFlags) 81 81 { 82 82 if (!m_textureMapper) { … … 85 85 } 86 86 87 ensureRootLayer(); 88 89 for (auto& state : states) 90 commitSceneState(state); 91 } 92 93 void CoordinatedGraphicsScene::paintToCurrentGLContext(const TransformationMatrix& matrix, float opacity, const FloatRect& clipRect, const Color& backgroundColor, bool drawsBackground, const FloatPoint& contentPosition, TextureMapper::PaintFlags PaintFlags) 94 { 87 syncRemoteContent(); 88 95 89 adjustPositionForFixedLayers(contentPosition); 96 90 TextureMapperLayer* currentRootLayer = rootLayer(); … … 587 581 } 588 582 583 void CoordinatedGraphicsScene::syncRemoteContent() 584 { 585 // We enqueue messages and execute them during paint, as they require an active GL context. 586 ensureRootLayer(); 587 588 Vector<Function<void()>> renderQueue; 589 bool calledOnMainThread = RunLoop::isMain(); 590 if (!calledOnMainThread) 591 m_renderQueueMutex.lock(); 592 renderQueue = WTFMove(m_renderQueue); 593 if (!calledOnMainThread) 594 m_renderQueueMutex.unlock(); 595 596 for (auto& function : renderQueue) 597 function(); 598 } 599 589 600 void CoordinatedGraphicsScene::purgeGLResources() 590 601 { … … 632 643 m_isActive = false; 633 644 m_client = nullptr; 645 LockHolder locker(m_renderQueueMutex); 646 m_renderQueue.clear(); 647 } 648 649 void CoordinatedGraphicsScene::appendUpdate(Function<void()>&& function) 650 { 651 if (!m_isActive) 652 return; 653 654 ASSERT(RunLoop::isMain()); 655 LockHolder locker(m_renderQueueMutex); 656 m_renderQueue.append(WTFMove(function)); 634 657 } 635 658 636 659 void CoordinatedGraphicsScene::setActive(bool active) 637 660 { 638 if (!m_client || m_isActive == active) 639 return; 640 661 if (!m_client) 662 return; 663 664 if (m_isActive == active) 665 return; 666 667 // Have to clear render queue in both cases. 668 // If there are some updates in queue during activation then those updates are from previous instance of paint node 669 // and cannot be applied to the newly created instance. 670 m_renderQueue.clear(); 641 671 m_isActive = active; 642 672 if (m_isActive) -
trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h
r220700 r220742 69 69 explicit CoordinatedGraphicsScene(CoordinatedGraphicsSceneClient*); 70 70 virtual ~CoordinatedGraphicsScene(); 71 72 void applyStateChanges(const Vector<WebCore::CoordinatedGraphicsState>&);73 71 void paintToCurrentGLContext(const WebCore::TransformationMatrix&, float, const WebCore::FloatRect&, const WebCore::Color& backgroundColor, bool drawsBackground, const WebCore::FloatPoint&, WebCore::TextureMapper::PaintFlags = 0); 74 72 void detach(); 73 void appendUpdate(Function<void()>&&); 75 74 76 75 WebCore::TextureMapperLayer* findScrollableContentsLayerAt(const WebCore::FloatPoint&); … … 126 125 WebCore::TextureMapperLayer* rootLayer() { return m_rootLayer.get(); } 127 126 127 void syncRemoteContent(); 128 128 void adjustPositionForFixedLayers(const WebCore::FloatPoint& contentPosition); 129 129 … … 149 149 WebCore::TextureMapperGL* texmapGL() override; 150 150 #endif 151 152 // Render queue can be accessed ony from main thread or updatePaintNode call stack! 153 Vector<Function<void()>> m_renderQueue; 154 Lock m_renderQueueMutex; 151 155 152 156 std::unique_ptr<WebCore::TextureMapper> m_textureMapper; -
trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp
r220700 r220742 209 209 bool drawsBackground; 210 210 bool needsResize; 211 Vector<WebCore::CoordinatedGraphicsState> states;212 Vector<uint32_t> atlasesToRemove;213 214 211 { 215 212 LockHolder locker(m_attributes.lock); … … 220 217 needsResize = m_attributes.needsResize; 221 218 222 states = WTFMove(m_attributes.states);223 atlasesToRemove = WTFMove(m_attributes.atlasesToRemove);224 225 if (!states.isEmpty()) {226 // Client has to be notified upon finishing this scene update.227 m_attributes.clientRendersNextFrame = true;228 229 // Coordinate scene update completion with the client in case of changed or updated platform layers.230 // But do not change coordinateUpdateCompletionWithClient while in force repaint because that231 // demands immediate scene update completion regardless of platform layers.232 if (!m_inForceRepaint) {233 bool coordinateUpdate = false;234 for (auto& state : states)235 coordinateUpdate |= std::any_of(state.layersToUpdate.begin(), state.layersToUpdate.end(),236 [](auto& it) { return it.second.platformLayerChanged || it.second.platformLayerUpdated; });237 m_attributes.coordinateUpdateCompletionWithClient = coordinateUpdate;238 }239 }240 241 219 // Reset the needsResize attribute to false. 242 220 m_attributes.needsResize = false; … … 255 233 } 256 234 257 m_scene->applyStateChanges(states);258 m_scene->releaseUpdateAtlases(atlasesToRemove);259 235 m_scene->paintToCurrentGLContext(viewportTransform, 1, FloatRect { FloatPoint { }, viewportSize }, 260 236 Color::transparent, !drawsBackground, scrollPosition, m_paintFlags); … … 303 279 void ThreadedCompositor::updateSceneState(const CoordinatedGraphicsState& state) 304 280 { 305 LockHolder locker(m_attributes.lock); 306 m_attributes.states.append(state); 281 ASSERT(RunLoop::isMain()); 282 m_scene->appendUpdate([this, scene = makeRef(*m_scene), state] { 283 scene->commitSceneState(state); 284 285 LockHolder locker(m_attributes.lock); 286 287 // Client has to be notified upon finishing this scene update. 288 m_attributes.clientRendersNextFrame = true; 289 290 // Coordinate scene update completion with the client in case of changed or updated platform layers. 291 // Do not change m_coordinateUpdateCompletionWithClient while in force repaint. 292 bool coordinateUpdate = !m_inForceRepaint && std::any_of(state.layersToUpdate.begin(), state.layersToUpdate.end(), 293 [](const std::pair<CoordinatedLayerID, CoordinatedGraphicsLayerState>& it) { 294 return it.second.platformLayerChanged || it.second.platformLayerUpdated; 295 }); 296 297 m_attributes.coordinateUpdateCompletionWithClient |= coordinateUpdate; 298 }); 299 307 300 m_compositingRunLoop->scheduleUpdate(); 308 301 } … … 310 303 void ThreadedCompositor::releaseUpdateAtlases(Vector<uint32_t>&& atlasesToRemove) 311 304 { 312 LockHolder locker(m_attributes.lock); 313 m_attributes.atlasesToRemove.appendVector(atlasesToRemove); 305 ASSERT(RunLoop::isMain()); 306 m_scene->appendUpdate([scene = makeRef(*m_scene), atlasesToRemove = WTFMove(atlasesToRemove)] { 307 scene->releaseUpdateAtlases(atlasesToRemove); 308 }); 314 309 m_compositingRunLoop->scheduleUpdate(); 315 310 } -
trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h
r220700 r220742 30 30 #include "CompositingRunLoop.h" 31 31 #include "CoordinatedGraphicsScene.h" 32 #include <WebCore/CoordinatedGraphicsState.h>33 32 #include <WebCore/GLContext.h> 34 33 #include <WebCore/IntSize.h> … … 42 41 #include <WebCore/DisplayRefreshMonitor.h> 43 42 #endif 43 44 namespace WebCore { 45 struct CoordinatedGraphicsState; 46 } 44 47 45 48 namespace WebKit { … … 124 127 bool needsResize { false }; 125 128 126 Vector<WebCore::CoordinatedGraphicsState> states;127 Vector<uint32_t> atlasesToRemove;128 129 129 bool clientRendersNextFrame { false }; 130 130 bool coordinateUpdateCompletionWithClient { false };
Note: See TracChangeset
for help on using the changeset viewer.