Auto merge of #14379 - kimsnj:run-headless, r=jdm

Use software rendering when running servo in headless mode

<!-- Please describe your changes on the following line: -->
Properly setting environment to use OsMesa in headless mode.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #13515

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because I manually ran: `./mach run -d tests/html/about-mozilla.html -z`

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14379)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-12-03 07:55:24 -08:00 committed by GitHub
commit bd5eef58a2
3 changed files with 45 additions and 26 deletions

View file

@ -209,6 +209,26 @@ def is_macosx():
return sys.platform == 'darwin'
def is_linux():
return sys.platform.startswith('linux')
def set_osmesa_env(bin_path, env):
"""Set proper LD_LIBRARY_PATH and DRIVE for software rendering on Linux and OSX"""
if is_linux():
osmesa_path = path.join(find_dep_path_newest('osmesa-src', bin_path), "out", "lib", "gallium")
env["LD_LIBRARY_PATH"] = osmesa_path
env["GALLIUM_DRIVER"] = "softpipe"
elif is_macosx():
osmesa_path = path.join(find_dep_path_newest('osmesa-src', bin_path),
"out", "src", "gallium", "targets", "osmesa", ".libs")
glapi_path = path.join(find_dep_path_newest('osmesa-src', bin_path),
"out", "src", "mapi", "shared-glapi", ".libs")
env["DYLD_LIBRARY_PATH"] = osmesa_path + ":" + glapi_path
env["GALLIUM_DRIVER"] = "softpipe"
return env
class BuildNotFound(Exception):
def __init__(self, message):
self.message = message