headless broken with osmesa on 67 (regression from 65)
Reported by
nik...@benaco.com,
Jun 21 2018
|
|||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/66.0.3359.181 Chrome/66.0.3359.181 Safari/537.36 Example URL: Steps to reproduce the problem: 1. Use the flags: --use-gl=osmesa --headless 2. Chromium will use swiftshader or egl instead of the requested osmesa What is the expected behavior? What went wrong? Somewhere between versions 65.0.3325.162 and 67.0.3396.87, --use-gl=osmesa broke when used with --headless. The issue is this: https://cs.chromium.org/chromium/src/content/browser/gpu/gpu_data_manager_impl_private.cc?l=564&rcl=c0dbb3daf5f5639ddd98f8601c9578d1b85d2d23 which unconditionally passes in --override-use-software-gl-for-tests if --headless is given. Then here https://cs.chromium.org/chromium/src/ui/gl/init/gl_factory.cc?l=46&rcl=36261ec5ea1bc5461dad64d119d3edebfac0871e that forces the software GL implementation (i.e. not osmesa) to be used; the `if (!base::ContainsValue(...))` branch further down that would usually select osmesa when it is given via --use-gl is NOT taken. Chromium 65 did not have this problem, it allowed --headless to work fine with --use-gl=osmesa. I see some issues with the current code: 1) --headless with osmesa no longer works, which is what many people use for headless interaction with WebGL application (n.b. swiftshader apparently does not support all texture formats that osmesa does) 2) The flag is called "...-for-tests", which suggests its something related to testing; not sure why release Chromium should come up with the use of that flag somewhere internally during non-testing use The commit that introduced the current code is https://chromium.googlesource.com/chromium/src/+/59c4139680eeda1589badde1d9d964d8efd3b24d%5E%21/content/browser/gpu/gpu_data_manager_impl_private.cc which was made as part of https://bugs.chromium.org/p/chromium/issues/detail?id=744658#c66 but I am not sure whether this is the commit that introduced the regression, or whether it has merely refactored it. On the one hand, it is likely it has merely refactored it, because the commit before already had `bool force_software_gl = ... || command_line->HasSwitch(switches::kHeadless)`. On the other hand, the comment in `if (force_software_gl) {` says "If using the OSMesa GL implementation, use fake vendor and device ids ..." which is what the code below does. So that suggests that `force_software_gl` included --use-gl=osmesa at that point, and that --headless should not disable the use of --use-gl=osmesa. So far I'm working around the issue by removing the condition in line https://cs.chromium.org/chromium/src/content/browser/gpu/gpu_data_manager_impl_private.cc?l=564&rcl=c0dbb3daf5f5639ddd98f8601c9578d1b85d2d23 Does it occur on multiple sites: N/A Is it a problem with a plugin? N/A Did this work before? Yes 65.0.3325.162 Does this work in other browsers? N/A Chrome version: 67.0.3396.87 Channel: n/a OS Version: Flash Version: 65.0.3325.162 may not be the *last* version where it worked, but it's the last one it worked. I haven't tracked down yet in which exact version the regression was introduced, but I know which code is the problem.
,
Jun 21 2018
We have no intension of supporting osmesa moving forward. The right thing would be switching to use SwiftShader whenever possible. capn@, sugoi@: should we switch to use SwiftShader when --override-use-software-gl-for-tests is passed in, on platforms where SwiftShader is enabled (Win, Linux, Mac)?
,
Jun 21 2018
Submitter: SwiftShader should support WebGL in this configuration via --use-gl=swiftshader with no code changes needed to the browser. Can you please confirm?
,
Jun 21 2018
> The right thing would be switching to use SwiftShader whenever possible. @zmo: The intention is good, but as mentioned in the issue description, swiftshader currently does not support all texture formats that osmesa does. In particular, all my textures in my WebGL project are rendered as fully black in swiftshader, while they render correctly with osmesa (and all physical desktop GPUs). I suspect this is a bug or missing feature in osmesa, probably in the DXT texture implementation. In any case, this renders (no pun intended) swiftshader useless for headless testing of many WebGL sites. > Submitter: SwiftShader should support WebGL in this configuration via --use-gl=swiftshader with no code changes needed to the browser. Can you please confirm? @kbr: Yes, `--use-gl=swiftshader` works fine with many WebGL examples. The issue is not that swiftshader doesn't work at all, but that it is not (yet?) a practical replacement for all use cases due to rendering bugs (see above). I would (probably) be happy to use swiftshader if it could render the contents of my page correctly.
,
Jun 21 2018
Independent of whether or not osmesa is intended to be supported going forward: At least with my current understanding, this issue looks like a refactoring accident, with osmesa accidentally no longer being counted as a software GL implementation, when it was before. It is not that Chromium is working less well with osmesa than it did before, only that it no longer uses it even if explicitly requested. It would thus be fantastic if we could fix the enabling/disabling logic, so that developers whose sites swiftshader cannot yet render continue to have an opt-in alternative that can.
,
Jun 22 2018
Would you mind giving us a list of formats that SwiftShader doesn't support in your tests? SwiftShader is fully compliant with the OpenGL ES 3.0 spec and does expose and support the GL_EXT_texture_compression_dxt1, GL_ANGLE_texture_compression_dxt3 and GL_ANGLE_texture_compression_dxt5 extensions. SwiftShader also passes the WebGL conformance test suite, so if a format that should be supported isn't properly supported yet, we would like to add it as a test in that test suite, to help us make sure we don't break that support going forward. Note that ASTC support isn't currently exposed, so if that's what you're using, this could be the issue (although I don't know that OSMesa supports ASTC). Also, if you can provide us with a simple WebGL test that reproduces your issue, we'd be happy to look into it. Thanks
,
Jun 22 2018
niklas@: let me echo sugoi@'s request. We should figure out why your content isn't rendering with Swiftshader and fix whatever's wrong. A huge amount of effort has been expended to switch all of Chrome's software rendering testing from OSMesa to Swiftshader, and we are going to delete Chromium's copy of OSMesa and, ideally, the OSMesa support code once that's complete.
,
Jun 22 2018
Hmm, what sugoi@ said really sounds like what I'm doing should really work in swiftshader. I'm using what three.js calls "RGB_S3TC_DXT1_Format". Let me dig a bit deeper and check whether this isn't the result of some building / packaging error, as the Linux system I run this on is a bit custom. Just in case a blind guess helps: I remember there were some patent issues with S3TC leading to some software shipping it separately. Would Chromium's S3TC support be linked in its main binary or in some separate location (e.g. .so file)?
,
Jun 22 2018
SwiftShader's support for S3TC is built in, and was enabled on all platforms earlier this year: https://swiftshader-review.googlesource.com/16808 On my Linux system, https://www.khronos.org/registry/webgl/sdk/tests/conformance/extensions/webgl-compressed-texture-s3tc.html?webglVersion=1 passes and has all extensions enabled, when using SwiftShader.
,
Jun 23 2018
I have finally managed to get a Chrome 67 binary build for Ubuntu 16.04 onto the system in question and indeed the textures look fine there with swiftshader. So I suspect the textures being black really is some form of packaging, build, compiler, or similar error. I am totally at a loss on what the error could be though, as all other swiftshader functionality works fine except from this specific type of texture (all three.js textures examples that work on Ubuntu Chrome also work fine on my build with swiftshader). Unfortunately, I'm running out of time to investigate this -- debugging all the way into specific features of swiftshader is much more effort than making sure an entire feature like swiftshader or osmesa is enabled. So I'll have to stop here for now and hope that the problem will have gone away by the time osmesa will be fully removed (or investigate more at that time). Let us use the rest of this issue for the actual problem I filed: --use-gl=osmesa being ignored when --headless is given. Obviously I'll recommend you guys to fix the logic around the line I linked to treat osmesa as software implementation (as it was before) to keep it working until you finally delete all osmesa support, as opposed to keep it present-but-not-working-in-practice. Especially if it was just a refactoring accident. The fix looks fairly easy (deleting that extra or-condition), but I don't feel equipped to send a CL without knowing why that condition was put there in the first place. That said, I won't be terribly sad if you can't fix it; I can live with patching chromium for my use case until the osmesa code disappears entirely. |
|||
►
Sign in to add a comment |
|||
Comment 1 by robliao@chromium.org
, Jun 21 2018