From c4ab510930e585235842d8030f8efc0187e1632c Mon Sep 17 00:00:00 2001 From: herbertxue Date: Sun, 9 Feb 2020 18:02:08 +0800 Subject: Update gpu args if instances created with any module of gpu. Bug: 147335651 Test: # Host image in config: cuttlefish-google-vsoc-0-9-12-30g acloud-dev create --gpu nvidia-tesla-p100 Change-Id: I00eef4bb61b76c8711aa145d8d4dc92bacf48127 --- internal/lib/cvd_compute_client_multi_stage.py | 4 ++++ internal/lib/cvd_compute_client_multi_stage_test.py | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/lib/cvd_compute_client_multi_stage.py b/internal/lib/cvd_compute_client_multi_stage.py index e833ad9b..2c31b25c 100644 --- a/internal/lib/cvd_compute_client_multi_stage.py +++ b/internal/lib/cvd_compute_client_multi_stage.py @@ -55,6 +55,7 @@ from acloud.pull import pull logger = logging.getLogger(__name__) _DECOMPRESS_KERNEL_ARG = "-decompress_kernel=true" +_GPU_ARG = "-gpu_mode=drm_virgl" _DEFAULT_BRANCH = "aosp-master" _FETCHER_BUILD_TARGET = "aosp_cf_x86_phone-userdebug" _FETCHER_NAME = "fetch_cvd" @@ -290,6 +291,9 @@ class CvdComputeClient(android_compute_client.AndroidComputeClient): if decompress_kernel: launch_cvd_args.append(_DECOMPRESS_KERNEL_ARG) + if self._gpu: + launch_cvd_args.append(_GPU_ARG) + return launch_cvd_args @staticmethod diff --git a/internal/lib/cvd_compute_client_multi_stage_test.py b/internal/lib/cvd_compute_client_multi_stage_test.py index b83bafb5..98ce7e43 100644 --- a/internal/lib/cvd_compute_client_multi_stage_test.py +++ b/internal/lib/cvd_compute_client_multi_stage_test.py @@ -109,13 +109,14 @@ class CvdComputeClientTest(driver_test_lib.BaseDriverTest): # test GetLaunchCvdArgs with avd_spec fake_avd_spec = avd_spec.AVDSpec(self.args) expeted_args = ['-x_res=1080', '-y_res=1920', '-dpi=240', '-cpus=2', - '-memory_mb=4096', '--setupwizard_mode=REQUIRED'] + '-memory_mb=4096', '--setupwizard_mode=REQUIRED', + '-gpu_mode=drm_virgl'] launch_cvd_args = self.cvd_compute_client_multi_stage._GetLaunchCvdArgs(fake_avd_spec) self.assertEqual(launch_cvd_args, expeted_args) # test GetLaunchCvdArgs without avd_spec expeted_args = ['-x_res=720', '-y_res=1280', '-dpi=160', - '--setupwizard_mode=REQUIRED'] + '--setupwizard_mode=REQUIRED', '-gpu_mode=drm_virgl'] launch_cvd_args = self.cvd_compute_client_multi_stage._GetLaunchCvdArgs( avd_spec=None) self.assertEqual(launch_cvd_args, expeted_args) -- cgit v1.2.3