Commit be2f7b1c by Peng Huang Committed by Commit Bot

Unbind fbo before context switching for PowerVR GPUs

Imagination GL drivers are buggy with context switching. We need to ubind fbo to workaround a crash in the driver. Bug: chromium:1187513 Change-Id: Ie5142b5f43a3f23a9743ba7af0d90567fedd00d3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2841083Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Peng Huang <penghuang@chromium.org>
parent 226259e5
...@@ -542,6 +542,13 @@ struct FeaturesGL : FeatureSetBase ...@@ -542,6 +542,13 @@ struct FeaturesGL : FeatureSetBase
"sanitize_amdgpu_renderer_string", FeatureCategory::OpenGLWorkarounds, "sanitize_amdgpu_renderer_string", FeatureCategory::OpenGLWorkarounds,
"Strip precise kernel and DRM version information from amdgpu renderer strings.", &members, "Strip precise kernel and DRM version information from amdgpu renderer strings.", &members,
"http://crbug.com/1181193"}; "http://crbug.com/1181193"};
// Imagination GL drivers are buggy with context switching. We need to ubind fbo to workaround a
// crash in the driver.
Feature unbindFBOOnContextSwitch = {"unbind_fbo_before_switching_context",
FeatureCategory::OpenGLWorkarounds,
"Imagination GL drivers are buggy with context switching.",
&members, "http://crbug.com/1181193"};
}; };
inline FeaturesGL::FeaturesGL() = default; inline FeaturesGL::FeaturesGL() = default;
......
...@@ -845,6 +845,15 @@ angle::Result ContextGL::onMakeCurrent(const gl::Context *context) ...@@ -845,6 +845,15 @@ angle::Result ContextGL::onMakeCurrent(const gl::Context *context)
return mRenderer->getStateManager()->onMakeCurrent(context); return mRenderer->getStateManager()->onMakeCurrent(context);
} }
angle::Result ContextGL::onUnMakeCurrent(const gl::Context *context)
{
if (getFeaturesGL().unbindFBOOnContextSwitch.enabled)
{
mRenderer->getStateManager()->bindFramebuffer(GL_FRAMEBUFFER, 0);
}
return ContextImpl::onUnMakeCurrent(context);
}
gl::Caps ContextGL::getNativeCaps() const gl::Caps ContextGL::getNativeCaps() const
{ {
return mRenderer->getNativeCaps(); return mRenderer->getNativeCaps();
......
...@@ -235,6 +235,7 @@ class ContextGL : public ContextImpl ...@@ -235,6 +235,7 @@ class ContextGL : public ContextImpl
// Context switching // Context switching
angle::Result onMakeCurrent(const gl::Context *context) override; angle::Result onMakeCurrent(const gl::Context *context) override;
angle::Result onUnMakeCurrent(const gl::Context *context) override;
// Caps queries // Caps queries
gl::Caps getNativeCaps() const override; gl::Caps getNativeCaps() const override;
......
...@@ -2094,6 +2094,11 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature ...@@ -2094,6 +2094,11 @@ void InitializeFeatures(const FunctionsGL *functions, angle::FeaturesGL *feature
// On desktop Linux/AMD when using the amdgpu drivers, the precise kernel and DRM version are // On desktop Linux/AMD when using the amdgpu drivers, the precise kernel and DRM version are
// leaked via GL_RENDERER. We workaround this too improve user security. // leaked via GL_RENDERER. We workaround this too improve user security.
ANGLE_FEATURE_CONDITION(features, sanitizeAmdGpuRendererString, IsLinux() && hasAMD); ANGLE_FEATURE_CONDITION(features, sanitizeAmdGpuRendererString, IsLinux() && hasAMD);
// http://crbug.com/1187513
// Imagination drivers are buggy with context switching. It needs to unbind fbo before context
// switching to workadround the driver issues.
ANGLE_FEATURE_CONDITION(features, unbindFBOOnContextSwitch, IsPowerVR(vendor));
} }
void InitializeFrontendFeatures(const FunctionsGL *functions, angle::FrontendFeatures *features) 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