Changeset 284834 in webkit
- Timestamp:
- Oct 25, 2021, 2:51:10 PM (5 years ago)
- Location:
- branches/safari-612-branch/Source/WebKit
- Files:
-
- 7 edited
-
ChangeLog (modified) (1 diff)
-
GPUProcess/media/RemoteMediaPlayerProxy.cpp (modified) (1 diff)
-
GPUProcess/media/RemoteMediaPlayerProxy.h (modified) (2 diffs)
-
GPUProcess/media/RemoteMediaPlayerProxy.messages.in (modified) (1 diff)
-
GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm (modified) (1 diff)
-
WebProcess/GPU/media/MediaPlayerPrivateRemote.h (modified) (1 diff)
-
WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-612-branch/Source/WebKit/ChangeLog
r284831 r284834 1 2021-10-25 Null <null@apple.com> 2 3 Cherry-pick r284102. rdar://problem/84630200 4 5 WebGL video texture upload is very slow due to excessive transfer of the video pixel buffer 6 https://bugs.webkit.org/show_bug.cgi?id=231425 7 8 Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2021-10-13 9 Reviewed by Youenn Fablet. 10 11 Typical WebGL content requests the videos to be uploaded to a texture 12 once per render loop update, even though the video has not changed. 13 The video pixel buffer is slow to transfer across IPC. It should be transferred 14 only when it has changed. 15 16 MediaPlayerPrivateAVFoundationObjC and MediaPlayerPrivateMediaSourceAVFObjC hold 17 the last requested pixel buffer ref. They will update it or discard it only 18 when pixelBufferForCurrentTime() is called. 19 20 Cache the pixel buffer to MediaPlayerPrivateRemote (GPUP side proxy) 21 Cache the pixel buffer to RemoteMediaPlayerProxy (WebP side proxy) 22 23 The caches increase the total memory use only during the duration 24 of the call, since after the ref has been updated, it refers 25 to the one always held in the original objects (MediaPlayerPrivateAVFoundationObjC 26 and MediaPlayerPrivateMediaSourceAVFObjC) 27 28 No new tests, fixes a perf regression wrt GPUP media. 29 30 * GPUProcess/media/RemoteMediaPlayerProxy.cpp: 31 (WebKit::RemoteMediaPlayerProxy::invalidate): 32 * GPUProcess/media/RemoteMediaPlayerProxy.h: 33 * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: 34 * GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm: 35 (WebKit::RemoteMediaPlayerProxy::nativeImageForCurrentTime): 36 (WebKit::RemoteMediaPlayerProxy::pixelBufferForCurrentTimeIfChanged): 37 (WebKit::RemoteMediaPlayerProxy::pixelBufferForCurrentTime): Deleted. 38 * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: 39 * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm: 40 (WebKit::MediaPlayerPrivateRemote::pixelBufferForCurrentTime): 41 42 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@284102 268f45cc-cd09-0410-ab3c-d52691b4dbfc 43 44 2021-10-13 Kimmo Kinnunen <kkinnunen@apple.com> 45 46 WebGL video texture upload is very slow due to excessive transfer of the video pixel buffer 47 https://bugs.webkit.org/show_bug.cgi?id=231425 48 49 Reviewed by Youenn Fablet. 50 51 Typical WebGL content requests the videos to be uploaded to a texture 52 once per render loop update, even though the video has not changed. 53 The video pixel buffer is slow to transfer across IPC. It should be transferred 54 only when it has changed. 55 56 MediaPlayerPrivateAVFoundationObjC and MediaPlayerPrivateMediaSourceAVFObjC hold 57 the last requested pixel buffer ref. They will update it or discard it only 58 when pixelBufferForCurrentTime() is called. 59 60 Cache the pixel buffer to MediaPlayerPrivateRemote (GPUP side proxy) 61 Cache the pixel buffer to RemoteMediaPlayerProxy (WebP side proxy) 62 63 The caches increase the total memory use only during the duration 64 of the call, since after the ref has been updated, it refers 65 to the one always held in the original objects (MediaPlayerPrivateAVFoundationObjC 66 and MediaPlayerPrivateMediaSourceAVFObjC) 67 68 No new tests, fixes a perf regression wrt GPUP media. 69 70 * GPUProcess/media/RemoteMediaPlayerProxy.cpp: 71 (WebKit::RemoteMediaPlayerProxy::invalidate): 72 * GPUProcess/media/RemoteMediaPlayerProxy.h: 73 * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: 74 * GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm: 75 (WebKit::RemoteMediaPlayerProxy::nativeImageForCurrentTime): 76 (WebKit::RemoteMediaPlayerProxy::pixelBufferForCurrentTimeIfChanged): 77 (WebKit::RemoteMediaPlayerProxy::pixelBufferForCurrentTime): Deleted. 78 * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: 79 * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm: 80 (WebKit::MediaPlayerPrivateRemote::pixelBufferForCurrentTime): 81 1 82 2021-10-25 Null <null@apple.com> 2 83 -
branches/safari-612-branch/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp
r282945 r284834 105 105 } 106 106 m_renderingResourcesRequest = { }; 107 #if USE(AVFOUNDATION) 108 m_pixelBufferForCurrentTime = nullptr; 109 #endif 107 110 } 108 111 -
branches/safari-612-branch/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h
r281227 r284834 312 312 #endif 313 313 #if USE(AVFOUNDATION) 314 void pixelBufferForCurrentTime (CompletionHandler<void(RetainPtr<CVPixelBufferRef>&&)>&&);314 void pixelBufferForCurrentTimeIfChanged(CompletionHandler<void(std::optional<RetainPtr<CVPixelBufferRef>>&&)>&&); 315 315 #endif 316 316 … … 367 367 368 368 bool m_observingTimeChanges { false }; 369 369 #if USE(AVFOUNDATION) 370 RetainPtr<CVPixelBufferRef> m_pixelBufferForCurrentTime; 371 #endif 370 372 #if !RELEASE_LOG_DISABLED 371 373 const Logger& m_logger; -
branches/safari-612-branch/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in
r281227 r284834 127 127 #endif 128 128 #if USE(AVFOUNDATION) 129 PixelBufferForCurrentTime () -> (RetainPtr<CVPixelBufferRef> pixelBuffer) Synchronous129 PixelBufferForCurrentTimeIfChanged() -> (std::optional<RetainPtr<CVPixelBufferRef>> pixelBuffer) Synchronous 130 130 #endif 131 131 -
branches/safari-612-branch/Source/WebKit/GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm
r280776 r284834 112 112 } 113 113 114 void RemoteMediaPlayerProxy::pixelBufferForCurrentTime(CompletionHandler<void(RetainPtr<CVPixelBufferRef>&&)>&& completionHandler) 114 #if USE(AVFOUNDATION) 115 void RemoteMediaPlayerProxy::pixelBufferForCurrentTimeIfChanged(CompletionHandler<void(std::optional<RetainPtr<CVPixelBufferRef>>&&)>&& completionHandler) 115 116 { 116 RetainPtr<CVPixelBufferRef> result; 117 std::optional<RetainPtr<CVPixelBufferRef>> result; 118 RetainPtr<CVPixelBufferRef> pixelBuffer; 117 119 if (m_player) 118 result = m_player->pixelBufferForCurrentTime(); 120 pixelBuffer = m_player->pixelBufferForCurrentTime(); 121 if (m_pixelBufferForCurrentTime != pixelBuffer) { 122 result = pixelBuffer; 123 m_pixelBufferForCurrentTime = WTFMove(pixelBuffer); 124 } 119 125 completionHandler(WTFMove(result)); 120 126 } 127 #endif 121 128 122 129 } // namespace WebKit -
branches/safari-612-branch/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h
r282945 r284834 446 446 bool m_timeIsProgressing { false }; 447 447 bool m_renderingCanBeAccelerated { false }; 448 #if USE(AVFOUNDATION) 449 RetainPtr<CVPixelBufferRef> m_pixelBufferForCurrentTime; 450 #endif 448 451 }; 449 452 -
branches/safari-612-branch/Source/WebKit/WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm
r281157 r284834 67 67 } 68 68 69 #if USE(AVFOUNDATION) 69 70 RetainPtr<CVPixelBufferRef> MediaPlayerPrivateRemote::pixelBufferForCurrentTime() 70 71 { 71 72 RetainPtr<CVPixelBufferRef> result; 73 if (!connection().sendSync(Messages::RemoteMediaPlayerProxy::PixelBufferForCurrentTime(), Messages::RemoteMediaPlayerProxy::PixelBufferForCurrentTime::Reply(result), m_id)) 72 std::optional<RetainPtr<CVPixelBufferRef>> result; 73 if (!connection().sendSync(Messages::RemoteMediaPlayerProxy::PixelBufferForCurrentTimeIfChanged(), Messages::RemoteMediaPlayerProxy::PixelBufferForCurrentTimeIfChanged::Reply(result), m_id)) 74 74 return nullptr; 75 return result; 75 if (result) 76 m_pixelBufferForCurrentTime = WTFMove(*result); 77 return m_pixelBufferForCurrentTime; 76 78 } 79 #endif 77 80 78 81 } // namespace WebKit
Note:
See TracChangeset
for help on using the changeset viewer.