Diff
Modified: trunk/Source/WebCore/ChangeLog (285989 => 285990)
--- trunk/Source/WebCore/ChangeLog 2021-11-18 09:41:56 UTC (rev 285989)
+++ trunk/Source/WebCore/ChangeLog 2021-11-18 09:49:45 UTC (rev 285990)
@@ -1,3 +1,36 @@
+2021-11-18 Kimmo Kinnunen <[email protected]>
+
+ RemoteGraphicsContextGLProxyBase should not have platform-specific implementations
+ https://bugs.webkit.org/show_bug.cgi?id=233175
+
+ Reviewed by Antti Koivisto.
+
+ Move platform-specific code from RemoteGraphicsContextGLProxyBase to
+ WebKit::RemoteGraphicsContextGLProxyCocoa and WebKit::RemoteGraphicsContextGLProxyWC.
+ The platform-specific code is trivial and anyway used by the WebKit side concrete classes.
+
+ No new tests, refactor.
+
+ * PlatformWinCairo.cmake:
+ * SourcesCocoa.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/graphics/RemoteGraphicsContextGLProxyBase.cpp:
+ (WebCore::RemoteGraphicsContextGLProxyBase::RemoteGraphicsContextGLProxyBase):
+ (WebCore::RemoteGraphicsContextGLProxyBase::platformInitialize): Deleted.
+ (WebCore::RemoteGraphicsContextGLProxyBase::platformLayer const): Deleted.
+ (WebCore::RemoteGraphicsContextGLProxyBase::paintCompositedResultsToMediaSample): Deleted.
+ * platform/graphics/RemoteGraphicsContextGLProxyBase.h:
+ * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h:
+ * platform/graphics/cocoa/RemoteGraphicsContextGLProxyBaseCocoa.mm: Removed.
+ (WebCore::RemoteGraphicsContextGLProxyBase::platformInitialize): Deleted.
+ (WebCore::RemoteGraphicsContextGLProxyBase::platformLayer const): Deleted.
+ (WebCore::RemoteGraphicsContextGLProxyBase::asCV): Deleted.
+ (WebCore::RemoteGraphicsContextGLProxyBase::paintCompositedResultsToMediaSample): Deleted.
+ * platform/graphics/wc/RemoteGraphicsContextGLProxyBaseWC.cpp: Removed.
+ (WebCore::RemoteGraphicsContextGLProxyBase::platformInitialize): Deleted.
+ (WebCore::RemoteGraphicsContextGLProxyBase::platformLayer const): Deleted.
+ (WebCore::RemoteGraphicsContextGLProxyBase::setPlatformLayer): Deleted.
+
2021-11-18 Ziran Sun <[email protected]>
[css-grid] Transfer size for grid item with an aspect-ratio and stretch alignment against the definite row
Modified: trunk/Source/WebCore/PlatformWinCairo.cmake (285989 => 285990)
--- trunk/Source/WebCore/PlatformWinCairo.cmake 2021-11-18 09:41:56 UTC (rev 285989)
+++ trunk/Source/WebCore/PlatformWinCairo.cmake 2021-11-18 09:49:45 UTC (rev 285990)
@@ -25,8 +25,6 @@
platform/graphics/harfbuzz/DrawGlyphsRecorderHarfBuzz.cpp
- platform/graphics/wc/RemoteGraphicsContextGLProxyBaseWC.cpp
-
platform/graphics/win/FontCustomPlatformDataCairo.cpp
platform/graphics/win/FontPlatformDataCairoWin.cpp
platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp
Modified: trunk/Source/WebCore/SourcesCocoa.txt (285989 => 285990)
--- trunk/Source/WebCore/SourcesCocoa.txt 2021-11-18 09:41:56 UTC (rev 285989)
+++ trunk/Source/WebCore/SourcesCocoa.txt 2021-11-18 09:49:45 UTC (rev 285990)
@@ -382,7 +382,6 @@
platform/graphics/cocoa/IntRectCocoa.mm
platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp
platform/graphics/cocoa/MediaPlaybackTargetContext.mm
-platform/graphics/cocoa/RemoteGraphicsContextGLProxyBaseCocoa.mm
platform/graphics/cocoa/SourceBufferParser.cpp
platform/graphics/cocoa/SourceBufferParserWebM.cpp
platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (285989 => 285990)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-11-18 09:41:56 UTC (rev 285989)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-11-18 09:49:45 UTC (rev 285990)
@@ -11031,7 +11031,6 @@
7B10339C2549720100C8C1AC /* GraphicsContextGLCVANGLE.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GraphicsContextGLCVANGLE.h; sourceTree = "<group>"; };
7B10339D2549720100C8C1AC /* GraphicsContextGLCV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GraphicsContextGLCV.h; sourceTree = "<group>"; };
7B1619102719880E00C40EAC /* WebProcessGraphicsContextGLOpenGLCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessGraphicsContextGLOpenGLCocoa.mm; sourceTree = "<group>"; };
- 7B64C0B4254C3B160006B4AF /* RemoteGraphicsContextGLProxyBaseCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteGraphicsContextGLProxyBaseCocoa.mm; sourceTree = "<group>"; };
7B6DC81525712E9100380C70 /* GraphicsContextGLIOSurfaceSwapChain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContextGLIOSurfaceSwapChain.cpp; sourceTree = "<group>"; };
7B6DC81725712E9200380C70 /* GraphicsContextGLIOSurfaceSwapChain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContextGLIOSurfaceSwapChain.h; sourceTree = "<group>"; };
7B7311FA25C092B7003B2796 /* ScopedHighPerformanceGPURequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScopedHighPerformanceGPURequest.h; sourceTree = "<group>"; };
@@ -28235,7 +28234,6 @@
1D008AA5262108C000EE3ADE /* MediaPlaybackTargetContext.mm */,
31647FA8251616BD0010F8FB /* OpenGLSoftLinkCocoa.h */,
31647FA9251616BD0010F8FB /* OpenGLSoftLinkCocoa.mm */,
- 7B64C0B4254C3B160006B4AF /* RemoteGraphicsContextGLProxyBaseCocoa.mm */,
CDEB3D7224C41A6E001FBEEF /* SourceBufferParser.cpp */,
CDEB3D7324C41A6E001FBEEF /* SourceBufferParser.h */,
CD8F667024C0F208000C421C /* SourceBufferParserWebM.cpp */,
Modified: trunk/Source/WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.cpp (285989 => 285990)
--- trunk/Source/WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.cpp 2021-11-18 09:41:56 UTC (rev 285989)
+++ trunk/Source/WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.cpp 2021-11-18 09:49:45 UTC (rev 285990)
@@ -42,7 +42,6 @@
RemoteGraphicsContextGLProxyBase::RemoteGraphicsContextGLProxyBase(const GraphicsContextGLAttributes& attrs)
: GraphicsContextGL(attrs)
{
- platformInitialize();
}
RemoteGraphicsContextGLProxyBase::~RemoteGraphicsContextGLProxyBase() = default;
@@ -134,16 +133,6 @@
m_requestableExtensions.add(extension);
}
-#if !PLATFORM(COCOA) && !USE(GRAPHICS_LAYER_WC)
-void RemoteGraphicsContextGLProxyBase::platformInitialize()
-{
-}
-
-PlatformLayer* RemoteGraphicsContextGLProxyBase::platformLayer() const
-{
- return nullptr;
-}
-#endif
#if !USE(ANGLE)
void RemoteGraphicsContextGLProxyBase::readnPixelsEXT(GCGLint, GCGLint, GCGLsizei, GCGLsizei, GCGLenum, GCGLenum, GCGLsizei, GCGLvoid*)
{
@@ -159,10 +148,6 @@
#endif
#if ENABLE(MEDIA_STREAM) && !PLATFORM(COCOA)
-RefPtr<MediaSample> RemoteGraphicsContextGLProxyBase::paintCompositedResultsToMediaSample()
-{
- return nullptr;
-}
#endif
}
#endif
Modified: trunk/Source/WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.h (285989 => 285990)
--- trunk/Source/WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.h 2021-11-18 09:41:56 UTC (rev 285989)
+++ trunk/Source/WebCore/platform/graphics/RemoteGraphicsContextGLProxyBase.h 2021-11-18 09:49:45 UTC (rev 285990)
@@ -33,21 +33,8 @@
#include <wtf/HashSet.h>
#include <wtf/text/StringHash.h>
-#if PLATFORM(COCOA)
-#include <wtf/RetainPtr.h>
-#endif
-
-#if PLATFORM(COCOA)
-OBJC_CLASS WebGLLayer;
-#endif
-
namespace WebCore {
-#if PLATFORM(COCOA)
-class GraphicsContextGLIOSurfaceSwapChain;
-class IOSurface;
-#endif
-
// A base class for RemoteGraphicsContextGL proxy side implementation
// This implements the parts that are using WebCore internal functionality:
// - Drawing buffer tracking management.
@@ -59,7 +46,6 @@
// Other WebCore::GraphicsContextGL overrides.
using GraphicsContextGL::isEnabled;
- PlatformLayer* platformLayer() const final;
ExtensionsGL& getExtensions() final;
void setContextVisibility(bool) final;
bool isGLES2Compliant() const final;
@@ -69,9 +55,6 @@
GCGLbitfield getBuffersToAutoClear() const final;
void markLayerComposited() final;
-#if ENABLE(VIDEO) && USE(AVFOUNDATION)
- GraphicsContextGLCV* asCV() final;
-#endif
// Other ExtensionGL overrides.
using ExtensionsGL::isEnabled;
bool supports(const String&) final;
@@ -83,9 +66,6 @@
void getnUniformfvEXT(GCGLuint, GCGLint, GCGLsizei, GCGLfloat*) final;
void getnUniformivEXT(GCGLuint, GCGLint, GCGLsizei, GCGLint*) final;
#endif
-#if ENABLE(MEDIA_STREAM)
- RefPtr<MediaSample> paintCompositedResultsToMediaSample() final;
-#endif
protected:
void initialize(const String& availableExtensions, const String& requestableExtensions);
@@ -93,16 +73,7 @@
virtual void ensureExtensionEnabled(const String&) = 0;
virtual void notifyMarkContextChanged() = 0;
-#if PLATFORM(COCOA)
- RetainPtr<WebGLLayer> m_webGLLayer;
- std::unique_ptr<IOSurface> m_displayBuffer;
-#elif USE(GRAPHICS_LAYER_WC)
- void setPlatformLayer(PlatformLayerContainer&&);
- PlatformLayerContainer m_platformLayer;
-#endif
private:
- void platformInitialize();
-
// Guarded by waitUntilInitialized().
HashSet<String> m_availableExtensions;
HashSet<String> m_requestableExtensions;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h (285989 => 285990)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h 2021-11-18 09:41:56 UTC (rev 285989)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h 2021-11-18 09:49:45 UTC (rev 285990)
@@ -42,7 +42,7 @@
static Ref<MediaSampleAVFObjC> create(CMSampleBufferRef sample, AtomString trackID) { return adoptRef(*new MediaSampleAVFObjC(sample, trackID)); }
static Ref<MediaSampleAVFObjC> create(CMSampleBufferRef sample, VideoRotation rotation = VideoRotation::None, bool mirrored = false) { return adoptRef(*new MediaSampleAVFObjC(sample, rotation, mirrored)); }
static RefPtr<MediaSampleAVFObjC> createImageSample(PixelBuffer&&);
- static RefPtr<MediaSampleAVFObjC> createImageSample(RetainPtr<CVPixelBufferRef>&&, VideoRotation, bool mirrored);
+ WEBCORE_EXPORT static RefPtr<MediaSampleAVFObjC> createImageSample(RetainPtr<CVPixelBufferRef>&&, VideoRotation, bool mirrored);
WEBCORE_EXPORT static void setAsDisplayImmediately(MediaSample&);
static RetainPtr<CMSampleBufferRef> cloneSampleBufferAndSetAsDisplayImmediately(CMSampleBufferRef);
Deleted: trunk/Source/WebCore/platform/graphics/cocoa/RemoteGraphicsContextGLProxyBaseCocoa.mm (285989 => 285990)
--- trunk/Source/WebCore/platform/graphics/cocoa/RemoteGraphicsContextGLProxyBaseCocoa.mm 2021-11-18 09:41:56 UTC (rev 285989)
+++ trunk/Source/WebCore/platform/graphics/cocoa/RemoteGraphicsContextGLProxyBaseCocoa.mm 2021-11-18 09:49:45 UTC (rev 285990)
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2020 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "config.h"
-#import "RemoteGraphicsContextGLProxyBase.h"
-
-#if ENABLE(GPU_PROCESS) && ENABLE(WEBGL) && PLATFORM(COCOA)
-
-#import "GraphicsContextGLIOSurfaceSwapChain.h"
-#import "WebGLLayer.h"
-#import <wtf/BlockObjCExceptions.h>
-
-#if ENABLE(MEDIA_STREAM)
-#import "CVUtilities.h"
-#import "MediaSampleAVFObjC.h"
-#endif
-
-namespace WebCore {
-
-void RemoteGraphicsContextGLProxyBase::platformInitialize()
-{
- auto attrs = contextAttributes();
- BEGIN_BLOCK_OBJC_EXCEPTIONS
- m_webGLLayer = adoptNS([[WebGLLayer alloc] initWithDevicePixelRatio:attrs.devicePixelRatio contentsOpaque:!attrs.alpha]);
-#ifndef NDEBUG
- [m_webGLLayer setName:@"WebGL Layer"];
-#endif
- END_BLOCK_OBJC_EXCEPTIONS
-}
-
-
-PlatformLayer* RemoteGraphicsContextGLProxyBase::platformLayer() const
-{
- return m_webGLLayer.get();
-}
-
-#if ENABLE(VIDEO) && USE(AVFOUNDATION)
-GraphicsContextGLCV* RemoteGraphicsContextGLProxyBase::asCV()
-{
- return nullptr;
-}
-#endif
-
-#if ENABLE(MEDIA_STREAM)
-RefPtr<MediaSample> RemoteGraphicsContextGLProxyBase::paintCompositedResultsToMediaSample()
-{
- if (!m_displayBuffer)
- return nullptr;
- auto pixelBuffer = createCVPixelBuffer(m_displayBuffer->surface());
- if (!pixelBuffer)
- return nullptr;
- return MediaSampleAVFObjC::createImageSample(WTFMove(*pixelBuffer), MediaSampleAVFObjC::VideoRotation::UpsideDown, true);
-}
-#endif
-
-}
-#endif
Modified: trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.h (285989 => 285990)
--- trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.h 2021-11-18 09:41:56 UTC (rev 285989)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.h 2021-11-18 09:49:45 UTC (rev 285990)
@@ -28,7 +28,7 @@
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
// A layer class showing one IOSurface.
-@interface WebGLLayer : CALayer
+WEBCORE_EXPORT @interface WebGLLayer : CALayer
- (id)initWithDevicePixelRatio:(float)devicePixelRatio contentsOpaque:(bool)contentsOpaque;
Deleted: trunk/Source/WebCore/platform/graphics/wc/RemoteGraphicsContextGLProxyBaseWC.cpp (285989 => 285990)
--- trunk/Source/WebCore/platform/graphics/wc/RemoteGraphicsContextGLProxyBaseWC.cpp 2021-11-18 09:41:56 UTC (rev 285989)
+++ trunk/Source/WebCore/platform/graphics/wc/RemoteGraphicsContextGLProxyBaseWC.cpp 2021-11-18 09:49:45 UTC (rev 285990)
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2021 Sony Interactive Entertainment Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "RemoteGraphicsContextGLProxyBase.h"
-
-#if ENABLE(GPU_PROCESS) && ENABLE(WEBGL) && USE(GRAPHICS_LAYER_WC)
-
-#include "TextureMapperPlatformLayer.h"
-
-namespace WebCore {
-
-void RemoteGraphicsContextGLProxyBase::platformInitialize()
-{
-}
-
-PlatformLayer* RemoteGraphicsContextGLProxyBase::platformLayer() const
-{
- return m_platformLayer.get();
-}
-
-void RemoteGraphicsContextGLProxyBase::setPlatformLayer(PlatformLayerContainer&& platformLayer)
-{
- m_platformLayer = WTFMove(platformLayer);
-}
-
-} // namespace WebCore
-
-#endif
Modified: trunk/Source/WebKit/ChangeLog (285989 => 285990)
--- trunk/Source/WebKit/ChangeLog 2021-11-18 09:41:56 UTC (rev 285989)
+++ trunk/Source/WebKit/ChangeLog 2021-11-18 09:49:45 UTC (rev 285990)
@@ -1,3 +1,26 @@
+2021-11-18 Kimmo Kinnunen <[email protected]>
+
+ RemoteGraphicsContextGLProxyBase should not have platform-specific implementations
+ https://bugs.webkit.org/show_bug.cgi?id=233175
+
+ Reviewed by Antti Koivisto.
+
+ Move platform-specific code from RemoteGraphicsContextGLProxyBase to
+ WebKit::RemoteGraphicsContextGLProxyCocoa and WebKit::RemoteGraphicsContextGLProxyWC.
+ The platform-specific code is trivial and anyway used by the WebKit side concrete classes.
+
+ * PlatformWin.cmake:
+ * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
+ (WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy):
+ (WebKit::RemoteGraphicsContextGLProxy::create): Deleted.
+ (WebKit::RemoteGraphicsContextGLProxy::prepareForDisplay): Deleted.
+ * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
+ * WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm:
+ (WebKit::RemoteGraphicsContextGLProxy::create):
+ (WebKit::RemoteGraphicsContextGLProxy::prepareForDisplay): Deleted.
+ * WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp: Added.
+ (WebKit::RemoteGraphicsContextGLProxy::create):
+
2021-11-18 Antoine Quint <[email protected]>
[Model] [macOS] Add support for interaction on macOS
Modified: trunk/Source/WebKit/PlatformWin.cmake (285989 => 285990)
--- trunk/Source/WebKit/PlatformWin.cmake 2021-11-18 09:41:56 UTC (rev 285989)
+++ trunk/Source/WebKit/PlatformWin.cmake 2021-11-18 09:49:45 UTC (rev 285990)
@@ -82,6 +82,7 @@
UIProcess/win/WebProcessPoolWin.cpp
UIProcess/win/WebView.cpp
+ WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp
WebProcess/GPU/graphics/wc/RemoteWCLayerTreeHostProxy.cpp
WebProcess/GPU/media/win/VideoLayerRemoteWin.cpp
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp (285989 => 285990)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp 2021-11-18 09:41:56 UTC (rev 285989)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp 2021-11-18 09:49:45 UTC (rev 285990)
@@ -35,24 +35,10 @@
#include "WebProcess.h"
#include <WebCore/ImageBuffer.h>
-#if PLATFORM(COCOA)
-#include <WebCore/GraphicsContextCG.h>
-#include <WebCore/GraphicsContextGLIOSurfaceSwapChain.h>
-#endif
-
-#if USE(GRAPHICS_LAYER_WC)
-#include "WCPlatformLayerGCGL.h"
-#endif
-
namespace WebKit {
using namespace WebCore;
-RefPtr<RemoteGraphicsContextGLProxy> RemoteGraphicsContextGLProxy::create(const GraphicsContextGLAttributes& attributes, RenderingBackendIdentifier renderingBackend)
-{
- return adoptRef(new RemoteGraphicsContextGLProxy(WebProcess::singleton().ensureGPUProcessConnection(), attributes, renderingBackend));
-}
-
static constexpr size_t defaultStreamSize = 1 << 21;
RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy(GPUProcessConnection& gpuProcessConnection, const GraphicsContextGLAttributes& attributes, RenderingBackendIdentifier renderingBackend)
@@ -66,9 +52,6 @@
// TODO: We must wait until initialized, because at the moment we cannot receive IPC messages
// during wait while in synchronous stream send. Should be fixed as part of https://bugs.webkit.org/show_bug.cgi?id=217211.
waitUntilInitialized();
-#if USE(GRAPHICS_LAYER_WC)
- setPlatformLayer(makeUnique<WCPlatformLayerGCGL>(m_graphicsContextGLIdentifier));
-#endif
}
RemoteGraphicsContextGLProxy::~RemoteGraphicsContextGLProxy()
@@ -87,20 +70,6 @@
markContextLost();
}
-#if !PLATFORM(COCOA)
-void RemoteGraphicsContextGLProxy::prepareForDisplay()
-{
- if (isContextLost())
- return;
- auto sendResult = sendSync(Messages::RemoteGraphicsContextGL::PrepareForDisplay(), Messages::RemoteGraphicsContextGL::PrepareForDisplay::Reply());
- if (!sendResult) {
- markContextLost();
- return;
- }
- markLayerComposited();
-}
-#endif
-
void RemoteGraphicsContextGLProxy::ensureExtensionEnabled(const String& extension)
{
if (isContextLost())
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h (285989 => 285990)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h 2021-11-18 09:41:56 UTC (rev 285989)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h 2021-11-18 09:49:45 UTC (rev 285990)
@@ -47,13 +47,13 @@
// converts the interface to a sequence of IPC messages and sends the messages to
// RemoteGraphicsContextGL in GPU process.
// The implementation is largely generated by running Tools/Scripts/generate-gpup-webgl.
-class RemoteGraphicsContextGLProxy final
+class RemoteGraphicsContextGLProxy
: private IPC::MessageReceiver
, private GPUProcessConnection::Client
, public WebCore::RemoteGraphicsContextGLProxyBase {
public:
static RefPtr<RemoteGraphicsContextGLProxy> create(const WebCore::GraphicsContextGLAttributes&, RenderingBackendIdentifier);
- ~RemoteGraphicsContextGLProxy() final;
+ ~RemoteGraphicsContextGLProxy();
// IPC::MessageReceiver overrides.
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
@@ -60,7 +60,6 @@
// RemoteGraphicsContextGLProxyBase overrides.
void reshape(int width, int height) final;
- void prepareForDisplay() final;
using WebCore::RemoteGraphicsContextGLProxyBase::isEnabled;
void ensureExtensionEnabled(const String& extension) final;
void notifyMarkContextChanged() final;
@@ -319,6 +318,8 @@
// End of list used by generate-gpup-webgl script.
protected:
+ RemoteGraphicsContextGLProxy(GPUProcessConnection&, const WebCore::GraphicsContextGLAttributes&, RenderingBackendIdentifier);
+
// RemoteGraphicsContextGLProxyBase overrides.
void waitUntilInitialized() final;
@@ -338,6 +339,7 @@
}
IPC::Connection& connection() const { return m_gpuProcessConnection->connection(); }
+ GraphicsContextGLIdentifier m_graphicsContextGLIdentifier { GraphicsContextGLIdentifier::generate() };
private:
// Messages to be received.
void wasCreated(bool didSucceed, IPC::Semaphore&&, String&& availableExtensions, String&& requestedExtensions);
@@ -350,11 +352,9 @@
void disconnectGpuProcessIfNeeded();
void abandonGpuProcess();
- RemoteGraphicsContextGLProxy(GPUProcessConnection&, const WebCore::GraphicsContextGLAttributes&, RenderingBackendIdentifier);
GPUProcessConnection* m_gpuProcessConnection;
bool m_didInitialize { false };
GCGLenum m_errorWhenContextIsLost = NO_ERROR;
- GraphicsContextGLIdentifier m_graphicsContextGLIdentifier { GraphicsContextGLIdentifier::generate() };
IPC::StreamClientConnection m_streamConnection;
};
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm (285989 => 285990)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm 2021-11-18 09:41:56 UTC (rev 285989)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm 2021-11-18 09:49:45 UTC (rev 285990)
@@ -27,16 +27,69 @@
#import "RemoteGraphicsContextGLProxy.h"
#if ENABLE(GPU_PROCESS) && ENABLE(WEBGL)
+#import "GPUConnectionToWebProcess.h"
+#import "GPUProcessConnection.h"
#import "RemoteGraphicsContextGLMessages.h"
+#import "WebProcess.h"
+#import <WebCore/CVUtilities.h>
+#import <WebCore/GraphicsContextCG.h>
+#import <WebCore/GraphicsContextGLIOSurfaceSwapChain.h>
#import <WebCore/IOSurface.h>
+#import <WebCore/MediaSampleAVFObjC.h>
#import <WebCore/WebGLLayer.h>
#import <wtf/BlockObjCExceptions.h>
namespace WebKit {
-using namespace WebCore;
-void RemoteGraphicsContextGLProxy::prepareForDisplay()
+namespace {
+
+class RemoteGraphicsContextGLProxyCocoa final : public RemoteGraphicsContextGLProxy {
+public:
+ bool isValid() const { return m_webGLLayer; }
+ WebCore::IOSurface* displayBuffer() const { return m_displayBuffer.get(); }
+
+ // RemoteGraphicsContextGLProxy overrides.
+ PlatformLayer* platformLayer() const final { return m_webGLLayer.get(); }
+ void prepareForDisplay() final;
+#if ENABLE(VIDEO) && USE(AVFOUNDATION)
+ WebCore::GraphicsContextGLCV* asCV() final { return nullptr; }
+#endif
+#if ENABLE(MEDIA_STREAM)
+ RefPtr<WebCore::MediaSample> paintCompositedResultsToMediaSample() final;
+#endif
+private:
+ RemoteGraphicsContextGLProxyCocoa(GPUProcessConnection&, const WebCore::GraphicsContextGLAttributes&, RenderingBackendIdentifier);
+ RetainPtr<WebGLLayer> m_webGLLayer;
+ std::unique_ptr<WebCore::IOSurface> m_displayBuffer;
+ friend class RemoteGraphicsContextGLProxy;
+};
+
+RemoteGraphicsContextGLProxyCocoa::RemoteGraphicsContextGLProxyCocoa(GPUProcessConnection& gpuProcessConnection, const WebCore::GraphicsContextGLAttributes& attributes, RenderingBackendIdentifier renderingBackend)
+ : RemoteGraphicsContextGLProxy(gpuProcessConnection, attributes, renderingBackend)
{
+ auto attrs = contextAttributes();
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
+ m_webGLLayer = adoptNS([[WebGLLayer alloc] initWithDevicePixelRatio:attrs.devicePixelRatio contentsOpaque:!attrs.alpha]);
+#ifndef NDEBUG
+ [m_webGLLayer setName:@"WebGL Layer"];
+#endif
+ END_BLOCK_OBJC_EXCEPTIONS
+}
+
+#if ENABLE(MEDIA_STREAM)
+RefPtr<WebCore::MediaSample> RemoteGraphicsContextGLProxyCocoa::paintCompositedResultsToMediaSample()
+{
+ if (!m_displayBuffer)
+ return nullptr;
+ auto pixelBuffer = WebCore::createCVPixelBuffer(m_displayBuffer->surface());
+ if (!pixelBuffer)
+ return nullptr;
+ return WebCore::MediaSampleAVFObjC::createImageSample(WTFMove(*pixelBuffer), WebCore::MediaSampleAVFObjC::VideoRotation::UpsideDown, true);
+}
+#endif
+
+void RemoteGraphicsContextGLProxyCocoa::prepareForDisplay()
+{
if (isContextLost())
return;
MachSendRight displayBufferSendRight;
@@ -61,4 +114,14 @@
}
+RefPtr<RemoteGraphicsContextGLProxy> RemoteGraphicsContextGLProxy::create(const WebCore::GraphicsContextGLAttributes& attributes, RenderingBackendIdentifier renderingBackend)
+{
+ auto context = adoptRef(new RemoteGraphicsContextGLProxyCocoa(WebProcess::singleton().ensureGPUProcessConnection(), attributes, renderingBackend));
+ if (!context->isValid())
+ return nullptr;
+ return context;
+}
+
+}
+
#endif
Added: trunk/Source/WebKit/WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp (0 => 285990)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp (rev 0)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp 2021-11-18 09:49:45 UTC (rev 285990)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2021 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RemoteGraphicsContextGLProxy.h"
+
+#if ENABLE(GPU_PROCESS) && ENABLE(WEBGL) && USE(GRAPHICS_LAYER_WC)
+
+#include "GPUConnectionToWebProcess.h"
+#include "GPUProcessConnection.h"
+#include "RemoteGraphicsContextGLMessages.h"
+#include "WCPlatformLayerGCGL.h"
+#include "WebProcess.h"
+#include <WebCore/TextureMapperPlatformLayer.h>
+
+namespace WebKit {
+
+namespace {
+
+class RemoteGraphicsContextGLProxyWC final : public RemoteGraphicsContextGLProxy {
+public:
+ // RemoteGraphicsContextGLProxy overrides.
+ void prepareForDisplay() final;
+ PlatformLayer* platformLayer() const final { return m_platformLayer.get(); }
+#if ENABLE(MEDIA_STREAM)
+ RefPtr<WebCore::MediaSample> paintCompositedResultsToMediaSample() final { return nullptr; }
+#endif
+private:
+ RemoteGraphicsContextGLProxyWC(GPUProcessConnection&, const WebCore::GraphicsContextGLAttributes&, RenderingBackendIdentifier);
+
+ PlatformLayerContainer m_platformLayer;
+ friend class RemoteGraphicsContextGLProxy;
+};
+
+RemoteGraphicsContextGLProxyWC::RemoteGraphicsContextGLProxyWC(GPUProcessConnection& gpuProcessConnection, const WebCore::GraphicsContextGLAttributes& attributes, RenderingBackendIdentifier renderingBackend)
+ : RemoteGraphicsContextGLProxy(gpuProcessConnection, attributes, renderingBackend)
+ , m_platformLayer(makeUnique<WCPlatformLayerGCGL>(m_graphicsContextGLIdentifier))
+{
+}
+
+void RemoteGraphicsContextGLProxyWC::prepareForDisplay()
+{
+ if (isContextLost())
+ return;
+ auto sendResult = sendSync(Messages::RemoteGraphicsContextGL::PrepareForDisplay(), Messages::RemoteGraphicsContextGL::PrepareForDisplay::Reply());
+ if (!sendResult) {
+ markContextLost();
+ return;
+ }
+ markLayerComposited();
+}
+
+}
+
+RefPtr<RemoteGraphicsContextGLProxy> RemoteGraphicsContextGLProxy::create(const WebCore::GraphicsContextGLAttributes& attributes, RenderingBackendIdentifier renderingBackend)
+{
+ return adoptRef(new RemoteGraphicsContextGLProxyWC(WebProcess::singleton().ensureGPUProcessConnection(), attributes, renderingBackend));
+}
+
+}
+
+#endif