Bug 235636 - [GPU Process] Remove the resource use counters from the remote resource cache
Summary: [GPU Process] Remove the resource use counters from the remote resource cache
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-01-26 03:07 PST by Said Abou-Hallawa
Modified: 2022-04-13 21:32 PDT (History)
6 users (show)

See Also:


Attachments
Patch (37.06 KB, patch)
2022-01-26 03:14 PST, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2022-01-26 03:07:17 PST
The display list items and the resource caching messages are both communicated from the WebProcess and the GPUProcess through the stream connection. The resources will be sent to the GPUProcess, consumed by the display items and then released in the right order. So there is no need anymore for the resource use counters. They were added in bug 228216 to synchronize properly the use and the release of the resources.
Comment 1 Said Abou-Hallawa 2022-01-26 03:14:41 PST
Created attachment 450010 [details]
Patch
Comment 2 Said Abou-Hallawa 2022-01-26 10:16:56 PST
The reason for filing this bug is I found the following crash when running the layout tests with "--use-gpu-process". So instead of trying to investigate this crash, I think it is better to remove this unnecessary code.

No crash log found for GPUProcess:51290.

stdout:

stderr:
ASSERTION FAILED: iterator != m_resourceUseCounters.end()
/Volumes/Data/WebKit/OpenSource/Source/WebKit/GPUProcess/graphics/RemoteResourceCache.cpp(165) : void WebKit::RemoteResourceCache::recordResourceUse(WebKit::QualifiedRenderingResourceIdentifier)
1   0x13b13ef59 WTFCrash
2   0x1277b8d1b WTFCrashWithInfo(int, char const*, char const*, int)
3   0x1284fa36e WebKit::RemoteResourceCache::recordResourceUse(WebCore::ProcessQualified<WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType> >)
4   0x1284fbb86 WebKit::RemoteDisplayListRecorder::drawImageBufferWithQualifiedIdentifier(WebCore::ProcessQualified<WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType> >, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&)
5   0x1284fba3a WebKit::RemoteDisplayListRecorder::drawImageBuffer(WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&)
6   0x128273d75 void IPC::callMemberFunctionImpl<WebKit::RemoteDisplayListRecorder, void (WebKit::RemoteDisplayListRecorder::*)(WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&), std::__1::tuple<WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect, WebCore::FloatRect, WebCore::ImagePaintingOptions>, 0ul, 1ul, 2ul, 3ul>(WebKit::RemoteDisplayListRecorder*, void (WebKit::RemoteDisplayListRecorder::*)(WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&), std::__1::tuple<WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect, WebCore::FloatRect, WebCore::ImagePaintingOptions>&&, std::__1::integer_sequence<unsigned long, 0ul, 1ul, 2ul, 3ul>)
7   0x12827188d void IPC::callMemberFunction<WebKit::RemoteDisplayListRecorder, void (WebKit::RemoteDisplayListRecorder::*)(WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&), std::__1::tuple<WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect, WebCore::FloatRect, WebCore::ImagePaintingOptions>, std::__1::integer_sequence<unsigned long, 0ul, 1ul, 2ul, 3ul> >(std::__1::tuple<WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect, WebCore::FloatRect, WebCore::ImagePaintingOptions>&&, WebKit::RemoteDisplayListRecorder*, void (WebKit::RemoteDisplayListRecorder::*)(WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&))
8   0x12823549a void IPC::handleMessage<Messages::RemoteDisplayListRecorder::DrawImageBuffer, WebKit::RemoteDisplayListRecorder, void (WebKit::RemoteDisplayListRecorder::*)(WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&)>(IPC::Connection&, IPC::Decoder&, WebKit::RemoteDisplayListRecorder*, void (WebKit::RemoteDisplayListRecorder::*)(WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WebCore::FloatRect const&, WebCore::FloatRect const&, WebCore::ImagePaintingOptions const&))
9   0x1282328cf WebKit::RemoteDisplayListRecorder::didReceiveStreamMessage(IPC::StreamServerConnectionBase&, IPC::Decoder&)
10  0x128ca73bb IPC::StreamServerConnection::dispatchStreamMessage(IPC::Decoder&&, IPC::StreamMessageReceiver&)
11  0x128ca6d60 IPC::StreamServerConnection::dispatchStreamMessages(unsigned long)
12  0x128ca56b8 IPC::StreamConnectionWorkQueue::processStreams()
13  0x128cad8b0 IPC::StreamConnectionWorkQueue::startProcessingThread()::$_0::operator()()
14  0x128cad869 WTF::Detail::CallableWrapper<IPC::StreamConnectionWorkQueue::startProcessingThread()::$_0, void>::call()
15  0x13b169942 WTF::Function<void ()>::operator()() const
16  0x13b231f18 WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*)
17  0x13b23e375 WTF::wtfThreadEntryPoint(void*)
18  0x10c1d84bc _pthread_start
19  0x10c1d3ebf thread_start
Comment 3 Wenson Hsieh 2022-01-26 10:17:49 PST
(In reply to Said Abou-Hallawa from comment #2)
> The reason for filing this bug is I found the following crash when running
> the layout tests with "--use-gpu-process". So instead of trying to
> investigate this crash, I think it is better to remove this unnecessary code.

+1!
Comment 4 Said Abou-Hallawa 2022-01-26 10:44:16 PST
The above crash seems to happen because the m_resourceHeap of RemoteResourceCache got out of sync from its m_resourceUseCounters. 

When RemoteDisplayListRecorder::drawImageBufferWithQualifiedIdentifier() calls resourceCache().cachedImageBuffer() with the given imageBufferIdentifier, it finds an ImageBuffer in its m_resourceHeap but when it calls resourceCache().recordResourceUse() with the same imageBufferIdentifier, it does not find a counter in its m_resourceUseCounters.
Comment 5 Said Abou-Hallawa 2022-01-26 10:46:10 PST
I meant to say the "assertion" not the "crash".
Comment 6 Said Abou-Hallawa 2022-01-31 13:58:57 PST
rdar://86150540
Comment 7 EWS 2022-01-31 14:53:26 PST
Committed r288847 (246608@main): <https://commits.webkit.org/246608@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 450010 [details].