Repository navigation
Replace GLX by EGL platform for headless view - #5843
tiagovignatti wants to merge 2 commits into
Conversation
Calling X11 window system is superfluous for headless rendering. This patch implements EGL platform using GBM, which is slightly more simple than the GLX path when using X11. In principle there are no big advantages in terms of performance etc. My motivation behind this was to get in touch with the code and the project. For testing I'm using: $ unset DISPLAY && make As a follow-up patch, one would now remove the GLX code all over (look for MBGL_USE_GLX macro).
This patch removes headless GLX code entirely in favour of the new EGL one. Qt and Node test suites needed to be accommodated to use that as well. I've tested locally and had the following output: $ node platform/node/test/render.test.js: 317 passed (81.5%) 37 passed but were ignored (9.5%) 35 ignored (9.0%) $ make test-qt [==========] 334 tests from 51 test cases ran. (24821 ms total) [ PASSED ] 333 tests. [ FAILED ] 1 test, listed below: [ FAILED ] TextConversions.to_upper The latter suite accuses one error which doesn't seem to be related with the changes performed here.
|
@tiagovignatti, thanks for your PR! By analyzing this pull request, we identified @mikemorris, @jfirebaugh and @tmpsantos to be potential reviewers. |
|
cc @kkaefer |
|
Hmmm, neat! I've got a few questions:
|
|
EGL is more like the glue between the rendering API and what is providing the buffers to be rendered. So changing the headless now to use EGL doesn't mean much besides clean up -- with GLX there was this indirection to the X (X11) server, which is a window system but, well, headless doesn't care about windows. So there shouldn't be any impact whether your system is rasterizing with software or not. I think you should be able to remove xvfb dependency now from your build bot (but again: it doesn't mean that its rendering method will be changed). I hope I've answered the three questions, @mikemorris ? |
|
@tiagovignatti Was specifically referring to #4638 re OSMesa, as an alternative means of eliminating the window server. I'm 👍 in general on this though, as EGL seems to be in better shape than the OSMesa API. I'll test this out a bit today to see if anything unexpected pops up. |
|
This is currently failing CI tests because we're running against a version of Mesa compiled without EGL. I can work on publishing a release of Mesa 12.0.1 with EGL enabled. |
|
@mikemorris I think these are orthogonal problems: replace GLX by EGL would simply remove the window system underneath which is useless for the headless configuration, while your suggestion of using libOSMesa means that headless would also be using a software rasterizer instead. Let me know how the new Mesa integration with the CI is going. Thanks! |
|
One more thing @mikemorris. In case your CI bot doesn't have a GPU hw available, then you will need to set Mesa to be compiled using |
| throw std::runtime_error("Failed to XInitThreads."); | ||
| #if MBGL_USE_EGL | ||
| // TODO(vignatti): it should search for a valid render* handle instead. | ||
| const char device_name[] = "/dev/dri/renderD128"; |
There was a problem hiding this comment.
How would we update this to search for a valid handle?
👍
Yep, this is exactly the case - we need to support hardware rendering as well as software rendering because Travis CI boxes don't have GPUs. I got a Mesa 12.0.1 build configured and packaged up at https://github.com/mapbox/mason/compare/mesa-12.0.1, and have mapbox-gl-native building against it successfully on Travis now by applying 04fc3cb to your branch @tiagovignatti. CI tests are currently failing on a runtime error, which I'm guessing is expected at this point judging by your |
|
hey back @mikemorris. I've just rebased now the two commits and fixed the TODOs that you commented about. They're living here ( I thought about rebasing 04fc3cb as well but I can't test it cause I don't have access to the Travis machine. I'm sure you can roll this commit quite easy on top of my new branch though :) Let me know if the CI tests are alright then. |
Qt has now a "Qt headless view" using only Qt stuff, which could be potentially used on Windows. |
|
Follow-up: #7007. |
Calling X11 window system is superfluous for headless rendering. This patch implements EGL platform using GBM, which is slightly more simple than the GLX path when using X11.
In principle there are no big advantages in terms of performance etc. My motivation behind this was to get in touch with the code and the project. For testing I'm using:
$ unset DISPLAY && makeAlso, it removes headless GLX code and use EGL platform for Qt and Node.