2020-10-14 Alan Coon Cherry-pick r268308. rdar://problem/70321631 [Mac] AirPlay menu does not show up when AirPlay button is clicked https://bugs.webkit.org/show_bug.cgi?id=217536 Reviewed by Eric Carlson. Source/WebCore: PAL tries to soft-link the AVRoutePickerView from the AVFoundation framework, rather than the (correct) AVKit framework. Remove AVRoutePickerView from AVFoundationSoftLink.h and use the already declared version inside AVRoutePickerViewTargetPicker.mm. * platform/graphics/avfoundation/objc/AVRoutePickerViewTargetPicker.mm: (WebCore::AVRoutePickerViewTargetPicker::isAvailable): Source/WebCore/PAL: * pal/cocoa/AVFoundationSoftLink.h: * pal/cocoa/AVFoundationSoftLink.mm: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268308 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-09 Jer Noble [Mac] AirPlay menu does not show up when AirPlay button is clicked https://bugs.webkit.org/show_bug.cgi?id=217536 Reviewed by Eric Carlson. * pal/cocoa/AVFoundationSoftLink.h: * pal/cocoa/AVFoundationSoftLink.mm: 2020-10-12 Babak Shafiei Cherry-pick r268330. rdar://problem/70189394 Strip patch version from TARGET_MAC_OS_X_VERSION_MAJOR when building for macOS Big Sur or later https://bugs.webkit.org/show_bug.cgi?id=217594 rdar://70188497 Patch by Luming Yin on 2020-10-11 Reviewed by Darin Adler. To ensure successful Mac Catalyst WebKit builds, strip the patch version from TARGET_MAC_OS_X_VERSION_MAJOR by using two `base:`s on MACOSX_DEPLOYMENT_TARGET. * Configurations/Base.xcconfig: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268330 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-11 Luming Yin Strip patch version from TARGET_MAC_OS_X_VERSION_MAJOR when building for macOS Big Sur or later https://bugs.webkit.org/show_bug.cgi?id=217594 rdar://70188497 Reviewed by Darin Adler. To ensure successful Mac Catalyst WebKit builds, strip the patch version from TARGET_MAC_OS_X_VERSION_MAJOR by using two `base:`s on MACOSX_DEPLOYMENT_TARGET. * Configurations/Base.xcconfig: 2020-10-12 Babak Shafiei Cherry-pick r268327. rdar://problem/70189401 Ignore deployment suffix and identifier when computing major OS version for macOS Big Sur and newer https://bugs.webkit.org/show_bug.cgi?id=217584 rdar://70168426 Patch by Luming Yin on 2020-10-11 Reviewed by Darin Adler. Stop using MACOSX_DEPLOYMENT_TARGET:suffix:identifier to compute major OS versions. Only use the deployment target base for macOS Big Sur and newer. Keep the manual definitions for legacy versions of macOS. * Configurations/Base.xcconfig: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268327 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-10-11 Luming Yin Ignore deployment suffix and identifier when computing major OS version for macOS Big Sur and newer https://bugs.webkit.org/show_bug.cgi?id=217584 rdar://70168426 Reviewed by Darin Adler. Stop using MACOSX_DEPLOYMENT_TARGET:suffix:identifier to compute major OS versions. Only use the deployment target base for macOS Big Sur and newer. Keep the manual definitions for legacy versions of macOS. * Configurations/Base.xcconfig: 2020-10-05 Alan Coon Cherry-pick r267602. rdar://problem/69904386 WebGL should use GLES in iOS apps running on Apple Silicon https://bugs.webkit.org/show_bug.cgi?id=216722 Reviewed by Tim Horton and Ken Russell. Source/ThirdParty/ANGLE: Change ANGLE to dynamically load either EAGL (OpenGLES) or CGL (OpenGL) depending on both compile and runtime configurations. Intel Mac -> CGL Intel Mac Catalyst -> CGL Intel iOS Simulator -> EAGL iOS Device -> EAGL Apple Silicon Mac -> CGL Apple Silicon Mac Catalyst (with Mac app) -> CGL Apple Silicon Mac Catalyst (with iOS app) -> EAGL The trickiest bit is Apple Silicon Mac Catalyst, which depends on the type of the application it is attempting to run. In that case ANGLE must compile both the CGL and EAGL interfaces and then pick one to use after launch. * ANGLE.xcodeproj/project.pbxproj: Add new files. * Configurations/ANGLE-dynamic.xcconfig: Remove all the OpenGL* linking. * Configurations/ANGLE-static.xcconfig: * GLESv2.cmake: New files. * src/common/platform.h: New definitions for CPU type on Apple Systems. * src/gpu_info_util/SystemInfo.h: Split SystemInfo for Apple into two files, for iOS and Mac. Added a field for isiOSAppOnMac that will only be true when running an iOS binary on Apple Silicon. * src/gpu_info_util/SystemInfo_apple.mm: Added. Decides which SystemInfo to call. (angle::GetSystemInfo): * src/gpu_info_util/SystemInfo_ios.cpp: (angle::GetSystemInfo_ios): (angle::GetSystemInfo): Deleted. * src/gpu_info_util/SystemInfo_macos.mm: (angle::GetSystemInfo_mac): (angle::GetSystemInfo): Deleted. * src/libANGLE/Caps.cpp: Can no longer just check for PLATFORM_IOS. This might still need a runtime check. (gl::DetermineDepthTextureANGLESupport): (gl::DetermineDepthTextureOESSupport): * src/libANGLE/Display.cpp: This is the main initialization point for ANGLE, which decides at compile/runtime which variant of Display to create. * src/libANGLE/formatutils.cpp: Add the correct formats. (gl::BuildInternalFormatInfoMap): * src/libANGLE/renderer/gl/SoftLinking_apple.h: Added. Macros to help soft-link functions and ObjC classes. * src/libANGLE/renderer/gl/cgl/CGLFunctions.cpp: Added. Where we soft-link all the OpenGL/CGL API. * src/libANGLE/renderer/gl/cgl/CGLFunctions.h: Added. * src/libANGLE/renderer/gl/cgl/DisplayCGL.mm: Use the soft-linked methods. * src/libANGLE/renderer/gl/cgl/IOSurfaceSurfaceCGL.cpp: * src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h: * src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm: Rename WebSwapLayer to WebSwapLayerCGL otherwise it clashes with the EAGL version. (rx::WindowSurfaceCGL::initialize): (-[WebSwapLayer initWithSharedState:withContext:withFunctions:]): Deleted. (-[WebSwapLayer copyCGLPixelFormatForDisplayMask:]): Deleted. (-[WebSwapLayer copyCGLContextForPixelFormat:]): Deleted. (-[WebSwapLayer canDrawInCGLContext:pixelFormat:forLayerTime:displayTime:]): Deleted. (-[WebSwapLayer drawInCGLContext:pixelFormat:forLayerTime:displayTime:]): Deleted. * src/libANGLE/renderer/gl/eagl/DeviceEAGL.cpp: Similar changes to the CGL implementation. * src/libANGLE/renderer/gl/eagl/DeviceEAGL.h: * src/libANGLE/renderer/gl/eagl/DisplayEAGL.h: * src/libANGLE/renderer/gl/eagl/DisplayEAGL.mm: (rx::DisplayEAGL::initialize): (rx::DisplayEAGL::terminate): (rx::WorkerContextEAGL::~WorkerContextEAGL): (rx::WorkerContextEAGL::makeCurrent): (rx::WorkerContextEAGL::unmakeCurrent): (rx::DisplayEAGL::createWorkerContext): * src/libANGLE/renderer/gl/eagl/EAGLFunctions.h: Added. * src/libANGLE/renderer/gl/eagl/EAGLFunctions.mm: Added. * src/libANGLE/renderer/gl/eagl/IOSurfaceSurfaceEAGL.mm: * src/libANGLE/renderer/gl/eagl/PbufferSurfaceEAGL.cpp: * src/libANGLE/renderer/gl/eagl/RendererEAGL.cpp: * src/libANGLE/renderer/gl/eagl/WindowSurfaceEAGL.h: * src/libANGLE/renderer/gl/eagl/WindowSurfaceEAGL.mm: (-[WebSwapLayerEAGL display]): (rx::WindowSurfaceEAGL::initialize): (-[WebSwapLayer initWithSharedState:withContext:withFunctions:]): Deleted. (-[WebSwapLayer display]): Deleted. * src/libANGLE/renderer/gl/renderergl_utils.cpp: Runtime check. (rx::nativegl_gl::GenerateCaps): Source/WebCore: * Configurations/WebCore.xcconfig: Remove all OpenGL/OpenGLES linking. * WebCore.xcodeproj/project.pbxproj: * platform/graphics/GraphicsContextGL.h: Change the ANGLE IOSurface texture binding enums into functions, because they have to be calculated at run-time. * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm: Use the new soft-linked functions from PAL. Also implement the IOSurface texture binding helpers that were previously enums. * platform/mac/PlatformScreenMac.mm: * platform/mac/WebGLBlocklist.mm: Source/WebCore/PAL: Add soft-linking content for OpenGL/OpenGLES. * PAL.xcodeproj/project.pbxproj: * pal/PlatformMac.cmake: * pal/cocoa/OpenGLSoftLinkCocoa.h: Added. * pal/cocoa/OpenGLSoftLinkCocoa.mm: Added. Source/WebKit: * Configurations/WebKit.xcconfig: Remove OpenGL linking. * UIProcess/mac/HighPerformanceGPUManager.mm: Renamed to .mm. Use the PAL soft-linked OpenGL API. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267602 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-24 Dean Jackson WebGL should use GLES in iOS apps running on Apple Silicon https://bugs.webkit.org/show_bug.cgi?id=216722 Reviewed by Tim Horton. Add soft-linking content for OpenGL/OpenGLES. * PAL.xcodeproj/project.pbxproj: * pal/PlatformMac.cmake: * pal/cocoa/OpenGLSoftLinkCocoa.h: Added. * pal/cocoa/OpenGLSoftLinkCocoa.mm: Added. 2020-09-27 Alan Coon Cherry-pick r267215. rdar://problem/69594225 Per-app accent color overrides are broken https://bugs.webkit.org/show_bug.cgi?id=216674 Reviewed by Wenson Hsieh. Source/WebCore/PAL: * pal/spi/mac/NSApplicationSPI.h: Source/WebKit: No new tests; I've no idea how to write a test that would have caught this; any test I can imagine would have also written to _accentColor and worked fine. * UIProcess/mac/PageClientImplMac.mm: (WebKit::PageClientImpl::accentColor): AppKit changed the meaning of the IPI. Use the correct version. We still write to _accentColor; it is now purely an override. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267215 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-17 Tim Horton Per-app accent color overrides are broken https://bugs.webkit.org/show_bug.cgi?id=216674 Reviewed by Wenson Hsieh. * pal/spi/mac/NSApplicationSPI.h: 2020-09-14 Alan Coon Cherry-pick r266932. rdar://problem/68881008 Fix undeclared identifier issue due to clashes in soft link headers https://bugs.webkit.org/show_bug.cgi?id=216412 Reviewed by Geoffrey Garen. Source/WebCore/PAL: r266898 broke builds on certain SDKs. The reason for this is that it includes MediaToolbox/FigPhoto.h, which transitively includes CoreMedia/CMTimePrivate.h. The latter header has a bunch of inline code in certain SDKs which conflicts with the CoreMediaSoftLink.h header. For instance, CoreMediaSoftLink.h redefines CMTimeCompare to softLink_CoreMedia_CMTimeCompare, which messes up the inline code in the CMTimePrivate.h header that references CMTimeCompare. For now, we just avoid including FigPhoto.h altogether and use a constant. We'll clean this up once we start weak linking rather than soft linking CoreMedia and MediaToolbox (216388). * pal/cocoa/MediaToolboxSoftLink.cpp: * pal/cocoa/MediaToolboxSoftLink.h: * pal/spi/cocoa/MediaToolboxSPI.h: Source/WebKit: Use the workaround constant kPALFigPhotoContainerFormat_JFIF instead of the enum value kFigPhotoContainerFormat_JFIF. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266932 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-11 Ben Nham Fix undeclared identifier issue due to clashes in soft link headers https://bugs.webkit.org/show_bug.cgi?id=216412 Reviewed by Geoffrey Garen. r266898 broke builds on certain SDKs. The reason for this is that it includes MediaToolbox/FigPhoto.h, which transitively includes CoreMedia/CMTimePrivate.h. The latter header has a bunch of inline code in certain SDKs which conflicts with the CoreMediaSoftLink.h header. For instance, CoreMediaSoftLink.h redefines CMTimeCompare to softLink_CoreMedia_CMTimeCompare, which messes up the inline code in the CMTimePrivate.h header that references CMTimeCompare. For now, we just avoid including FigPhoto.h altogether and use a constant. We'll clean this up once we start weak linking rather than soft linking CoreMedia and MediaToolbox (216388). * pal/cocoa/MediaToolboxSoftLink.cpp: * pal/cocoa/MediaToolboxSoftLink.h: * pal/spi/cocoa/MediaToolboxSPI.h: 2020-09-14 Alan Coon Cherry-pick r266898. rdar://problem/68881029 Disable hardware JPEG decoding on x86 Mac https://bugs.webkit.org/show_bug.cgi?id=216377 Reviewed by Geoff Garen. Source/WebCore/PAL: Add wrappers for a new MediaToolbox SPI that allows us to disable HW JPEG decoding. * PAL.xcodeproj/project.pbxproj: * pal/PlatformMac.cmake: * pal/cocoa/MediaToolboxSoftLink.cpp: * pal/cocoa/MediaToolboxSoftLink.h: Source/WebKit: In Big Sur, ImageIO uses hardware JPEG decoding automatically for certain JPEGs. This caused a small regression in our battery life benchmark since the one-time setup cost for the decoder (~20-30 ms per process) was higher than the per-decode win we got from the HW decoder. For now, we're reverting to the Catalina behavior of not using hardware JPEG on x86 Macs by calling a MediaToolbox SPI. (The tradeoffs for Apple Silicon are different so we use ImageIO's default heuristics on that architecture.) We plan to revisit this decision once we move to a GPUProcess world. * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::platformInitializeWebProcess): Source/WTF: Add macros to disable HW JPEG decoding on x86 Macs and indicate the presence of a new MediaToolbox SPI. (The latter is to prevent unnecessary dlopen/dlsym calls since we soft-link MediaToolbox.) * wtf/PlatformEnableCocoa.h: * wtf/PlatformHave.h: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266898 268f45cc-cd09-0410-ab3c-d52691b4dbfc 2020-09-10 Ben Nham Disable hardware JPEG decoding on x86 Mac https://bugs.webkit.org/show_bug.cgi?id=216377 Reviewed by Geoff Garen. Add wrappers for a new MediaToolbox SPI that allows us to disable HW JPEG decoding. * PAL.xcodeproj/project.pbxproj: * pal/PlatformMac.cmake: * pal/cocoa/MediaToolboxSoftLink.cpp: * pal/cocoa/MediaToolboxSoftLink.h: 2020-09-14 Alan Coon Cherry-pick r266844. rdar://problem/68880990 [Cocoa] PERF: Don't instantiate AVPlayer-based audio decoders or renderers if an element is initially muted. https://bugs.webkit.org/show_bug.cgi?id=216299 Reviewed by Eric Carlson. Source/WebCore: When an AVPlayer is created, even if muted, it will still instantiate an audio decoder and renderer if the AVAsset in the current player item has an audio track. Ostensibly, this is so that an unmute operation is instantaneous, as it's merely applying a zero gain to the decoded audio. However for web content, there's many autoplaying, muted