summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2024-04-19 08:58:26 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-04-25 13:39:54 +0000
commit0d974d863e642b3dc8da4bf5764243cf6dabda6e (patch)
tree50febb5bb5c35b0aff48135238a504ff3b82bfcb
parente661599ec294faa19ff132bcb62b37df3b077a36 (diff)
Fix synchronization of skImage in NativeSkiaOutputDevice
Wait for SkiaImageRepresentation::ScopedReadAccess::CreateSkImage() completion on UI thread. Amends 663ac447476268998fa7f86b03b32115978dfda4 Change-Id: I83c47d65f0e4bf911d45f024cb9c7376ba35b6f1 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit b5cfe6054e593beb2123d8de36f65b3b14e214ff) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/core/compositor/native_skia_output_device.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/compositor/native_skia_output_device.cpp b/src/core/compositor/native_skia_output_device.cpp
index 8f11e5162..708692df7 100644
--- a/src/core/compositor/native_skia_output_device.cpp
+++ b/src/core/compositor/native_skia_output_device.cpp
@@ -309,11 +309,13 @@ std::vector<GrBackendSemaphore> NativeSkiaOutputDevice::Buffer::takeEndWriteSkia
void NativeSkiaOutputDevice::Buffer::createSkImageOnGPUThread()
{
- if (!m_scopedSkiaReadAccess)
+ if (!m_scopedSkiaReadAccess) {
+ m_skImageMutex.unlock();
return;
+ }
- QMutexLocker locker(&m_skImageMutex);
m_cachedSkImage = m_scopedSkiaReadAccess->CreateSkImage(m_parent->m_contextState.get());
+ m_skImageMutex.unlock();
if (!m_cachedSkImage)
qWarning("SKIA: Failed to create SkImage.");
}
@@ -341,6 +343,7 @@ void NativeSkiaOutputDevice::Buffer::beginPresent()
if (!beginSemaphores.empty())
qWarning("SKIA: Unexpected semaphores while reading texture, wait is not implemented.");
+ m_skImageMutex.tryLock();
m_parent->m_gpuTaskRunner->PostTask(FROM_HERE,
base::BindOnce(&NativeSkiaOutputDevice::Buffer::createSkImageOnGPUThread,
base::Unretained(this)));
@@ -390,6 +393,7 @@ void NativeSkiaOutputDevice::Buffer::consumeFence()
sk_sp<SkImage> NativeSkiaOutputDevice::Buffer::skImage()
{
+ QMutexLocker locker(&m_skImageMutex);
return m_cachedSkImage;
}
#if defined(USE_OZONE)