RESOLVED FIXED 208090
[GPUP] Implement Modern EME API in the GPU Process
https://bugs.webkit.org/show_bug.cgi?id=208090
Summary [GPUP] Implement Modern EME API in the GPU Process
Jer Noble
Reported 2020-02-21 23:37:49 PST
[GPUP] Implement Modern EME API in the GPU Process
Attachments
WIP (254.65 KB, patch)
2020-02-21 23:49 PST, Jer Noble
no flags
WIP (253.69 KB, patch)
2020-02-22 09:05 PST, Jer Noble
no flags
WIP (266.06 KB, patch)
2020-02-22 10:35 PST, Jer Noble
no flags
WIP (261.10 KB, patch)
2020-02-22 11:25 PST, Jer Noble
no flags
WIP (261.18 KB, patch)
2020-02-22 14:24 PST, Jer Noble
no flags
WIP (261.20 KB, patch)
2020-02-22 21:06 PST, Jer Noble
no flags
WIP (262.31 KB, patch)
2020-02-23 21:18 PST, Jer Noble
no flags
WIP (261.92 KB, patch)
2020-02-23 21:23 PST, Jer Noble
no flags
Part 1: WebCore (61.30 KB, patch)
2020-02-23 21:27 PST, Jer Noble
no flags
Part 2: WebKit + SharedBuffer (29.41 KB, patch)
2020-02-23 21:42 PST, Jer Noble
no flags
Part 3: RemoteCDM (Depends on Parts 1 & 2) (167.41 KB, patch)
2020-02-23 21:44 PST, Jer Noble
no flags
Part 1: WebCore (63.53 KB, patch)
2020-02-23 21:50 PST, Jer Noble
no flags
Part 2: WebKit + SharedBuffer (29.75 KB, patch)
2020-02-23 21:54 PST, Jer Noble
no flags
Part 1: WebCore (63.69 KB, patch)
2020-02-24 07:14 PST, Jer Noble
no flags
Part 1: WebCore (148.39 KB, patch)
2020-02-24 22:12 PST, Jer Noble
eric.carlson: review+
Part 2: WebKit + SharedBuffer (30.01 KB, patch)
2020-02-24 22:18 PST, Jer Noble
achristensen: review-
Part 3: RemoteCDM (depends on Parts 1 & 2) (159.24 KB, patch)
2020-02-24 22:21 PST, Jer Noble
no flags
Patch for landing: Part 1: WebCore (152.75 KB, patch)
2020-02-28 07:46 PST, Jer Noble
no flags
Patch for landing: Part 1: WebCore (152.75 KB, patch)
2020-02-28 08:08 PST, Jer Noble
no flags
Patch for landing: Part 1: WebCore (153.01 KB, patch)
2020-02-28 08:19 PST, Jer Noble
no flags
Patch for landing: Part 1: WebCore (153.02 KB, patch)
2020-02-28 09:49 PST, Jer Noble
no flags
Part 2: WebKit + SharedBuffer (34.61 KB, patch)
2020-02-28 10:34 PST, Jer Noble
achristensen: review+
achristensen: commit-queue-
Patch for landing: Part 1: WebCore (153.03 KB, patch)
2020-02-28 10:46 PST, Jer Noble
no flags
Patch for landing: Part 2: WebKit + SharedBuffer (35.11 KB, patch)
2020-02-28 13:04 PST, Jer Noble
no flags
Part 3: RemoteCDM (162.72 KB, patch)
2020-02-28 17:13 PST, Jer Noble
no flags
Part 3: RemoteCDM (161.46 KB, patch)
2020-02-28 21:53 PST, Jer Noble
no flags
Patch (163.33 KB, patch)
2020-02-28 22:56 PST, Jer Noble
no flags
Part 3: RemoteCDM (162.87 KB, patch)
2020-02-29 09:58 PST, Jer Noble
eric.carlson: review+
Patch for landing: Part 3: WebKit (162.93 KB, patch)
2020-03-04 08:01 PST, Jer Noble
no flags
Patch for landing: Part 3: RemoteCDM (168.20 KB, patch)
2020-03-04 09:12 PST, Jer Noble
no flags
Patch for landing: Part 3: RemoteCDM (168.41 KB, patch)
2020-03-04 09:22 PST, Jer Noble
no flags
Patch for landing: Part 3: RemoteCDM (168.41 KB, patch)
2020-03-04 09:31 PST, Jer Noble
no flags
Patch for landing: Part 3: RemoteCDM (169.04 KB, patch)
2020-03-04 09:37 PST, Jer Noble
no flags
Patch for landing: Part 3: RemoteCDM (169.04 KB, patch)
2020-03-04 09:47 PST, Jer Noble
no flags
Patch for landing: Part 3: RemoteCDM (169.04 KB, patch)
2020-03-04 09:50 PST, Jer Noble
no flags
Jer Noble
Comment 1 2020-02-21 23:49:50 PST Comment hidden (obsolete)
Jer Noble
Comment 2 2020-02-22 09:05:28 PST Comment hidden (obsolete)
Jer Noble
Comment 3 2020-02-22 10:35:10 PST Comment hidden (obsolete)
Jer Noble
Comment 4 2020-02-22 11:25:36 PST Comment hidden (obsolete)
Jer Noble
Comment 5 2020-02-22 14:24:05 PST
Jer Noble
Comment 6 2020-02-22 21:06:50 PST
Jer Noble
Comment 7 2020-02-23 21:18:56 PST
Jer Noble
Comment 8 2020-02-23 21:23:00 PST
Jer Noble
Comment 9 2020-02-23 21:27:04 PST
Created attachment 391511 [details] Part 1: WebCore
Jer Noble
Comment 10 2020-02-23 21:42:21 PST
Created attachment 391512 [details] Part 2: WebKit + SharedBuffer
Jer Noble
Comment 11 2020-02-23 21:44:47 PST
Created attachment 391513 [details] Part 3: RemoteCDM (Depends on Parts 1 & 2)
Jer Noble
Comment 12 2020-02-23 21:50:10 PST
Created attachment 391514 [details] Part 1: WebCore
Jer Noble
Comment 13 2020-02-23 21:54:48 PST
Created attachment 391515 [details] Part 2: WebKit + SharedBuffer
Sam Weinig
Comment 14 2020-02-24 06:09:01 PST
Comment on attachment 391513 [details] Part 3: RemoteCDM (Depends on Parts 1 & 2) This adds a lot of additional sync IPC. Can you help me understand why these all need to be synchronous?
Jer Noble
Comment 15 2020-02-24 07:04:38 PST
(In reply to Sam Weinig from comment #14) > Comment on attachment 391513 [details] > Part 3: RemoteCDM (Depends on Parts 1 & 2) > > This adds a lot of additional sync IPC. Can you help me understand why these > all need to be synchronous? Yeah, I know. :( A ton of changes would have to be made to the algorithms inside CDM.cpp in order to make all the messaging asynchronous; see getSupportedConfiguration() in that file, e.g. I've already done some of that, by pushing up the list of "supportedInitTypes" rather issuing a sync XPC to ask whether a given type is supported. There are a few other changes I'm planning to make to push more information up across from the GPUProcess so that queries are local and don't need XPCs at all, but it won't be possible for all the methods. Another possibility I considered is to move the entire implementation of CDM into a background thread, the way we do for MSE parsing. We can't send sync messages from background threads, so that'd be hard, and would require getting replies on the main thread and doing semaphore magic to move the results back to the work queue.
Jer Noble
Comment 16 2020-02-24 07:14:09 PST
...(continued) I'm not saying that work is impossible, and I do plan on converting sync messages to asyncs in future patches.
Jer Noble
Comment 17 2020-02-24 07:14:52 PST
Created attachment 391534 [details] Part 1: WebCore
Jer Noble
Comment 18 2020-02-24 09:18:18 PST
...or maybe I can move all of the CDM::getSupportedConfiguration into platform and then into the GPUProcess.
Jer Noble
Comment 19 2020-02-24 12:09:25 PST
(In reply to Jer Noble from comment #18) > ...or maybe I can move all of the CDM::getSupportedConfiguration into > platform and then into the GPUProcess. Looks like that technique will work; the only DOM part of that implementation is asking the Document for it's securityOrigin, and that can stay in CDM and be passed into the algorithm from outside. I'll post a new patch that removes most of the sync messages from RemoteCDMProxy.messages.in.
Jer Noble
Comment 20 2020-02-24 22:12:43 PST
Created attachment 391622 [details] Part 1: WebCore
Jer Noble
Comment 21 2020-02-24 22:18:02 PST
Created attachment 391623 [details] Part 2: WebKit + SharedBuffer
Jer Noble
Comment 22 2020-02-24 22:21:42 PST
Created attachment 391625 [details] Part 3: RemoteCDM (depends on Parts 1 & 2)
Jer Noble
Comment 23 2020-02-24 22:24:59 PST
Okay, almost all the synchronous messages have been removed entirely or converted to Async ones. The remaining Sync messages are creating objects, and they need to be synchronous because the creation message returns with it the configuration properties which themselves allow WebContent-side queries to not require any XPC at all. If the creation methods weren't sync, those property queries would have to block until the configuration message was received.
Alex Christensen
Comment 24 2020-02-25 13:33:02 PST
Comment on attachment 391623 [details] Part 2: WebKit + SharedBuffer View in context: https://bugs.webkit.org/attachment.cgi?id=391623&action=review > Source/WebKit/Platform/IPC/SharedBufferDataReference.h:36 > SharedBufferDataReference() = default; > + SharedBufferDataReference(RefPtr<WebCore::SharedBuffer>&& buffer) Can we remove these? The default constructor was only needed in a time when decoding needed to instantiate a default constructed object, which is not the case any more. Can we make m_buffer a Ref? > Source/WebKit/Scripts/webkit/messages.py:230 > + 'WebKit::RemoteCDMIdentifier', This change seems unrelated to the rest of this patch. > Source/WebKit/Shared/WebCoreArgumentCoders.cpp:3211 > +Optional<RefPtr<SharedBuffer>> ArgumentCoder<RefPtr<WebCore::SharedBuffer>>::decode(Decoder& decoder) Optional<Ref<SharedBuffer>> ArgumentCoder<Ref<... > Source/WebKit/Shared/WebCoreArgumentCoders.h:835 > + static Optional<RefPtr<WebCore::SharedBuffer>> decode(Decoder&); Optional<Ref<... > Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:132 > + m_connection->send(Messages::ServiceWorkerFetchTask::DidReceiveData { { SharedBuffer::create(data, size) }, static_cast<int64_t>(size) }, m_fetchIdentifier); This is an unnecessary copy of the data. > Source/WebKit/WebProcess/WebPage/WebPage.cpp:3503 > + dataReference = SharedBuffer::create(data.get()); This is a great improvement. > Source/WebKit/WebProcess/WebPage/WebPage.cpp:4922 > + send(Messages::WebPageProxy::DataCallback({ SharedBuffer::create(pdfPageData.get()) }, callbackID)); Great!
Jer Noble
Comment 25 2020-02-26 11:47:44 PST
(In reply to Alex Christensen from comment #24) > Comment on attachment 391623 [details] > Part 2: WebKit + SharedBuffer > > View in context: > https://bugs.webkit.org/attachment.cgi?id=391623&action=review > > > Source/WebKit/Platform/IPC/SharedBufferDataReference.h:36 > > SharedBufferDataReference() = default; > > + SharedBufferDataReference(RefPtr<WebCore::SharedBuffer>&& buffer) > > Can we remove these? The default constructor was only needed in a time when > decoding needed to instantiate a default constructed object, which is not > the case any more. > Can we make m_buffer a Ref? Probably not. For sync replies, you still need to create a default object and pass that object in by reference to the reply handler. Doing so would mean not being able to use a SharedBufferDataReference in a sync reply. > > Source/WebKit/Scripts/webkit/messages.py:230 > > + 'WebKit::RemoteCDMIdentifier', > > This change seems unrelated to the rest of this patch. Yep! That should have gone into Part 3. > > Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:132 > > + m_connection->send(Messages::ServiceWorkerFetchTask::DidReceiveData { { SharedBuffer::create(data, size) }, static_cast<int64_t>(size) }, m_fetchIdentifier); > > This is an unnecessary copy of the data. There are two call sites which generate a "DidReceiveData" message. Should there be two separate messages, one that takes a DataReference and one that takes a SharedDataReference? Or can the FetchTaskClient be modified to require the caller gives a SharedBuffer?
Jer Noble
Comment 26 2020-02-26 11:59:17 PST
(In reply to Jer Noble from comment #25) > (In reply to Alex Christensen from comment #24) > > Comment on attachment 391623 [details] > > > Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:132 > > > + m_connection->send(Messages::ServiceWorkerFetchTask::DidReceiveData { { SharedBuffer::create(data, size) }, static_cast<int64_t>(size) }, m_fetchIdentifier); > > > > This is an unnecessary copy of the data. > > There are two call sites which generate a "DidReceiveData" message. Should > there be two separate messages, one that takes a DataReference and one that > takes a SharedDataReference? Or can the FetchTaskClient be modified to > require the caller gives a SharedBuffer? It looks like there's a precambrian explosion of void*/size_t didReceiveData() across all of WebCore, and a random sampling shows that the majority starts off as a RefPtr<SharedBuffer>. So there's a huge opportunity for reducing copies, but also a ton of refactoring work. So I'll just add a DidReceiveRawData() message that takes an IPC::DataReference.
Eric Carlson
Comment 27 2020-02-26 13:35:45 PST
Comment on attachment 391622 [details] Part 1: WebCore View in context: https://bugs.webkit.org/attachment.cgi?id=391622&action=review > Source/WebCore/Modules/encryptedmedia/MediaKeySystemAccess.cpp:89 > + instance->initializeWithConfiguration(*m_configuration, useDistinctiveIdentifier ? AllowDistinctiveIdentifiers::Yes : AllowDistinctiveIdentifiers::No, persistentStateAllowed ? AllowPersistentState::Yes : AllowPersistentState::No, [this, protectedThis = makeRef(*this), useDistinctiveIdentifier, persistentStateAllowed, instance = WTFMove(instance), promise = WTFMove(promise)] (auto successValue) mutable { Wouldn't a weakPtr be better than a refPtr when using the GPU process? > Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp:110 > + m_instance->setServerCertificate(WTFMove(certificate), [promise = WTFMove(promise)] (auto success) { Doesn't this need one or the other? > Source/WebCore/platform/encryptedmedia/CDMPrivate.cpp:214 > + persistentStateRequirement = CDMRequirement::NotAllowed; Nit: two spaces. > Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:275 > + auto initialize = [&] () { > + if (configuration.distinctiveIdentifier == CDMRequirement::Required) Doesn't this need a protectedThis or weakThis?
Jer Noble
Comment 28 2020-02-28 07:16:32 PST
(In reply to Eric Carlson from comment #27) > Comment on attachment 391622 [details] > Part 1: WebCore > > View in context: > https://bugs.webkit.org/attachment.cgi?id=391622&action=review > > > Source/WebCore/Modules/encryptedmedia/MediaKeySystemAccess.cpp:89 > > + instance->initializeWithConfiguration(*m_configuration, useDistinctiveIdentifier ? AllowDistinctiveIdentifiers::Yes : AllowDistinctiveIdentifiers::No, persistentStateAllowed ? AllowPersistentState::Yes : AllowPersistentState::No, [this, protectedThis = makeRef(*this), useDistinctiveIdentifier, persistentStateAllowed, instance = WTFMove(instance), promise = WTFMove(promise)] (auto successValue) mutable { > > Wouldn't a weakPtr be better than a refPtr when using the GPU process? It doesn't /really/ need either, if I change this block to take all the arguments it needs an not use `this`. > > Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp:110 > > + m_instance->setServerCertificate(WTFMove(certificate), [promise = WTFMove(promise)] (auto success) { > > Doesn't this need one or the other? Nope, it only references the promise inside the block, which was moved in. > > Source/WebCore/platform/encryptedmedia/CDMPrivate.cpp:214 > > + persistentStateRequirement = CDMRequirement::NotAllowed; > > Nit: two spaces. Fixed. > > Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:275 > > + auto initialize = [&] () { > > + if (configuration.distinctiveIdentifier == CDMRequirement::Required) > > Doesn't this need a protectedThis or weakThis? Nope. It's run synchronously inside this function.
Jer Noble
Comment 29 2020-02-28 07:46:02 PST Comment hidden (obsolete)
Jer Noble
Comment 30 2020-02-28 08:08:05 PST Comment hidden (obsolete)
Jer Noble
Comment 31 2020-02-28 08:19:33 PST Comment hidden (obsolete)
Jer Noble
Comment 32 2020-02-28 09:49:45 PST Comment hidden (obsolete)
Jer Noble
Comment 33 2020-02-28 10:34:12 PST
Created attachment 391989 [details] Part 2: WebKit + SharedBuffer
Jer Noble
Comment 34 2020-02-28 10:46:08 PST
Created attachment 391994 [details] Patch for landing: Part 1: WebCore
Alex Christensen
Comment 35 2020-02-28 11:12:37 PST
Comment on attachment 391989 [details] Part 2: WebKit + SharedBuffer View in context: https://bugs.webkit.org/attachment.cgi?id=391989&action=review > Source/WebKit/ChangeLog:13 > + by the SharedBuffer object at creation time, leading to zero-copy decoding, but is not done in this patch. Wouldn't this still be one-copy because we need to copy it into shared memory when encoding? decodeSharedBuffer is in desperate need of at least a FIXME comment saying that the SharedBuffer should just adopt SharedMemory::Handle as a new type of DataSegment, which would require moving SharedMemory to WebCore. I think we should to that before this to prevent performance regressions, but if you promise to do that in the next week or two I'd be ok with a FIXME comment. > Source/WebKit/Platform/IPC/SharedBufferDataReference.h:39 > + : m_buffer(WTFMove(buffer)) > + { > + } We're starting to put these on the line before. : m_buffer(WTFMove(buffer)) { } > Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:192 > + auto fileWrapper = adoptNS([pageClient().allocFileWrapperInstance() initRegularFileWithContents:dataReference.buffer()->createNSData().autorelease()]); This used to be a Ref<SharedBuffer> but now it is a RefPtr<SharedBuffer> which would need a null check. > Source/WebKit/WebProcess/Network/WebResourceLoader.cpp:198 > + if (UNLIKELY(m_interceptController.isIntercepting(m_coreLoader->identifier()))) { I'm not a huge fan of all this duplicate code. > Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:132 > + m_connection->send(Messages::ServiceWorkerFetchTask::DidReceiveSharedBuffer { { SharedBuffer::create(data, size) }, static_cast<int64_t>(size) }, m_fetchIdentifier); This looks like an unnecessary copy from {data, size} into a SharedBuffer which will then copy it into shared memory to serialize. This at least needs a FIXME comment saying to improve it.
Jer Noble
Comment 36 2020-02-28 11:17:47 PST
Comment on attachment 391989 [details] Part 2: WebKit + SharedBuffer View in context: https://bugs.webkit.org/attachment.cgi?id=391989&action=review >> Source/WebKit/ChangeLog:13 >> + by the SharedBuffer object at creation time, leading to zero-copy decoding, but is not done in this patch. > > Wouldn't this still be one-copy because we need to copy it into shared memory when encoding? > decodeSharedBuffer is in desperate need of at least a FIXME comment saying that the SharedBuffer should just adopt SharedMemory::Handle as a new type of DataSegment, which would require moving SharedMemory to WebCore. I think we should to that before this to prevent performance regressions, but if you promise to do that in the next week or two I'd be ok with a FIXME comment. I don't this current patch (with the fix you mention below) will result in any extra copies, and with the change you mention here, will definitely reduce copies, with the potential (if both ends are SharedMemory-backed) of zero-copies. So I'm not sure that this needs a FIXME, though it does need a follow up. >> Source/WebKit/Platform/IPC/SharedBufferDataReference.h:39 >> + } > > We're starting to put these on the line before. > : m_buffer(WTFMove(buffer)) { } Ok. >> Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:192 >> + auto fileWrapper = adoptNS([pageClient().allocFileWrapperInstance() initRegularFileWithContents:dataReference.buffer()->createNSData().autorelease()]); > > This used to be a Ref<SharedBuffer> but now it is a RefPtr<SharedBuffer> which would need a null check. dataReference.isEmpty() above performs the null-check. >> Source/WebKit/WebProcess/Network/WebResourceLoader.cpp:198 >> + if (UNLIKELY(m_interceptController.isIntercepting(m_coreLoader->identifier()))) { > > I'm not a huge fan of all this duplicate code. Okay, I'll abstract it. >> Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:132 >> + m_connection->send(Messages::ServiceWorkerFetchTask::DidReceiveSharedBuffer { { SharedBuffer::create(data, size) }, static_cast<int64_t>(size) }, m_fetchIdentifier); > > This looks like an unnecessary copy from {data, size} into a SharedBuffer which will then copy it into shared memory to serialize. This at least needs a FIXME comment saying to improve it. Oh right, this can revert to the DidReceiveData message.
Jer Noble
Comment 37 2020-02-28 13:04:39 PST
Created attachment 392008 [details] Patch for landing: Part 2: WebKit + SharedBuffer
Jer Noble
Comment 38 2020-02-28 15:20:11 PST
Comment on attachment 391994 [details] Patch for landing: Part 1: WebCore Clearing flags on attachment: 391994 Committed r257660: <https://trac.webkit.org/changeset/257660>
Jer Noble
Comment 39 2020-02-28 16:32:23 PST
Comment on attachment 392008 [details] Patch for landing: Part 2: WebKit + SharedBuffer Clearing flags on attachment: 392008 Committed r257667: <https://trac.webkit.org/changeset/257667>
Jer Noble
Comment 40 2020-02-28 17:13:14 PST
Created attachment 392035 [details] Part 3: RemoteCDM
Jer Noble
Comment 41 2020-02-28 21:53:12 PST
Created attachment 392048 [details] Part 3: RemoteCDM
Jer Noble
Comment 42 2020-02-28 22:56:21 PST
Jer Noble
Comment 43 2020-02-29 09:58:11 PST
Created attachment 392066 [details] Part 3: RemoteCDM
Eric Carlson
Comment 44 2020-03-02 07:23:06 PST
Comment on attachment 392066 [details] Part 3: RemoteCDM View in context: https://bugs.webkit.org/attachment.cgi?id=392066&action=review > Source/WebKit/ChangeLog:10 > + Allow the existing CDMFactory machinery to work normally by explicitly clearing out all the existing > + when the GPU process is enabled, and resetting those factories to default when the GPU process is disabled. "clearing out all the existing when the GPU process" - all the existing what? > Source/WebKit/GPUProcess/media/RemoteCDMFactoryProxy.cpp:70 > + auto factory = factoryForKeySystem(keySystem); > + if (!factory) { > + completion({ }, { }); > + return; > + } > + > + auto privateCDM = factory->createCDM(keySystem); > + if (!privateCDM) { > + completion({ }, { }); > + return; > + } It is probably worth logging these failures. > Source/WebKit/GPUProcess/media/RemoteCDMFactoryProxy.cpp:144 > +RemoteCDMInstanceProxy* RemoteCDMFactoryProxy::getInstance(const RemoteCDMInstanceIdentifier& id) RemoteCDMInstanceIdentifier id > Source/WebKit/WebProcess/GPU/media/RemoteCDMFactory.cpp:68 > + bool supported = false; > + gpuProcessConnection().connection().sendSync(Messages::RemoteCDMFactoryProxy::SupportsKeySystem(keySystem), Messages::RemoteCDMFactoryProxy::SupportsKeySystem::Reply(supported), { }); > + return supported; Can the key systems a CDM supports change dynamically? If not, we should cache the results to avoid making a sync IPC more than once for a given string. > Source/WebKit/WebProcess/GPU/media/RemoteCDMInstanceSession.h:58 > + Nit: extra blank line > Source/WebKit/WebProcess/GPU/media/WebMediaStrategy.cpp:63 > void WebMediaStrategy::registerCDMFactories(Vector<WebCore::CDMFactory*>& factories) > { > - return WebCore::CDMFactory::platformRegisterFactories(factories); > +#if ENABLE(GPU_PROCESS) > + if (m_useGPUProcess) { > + WebProcess::singleton().ensureGPUProcessConnection().cdmFactory().registerFactory(factories); > + return; > + } > +#endif > + WebCore::CDMFactory::platformRegisterFactories(factories); > } Didn't Sam recommend we not use a strategy for this?
Radar WebKit Bug Importer
Comment 45 2020-03-02 10:04:29 PST
Jer Noble
Comment 46 2020-03-02 10:12:11 PST
(In reply to Eric Carlson from comment #44) > Comment on attachment 392066 [details] > Part 3: RemoteCDM > > View in context: > https://bugs.webkit.org/attachment.cgi?id=392066&action=review > > > Source/WebKit/ChangeLog:10 > > + Allow the existing CDMFactory machinery to work normally by explicitly clearing out all the existing > > + when the GPU process is enabled, and resetting those factories to default when the GPU process is disabled. > > "clearing out all the existing when the GPU process" - all the existing what? Ah, that's referring to a previous implementation where we would reset the factories when the "use GPU Process for media" setting changed. Now that we're using the PlatformStrategies, we don't need to do this. > > Source/WebKit/GPUProcess/media/RemoteCDMFactoryProxy.cpp:70 > > + auto factory = factoryForKeySystem(keySystem); > > + if (!factory) { > > + completion({ }, { }); > > + return; > > + } > > + > > + auto privateCDM = factory->createCDM(keySystem); > > + if (!privateCDM) { > > + completion({ }, { }); > > + return; > > + } > > It is probably worth logging these failures. Oky. > > Source/WebKit/GPUProcess/media/RemoteCDMFactoryProxy.cpp:144 > > +RemoteCDMInstanceProxy* RemoteCDMFactoryProxy::getInstance(const RemoteCDMInstanceIdentifier& id) > > RemoteCDMInstanceIdentifier id Why? > > Source/WebKit/WebProcess/GPU/media/RemoteCDMFactory.cpp:68 > > + bool supported = false; > > + gpuProcessConnection().connection().sendSync(Messages::RemoteCDMFactoryProxy::SupportsKeySystem(keySystem), Messages::RemoteCDMFactoryProxy::SupportsKeySystem::Reply(supported), { }); > > + return supported; > > Can the key systems a CDM supports change dynamically? The list of keySystems supported (e.g., by FairPlay) is effectively a regular expression. > If not, we should > cache the results to avoid making a sync IPC more than once for a given > string. I think I'd rather modify the DOM code so that we could make SupportsKeySystem asynchronous. > > Source/WebKit/WebProcess/GPU/media/RemoteCDMInstanceSession.h:58 > > + > > Nit: extra blank line Ok. > > Source/WebKit/WebProcess/GPU/media/WebMediaStrategy.cpp:63 > > void WebMediaStrategy::registerCDMFactories(Vector<WebCore::CDMFactory*>& factories) > > { > > - return WebCore::CDMFactory::platformRegisterFactories(factories); > > +#if ENABLE(GPU_PROCESS) > > + if (m_useGPUProcess) { > > + WebProcess::singleton().ensureGPUProcessConnection().cdmFactory().registerFactory(factories); > > + return; > > + } > > +#endif > > + WebCore::CDMFactory::platformRegisterFactories(factories); > > } > > Didn't Sam recommend we not use a strategy for this? Ryosuke disagrees, and has a compelling justification.
Eric Carlson
Comment 47 2020-03-02 11:23:07 PST
Comment on attachment 392066 [details] Part 3: RemoteCDM View in context: https://bugs.webkit.org/attachment.cgi?id=392066&action=review >>> Source/WebKit/GPUProcess/media/RemoteCDMFactoryProxy.cpp:144 >>> +RemoteCDMInstanceProxy* RemoteCDMFactoryProxy::getInstance(const RemoteCDMInstanceIdentifier& id) >> >> RemoteCDMInstanceIdentifier id > > Why? To match all of the other RemoteCDMInstanceProxy methods? >>> Source/WebKit/WebProcess/GPU/media/WebMediaStrategy.cpp:63 >>> } >> >> Didn't Sam recommend we not use a strategy for this? > > Ryosuke disagrees, and has a compelling justification. We need a cage match!
Jer Noble
Comment 48 2020-03-04 08:01:01 PST
Created attachment 392414 [details] Patch for landing: Part 3: WebKit
Jer Noble
Comment 49 2020-03-04 09:12:22 PST
Created attachment 392422 [details] Patch for landing: Part 3: RemoteCDM
Jer Noble
Comment 50 2020-03-04 09:22:20 PST
Created attachment 392423 [details] Patch for landing: Part 3: RemoteCDM
Jer Noble
Comment 51 2020-03-04 09:31:28 PST
Created attachment 392424 [details] Patch for landing: Part 3: RemoteCDM
Jer Noble
Comment 52 2020-03-04 09:37:01 PST
Created attachment 392427 [details] Patch for landing: Part 3: RemoteCDM
Jer Noble
Comment 53 2020-03-04 09:47:36 PST
Created attachment 392428 [details] Patch for landing: Part 3: RemoteCDM
Jer Noble
Comment 54 2020-03-04 09:50:18 PST
Created attachment 392429 [details] Patch for landing: Part 3: RemoteCDM
WebKit Commit Bot
Comment 55 2020-03-04 11:42:33 PST
Comment on attachment 392429 [details] Patch for landing: Part 3: RemoteCDM Clearing flags on attachment: 392429 Committed r257867: <https://trac.webkit.org/changeset/257867>
Note You need to log in before you can comment on or make changes to this bug.