-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WebGPU] MTLResource allocations should be attributed to the respecti…
…ve web process https://bugs.webkit.org/show_bug.cgi?id=254219 <radar://107001772> Reviewed by Tadeu Zagallo and Myles C. Maxfield. Attribute memory used by IOSurfaces and MTLResource instances to the corresponding web process, so we do not exceed jetsam limits on iOS. Mostly this involves piping the web process ID which already is accessible via RemoteGPU down to WebGPU.framework and then calling the appropriate IOSurface and Metal SPIs. * Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUCreateImpl.cpp: (PAL::WebGPU::create): * Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUCreateImpl.h: * Source/WebGPU/WebGPU/Buffer.mm: (WebGPU::Device::safeCreateBuffer const): * Source/WebGPU/WebGPU/Device.h: * Source/WebGPU/WebGPU/Device.mm: (WebGPU::setOwnerWithIdentity): (WebGPU::Device::setOwnerWithIdentity const): (WebGPU::Device::newBufferWithBytes const): (WebGPU::Device::newTextureWithDescriptor const): * Source/WebGPU/WebGPU/Instance.h: * Source/WebGPU/WebGPU/Instance.mm: (WebGPU::Instance::create): (WebGPU::Instance::Instance): (WebGPU::m_webProcessID): (WebGPU::Instance::createSurface): (WebGPU::Instance::webProcessID const): * Source/WebGPU/WebGPU/PresentationContext.h: * Source/WebGPU/WebGPU/PresentationContext.mm: (WebGPU::PresentationContext::create): * Source/WebGPU/WebGPU/PresentationContextIOSurface.h: * Source/WebGPU/WebGPU/PresentationContextIOSurface.mm: (WebGPU::PresentationContextIOSurface::create): (WebGPU::PresentationContextIOSurface::PresentationContextIOSurface): (WebGPU::PresentationContextIOSurface::renderBuffersWereRecreated): (WebGPU::PresentationContextIOSurface::configure): * Source/WebGPU/WebGPU/Queue.mm: (WebGPU::Queue::writeBuffer): (WebGPU::Queue::writeTexture): * Source/WebGPU/WebGPU/Texture.mm: (WebGPU::Device::createTexture): * Source/WebGPU/WebGPU/WebGPUExt.h: * Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.cpp: (WebKit::webProcessID): (WebKit::RemoteGPU::workQueueInitialize): * Source/WebGPU/WebGPU/MetalSPI.h: Add SPI header. Canonical link: https://commits.webkit.org/276332@main
- Loading branch information
1 parent
48a7d5d
commit d984488
Showing
20 changed files
with
163 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (c) 2023 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. | ||
*/ | ||
|
||
#if USE(INTERNAL_APPLE_SDK) | ||
#import <Metal/MTLResource_Private.h> | ||
#else | ||
@protocol MTLResourceSPI <MTLResource> | ||
@optional | ||
- (kern_return_t)setOwnerWithIdentity:(mach_port_t)task_id_token; | ||
@end | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.