Commit c99e405c by Peng Huang Committed by Commit Bot

Disable timestamp queries for some GPUs on Android

Copy some workaround from chromium. Bug: chromium:702980,chromium:477514,chromium:462553,chromium:1178333 Change-Id: I9acb6ef49c91193a9e6bb03c6fc5eabf336cba9a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2756728 Commit-Queue: Peng Huang <penghuang@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com>
parent 79e39478
...@@ -69,20 +69,66 @@ bool IsMesa(const FunctionsGL *functions, std::array<int, 3> *version) ...@@ -69,20 +69,66 @@ bool IsMesa(const FunctionsGL *functions, std::array<int, 3> *version)
return true; return true;
} }
bool IsAdreno42xOr3xx(const FunctionsGL *functions) int getAdrenoNumber(const FunctionsGL *functions)
{ {
const char *nativeGLRenderer = GetString(functions, GL_RENDERER); static int number = -1;
if (number == -1)
{
const char *nativeGLRenderer = GetString(functions, GL_RENDERER);
if (std::sscanf(nativeGLRenderer, "Adreno (TM) %d", &number) < 1 &&
std::sscanf(nativeGLRenderer, "FD%d", &number) < 1)
{
number = 0;
}
}
return number;
}
int adrenoNumber = 0; int getMaliTNumber(const FunctionsGL *functions)
if (std::sscanf(nativeGLRenderer, "Adreno (TM) %d", &adrenoNumber) < 1) {
static int number = -1;
if (number == -1)
{ {
// retry for freedreno driver const char *nativeGLRenderer = GetString(functions, GL_RENDERER);
if (std::sscanf(nativeGLRenderer, "FD%d", &adrenoNumber) < 1) if (std::sscanf(nativeGLRenderer, "Mali-T%d", &number) < 1)
{ {
return false; number = 0;
} }
} }
return adrenoNumber < 430; return number;
}
bool IsAdreno42xOr3xx(const FunctionsGL *functions)
{
int number = getAdrenoNumber(functions);
return number != 0 && getAdrenoNumber(functions) < 430;
}
bool IsAdreno5xxOrOlder(const FunctionsGL *functions)
{
int number = getAdrenoNumber(functions);
return number != 0 && number < 600;
}
bool IsMaliT8xxOrOlder(const FunctionsGL *functions)
{
int number = getMaliTNumber(functions);
return number != 0 && number < 900;
}
int GetAndroidSdkLevel()
{
if (!IsAndroid())
{
return 0;
}
angle::SystemInfo info;
if (!angle::GetSystemInfo(&info))
{
return 0;
}
return info.androidSdkLevel;
} }
bool IsAndroidEmulator(const FunctionsGL *functions) bool IsAndroidEmulator(const FunctionsGL *functions)
...@@ -1929,7 +1975,11 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature ...@@ -1929,7 +1975,11 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature
features, disableSemaphoreFd, features, disableSemaphoreFd,
IsLinux() && isAMD && isMesa && mesaVersion < (std::array<int, 3>{19, 3, 5})); IsLinux() && isAMD && isMesa && mesaVersion < (std::array<int, 3>{19, 3, 5}));
ANGLE_FEATURE_CONDITION(features, disableTimestampQueries, IsLinux() && isVMWare); ANGLE_FEATURE_CONDITION(
features, disableTimestampQueries,
(IsLinux() && isVMWare) || (IsAndroid() && isNvidia) ||
(IsAndroid() && GetAndroidSdkLevel() < 27 && IsAdreno5xxOrOlder(functions)) ||
(IsAndroid() && IsMaliT8xxOrOlder(functions)));
ANGLE_FEATURE_CONDITION(features, encodeAndDecodeSRGBForGenerateMipmap, IsApple()); ANGLE_FEATURE_CONDITION(features, encodeAndDecodeSRGBForGenerateMipmap, IsApple());
......
...@@ -146,7 +146,7 @@ void GenerateMipmapBenchmarkBase::initializeBenchmark() ...@@ -146,7 +146,7 @@ void GenerateMipmapBenchmarkBase::initializeBenchmark()
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glViewport(0, 0, getWindow()->getWidth(), getWindow()->getHeight()); glViewport(0, 0, getWindow()->getWidth(), getWindow()->getHeight());
if (params.webgl) if (mIsTimestampQueryAvailable && params.webgl)
{ {
glRequestExtensionANGLE("GL_EXT_disjoint_timer_query"); glRequestExtensionANGLE("GL_EXT_disjoint_timer_query");
} }
......
...@@ -193,7 +193,7 @@ void TextureUploadBenchmarkBase::initializeBenchmark() ...@@ -193,7 +193,7 @@ void TextureUploadBenchmarkBase::initializeBenchmark()
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glViewport(0, 0, getWindow()->getWidth(), getWindow()->getHeight()); glViewport(0, 0, getWindow()->getWidth(), getWindow()->getHeight());
if (params.webgl) if (mIsTimestampQueryAvailable && params.webgl)
{ {
glRequestExtensionANGLE("GL_EXT_disjoint_timer_query"); glRequestExtensionANGLE("GL_EXT_disjoint_timer_query");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment