зеркало из https://github.com/AvaloniaUI/angle.git
Vulkan: Minor fix when waitFor*ToBeSubmitted() may skip error.
Calling "checkAndPopPendingError()" without "mSubmissionMutex" lock may cause situation, when new error is added to "mErrors" right after the call. This new error may be for the work we are waiting for, and it processing will be skipped. Current CommandProcessor error handing should be rewritten in the future anyway, but I think this minor error should be addressed now. Bug: b/267348918 Change-Id: I65c49f7dc8e1984696d464c38f13fcdce93337bf Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4245421 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>
This commit is contained in:
Родитель
8374bf5ff8
Коммит
f2617a0974
|
@ -778,10 +778,12 @@ angle::Result CommandProcessor::processTask(CommandProcessorTask *task)
|
|||
angle::Result CommandProcessor::waitForAllWorkToBeSubmitted(Context *context)
|
||||
{
|
||||
ANGLE_TRACE_EVENT0("gpu.angle", "CommandProcessor::waitForAllWorkToBeSubmitted");
|
||||
std::lock_guard<std::mutex> dequeueLock(mSubmissionMutex);
|
||||
|
||||
// Sync any errors to the context
|
||||
// Do this inside the mutex to prevent new errors adding to the list.
|
||||
ANGLE_TRY(checkAndPopPendingError(context));
|
||||
|
||||
std::lock_guard<std::mutex> dequeueLock(mSubmissionMutex);
|
||||
while (!mTasks.empty())
|
||||
{
|
||||
CommandProcessorTask task(std::move(mTasks.front()));
|
||||
|
@ -1003,13 +1005,15 @@ bool CommandProcessor::hasUnsubmittedUse(const vk::ResourceUse &use) const
|
|||
angle::Result CommandProcessor::waitForResourceUseToBeSubmitted(vk::Context *context,
|
||||
const ResourceUse &use)
|
||||
{
|
||||
ANGLE_TRY(checkAndPopPendingError(context));
|
||||
|
||||
if (mCommandQueue->hasUnsubmittedUse(use))
|
||||
{
|
||||
// We do not hold mWorkerMutex lock, so that we still allow other context to enqueue work
|
||||
// while we are processing them.
|
||||
std::lock_guard<std::mutex> dequeueLock(mSubmissionMutex);
|
||||
|
||||
// Do this inside the mutex to prevent new errors adding to the list.
|
||||
ANGLE_TRY(checkAndPopPendingError(context));
|
||||
|
||||
size_t maxTaskCount = mTasks.size();
|
||||
size_t taskCount = 0;
|
||||
while (taskCount < maxTaskCount && mCommandQueue->hasUnsubmittedUse(use))
|
||||
|
@ -1020,6 +1024,10 @@ angle::Result CommandProcessor::waitForResourceUseToBeSubmitted(vk::Context *con
|
|||
taskCount++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ANGLE_TRY(checkAndPopPendingError(context));
|
||||
}
|
||||
return angle::Result::Continue;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче