This commit is contained in:
eric
2026-04-04 15:58:27 -05:00
parent e141bc000f
commit 78bbbc1303
4 changed files with 258 additions and 3 deletions

View File

@@ -5,7 +5,9 @@ import os
import re
import shlex
import subprocess
import sys
import tools.compat as compat
from tools.helper import bcolors, print_color
@@ -224,8 +226,11 @@ def main():
)
parser.add_argument(
"--gpu-mode",
default="guest",
help="Value for androidboot.redroid_gpu_mode",
default="auto",
help=(
"androidboot.redroid_gpu_mode: auto=host if /dev/dri exists else guest (default); "
"guest=software GLES; host=GPU (adds --device for each DRI node when present)"
),
)
parser.add_argument(
"--device-profile",
@@ -266,6 +271,11 @@ def main():
"(before device profile; see redroid-doc README / #579). Overrides user-build secure props."
),
)
parser.add_argument(
"--no-compat-check",
action="store_true",
help="Skip compatibility messages and docker/podman probe (still resolves --gpu-mode auto from DRI)",
)
args = parser.parse_args()
image = args.image
@@ -278,6 +288,16 @@ def main():
os.makedirs(data_dir, exist_ok=True)
run_report, effective_gpu_mode, dri_device_args = compat.analyze_for_run(
args.container,
args.gpu_mode,
skip_check=args.no_compat_check,
)
if not args.no_compat_check:
compat.emit_compat_report(run_report)
if run_report.errors:
sys.exit(1)
cmd = [
args.container,
"run",
@@ -294,6 +314,7 @@ def main():
cmd.extend(["--memory", memory])
if not args.keep_container:
cmd.append("--rm")
cmd.extend(dri_device_args)
cmd.append(image)
# Init applies read-only props in order; later ro.adb.secure=0 is ignored if adb.secure
# was already set (redroid-doc #579). Put these immediately after the image name.
@@ -308,7 +329,7 @@ def main():
"ro.debuggable=1",
]
)
cmd.append("androidboot.redroid_gpu_mode={}".format(args.gpu_mode))
cmd.append("androidboot.redroid_gpu_mode={}".format(effective_gpu_mode))
cmd.extend(bridge_props(bridge))
cmd.extend(preset_props(preset))
cmd.extend(device_profile_props(device_profile))
@@ -322,6 +343,10 @@ def main():
check=False,
)
print_color(
"Selected GPU mode: {} (androidboot.redroid_gpu_mode)".format(effective_gpu_mode),
bcolors.GREEN,
)
print_color("Selected native bridge: {}".format(bridge), bcolors.GREEN)
if preset != "none":
print_color("Selected launch preset: {}".format(preset), bcolors.GREEN)