Skip to content

Commit

Permalink
Default nvidia to swiftshader
Browse files Browse the repository at this point in the history
Try to choose a supported gpu on PRIME devices
  • Loading branch information
aleasto authored and erfanoabdi committed Jul 13, 2022
1 parent 58e50a7 commit fb349c8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions tools/helpers/__init__.py
Expand Up @@ -9,3 +9,4 @@
import tools.helpers.mount
import tools.helpers.http
import tools.helpers.ipc
import tools.helpers.gpu
13 changes: 13 additions & 0 deletions tools/helpers/gpu.py
@@ -0,0 +1,13 @@
import glob
import os
import tools.helpers.props

unsupported = ["nvidia"]

def getDriNode(args):
for node in glob.glob("/dev/dri/renderD*"):
dev = os.path.basename(node)
driver = tools.helpers.props.file_get(args, "/sys/class/drm/{}/device/uevent".format(dev), "DRIVER")
if driver not in unsupported:
return node
return ""
4 changes: 2 additions & 2 deletions tools/helpers/lxc.py
Expand Up @@ -51,7 +51,7 @@ def make_entry(src, dist=None, mnt_type="none", options="bind,create=file,option
make_entry("/dev/pvr_sync")
make_entry("/dev/pmsg0")
make_entry("/dev/dxg")
make_entry("/dev/dri", options="bind,create=dir,optional 0 0")
make_entry(tools.helpers.gpu.getDriNode(args), "dev/dri/renderD128")

for n in glob.glob("/dev/fb*"):
make_entry(n)
Expand Down Expand Up @@ -180,7 +180,7 @@ def find_hal(hardware):

gralloc = find_hal("gralloc")
if gralloc == "":
if os.path.exists("/dev/dri"):
if tools.helpers.gpu.getDriNode(args):
gralloc = "gbm"
egl = "mesa"
else:
Expand Down

0 comments on commit fb349c8

Please sign in to comment.