Skip to content

Commit

Permalink
CHR-6375: [Windows] Fixed crash on fallback from ANGLE to SwiftShader.
Browse files Browse the repository at this point in the history
During fallback from ANGLE to SwiftShader it is required to unload
ANGLE libraries, otherwise SwiftShader will fail to load its own
libGLESv2.dll.

Fixed ANGLE platform reset.

Bug: 760063
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I02280b2c1cd6c3d81087c7e2befb412bb2a89510
Reviewed-on: https://chromium-review.googlesource.com/640992
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Cr-Commit-Position: refs/heads/master@{#499529}
  • Loading branch information
Michał Pichliński authored and Commit Bot committed Sep 5, 2017
1 parent 870b9f1 commit 2132849
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions ui/gl/angle_platform_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ void ResetPlatform(EGLDisplay display) {
return;
g_angle_reset_platform(static_cast<EGLDisplayType>(display));
ResetCacheProgramCallback();
g_angle_reset_platform = nullptr;
}

void SetCacheProgramCallback(CacheProgramCallback callback) {
Expand Down
17 changes: 14 additions & 3 deletions ui/gl/gl_implementation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,20 @@ GLGetProcAddressProc g_get_proc_address;

void CleanupNativeLibraries(void* unused) {
if (g_libraries) {
// We do not call base::UnloadNativeLibrary() for these libraries as
// unloading libGL without closing X display is not allowed. See
// crbug.com/250813 for details.
bool unload_libraries = true;
#if defined(USE_X11)
// We do not call base::UnloadNativeLibrary() for kGLImplementationDesktopGL
// which use libGL which unloading without closing X display is not allowed.
// See crbug.com/250813 for details.
// If kGLImplementationDesktopGL is used with switch "test-gl-lib" and ANGLE
// implementation then in case of fallback to SwiftShader crash will occur
// See crbug.com/760063 for details.
unload_libraries = GetGLImplementation() != kGLImplementationDesktopGL;
#endif
if (unload_libraries) {
for (auto* library : *g_libraries)
base::UnloadNativeLibrary(library);
}
delete g_libraries;
g_libraries = NULL;
}
Expand Down

0 comments on commit 2132849

Please sign in to comment.