New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 852537 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocking:
issue 763376



Sign in to add a comment

GL bindings shut down and re-initialize doesn't work well

Project Member Reported by zmo@chromium.org, Jun 13 2018

Issue description

See the about:gpu info in https://bugs.chromium.org/p/chromium/issues/detail?id=763376#c18

It looks like we launch and initialize with VMware mesa, and then realize mesa version is too old, so fallback to SwiftShader. Now we shut down GL bindings from VMware mesa, and re-initialize with SwiftShader, but somehow some things are not cleared properly, so SwiftShader gets stuck with mesa's GL_EXTENSIONS (very likely some other data too).
 

Comment 1 by zmo@chromium.org, Jun 13 2018

Blocking: 763376
capn: I hacked the software_rendering_list.json to force my Linux machine to fall back to SwiftShader after initializing the GL bindings. So it correctly falls back to SwiftShader and I ran WebGL Aquarium and it worked fine.

The about:gpu does report NVidia's GL_EXTENSIONS and I am fixing it in https://chromium-review.googlesource.com/c/chromium/src/+/1100123. However, I don't think that's the root cause of the failure you reported in  crbug.com/763376 .

Could you provide more details how the SwiftShader failed? That may give me a better sense what went wrong. I still think it's due to gl bindings ShutDown() fails to do a complete job, but any hints may help pinpoint what it is.
Thanks for having a deeper look at this! I tried your patch, but it didn't fix  Issue 763376  on the Cloudtop VM. That wasn't expected anyway, but it did change the GL_EXTENSIONS output of about:gpu to match SwiftShader's supported extensions, for the 'Driver Information' section. For the 'Driver Information for Hardware GPU' section it still shows Mesa llvmpipe. Note also that it marks both as *ACTIVE*. I've attached the full about:gpu output for running both with and without the --disable-gpu flag.

I also used lsof to check which shared libraries are loaded by the GPU process. Without --disable-gpu, I'm seeing:

/usr/lib/x86_64-linux-gnu/libLLVM-5.0.so.1
/usr/lib/x86_64-linux-gnu/libdrm_amdgpu.so.1.0.0
/usr/lib/x86_64-linux-gnu/libdrm_radeon.so.1.0.1
/usr/lib/x86_64-linux-gnu/libdrm_nouveau.so.2.0.0
/usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
/usr/lib/x86_64-linux-gnu/libglapi.so.0.0.0
/usr/lib/x86_64-linux-gnu/libxshmfence.so.1.0.0
/usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0.0.0
/usr/lib/x86_64-linux-gnu/libGLdispatch.so.0.0.0
/usr/lib/x86_64-linux-gnu/libGLX.so.0.0.0
/usr/lib/x86_64-linux-gnu/libGL.so.1.0.0

This seems consistent with Mesa llvmpipe. With --disable-gpu, none of those shared libraries were loaded.

The SwifthShader libraries were loaded in both cases. So to check if they were actually being used during WebGL Aquarium rendering, I forced SwiftShader to output a purple color. And it showed up both with and without the --disable-gpu flag.

So perhaps Chrome is still using the extensions of Mesa llvmpipe to determine the graphics code paths, which then causes a mismatch when actually calling SwiftShader and thus produces some incorrect results.
cloudtop-patched.txt
15.4 KB View Download
cloudtop-patched-disable-gpu.txt
8.9 KB View Download
Project Member

Comment 3 by bugdroid1@chromium.org, Jun 14 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/dd957d674d79ca4fc2f869cf6afd11f57f1837e1

commit dd957d674d79ca4fc2f869cf6afd11f57f1837e1
Author: Zhenyao Mo <zmo@chromium.org>
Date: Thu Jun 14 17:27:31 2018

Collect correct GL strings when falling back to SwiftShader.

Plus some minor fixes.
1) consistently use gpu_preferences_ instead of gpu_preferences in case in the
   future we want to update gpu_preferences_ in the beginning.
2) change ShouldEnableSwiftShader() to EnableSwiftShaderIfNeeded().

I don't think this is the root cause why SwiftShader fails to fall back as
reported in the bug, but still, it's good to fix this issue.

BUG= 852537 
TEST=about:gpu
R=piman@chromium.org
TBR=rsesek@chromium.org

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I17ab4d26b4eea079bcd9f732e6689c76f002d584
Reviewed-on: https://chromium-review.googlesource.com/1100123
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Alexis Hétu <sugoi@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567324}
[modify] https://crrev.com/dd957d674d79ca4fc2f869cf6afd11f57f1837e1/content/common/sandbox_init_mac.cc
[modify] https://crrev.com/dd957d674d79ca4fc2f869cf6afd11f57f1837e1/gpu/config/gpu_util.cc
[modify] https://crrev.com/dd957d674d79ca4fc2f869cf6afd11f57f1837e1/gpu/config/gpu_util.h
[modify] https://crrev.com/dd957d674d79ca4fc2f869cf6afd11f57f1837e1/gpu/ipc/service/gpu_init.cc

Comment 4 by capn@chromium.org, Jun 15 2018

Please find attached the WebGL conformance test results, with and without --disable-gpu, running on the Cloudtop instance.

There's a lot more failures when running without --disable-gpu.

I haven't spotted an obvious potential single cause from these summaries. I'll check for some of these tests what kind of errors they run into specifically.
cloudtop-webgl-conformance-1.0.4 (beta).txt
138 KB View Download
cloudtop-webgl-conformance-1.0.4 (beta)-disable-gpu.txt
130 KB View Download

Comment 5 by zmo@chromium.org, Jun 18 2018

capn: thanks for running the tests. From a quick scan, I see some real simple tests failing only in regular mode.

Can you run again conformance/limits/gl-min-textures.html and tell me the page output? This might give us some idea what part went wrong.
gl-min-textures.html produces:

FAIL Should render using all texture units
at (0, 0) expected: 255,128,64,252 was 255,128,64,0

Another potentially interesting case is tex-image-webgl.html:

FAIL Canvas should be red
at (0, 0) expected: 255,0,0,255 was 0,0,0,255
FAIL Canvas should be green
at (0, 0) expected: 0,255,0,255 was 0,0,0,255
PASS Canvas should be blue

Comment 7 by capn@chromium.org, Jun 19 2018

I've attached the about:gpu when running with --disable-software-rasterizer

I also tried running with --disable-gpu-driver-bug-workarounds, and the Aquarium demo was still rendering incorrectly.
cloudtop-disable-software-rasterizer.txt
12.1 KB View Download

Comment 8 by zmo@chromium.org, Jun 19 2018

Here are a list of tests that only fails without --disable-gpu

"conformance/canvas/texture-bindings-unaffected-on-resize.html",
"conformance/context/context-attributes-alpha-depth-stencil-antialias.html",
"conformance/context/context-hidden-alpha.html",
"conformance/extensions/ext-blend-minmax.html",
"conformance/extensions/oes-texture-float-with-canvas.html",
"conformance/extensions/oes-texture-float-with-image-data.html",
"conformance/extensions/oes-texture-float-with-image.html",
"conformance/extensions/oes-texture-half-float-with-canvas.html",
"conformance/extensions/oes-texture-half-float-with-image-data.html",
"conformance/extensions/oes-texture-half-float-with-image.html",
"conformance/glsl/bugs/bool-type-cast-bug-int-float.html",
"conformance/glsl/bugs/compare-loop-index-to-uniform.html",
"conformance/glsl/bugs/conditional-texture-fetch.html",
"conformance/glsl/bugs/nested-loops-with-break-and-continue.html",
"conformance/glsl/bugs/sampler-array-using-loop-index.html",
"conformance/glsl/misc/global-variable-init.html",
"conformance/limits/gl-min-textures.html",
"conformance/reading/read-pixels-test.html",
"conformance/state/gl-object-get-calls.html",
"conformance/textures/misc/tex-image-and-sub-image-2d-with-array-buffer-view.html",
"conformance/textures/misc/tex-image-webgl.html",
"conformance/textures/misc/texture-active-bind-2.html",
"conformance/textures/misc/texture-active-bind.html",
"conformance/textures/misc/texture-transparent-pixels-initialized.html",
"conformance/textures/misc/texture-draw-with-2d-and-cube.html",
"conformance/textures/canvas/tex-2d-rgb-rgb-unsigned_byte.html",
"conformance/textures/canvas/tex-2d-rgb-rgb-unsigned_short_5_6_5.html",
"conformance/textures/canvas/tex-2d-rgba-rgba-unsigned_byte.html",
"conformance/textures/canvas/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html",
"conformance/textures/canvas/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html",
"conformance/textures/canvas/tex-2d-luminance-luminance-unsigned_byte.html",
"conformance/textures/canvas/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html",
"conformance/textures/image/tex-2d-rgb-rgb-unsigned_byte.html",
"conformance/textures/image/tex-2d-rgb-rgb-unsigned_short_5_6_5.html",
"conformance/textures/image/tex-2d-rgba-rgba-unsigned_byte.html",
"conformance/textures/image/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html",
"conformance/textures/image/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html",
"conformance/textures/image/tex-2d-luminance-luminance-unsigned_byte.html",
"conformance/textures/image/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html",
"conformance/textures/image_data/tex-2d-rgb-rgb-unsigned_byte.html",
"conformance/textures/image_data/tex-2d-rgb-rgb-unsigned_short_5_6_5.html",
"conformance/textures/image_data/tex-2d-rgba-rgba-unsigned_byte.html",
"conformance/textures/image_data/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html",
"conformance/textures/image_data/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html",
"conformance/textures/image_data/tex-2d-luminance-luminance-unsigned_byte.html",
"conformance/textures/image_data/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html",
"conformance/textures/svg_image/tex-2d-rgb-rgb-unsigned_byte.html",
"conformance/textures/svg_image/tex-2d-rgb-rgb-unsigned_short_5_6_5.html",
"conformance/textures/svg_image/tex-2d-rgba-rgba-unsigned_byte.html",
"conformance/textures/svg_image/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html",
"conformance/textures/svg_image/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html",
"conformance/textures/svg_image/tex-2d-luminance-luminance-unsigned_byte.html",
"conformance/textures/svg_image/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html",
"conformance/textures/webgl_canvas/tex-2d-rgb-rgb-unsigned_byte.html",
"conformance/textures/webgl_canvas/tex-2d-rgb-rgb-unsigned_short_5_6_5.html",
"conformance/textures/webgl_canvas/tex-2d-rgba-rgba-unsigned_byte.html",
"conformance/textures/webgl_canvas/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html",
"conformance/textures/webgl_canvas/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html",
"conformance/textures/webgl_canvas/tex-2d-luminance-luminance-unsigned_byte.html",
"conformance/textures/webgl_canvas/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html",
"conformance/textures/image_bitmap_from_image_data/tex-2d-rgb-rgb-unsigned_byte.html",
"conformance/textures/image_bitmap_from_image_data/tex-2d-rgb-rgb-unsigned_short_5_6_5.html",
"conformance/textures/image_bitmap_from_image_data/tex-2d-rgba-rgba-unsigned_byte.html",
"conformance/textures/image_bitmap_from_image_data/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html",
"conformance/textures/image_bitmap_from_image_data/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html",
"conformance/textures/image_bitmap_from_image_data/tex-2d-luminance-luminance-unsigned_byte.html",
"conformance/textures/image_bitmap_from_image_data/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html",
"conformance/textures/image_bitmap_from_image/tex-2d-rgb-rgb-unsigned_byte.html",
"conformance/textures/image_bitmap_from_image/tex-2d-rgb-rgb-unsigned_short_5_6_5.html",
"conformance/textures/image_bitmap_from_image/tex-2d-rgba-rgba-unsigned_byte.html",
"conformance/textures/image_bitmap_from_image/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html",
"conformance/textures/image_bitmap_from_image/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html",
"conformance/textures/image_bitmap_from_image/tex-2d-luminance-luminance-unsigned_byte.html",
"conformance/textures/image_bitmap_from_image/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html",
"conformance/textures/image_bitmap_from_canvas/tex-2d-rgb-rgb-unsigned_byte.html",
"conformance/textures/image_bitmap_from_canvas/tex-2d-rgb-rgb-unsigned_short_5_6_5.html",
"conformance/textures/image_bitmap_from_canvas/tex-2d-rgba-rgba-unsigned_byte.html",
"conformance/textures/image_bitmap_from_canvas/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html",
"conformance/textures/image_bitmap_from_canvas/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html",
"conformance/textures/image_bitmap_from_canvas/tex-2d-luminance-luminance-unsigned_byte.html",
"conformance/textures/image_bitmap_from_canvas/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html",
"conformance/textures/image_bitmap_from_blob/tex-2d-rgb-rgb-unsigned_byte.html",
"conformance/textures/image_bitmap_from_blob/tex-2d-rgb-rgb-unsigned_short_5_6_5.html",
"conformance/textures/image_bitmap_from_blob/tex-2d-rgba-rgba-unsigned_byte.html",
"conformance/textures/image_bitmap_from_blob/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html",
"conformance/textures/image_bitmap_from_blob/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html",
"conformance/textures/image_bitmap_from_blob/tex-2d-luminance-luminance-unsigned_byte.html",
"conformance/textures/image_bitmap_from_blob/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html",
"conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgb-rgb-unsigned_byte.html",
"conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgb-rgb-unsigned_short_5_6_5.html",
"conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgba-rgba-unsigned_byte.html",
"conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html",
"conformance/textures/image_bitmap_from_image_bitmap/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html",
"conformance/textures/image_bitmap_from_image_bitmap/tex-2d-luminance-luminance-unsigned_byte.html",
"conformance/textures/image_bitmap_from_image_bitmap/tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html",
"conformance/uniforms/uniform-default-values.html",
"conformance/uniforms/uniform-values-per-program.html",
"conformance/uniforms/uniform-location.html",
"conformance/more/functions/uniformi.html",

Comment 9 by zmo@chromium.org, Jun 19 2018

Looking at CleanupNativeLibraries() in ui/gl/gl_implementation.cc

we didn't actually unload the libraries because we won't be able to reload with the same X display.

With SwiftShader, X is no longer relevant, so in theory we could unload libraries.

This is just a guess, but let me land a CL to unload libraries when we fallback to SwiftShader (the tests won't be affected) and see if this actually fixes our issue.

Comment 10 by kbr@chromium.org, Jun 19 2018

Got a Linux VM instance and did some debugging with zmo@. We find one basic error: uniform1i seems to be broken. In this test:
https://www.khronos.org/registry/webgl/sdk/tests/conformance/uniforms/uniform-default-values.html

All of the tests which call glUniform1i are broken.

Changing them all locally to call glUniform1iv, and passing the argument as a 1-element array from JavaScript, works.

This is an odd bug. Chromium's GL bindings don't have different behavior for glUniform1i compared to other glUniform entry points. On Linux, all of the entry points are looked up dynamically either using dlsym or glXGetProcAddress. (Or eglGetProcAddress, after fallback to SwiftShader).

Comment 11 by zmo@chromium.org, Jun 20 2018

capn: can you test if https://chromium-review.googlesource.com/c/chromium/src/+/1107254 fixes the issue?

Comment 12 by kbr@chromium.org, Jun 20 2018

Cc: kkaluri@chromium.org
 Issue 853398  has been merged into this issue.

Comment 13 by zmo@chromium.org, Jun 20 2018

Cc: -zmo@chromium.org
Owner: zmo@chromium.org
Status: Started (was: Available)
Project Member

Comment 14 by bugdroid1@chromium.org, Jun 20 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/25737a750303c3ff8ee23f1b2684d22f8d20fe1c

commit 25737a750303c3ff8ee23f1b2684d22f8d20fe1c
Author: Zhenyao Mo <zmo@chromium.org>
Date: Wed Jun 20 20:48:19 2018

Unload previous GL's libraries if falling back to SwiftShader

BUG= 852537 
TEST=buildbots
R=piman@chromium.org,kbr@chromium.org,capn@chromium.org,sugoi@chromium.org

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I14021e5ecf9f0716974a99f14c2c154299eac310
Reviewed-on: https://chromium-review.googlesource.com/1107254
Commit-Queue: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569003}
[modify] https://crrev.com/25737a750303c3ff8ee23f1b2684d22f8d20fe1c/ui/gl/gl_implementation.cc

Comment 15 by zmo@chromium.org, Jun 20 2018

Status: Fixed (was: Started)

Comment 16 by capn@chromium.org, Jun 21 2018

Thanks Mo and Ken for getting to the bottom of this!
Project Member

Comment 17 by bugdroid1@chromium.org, Jul 5

The following revision refers to this bug:
  https://swiftshader.googlesource.com/SwiftShader.git/+/c4972610c38bcf8478016572a92843f165d9bfb4

commit c4972610c38bcf8478016572a92843f165d9bfb4
Author: Nicolas Capens <capn@google.com>
Date: Thu Jul 05 17:12:45 2018

Protect exported symbols from overrides.

While all symbols except for the ones in the version script are hidden,
the exported ones can still be overridden by other libraries which
export the same symbols. Using -fvisibility=protected or the equivalent
attribute fixes this.

Protected visibility used to not work because of
https://bugs.llvm.org//show_bug.cgi?id=30960, but that doesn't appear
to be an issue any more.

 Bug chromium:852537 
 Bug swiftshader:64 

Change-Id: Id0b1197b90baa5f5c68bf2aa107d12f8a9856796
Reviewed-on: https://swiftshader-review.googlesource.com/19728
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>

[modify] https://crrev.com/c4972610c38bcf8478016572a92843f165d9bfb4/src/OpenGL/libEGL/BUILD.gn
[modify] https://crrev.com/c4972610c38bcf8478016572a92843f165d9bfb4/src/OpenGL/libGLESv2/BUILD.gn

Sign in to add a comment