- Revision
- 292035
- Author
- simon.fra...@apple.com
- Date
- 2022-03-29 10:05:11 -0700 (Tue, 29 Mar 2022)
Log Message
[iOS GPUProcess] Image decoding should not trigger IOSurface usage in the web process
https://bugs.webkit.org/show_bug.cgi?id=238489
<rdar://88717577>
Reviewed by Per Arne Vollan.
Source/WebCore:
When hardwareAcceleratedDecodingDisabled() has been called, turn off hardware acceleration
for image decoding.
* platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::createImageSourceOptions):
(WebCore::ImageDecoderCG::disableHardwareAcceleratedDecoding):
(WebCore::ImageDecoderCG::hardwareAcceleratedDecodingDisabled):
* platform/graphics/cg/ImageDecoderCG.h:
Source/WebCore/PAL:
Expose kCGImageSourceUseHardwareAcceleration.
* pal/spi/cg/ImageIOSPI.h:
Source/WebKit:
When useGPUProcessForDOMRendering is true, disable hardware image decoding since
we need to avoid IOSurface access in the web process.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::setUseGPUProcessForDOMRendering):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (292034 => 292035)
--- trunk/Source/WebCore/ChangeLog 2022-03-29 15:54:21 UTC (rev 292034)
+++ trunk/Source/WebCore/ChangeLog 2022-03-29 17:05:11 UTC (rev 292035)
@@ -1,3 +1,20 @@
+2022-03-28 Simon Fraser <simon.fra...@apple.com>
+
+ [iOS GPUProcess] Image decoding should not trigger IOSurface usage in the web process
+ https://bugs.webkit.org/show_bug.cgi?id=238489
+ <rdar://88717577>
+
+ Reviewed by Per Arne Vollan.
+
+ When hardwareAcceleratedDecodingDisabled() has been called, turn off hardware acceleration
+ for image decoding.
+
+ * platform/graphics/cg/ImageDecoderCG.cpp:
+ (WebCore::createImageSourceOptions):
+ (WebCore::ImageDecoderCG::disableHardwareAcceleratedDecoding):
+ (WebCore::ImageDecoderCG::hardwareAcceleratedDecodingDisabled):
+ * platform/graphics/cg/ImageDecoderCG.h:
+
2022-03-29 Brandon Stewart <brandonstew...@apple.com>
Check page exists before trying to access authenticatorCoordinator
Modified: trunk/Source/WebCore/PAL/ChangeLog (292034 => 292035)
--- trunk/Source/WebCore/PAL/ChangeLog 2022-03-29 15:54:21 UTC (rev 292034)
+++ trunk/Source/WebCore/PAL/ChangeLog 2022-03-29 17:05:11 UTC (rev 292035)
@@ -1,3 +1,15 @@
+2022-03-28 Simon Fraser <simon.fra...@apple.com>
+
+ [iOS GPUProcess] Image decoding should not trigger IOSurface usage in the web process
+ https://bugs.webkit.org/show_bug.cgi?id=238489
+ <rdar://88717577>
+
+ Reviewed by Per Arne Vollan.
+
+ Expose kCGImageSourceUseHardwareAcceleration.
+
+ * pal/spi/cg/ImageIOSPI.h:
+
2022-03-28 Chris Dumez <cdu...@apple.com>
Prepare WebCore for making the String(const char*) constructor explicit
Modified: trunk/Source/WebCore/PAL/pal/spi/cg/ImageIOSPI.h (292034 => 292035)
--- trunk/Source/WebCore/PAL/pal/spi/cg/ImageIOSPI.h 2022-03-29 15:54:21 UTC (rev 292034)
+++ trunk/Source/WebCore/PAL/pal/spi/cg/ImageIOSPI.h 2022-03-29 17:05:11 UTC (rev 292035)
@@ -36,6 +36,7 @@
IMAGEIO_EXTERN const CFStringRef kCGImageSourceSkipMetadata;
IMAGEIO_EXTERN const CFStringRef kCGImageSourceSubsampleFactor;
IMAGEIO_EXTERN const CFStringRef kCGImageSourceShouldCacheImmediately;
+IMAGEIO_EXTERN const CFStringRef kCGImageSourceUseHardwareAcceleration;
#endif
WTF_EXTERN_C_BEGIN
Modified: trunk/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp (292034 => 292035)
--- trunk/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp 2022-03-29 15:54:21 UTC (rev 292034)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp 2022-03-29 17:05:11 UTC (rev 292035)
@@ -56,6 +56,7 @@
const CFStringRef kCGImageSourceSkipMetadata = CFSTR("kCGImageSourceSkipMetadata");
const CFStringRef kCGImageSourceSubsampleFactor = CFSTR("kCGImageSourceSubsampleFactor");
const CFStringRef kCGImageSourceShouldCacheImmediately = CFSTR("kCGImageSourceShouldCacheImmediately");
+const CFStringRef kCGImageSourceUseHardwareAcceleration = CFSTR("kCGImageSourceUseHardwareAcceleration");
#endif
const CFStringRef kCGImageSourceEnableRestrictedDecoding = CFSTR("kCGImageSourceEnableRestrictedDecoding");
@@ -66,6 +67,10 @@
CFDictionarySetValue(options.get(), kCGImageSourceShouldCache, kCFBooleanTrue);
CFDictionarySetValue(options.get(), kCGImageSourceShouldPreferRGB32, kCFBooleanTrue);
CFDictionarySetValue(options.get(), kCGImageSourceSkipMetadata, kCFBooleanTrue);
+
+ if (ImageDecoderCG::hardwareAcceleratedDecodingDisabled())
+ CFDictionarySetValue(options.get(), kCGImageSourceUseHardwareAcceleration, kCFBooleanFalse);
+
#if HAVE(IMAGE_RESTRICTED_DECODING) && USE(APPLE_INTERNAL_SDK)
if (ImageDecoderCG::restrictedDecodingEnabled())
CFDictionarySetValue(options.get(), kCGImageSourceEnableRestrictedDecoding, kCFBooleanTrue);
@@ -256,6 +261,7 @@
#endif
bool ImageDecoderCG::s_enableRestrictedDecoding = false;
+bool ImageDecoderCG::s_hardwareAcceleratedDecodingDisabled = false;
ImageDecoderCG::ImageDecoderCG(FragmentedSharedBuffer& data, AlphaOption, GammaAndColorProfileOption)
{
@@ -607,6 +613,16 @@
return s_enableRestrictedDecoding;
}
+void ImageDecoderCG::disableHardwareAcceleratedDecoding()
+{
+ s_hardwareAcceleratedDecodingDisabled = true;
}
+bool ImageDecoderCG::hardwareAcceleratedDecodingDisabled()
+{
+ return s_hardwareAcceleratedDecodingDisabled;
+}
+
+}
+
#endif // USE(CG)
Modified: trunk/Source/WebCore/platform/graphics/cg/ImageDecoderCG.h (292034 => 292035)
--- trunk/Source/WebCore/platform/graphics/cg/ImageDecoderCG.h 2022-03-29 15:54:21 UTC (rev 292034)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageDecoderCG.h 2022-03-29 17:05:11 UTC (rev 292035)
@@ -27,6 +27,8 @@
#include "ImageDecoder.h"
+#if USE(CG)
+
namespace WebCore {
class ImageDecoderCG final : public ImageDecoder {
@@ -71,11 +73,17 @@
WEBCORE_EXPORT static void enableRestrictedDecoding();
static bool restrictedDecodingEnabled();
+ WEBCORE_EXPORT static void disableHardwareAcceleratedDecoding();
+ static bool hardwareAcceleratedDecodingDisabled();
+
private:
bool m_isAllDataReceived { false };
mutable EncodedDataStatus m_encodedDataStatus { EncodedDataStatus::Unknown };
RetainPtr<CGImageSourceRef> m_nativeDecoder;
static bool s_enableRestrictedDecoding;
+ static bool s_hardwareAcceleratedDecodingDisabled;
};
-}
+} // namespace WebCore
+
+#endif // USE(CG)
Modified: trunk/Source/WebKit/ChangeLog (292034 => 292035)
--- trunk/Source/WebKit/ChangeLog 2022-03-29 15:54:21 UTC (rev 292034)
+++ trunk/Source/WebKit/ChangeLog 2022-03-29 17:05:11 UTC (rev 292035)
@@ -1,3 +1,17 @@
+2022-03-28 Simon Fraser <simon.fra...@apple.com>
+
+ [iOS GPUProcess] Image decoding should not trigger IOSurface usage in the web process
+ https://bugs.webkit.org/show_bug.cgi?id=238489
+ <rdar://88717577>
+
+ Reviewed by Per Arne Vollan.
+
+ When useGPUProcessForDOMRendering is true, disable hardware image decoding since
+ we need to avoid IOSurface access in the web process.
+
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::setUseGPUProcessForDOMRendering):
+
2022-03-29 Don Olmstead <don.olmst...@sony.com>
Share WebAutomationSession among USE(LIBWPE) ports
Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (292034 => 292035)
--- trunk/Source/WebKit/WebProcess/WebProcess.cpp 2022-03-29 15:54:21 UTC (rev 292034)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp 2022-03-29 17:05:11 UTC (rev 292035)
@@ -166,6 +166,10 @@
#include "UserMediaCaptureManager.h"
#endif
+#if USE(CG)
+#include <WebCore/ImageDecoderCG.h>
+#endif
+
#if PLATFORM(MAC)
#include <WebCore/DisplayRefreshMonitorManager.h>
#endif
@@ -2102,7 +2106,14 @@
void WebProcess::setUseGPUProcessForDOMRendering(bool useGPUProcessForDOMRendering)
{
+ if (useGPUProcessForDOMRendering == m_useGPUProcessForDOMRendering)
+ return;
+
m_useGPUProcessForDOMRendering = useGPUProcessForDOMRendering;
+#if USE(CG)
+ if (m_useGPUProcessForDOMRendering)
+ ImageDecoderCG::disableHardwareAcceleratedDecoding();
+#endif
}
void WebProcess::setUseGPUProcessForMedia(bool useGPUProcessForMedia)
@@ -2201,11 +2212,10 @@
{
return m_useGPUProcessForWebGL;
}
+#endif // ENABLE(WEBGL)
-#endif
+#endif // ENABLE(GPU_PROCESS)
-#endif
-
#if ENABLE(MEDIA_STREAM)
SpeechRecognitionRealtimeMediaSourceManager& WebProcess::ensureSpeechRecognitionRealtimeMediaSourceManager()
{