aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/command_base.py
diff options
context:
space:
mode:
authorKimSnj <karimair@gmail.com>2016-11-27 18:15:51 +0100
committerKimSnj <karimair@gmail.com>2016-11-27 18:15:51 +0100
commitb5b76e80536c1245e9535980f6b00347f1dcd648 (patch)
tree4518ca1d95b4429e8b432f23d8ce0fcfd80fb8c1 /python/servo/command_base.py
parentc4f87f451faf8eeac3e046c38ebf8b9b3dd0051e (diff)
downloadservo-b5b76e80536c1245e9535980f6b00347f1dcd648.tar.gz
servo-b5b76e80536c1245e9535980f6b00347f1dcd648.zip
Use software rendering when running servo in headless mode
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r--python/servo/command_base.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index d277bff55ae..4dfbc0a165c 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -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