Changeset 211281 in webkit
- Timestamp:
- Jan 27, 2017 4:10:56 AM (7 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r211277 r211281 1 2017-01-27 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [Threaded Compositor] Stop creating the GLContext on demand the first time makeContextCurrent is called 4 https://bugs.webkit.org/show_bug.cgi?id=167496 5 6 Reviewed by Žan Doberšek. 7 8 This is causing problems with animations when entering AC mode on demand. What happens is that the threaded 9 compositor is created, then the animation is scheduled and during the first animation iteration the GLContext is 10 created, making the first frame of the animation quite slow. In my computer creating the GLContext takes 0.8 11 seconds. If the animation duration is less than the time it takes to create the GLContext, the animation ends 12 without iterating. This causing timeouts in the bots in tests like 13 animations/animation-iteration-event-destroy-renderer.html that expect webkitAnimationIteration events that 14 never fire. 15 16 * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp: 17 (WebKit::ThreadedCompositor::ThreadedCompositor): Create the GLContext right after the compositing thread is 18 created if we already have a native surface handle. 19 (WebKit::ThreadedCompositor::createGLContext): Helper to create the GLContext. 20 (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing): Create the GLContext when a native surface 21 handle is given. 22 (WebKit::ThreadedCompositor::makeContextCurrent): Deleted. 23 (WebKit::ThreadedCompositor::renderLayerTree): Make the context cunrrent directly here. 24 * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h: 25 1 26 2017-01-27 Carlos Garcia Campos <cgarcia@igalia.com> 2 27 -
trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp
r210954 r211281 60 60 m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this)] { 61 61 m_scene = adoptRef(new CoordinatedGraphicsScene(this)); 62 m_scene->setActive(!!m_nativeSurfaceHandle); 62 if (m_nativeSurfaceHandle) { 63 createGLContext(); 64 m_scene->setActive(true); 65 } else 66 m_scene->setActive(false); 63 67 }); 64 68 } … … 66 70 ThreadedCompositor::~ThreadedCompositor() 67 71 { 72 } 73 74 void ThreadedCompositor::createGLContext() 75 { 76 ASSERT(!isMainThread()); 77 ASSERT(m_nativeSurfaceHandle); 78 79 m_context = GLContext::createContextForWindow(reinterpret_cast<GLNativeWindowType>(m_nativeSurfaceHandle), &PlatformDisplay::sharedDisplayForCompositing()); 80 if (!m_context) 81 return; 82 83 if (m_doFrameSync == ShouldDoFrameSync::No) { 84 if (m_context->makeContextCurrent()) 85 m_context->swapInterval(0); 86 } 68 87 } 69 88 … … 84 103 m_compositingRunLoop->stopUpdateTimer(); 85 104 m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this), handle] { 86 m_scene->setActive(!!handle);87 88 105 // A new native handle can't be set without destroying the previous one first if any. 89 106 ASSERT(!!handle ^ !!m_nativeSurfaceHandle); 90 107 m_nativeSurfaceHandle = handle; 91 if (!m_nativeSurfaceHandle) 108 if (m_nativeSurfaceHandle) { 109 createGLContext(); 110 m_scene->setActive(true); 111 } else { 112 m_scene->setActive(false); 92 113 m_context = nullptr; 114 } 93 115 }); 94 116 } … … 151 173 } 152 174 153 bool ThreadedCompositor::makeContextCurrent()154 {155 if (m_context)156 return m_context->makeContextCurrent();157 158 if (!m_nativeSurfaceHandle)159 return false;160 161 m_context = GLContext::createContextForWindow(reinterpret_cast<GLNativeWindowType>(m_nativeSurfaceHandle), &PlatformDisplay::sharedDisplayForCompositing());162 if (!m_context)163 return false;164 165 if (!m_context->makeContextCurrent())166 return false;167 168 if (m_doFrameSync == ShouldDoFrameSync::No)169 m_context->swapInterval(0);170 171 return true;172 }173 174 175 void ThreadedCompositor::forceRepaint() 175 176 { … … 184 185 return; 185 186 186 if (!m akeContextCurrent())187 if (!m_context || !m_context->makeContextCurrent()) 187 188 return; 188 189 -
trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h
r210954 r211281 85 85 void scheduleDisplayImmediately(); 86 86 87 bool makeContextCurrent();87 void createGLContext(); 88 88 89 89 Client& m_client;
Note: See TracChangeset
for help on using the changeset viewer.