Changeset 285990 in webkit
- Timestamp:
- Nov 18, 2021, 1:49:45 AM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 2 deleted
- 13 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/PlatformWinCairo.cmake (modified) (1 diff)
-
WebCore/SourcesCocoa.txt (modified) (1 diff)
-
WebCore/WebCore.xcodeproj/project.pbxproj (modified) (2 diffs)
-
WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.cpp (modified) (3 diffs)
-
WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.h (modified) (5 diffs)
-
WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h (modified) (1 diff)
-
WebCore/platform/graphics/cocoa/RemoteGraphicsContextGLProxyBaseCocoa.mm (deleted)
-
WebCore/platform/graphics/cocoa/WebGLLayer.h (modified) (1 diff)
-
WebCore/platform/graphics/wc/RemoteGraphicsContextGLProxyBaseWC.cpp (deleted)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/PlatformWin.cmake (modified) (1 diff)
-
WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp (modified) (3 diffs)
-
WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h (modified) (6 diffs)
-
WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm (modified) (2 diffs)
-
WebKit/WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r285987 r285990 1 2021-11-18 Kimmo Kinnunen <kkinnunen@apple.com> 2 3 RemoteGraphicsContextGLProxyBase should not have platform-specific implementations 4 https://bugs.webkit.org/show_bug.cgi?id=233175 5 6 Reviewed by Antti Koivisto. 7 8 Move platform-specific code from RemoteGraphicsContextGLProxyBase to 9 WebKit::RemoteGraphicsContextGLProxyCocoa and WebKit::RemoteGraphicsContextGLProxyWC. 10 The platform-specific code is trivial and anyway used by the WebKit side concrete classes. 11 12 No new tests, refactor. 13 14 * PlatformWinCairo.cmake: 15 * SourcesCocoa.txt: 16 * WebCore.xcodeproj/project.pbxproj: 17 * platform/graphics/RemoteGraphicsContextGLProxyBase.cpp: 18 (WebCore::RemoteGraphicsContextGLProxyBase::RemoteGraphicsContextGLProxyBase): 19 (WebCore::RemoteGraphicsContextGLProxyBase::platformInitialize): Deleted. 20 (WebCore::RemoteGraphicsContextGLProxyBase::platformLayer const): Deleted. 21 (WebCore::RemoteGraphicsContextGLProxyBase::paintCompositedResultsToMediaSample): Deleted. 22 * platform/graphics/RemoteGraphicsContextGLProxyBase.h: 23 * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h: 24 * platform/graphics/cocoa/RemoteGraphicsContextGLProxyBaseCocoa.mm: Removed. 25 (WebCore::RemoteGraphicsContextGLProxyBase::platformInitialize): Deleted. 26 (WebCore::RemoteGraphicsContextGLProxyBase::platformLayer const): Deleted. 27 (WebCore::RemoteGraphicsContextGLProxyBase::asCV): Deleted. 28 (WebCore::RemoteGraphicsContextGLProxyBase::paintCompositedResultsToMediaSample): Deleted. 29 * platform/graphics/wc/RemoteGraphicsContextGLProxyBaseWC.cpp: Removed. 30 (WebCore::RemoteGraphicsContextGLProxyBase::platformInitialize): Deleted. 31 (WebCore::RemoteGraphicsContextGLProxyBase::platformLayer const): Deleted. 32 (WebCore::RemoteGraphicsContextGLProxyBase::setPlatformLayer): Deleted. 33 1 34 2021-11-18 Ziran Sun <zsun@igalia.com> 2 35 -
trunk/Source/WebCore/PlatformWinCairo.cmake
r285099 r285990 25 25 26 26 platform/graphics/harfbuzz/DrawGlyphsRecorderHarfBuzz.cpp 27 28 platform/graphics/wc/RemoteGraphicsContextGLProxyBaseWC.cpp29 27 30 28 platform/graphics/win/FontCustomPlatformDataCairo.cpp -
trunk/Source/WebCore/SourcesCocoa.txt
r285846 r285990 383 383 platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp 384 384 platform/graphics/cocoa/MediaPlaybackTargetContext.mm 385 platform/graphics/cocoa/RemoteGraphicsContextGLProxyBaseCocoa.mm386 385 platform/graphics/cocoa/SourceBufferParser.cpp 387 386 platform/graphics/cocoa/SourceBufferParserWebM.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r285984 r285990 11032 11032 7B10339D2549720100C8C1AC /* GraphicsContextGLCV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GraphicsContextGLCV.h; sourceTree = "<group>"; }; 11033 11033 7B1619102719880E00C40EAC /* WebProcessGraphicsContextGLOpenGLCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessGraphicsContextGLOpenGLCocoa.mm; sourceTree = "<group>"; }; 11034 7B64C0B4254C3B160006B4AF /* RemoteGraphicsContextGLProxyBaseCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteGraphicsContextGLProxyBaseCocoa.mm; sourceTree = "<group>"; };11035 11034 7B6DC81525712E9100380C70 /* GraphicsContextGLIOSurfaceSwapChain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContextGLIOSurfaceSwapChain.cpp; sourceTree = "<group>"; }; 11036 11035 7B6DC81725712E9200380C70 /* GraphicsContextGLIOSurfaceSwapChain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContextGLIOSurfaceSwapChain.h; sourceTree = "<group>"; }; … … 28236 28235 31647FA8251616BD0010F8FB /* OpenGLSoftLinkCocoa.h */, 28237 28236 31647FA9251616BD0010F8FB /* OpenGLSoftLinkCocoa.mm */, 28238 7B64C0B4254C3B160006B4AF /* RemoteGraphicsContextGLProxyBaseCocoa.mm */,28239 28237 CDEB3D7224C41A6E001FBEEF /* SourceBufferParser.cpp */, 28240 28238 CDEB3D7324C41A6E001FBEEF /* SourceBufferParser.h */, -
trunk/Source/WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.cpp
r285099 r285990 43 43 : GraphicsContextGL(attrs) 44 44 { 45 platformInitialize();46 45 } 47 46 … … 135 134 } 136 135 137 #if !PLATFORM(COCOA) && !USE(GRAPHICS_LAYER_WC)138 void RemoteGraphicsContextGLProxyBase::platformInitialize()139 {140 }141 142 PlatformLayer* RemoteGraphicsContextGLProxyBase::platformLayer() const143 {144 return nullptr;145 }146 #endif147 136 #if !USE(ANGLE) 148 137 void RemoteGraphicsContextGLProxyBase::readnPixelsEXT(GCGLint, GCGLint, GCGLsizei, GCGLsizei, GCGLenum, GCGLenum, GCGLsizei, GCGLvoid*) … … 160 149 161 150 #if ENABLE(MEDIA_STREAM) && !PLATFORM(COCOA) 162 RefPtr<MediaSample> RemoteGraphicsContextGLProxyBase::paintCompositedResultsToMediaSample()163 {164 return nullptr;165 }166 151 #endif 167 152 } -
trunk/Source/WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.h
r285099 r285990 34 34 #include <wtf/text/StringHash.h> 35 35 36 #if PLATFORM(COCOA)37 #include <wtf/RetainPtr.h>38 #endif39 40 #if PLATFORM(COCOA)41 OBJC_CLASS WebGLLayer;42 #endif43 44 36 namespace WebCore { 45 46 #if PLATFORM(COCOA)47 class GraphicsContextGLIOSurfaceSwapChain;48 class IOSurface;49 #endif50 37 51 38 // A base class for RemoteGraphicsContextGL proxy side implementation … … 60 47 // Other WebCore::GraphicsContextGL overrides. 61 48 using GraphicsContextGL::isEnabled; 62 PlatformLayer* platformLayer() const final;63 49 ExtensionsGL& getExtensions() final; 64 50 void setContextVisibility(bool) final; … … 70 56 void markLayerComposited() final; 71 57 72 #if ENABLE(VIDEO) && USE(AVFOUNDATION)73 GraphicsContextGLCV* asCV() final;74 #endif75 58 // Other ExtensionGL overrides. 76 59 using ExtensionsGL::isEnabled; … … 84 67 void getnUniformivEXT(GCGLuint, GCGLint, GCGLsizei, GCGLint*) final; 85 68 #endif 86 #if ENABLE(MEDIA_STREAM)87 RefPtr<MediaSample> paintCompositedResultsToMediaSample() final;88 #endif89 69 90 70 protected: … … 94 74 virtual void notifyMarkContextChanged() = 0; 95 75 96 #if PLATFORM(COCOA)97 RetainPtr<WebGLLayer> m_webGLLayer;98 std::unique_ptr<IOSurface> m_displayBuffer;99 #elif USE(GRAPHICS_LAYER_WC)100 void setPlatformLayer(PlatformLayerContainer&&);101 PlatformLayerContainer m_platformLayer;102 #endif103 76 private: 104 void platformInitialize();105 106 77 // Guarded by waitUntilInitialized(). 107 78 HashSet<String> m_availableExtensions; -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h
r283605 r285990 43 43 static Ref<MediaSampleAVFObjC> create(CMSampleBufferRef sample, VideoRotation rotation = VideoRotation::None, bool mirrored = false) { return adoptRef(*new MediaSampleAVFObjC(sample, rotation, mirrored)); } 44 44 static RefPtr<MediaSampleAVFObjC> createImageSample(PixelBuffer&&); 45 static RefPtr<MediaSampleAVFObjC> createImageSample(RetainPtr<CVPixelBufferRef>&&, VideoRotation, bool mirrored);45 WEBCORE_EXPORT static RefPtr<MediaSampleAVFObjC> createImageSample(RetainPtr<CVPixelBufferRef>&&, VideoRotation, bool mirrored); 46 46 47 47 WEBCORE_EXPORT static void setAsDisplayImmediately(MediaSample&); -
trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.h
r284371 r285990 29 29 30 30 // A layer class showing one IOSurface. 31 @interface WebGLLayer : CALayer31 WEBCORE_EXPORT @interface WebGLLayer : CALayer 32 32 33 33 - (id)initWithDevicePixelRatio:(float)devicePixelRatio contentsOpaque:(bool)contentsOpaque; -
trunk/Source/WebKit/ChangeLog
r285986 r285990 1 2021-11-18 Kimmo Kinnunen <kkinnunen@apple.com> 2 3 RemoteGraphicsContextGLProxyBase should not have platform-specific implementations 4 https://bugs.webkit.org/show_bug.cgi?id=233175 5 6 Reviewed by Antti Koivisto. 7 8 Move platform-specific code from RemoteGraphicsContextGLProxyBase to 9 WebKit::RemoteGraphicsContextGLProxyCocoa and WebKit::RemoteGraphicsContextGLProxyWC. 10 The platform-specific code is trivial and anyway used by the WebKit side concrete classes. 11 12 * PlatformWin.cmake: 13 * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp: 14 (WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy): 15 (WebKit::RemoteGraphicsContextGLProxy::create): Deleted. 16 (WebKit::RemoteGraphicsContextGLProxy::prepareForDisplay): Deleted. 17 * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h: 18 * WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm: 19 (WebKit::RemoteGraphicsContextGLProxy::create): 20 (WebKit::RemoteGraphicsContextGLProxy::prepareForDisplay): Deleted. 21 * WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp: Added. 22 (WebKit::RemoteGraphicsContextGLProxy::create): 23 1 24 2021-11-18 Antoine Quint <graouts@webkit.org> 2 25 -
trunk/Source/WebKit/PlatformWin.cmake
r285099 r285990 83 83 UIProcess/win/WebView.cpp 84 84 85 WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp 85 86 WebProcess/GPU/graphics/wc/RemoteWCLayerTreeHostProxy.cpp 86 87 -
trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp
r285099 r285990 36 36 #include <WebCore/ImageBuffer.h> 37 37 38 #if PLATFORM(COCOA)39 #include <WebCore/GraphicsContextCG.h>40 #include <WebCore/GraphicsContextGLIOSurfaceSwapChain.h>41 #endif42 43 #if USE(GRAPHICS_LAYER_WC)44 #include "WCPlatformLayerGCGL.h"45 #endif46 47 38 namespace WebKit { 48 39 49 40 using namespace WebCore; 50 51 RefPtr<RemoteGraphicsContextGLProxy> RemoteGraphicsContextGLProxy::create(const GraphicsContextGLAttributes& attributes, RenderingBackendIdentifier renderingBackend)52 {53 return adoptRef(new RemoteGraphicsContextGLProxy(WebProcess::singleton().ensureGPUProcessConnection(), attributes, renderingBackend));54 }55 41 56 42 static constexpr size_t defaultStreamSize = 1 << 21; … … 67 53 // during wait while in synchronous stream send. Should be fixed as part of https://bugs.webkit.org/show_bug.cgi?id=217211. 68 54 waitUntilInitialized(); 69 #if USE(GRAPHICS_LAYER_WC)70 setPlatformLayer(makeUnique<WCPlatformLayerGCGL>(m_graphicsContextGLIdentifier));71 #endif72 55 } 73 56 … … 87 70 markContextLost(); 88 71 } 89 90 #if !PLATFORM(COCOA)91 void RemoteGraphicsContextGLProxy::prepareForDisplay()92 {93 if (isContextLost())94 return;95 auto sendResult = sendSync(Messages::RemoteGraphicsContextGL::PrepareForDisplay(), Messages::RemoteGraphicsContextGL::PrepareForDisplay::Reply());96 if (!sendResult) {97 markContextLost();98 return;99 }100 markLayerComposited();101 }102 #endif103 72 104 73 void RemoteGraphicsContextGLProxy::ensureExtensionEnabled(const String& extension) -
trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h
r278253 r285990 48 48 // RemoteGraphicsContextGL in GPU process. 49 49 // The implementation is largely generated by running Tools/Scripts/generate-gpup-webgl. 50 class RemoteGraphicsContextGLProxy final50 class RemoteGraphicsContextGLProxy 51 51 : private IPC::MessageReceiver 52 52 , private GPUProcessConnection::Client … … 54 54 public: 55 55 static RefPtr<RemoteGraphicsContextGLProxy> create(const WebCore::GraphicsContextGLAttributes&, RenderingBackendIdentifier); 56 ~RemoteGraphicsContextGLProxy() final;56 ~RemoteGraphicsContextGLProxy(); 57 57 58 58 // IPC::MessageReceiver overrides. … … 61 61 // RemoteGraphicsContextGLProxyBase overrides. 62 62 void reshape(int width, int height) final; 63 void prepareForDisplay() final;64 63 using WebCore::RemoteGraphicsContextGLProxyBase::isEnabled; 65 64 void ensureExtensionEnabled(const String& extension) final; … … 320 319 321 320 protected: 321 RemoteGraphicsContextGLProxy(GPUProcessConnection&, const WebCore::GraphicsContextGLAttributes&, RenderingBackendIdentifier); 322 322 323 // RemoteGraphicsContextGLProxyBase overrides. 323 324 void waitUntilInitialized() final; … … 339 340 IPC::Connection& connection() const { return m_gpuProcessConnection->connection(); } 340 341 342 GraphicsContextGLIdentifier m_graphicsContextGLIdentifier { GraphicsContextGLIdentifier::generate() }; 341 343 private: 342 344 // Messages to be received. … … 351 353 void abandonGpuProcess(); 352 354 353 RemoteGraphicsContextGLProxy(GPUProcessConnection&, const WebCore::GraphicsContextGLAttributes&, RenderingBackendIdentifier);354 355 GPUProcessConnection* m_gpuProcessConnection; 355 356 bool m_didInitialize { false }; 356 357 GCGLenum m_errorWhenContextIsLost = NO_ERROR; 357 GraphicsContextGLIdentifier m_graphicsContextGLIdentifier { GraphicsContextGLIdentifier::generate() };358 358 IPC::StreamClientConnection m_streamConnection; 359 359 }; -
trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm
r284371 r285990 28 28 29 29 #if ENABLE(GPU_PROCESS) && ENABLE(WEBGL) 30 #import "GPUConnectionToWebProcess.h" 31 #import "GPUProcessConnection.h" 30 32 #import "RemoteGraphicsContextGLMessages.h" 33 #import "WebProcess.h" 34 #import <WebCore/CVUtilities.h> 35 #import <WebCore/GraphicsContextCG.h> 36 #import <WebCore/GraphicsContextGLIOSurfaceSwapChain.h> 31 37 #import <WebCore/IOSurface.h> 38 #import <WebCore/MediaSampleAVFObjC.h> 32 39 #import <WebCore/WebGLLayer.h> 33 40 #import <wtf/BlockObjCExceptions.h> 34 41 35 42 namespace WebKit { 36 using namespace WebCore;37 43 38 void RemoteGraphicsContextGLProxy::prepareForDisplay() 44 namespace { 45 46 class RemoteGraphicsContextGLProxyCocoa final : public RemoteGraphicsContextGLProxy { 47 public: 48 bool isValid() const { return m_webGLLayer; } 49 WebCore::IOSurface* displayBuffer() const { return m_displayBuffer.get(); } 50 51 // RemoteGraphicsContextGLProxy overrides. 52 PlatformLayer* platformLayer() const final { return m_webGLLayer.get(); } 53 void prepareForDisplay() final; 54 #if ENABLE(VIDEO) && USE(AVFOUNDATION) 55 WebCore::GraphicsContextGLCV* asCV() final { return nullptr; } 56 #endif 57 #if ENABLE(MEDIA_STREAM) 58 RefPtr<WebCore::MediaSample> paintCompositedResultsToMediaSample() final; 59 #endif 60 private: 61 RemoteGraphicsContextGLProxyCocoa(GPUProcessConnection&, const WebCore::GraphicsContextGLAttributes&, RenderingBackendIdentifier); 62 RetainPtr<WebGLLayer> m_webGLLayer; 63 std::unique_ptr<WebCore::IOSurface> m_displayBuffer; 64 friend class RemoteGraphicsContextGLProxy; 65 }; 66 67 RemoteGraphicsContextGLProxyCocoa::RemoteGraphicsContextGLProxyCocoa(GPUProcessConnection& gpuProcessConnection, const WebCore::GraphicsContextGLAttributes& attributes, RenderingBackendIdentifier renderingBackend) 68 : RemoteGraphicsContextGLProxy(gpuProcessConnection, attributes, renderingBackend) 69 { 70 auto attrs = contextAttributes(); 71 BEGIN_BLOCK_OBJC_EXCEPTIONS 72 m_webGLLayer = adoptNS([[WebGLLayer alloc] initWithDevicePixelRatio:attrs.devicePixelRatio contentsOpaque:!attrs.alpha]); 73 #ifndef NDEBUG 74 [m_webGLLayer setName:@"WebGL Layer"]; 75 #endif 76 END_BLOCK_OBJC_EXCEPTIONS 77 } 78 79 #if ENABLE(MEDIA_STREAM) 80 RefPtr<WebCore::MediaSample> RemoteGraphicsContextGLProxyCocoa::paintCompositedResultsToMediaSample() 81 { 82 if (!m_displayBuffer) 83 return nullptr; 84 auto pixelBuffer = WebCore::createCVPixelBuffer(m_displayBuffer->surface()); 85 if (!pixelBuffer) 86 return nullptr; 87 return WebCore::MediaSampleAVFObjC::createImageSample(WTFMove(*pixelBuffer), WebCore::MediaSampleAVFObjC::VideoRotation::UpsideDown, true); 88 } 89 #endif 90 91 void RemoteGraphicsContextGLProxyCocoa::prepareForDisplay() 39 92 { 40 93 if (isContextLost()) … … 62 115 } 63 116 117 RefPtr<RemoteGraphicsContextGLProxy> RemoteGraphicsContextGLProxy::create(const WebCore::GraphicsContextGLAttributes& attributes, RenderingBackendIdentifier renderingBackend) 118 { 119 auto context = adoptRef(new RemoteGraphicsContextGLProxyCocoa(WebProcess::singleton().ensureGPUProcessConnection(), attributes, renderingBackend)); 120 if (!context->isValid()) 121 return nullptr; 122 return context; 123 } 124 125 } 126 64 127 #endif
Note:
See TracChangeset
for help on using the changeset viewer.