Move Texture locking and synchronization to PresentationEngine

The responsibility for synchronizing a texture and locking it is now on the `PresentationEngine` rather than the API-user as this'll allow more fine grained locking and delay waiting until necessary.
This commit is contained in:
PixelyIon 2022-04-25 21:01:16 +05:30
parent e692fcc770
commit 54794f4b71
2 changed files with 4 additions and 4 deletions

View File

@ -225,6 +225,7 @@ namespace skyline::gpu {
std::unique_lock lock(mutex);
surfaceCondition.wait(lock, [this]() { return vkSurface.has_value(); });
std::scoped_lock textureLock(*texture);
if (texture->format != swapchainFormat || texture->dimensions != swapchainExtent)
UpdateSwapchain(texture->format, texture->dimensions);
@ -258,6 +259,8 @@ namespace skyline::gpu {
}
std::ignore = gpu.vkDevice.waitForFences(*acquireFence, true, std::numeric_limits<u64>::max());
texture->SynchronizeHost();
images.at(nextImage.second)->CopyFrom(texture, vk::ImageSubresourceRange{
.aspectMask = vk::ImageAspectFlagBits::eColor,
.levelCount = 1,

View File

@ -386,11 +386,8 @@ namespace skyline::service::hosbinder {
fence.Wait(state.soc->host1x);
{
auto &texture{buffer.texture};
std::scoped_lock textureLock(*texture);
texture->SynchronizeHost();
u64 frameId;
state.gpu->presentation.Present(texture, isAutoTimestamp ? 0 : timestamp, swapInterval, crop, scalingMode, transform, frameId);
state.gpu->presentation.Present(buffer.texture, isAutoTimestamp ? 0 : timestamp, swapInterval, crop, scalingMode, transform, frameId);
}
buffer.frameNumber = ++frameNumber;