Vulkan: Add forceWaitForSubmissionToCompleteForQueryResult flag

Add forceWaitForSubmissionToCompleteForQueryResult feature flag and
enable it for ARM.

Also force host wait if async submission is enabled.

Bug: b/253522366
Change-Id: Ie2d7373930f1a2b3fc761d2f8d2df8fa84983c54
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3954044
Commit-Queue: Charlie Lao <cclao@google.com>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
This commit is contained in:
Charlie Lao 2022-10-13 16:51:32 -07:00 коммит произвёл Angle LUCI CQ
Родитель 72894f4268
Коммит e8f9355c33
7 изменённых файлов: 32 добавлений и 10 удалений

Просмотреть файл

@ -776,6 +776,11 @@ struct FeaturesVk : FeatureSetBase
"Submit commands to driver when last GL_ANY_SAMPLES_PASSED query is made for performance "
"improvements.",
&members, "https://issuetracker.google.com/250706693"};
FeatureInfo forceWaitForSubmissionToCompleteForQueryResult = {
"forceWaitForSubmissionToCompleteForQueryResult", FeatureCategory::VulkanWorkarounds,
"Force wait for submission to complete before calling getQueryResult(wait).", &members,
"https://issuetracker.google.com/253522366"};
};
inline FeaturesVk::FeaturesVk() = default;

Просмотреть файл

@ -1051,6 +1051,12 @@
"category": "Workarounds",
"description":["Submit commands to driver when last GL_ANY_SAMPLES_PASSED query is made for performance improvements."],
"issue": "https://issuetracker.google.com/250706693"
},
{
"name": "force_wait_for_submission_to_complete_for_query_result",
"category": "Workarounds",
"description":["Force wait for submission to complete before calling getQueryResult(wait)."],
"issue": "https://issuetracker.google.com/253522366"
}
]
}

Просмотреть файл

@ -6,7 +6,7 @@
"include/platform/FeaturesMtl_autogen.h":
"80c0f3379882d1f67e523a3a1530cd79",
"include/platform/FeaturesVk_autogen.h":
"5747e327c93b8d4b7ed4cc04b4507c19",
"03f5b51f08b6cb4f831764aa4848f399",
"include/platform/FrontendFeatures_autogen.h":
"a80ddc379cdb5ddb96b450925ae0fae5",
"include/platform/d3d_features.json":
@ -20,9 +20,9 @@
"include/platform/mtl_features.json":
"9833c17145ba2223da2e607a9340afda",
"include/platform/vk_features.json":
"733a328dc8a92c56013e0dea2bb1fedc",
"a0dd571e23e0bd521eb42d72a0863297",
"util/angle_features_autogen.cpp":
"dc9e6b07020cdbc6c460ec4677c953b5",
"b6a2d2cac7d30b6c08d9398fed38a14c",
"util/angle_features_autogen.h":
"78c791b57fe83887a4a21df8f1991183"
"1e4b7c6e89ee370d052fa7f0c48c11c6"
}

Просмотреть файл

@ -540,7 +540,9 @@ angle::Result QueryVk::getResult(const gl::Context *context, bool wait)
// a race condition in this case, wait for the batch to finish first before querying (or return
// not-ready if not waiting).
if (isCurrentlyInUse(contextVk->getLastCompletedQueueSerial()) &&
!renderer->getFeatures().supportsHostQueryReset.enabled)
(!renderer->getFeatures().supportsHostQueryReset.enabled ||
renderer->getFeatures().forceWaitForSubmissionToCompleteForQueryResult.enabled ||
renderer->isAsyncCommandQueueEnabled()))
{
// The query might appear busy because there was no check for completed commands
// recently. Do that now and see if the query is still busy. If the application is

Просмотреть файл

@ -3485,12 +3485,8 @@ void RendererVk::initFeatures(DisplayVk *displayVk,
ANGLE_FEATURE_CONDITION(&mFeatures, supportsProtectedMemory,
(mProtectedMemoryFeatures.protectedMemory == VK_TRUE) && !isARM);
// Workaround for nvidia earlier version driver which appears having a bug that
// vkGetQueryPoolResult() with VK_QUERY_RESULT_WAIT_BIT may result in incorrect result. In that
// case we force into CPU wait for submission to complete. http://anglebug.com/6692
ANGLE_FEATURE_CONDITION(&mFeatures, supportsHostQueryReset,
(mHostQueryResetFeatures.hostQueryReset == VK_TRUE &&
!(isNvidia && nvidiaVersion.major < 470u)));
(mHostQueryResetFeatures.hostQueryReset == VK_TRUE));
// VK_EXT_pipeline_creation_feedback is promoted to core in Vulkan 1.3.
ANGLE_FEATURE_CONDITION(
@ -4077,6 +4073,16 @@ void RendererVk::initFeatures(DisplayVk *displayVk,
ANGLE_FEATURE_CONDITION(&mFeatures, preferSubmitOnAnySamplesPassedQueryEnd,
isTileBasedRenderer);
// ARM driver appears having a bug that if we did not wait for submission to complete, but call
// vkGetQueryPoolResults(VK_QUERY_RESULT_WAIT_BIT), it may result VK_NOT_READY.
// https://issuetracker.google.com/253522366
//
// Workaround for nvidia earlier version driver which appears having a bug that On older nvidia
// driver, vkGetQueryPoolResult() with VK_QUERY_RESULT_WAIT_BIT may result in incorrect result.
// In that case we force into CPU wait for submission to complete. http://anglebug.com/6692
ANGLE_FEATURE_CONDITION(&mFeatures, forceWaitForSubmissionToCompleteForQueryResult,
isARM || (isNvidia && nvidiaVersion.major < 470u));
ApplyFeatureOverrides(&mFeatures, displayVk->getState());
// Disable async command queue when using Vulkan secondary command buffers temporarily to avoid

Просмотреть файл

@ -143,6 +143,8 @@ constexpr PackedEnumMap<Feature, const char *> kFeatureNames = {{
{Feature::ForceTextureLodOffset2, "forceTextureLodOffset2"},
{Feature::ForceTextureLodOffset3, "forceTextureLodOffset3"},
{Feature::ForceTextureLodOffset4, "forceTextureLodOffset4"},
{Feature::ForceWaitForSubmissionToCompleteForQueryResult,
"forceWaitForSubmissionToCompleteForQueryResult"},
{Feature::GenerateSPIRVThroughGlslang, "generateSPIRVThroughGlslang"},
{Feature::GetDimensionsIgnoresBaseLevel, "getDimensionsIgnoresBaseLevel"},
{Feature::HasBaseVertexInstancedDraw, "hasBaseVertexInstancedDraw"},

Просмотреть файл

@ -135,6 +135,7 @@ enum class Feature
ForceTextureLodOffset2,
ForceTextureLodOffset3,
ForceTextureLodOffset4,
ForceWaitForSubmissionToCompleteForQueryResult,
GenerateSPIRVThroughGlslang,
GetDimensionsIgnoresBaseLevel,
HasBaseVertexInstancedDraw,