Changeset 270591 in webkit
- Timestamp:
- Dec 9, 2020, 11:50:11 AM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
GPUProcess/graphics/RemoteRenderingBackend.cpp (modified) (7 diffs)
-
GPUProcess/graphics/RemoteRenderingBackend.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r270587 r270591 1 2020-12-09 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [Concurrent display lists] Support playback of display list items with cached resources 4 https://bugs.webkit.org/show_bug.cgi?id=218614 5 <rdar://problem/71326662> 6 7 Reviewed by Tim Horton. 8 9 Teaches the GPU process to resume playback of display list items that were previously unable to be played back 10 due to missing cached resources. See below for more details. 11 12 * GPUProcess/graphics/RemoteRenderingBackend.cpp: 13 (WebKit::RemoteRenderingBackend::createImageBuffer): 14 15 See if the newly created image buffer's ID matches that of the pending wakeup message; if so, immediately kick 16 off the wakeup loop. 17 18 (WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists): 19 (WebKit::RemoteRenderingBackend::wakeUpAndApplyDisplayList): 20 21 In the case where the next destination image buffer is unknown, bail early and resume when we eventually learn 22 about the image buffer in the GPU process. This can happen if a MetaCommandChangeDestinationImageBuffer item is 23 added that references a newly created image buffer. 24 25 (WebKit::RemoteRenderingBackend::setNextItemBufferToRead): 26 (WebKit::RemoteRenderingBackend::cacheNativeImage): 27 28 See if the newly cached image's ID matches that of the pending wakeup message; if so, immediately kick off the 29 wakeup loop. 30 31 (WebKit::RemoteRenderingBackend::didCreateSharedDisplayListHandle): 32 * GPUProcess/graphics/RemoteRenderingBackend.h: 33 34 Add a private `PendingWakeupInformation` struct that encapsulates all the information needed to remember that 35 we stopped display list processing, and resume processing in the future. Currently, this contains a set of 36 wakeup message arguments, and (optionally) the identifier of the missing resource that we need to receive in 37 order to continue. 38 39 We also use this in place of storing GPUProcessWakeupMessageArguments on RemoteRenderingBackend. 40 41 (WebKit::RemoteRenderingBackend::PendingWakeupInformation::shouldPerformWakeup const): 42 1 43 2020-12-09 Kimmo Kinnunen <kkinnunen@apple.com> 2 44 -
trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp
r270564 r270591 128 128 129 129 m_remoteResourceCache.cacheImageBuffer(makeRef(*imageBuffer)); 130 131 if (m_pendingWakeupInfo && m_pendingWakeupInfo->shouldPerformWakeup(renderingResourceIdentifier)) 132 wakeUpAndApplyDisplayList(std::exchange(m_pendingWakeupInfo, WTF::nullopt)->arguments); 130 133 } 131 134 … … 191 194 destination = makeRefPtr(m_remoteResourceCache.cachedImageBuffer(*result.nextDestinationImageBuffer)); 192 195 if (!destination) { 193 ASSERT(!m_pendingWakeup Arguments);194 m_pendingWakeup Arguments = {{ handle.identifier(), offset, *result.nextDestinationImageBuffer}};196 ASSERT(!m_pendingWakeupInfo); 197 m_pendingWakeupInfo = {{{ handle.identifier(), offset, *result.nextDestinationImageBuffer }, WTF::nullopt }}; 195 198 } 196 199 } 197 200 198 if (m_pendingWakeupArguments) 201 if (result.reasonForStopping == DisplayList::StopReplayReason::MissingCachedResource) { 202 m_pendingWakeupInfo = {{ 203 { handle.identifier(), offset, destination->renderingResourceIdentifier() }, 204 result.missingCachedResourceIdentifier 205 }}; 206 } 207 208 if (m_pendingWakeupInfo) 199 209 break; 200 210 … … 225 235 destinationImageBuffer = nextDestinationImageBufferAfterApplyingDisplayLists(*destinationImageBuffer, arguments.offset, *initialHandle); 226 236 if (!destinationImageBuffer) { 227 ASSERT_NOT_REACHED(); 228 return; 229 } 230 231 while (m_pendingWakeupArguments) { 232 auto nextHandle = m_sharedDisplayListHandles.get(m_pendingWakeupArguments->itemBufferIdentifier); 237 RELEASE_ASSERT(m_pendingWakeupInfo); 238 return; 239 } 240 241 while (m_pendingWakeupInfo) { 242 if (m_pendingWakeupInfo->missingCachedResourceIdentifier) 243 break; 244 245 auto nextHandle = m_sharedDisplayListHandles.get(m_pendingWakeupInfo->arguments.itemBufferIdentifier); 233 246 if (!nextHandle) { 234 247 // If the handle identifier is currently unknown, wait until the GPU process receives an … … 238 251 239 252 // Otherwise, continue reading the next display list item buffer from the start. 240 auto arguments = *std::exchange(m_pendingWakeupArguments, WTF::nullopt);253 auto arguments = std::exchange(m_pendingWakeupInfo, WTF::nullopt)->arguments; 241 254 destinationImageBuffer = nextDestinationImageBufferAfterApplyingDisplayLists(*destinationImageBuffer, arguments.offset, *nextHandle); 242 255 if (!destinationImageBuffer) { 243 ASSERT_NOT_REACHED();244 return;256 RELEASE_ASSERT(m_pendingWakeupInfo); 257 break; 245 258 } 246 259 } … … 249 262 void RemoteRenderingBackend::setNextItemBufferToRead(DisplayList::ItemBufferIdentifier identifier, WebCore::RenderingResourceIdentifier destinationIdentifier) 250 263 { 251 if (UNLIKELY(m_pendingWakeup Arguments)) {264 if (UNLIKELY(m_pendingWakeupInfo)) { 252 265 // FIXME: Add a message check to terminate the web process. 253 266 ASSERT_NOT_REACHED(); 254 267 return; 255 268 } 256 m_pendingWakeup Arguments = {{ identifier, SharedDisplayListHandle::headerSize(), destinationIdentifier}};269 m_pendingWakeupInfo = {{{ identifier, SharedDisplayListHandle::headerSize(), destinationIdentifier }, WTF::nullopt }}; 257 270 } 258 271 … … 267 280 void RemoteRenderingBackend::cacheNativeImage(const ShareableBitmap::Handle& handle, RenderingResourceIdentifier renderingResourceIdentifier) 268 281 { 269 if (auto bitmap = ShareableBitmap::create(handle)) { 270 if (auto image = NativeImage::create(bitmap->createPlatformImage(), renderingResourceIdentifier)) 271 m_remoteResourceCache.cacheNativeImage(makeRef(*image)); 272 } 282 auto bitmap = ShareableBitmap::create(handle); 283 if (!bitmap) 284 return; 285 286 auto image = NativeImage::create(bitmap->createPlatformImage(), renderingResourceIdentifier); 287 if (!image) 288 return; 289 290 m_remoteResourceCache.cacheNativeImage(makeRef(*image)); 291 292 if (m_pendingWakeupInfo && m_pendingWakeupInfo->shouldPerformWakeup(renderingResourceIdentifier)) 293 wakeUpAndApplyDisplayList(std::exchange(m_pendingWakeupInfo, WTF::nullopt)->arguments); 273 294 } 274 295 … … 289 310 m_sharedDisplayListHandles.set(identifier, DisplayListReaderHandle::create(identifier, sharedMemory.releaseNonNull())); 290 311 291 if (m_pendingWakeup Arguments && m_pendingWakeupArguments->itemBufferIdentifier == identifier)292 wakeUpAndApplyDisplayList( *std::exchange(m_pendingWakeupArguments, WTF::nullopt));312 if (m_pendingWakeupInfo && m_pendingWakeupInfo->shouldPerformWakeup(identifier)) 313 wakeUpAndApplyDisplayList(std::exchange(m_pendingWakeupInfo, WTF::nullopt)->arguments); 293 314 } 294 315 -
trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h
r270564 r270591 114 114 void didCreateSharedDisplayListHandle(WebCore::DisplayList::ItemBufferIdentifier, const SharedMemory::IPCHandle&, WebCore::RenderingResourceIdentifier destinationBufferIdentifier); 115 115 116 struct PendingWakeupInformation { 117 GPUProcessWakeupMessageArguments arguments; 118 Optional<WebCore::RenderingResourceIdentifier> missingCachedResourceIdentifier; 119 120 bool shouldPerformWakeup(WebCore::RenderingResourceIdentifier identifier) const 121 { 122 return arguments.destinationImageBufferIdentifier == identifier 123 || missingCachedResourceIdentifier == identifier; 124 } 125 126 bool shouldPerformWakeup(WebCore::DisplayList::ItemBufferIdentifier identifier) const 127 { 128 return arguments.itemBufferIdentifier == identifier; 129 } 130 }; 131 116 132 RemoteResourceCache m_remoteResourceCache; 117 133 WeakPtr<GPUConnectionToWebProcess> m_gpuConnectionToWebProcess; 118 134 RenderingBackendIdentifier m_renderingBackendIdentifier; 119 135 HashMap<WebCore::DisplayList::ItemBufferIdentifier, RefPtr<DisplayListReaderHandle>> m_sharedDisplayListHandles; 120 Optional< GPUProcessWakeupMessageArguments> m_pendingWakeupArguments;136 Optional<PendingWakeupInformation> m_pendingWakeupInfo; 121 137 }; 122 138
Note:
See TracChangeset
for help on using the changeset viewer.