-
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.
Cherry-pick 03a60be. rdar://122127093
REGRESSION (271770@main): visionOS: Significant regression on MotionMark https://bugs.webkit.org/show_bug.cgi?id=269010 rdar://122127093 Reviewed by Simon Fraser. Before 271770@main, the dynamic content scaling image buffer was a sidecar, outside of the normal flow of the front/back buffer swapping. After that commit, it was moved inside the main image buffer, and thus is swapped like the base scale rendering. This had one unintended consequence: when we're discarding the back buffer (e.g. because it contains an IOSurface that is still in-use and can't be recycled), we will now *also* discard the dynamic content scaling image buffer, and, critically, its resource cache. The whole point of the resource cache is to maintain state between frames, so this is wildly counterproductive. Once you get into a state where you are discarding back buffers (which comes up frequently under load, like MotionMark), you're also losing all resource caching. Instead of trying to rearchitect the discarding code to avoid dropping the display list image buffer, just maintain the dynamic content scaling resource cache in a sidecar on the RemoteLayerBackingStore, like it was before, and pass it down to the image buffer. A subsequent patch will make a similar change for the remote rendering case. * Source/WebCore/SourcesCocoa.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/platform/graphics/cocoa/IOSurface.h: * Source/WebCore/platform/graphics/re/DynamicContentScalingResourceCache.h: Added. (WebCore::DynamicContentScalingResourceCache::DynamicContentScalingResourceCache): * Source/WebCore/platform/graphics/re/DynamicContentScalingResourceCache.mm: Added. (WebCore::DynamicContentScalingResourceCache::create): * Source/WebKit/Shared/RemoteLayerTree/DynamicContentScalingBifurcatedImageBuffer.mm: * Source/WebKit/Shared/RemoteLayerTree/DynamicContentScalingImageBufferBackend.mm: * Source/WebKit/Shared/RemoteLayerTree/RemoteLayerWithInProcessRenderingBackingStore.h: * Source/WebKit/Shared/RemoteLayerTree/RemoteLayerWithInProcessRenderingBackingStore.mm: (WebKit::RemoteLayerWithInProcessRenderingBackingStore::ensureDynamicContentScalingResourceCache): (WebKit::RemoteLayerWithInProcessRenderingBackingStore::allocateBuffer): (WebKit::RemoteLayerWithInProcessRenderingBackingStore::allocateBuffer const): Deleted. * Source/WebCore/platform/graphics/ImageBuffer.h: * Source/WebCore/platform/graphics/ImageBufferBackend.h: Note that it is not safe in a unified-sources world to forward-declare WebCore::IOSurface because of the name conflict with ::IOSurface; we need to strictly order the declarations, which is easiest to achieve by just importing our header. Canonical link: https://commits.webkit.org/274319@main Identifier: 272448.536@safari-7618.1.15.14-branch
- Loading branch information
1 parent
c2875c8
commit b878483
Showing
11 changed files
with
148 additions
and
9 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
51 changes: 51 additions & 0 deletions
51
Source/WebCore/platform/graphics/re/DynamicContentScalingResourceCache.h
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,51 @@ | ||
/* | ||
* Copyright (C) 2024 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. AND ITS CONTRIBUTORS ``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 ITS 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. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#if ENABLE(RE_DYNAMIC_CONTENT_SCALING) | ||
|
||
#include <wtf/Forward.h> | ||
|
||
namespace WebCore { | ||
|
||
class DynamicContentScalingResourceCache : public RetainPtr<id> { | ||
public: | ||
WEBCORE_EXPORT static DynamicContentScalingResourceCache create(); | ||
|
||
DynamicContentScalingResourceCache() | ||
: RetainPtr<id>() | ||
{ | ||
} | ||
|
||
DynamicContentScalingResourceCache(RetainPtr<id>&& object) | ||
: RetainPtr<id>(WTFMove(object)) | ||
{ | ||
} | ||
}; | ||
|
||
} | ||
|
||
#endif |
45 changes: 45 additions & 0 deletions
45
Source/WebCore/platform/graphics/re/DynamicContentScalingResourceCache.mm
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,45 @@ | ||
/* | ||
* Copyright (C) 2024 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. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#import "config.h" | ||
#import "DynamicContentScalingResourceCache.h" | ||
|
||
#if ENABLE(RE_DYNAMIC_CONTENT_SCALING) | ||
|
||
#import <CoreRE/RECGCommandsContext.h> | ||
#import <wtf/cocoa/TypeCastsCocoa.h> | ||
|
||
namespace WebCore { | ||
|
||
DynamicContentScalingResourceCache DynamicContentScalingResourceCache::create() | ||
{ | ||
return bridge_id_cast(adoptCF(RECGCommandsCacheCreate(nullptr))); | ||
} | ||
|
||
} | ||
|
||
#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
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