Title: [292040] branches/safari-614.1.8-branch/Source
Revision
292040
Author
repst...@apple.com
Date
2022-03-29 10:29:49 -0700 (Tue, 29 Mar 2022)

Log Message

Cherry-pick r292035. rdar://problem/88717577

    [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):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292035 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-614.1.8-branch/Source/WebCore/ChangeLog (292039 => 292040)


--- branches/safari-614.1.8-branch/Source/WebCore/ChangeLog	2022-03-29 17:29:46 UTC (rev 292039)
+++ branches/safari-614.1.8-branch/Source/WebCore/ChangeLog	2022-03-29 17:29:49 UTC (rev 292040)
@@ -1,5 +1,59 @@
 2022-03-29  Russell Epstein  <repst...@apple.com>
 
+        Cherry-pick r292035. rdar://problem/88717577
+
+    [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):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292035 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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  Russell Epstein  <repst...@apple.com>
+
         Cherry-pick r292026. rdar://problem/90941790
 
     REGRESSION(r291771): [ iOS ] Text sometimes draw with incorrect color

Modified: branches/safari-614.1.8-branch/Source/WebCore/PAL/ChangeLog (292039 => 292040)


--- branches/safari-614.1.8-branch/Source/WebCore/PAL/ChangeLog	2022-03-29 17:29:46 UTC (rev 292039)
+++ branches/safari-614.1.8-branch/Source/WebCore/PAL/ChangeLog	2022-03-29 17:29:49 UTC (rev 292040)
@@ -1,3 +1,52 @@
+2022-03-29  Russell Epstein  <repst...@apple.com>
+
+        Cherry-pick r292035. rdar://problem/88717577
+
+    [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):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292035 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-24  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         [Cocoa] REGRESSION(r281291): When accessibility bold is enabled, font-family:system-ui is supposed to be bold

Modified: branches/safari-614.1.8-branch/Source/WebCore/PAL/pal/spi/cg/ImageIOSPI.h (292039 => 292040)


--- branches/safari-614.1.8-branch/Source/WebCore/PAL/pal/spi/cg/ImageIOSPI.h	2022-03-29 17:29:46 UTC (rev 292039)
+++ branches/safari-614.1.8-branch/Source/WebCore/PAL/pal/spi/cg/ImageIOSPI.h	2022-03-29 17:29:49 UTC (rev 292040)
@@ -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: branches/safari-614.1.8-branch/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp (292039 => 292040)


--- branches/safari-614.1.8-branch/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp	2022-03-29 17:29:46 UTC (rev 292039)
+++ branches/safari-614.1.8-branch/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp	2022-03-29 17:29:49 UTC (rev 292040)
@@ -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: branches/safari-614.1.8-branch/Source/WebCore/platform/graphics/cg/ImageDecoderCG.h (292039 => 292040)


--- branches/safari-614.1.8-branch/Source/WebCore/platform/graphics/cg/ImageDecoderCG.h	2022-03-29 17:29:46 UTC (rev 292039)
+++ branches/safari-614.1.8-branch/Source/WebCore/platform/graphics/cg/ImageDecoderCG.h	2022-03-29 17:29:49 UTC (rev 292040)
@@ -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: branches/safari-614.1.8-branch/Source/WebKit/ChangeLog (292039 => 292040)


--- branches/safari-614.1.8-branch/Source/WebKit/ChangeLog	2022-03-29 17:29:46 UTC (rev 292039)
+++ branches/safari-614.1.8-branch/Source/WebKit/ChangeLog	2022-03-29 17:29:49 UTC (rev 292040)
@@ -1,5 +1,56 @@
 2022-03-29  Russell Epstein  <repst...@apple.com>
 
+        Cherry-pick r292035. rdar://problem/88717577
+
+    [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):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292035 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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  Russell Epstein  <repst...@apple.com>
+
         Cherry-pick r292010. rdar://problem/89559929
 
     Disable custom storage paths for IndexedDB and LocalStorage by default

Modified: branches/safari-614.1.8-branch/Source/WebKit/WebProcess/WebProcess.cpp (292039 => 292040)


--- branches/safari-614.1.8-branch/Source/WebKit/WebProcess/WebProcess.cpp	2022-03-29 17:29:46 UTC (rev 292039)
+++ branches/safari-614.1.8-branch/Source/WebKit/WebProcess/WebProcess.cpp	2022-03-29 17:29:49 UTC (rev 292040)
@@ -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()
 {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to