Commit fa9eff37 by Peng Huang Committed by Commit Bot

Disable GL_EXT_semaphore_fd for Mesa version < 19.3.5 on AMD GPUs

Bug: chromium:1053516 Change-Id: Idfc271ac70c8ded7d05a258beb4a7578a5a652c3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2062162 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com>
parent 123fd970
......@@ -419,6 +419,11 @@ struct FeaturesGL : FeatureSetBase
Feature avoidDXT1sRGBTextureFormat = {
"avoid_dxt1_srgb_texture_format", FeatureCategory::OpenGLWorkarounds,
"Replaces DXT1 sRGB with DXT1 sRGB Alpha as a driver bug workaround.", &members};
// GL_EXT_semaphore_fd doesn't work properly with Mesa 19.3.4 and earlier versions.
Feature disableSemaphoreFd = {"disable_semaphore_fd", FeatureCategory::OpenGLWorkarounds,
"Disable GL_EXT_semaphore_fd extension", &members,
"https://crbug.com/1046462"};
};
inline FeaturesGL::FeaturesGL() = default;
......
......@@ -9,6 +9,7 @@
#include "libANGLE/renderer/gl/renderergl_utils.h"
#include <array>
#include <limits>
#include "common/mathutil.h"
......@@ -86,6 +87,30 @@ uint32_t GetDeviceID(const FunctionsGL *functions)
return 0;
}
bool IsMesa(const FunctionsGL *functions, std::array<int, 3> *version)
{
ASSERT(version);
if (functions->standard != STANDARD_GL_DESKTOP)
{
return false;
}
std::string nativeVersionString(
reinterpret_cast<const char *>(functions->getString(GL_VERSION)));
size_t pos = nativeVersionString.find("Mesa");
if (pos == std::string::npos)
{
return false;
}
int *data = version->data();
data[0] = data[1] = data[2] = 0;
std::sscanf(nativeVersionString.c_str() + pos, "Mesa %d.%d.%d", data, data + 1, data + 2);
return true;
}
namespace nativegl_gl
{
......@@ -1471,8 +1496,9 @@ void GenerateCaps(const FunctionsGL *functions,
functions->hasGLESExtension("GL_EXT_semaphore");
extensions->memoryObjectFd = functions->hasGLExtension("GL_EXT_memory_object_fd") ||
functions->hasGLESExtension("GL_EXT_memory_object_fd");
extensions->semaphoreFd = functions->hasGLExtension("GL_EXT_semaphore_fd") ||
functions->hasGLESExtension("GL_EXT_semaphore_fd");
extensions->semaphoreFd = !features.disableSemaphoreFd.enabled &&
(functions->hasGLExtension("GL_EXT_semaphore_fd") ||
functions->hasGLESExtension("GL_EXT_semaphore_fd"));
extensions->gpuShader5EXT = functions->isAtLeastGL(gl::Version(4, 0)) ||
functions->isAtLeastGLES(gl::Version(3, 2)) ||
functions->hasGLExtension("GL_ARB_gpu_shader5") ||
......@@ -1488,6 +1514,9 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature
bool isNvidia = IsNvidia(vendor);
bool isQualcomm = IsQualcomm(vendor);
std::array<int, 3> mesaVersion = {0, 0, 0};
bool isMesa = IsMesa(functions, &mesaVersion);
// Don't use 1-bit alpha formats on desktop GL with AMD drivers.
ANGLE_FEATURE_CONDITION(features, avoid1BitAlphaTextureFormats,
functions->standard == STANDARD_GL_DESKTOP && isAMD);
......@@ -1653,6 +1682,10 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature
// Workaround for incorrect sampling from DXT1 sRGB textures in Intel OpenGL on Windows.
ANGLE_FEATURE_CONDITION(features, avoidDXT1sRGBTextureFormat, IsWindows() && isIntel);
ANGLE_FEATURE_CONDITION(
features, disableSemaphoreFd,
IsLinux() && isAMD && isMesa && mesaVersion < (std::array<int, 3>{19, 3, 5}));
}
void InitializeFrontendFeatures(const FunctionsGL *functions, angle::FrontendFeatures *features)
......
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