Add gpu_mode flag
BUG: 128842306
Test: Local boot
Change-Id: I300043e63baeaa1160f158619cb2154d080b10cc
diff --git a/host/commands/launch/flags.cc b/host/commands/launch/flags.cc
index 6cadcf0..1eda06e 100644
--- a/host/commands/launch/flags.cc
+++ b/host/commands/launch/flags.cc
@@ -88,6 +88,12 @@
DEFINE_string(
vm_manager, vm_manager::QemuManager::name(),
"What virtual machine manager to use, one of {qemu_cli, crosvm}");
+DEFINE_string(
+ gpu_mode, vsoc::kGpuModeGuestAshmem,
+ "What gpu configuration to use, one of {guest_ashmem, guest_drm}");
+DEFINE_string(wayland_socket, "",
+ "Location of the wayland socket to use for *_drm gpu_modes.");
+
DEFINE_string(system_image_dir, vsoc::DefaultGuestImagePath(""),
"Location of the system partition images.");
DEFINE_string(vendor_image, "", "Location of the vendor partition image.");
@@ -247,7 +253,18 @@
LOG(ERROR) << "Invalid vm_manager: " << FLAGS_vm_manager;
return false;
}
+ if (!vm_manager::VmManager::IsValidName(FLAGS_vm_manager)) {
+ LOG(ERROR) << "Invalid vm_manager: " << FLAGS_vm_manager;
+ return false;
+ }
tmp_config_obj.set_vm_manager(FLAGS_vm_manager);
+ tmp_config_obj.set_gpu_mode(FLAGS_gpu_mode);
+ if (!vm_manager::VmManager::ConfigureGpuMode(&tmp_config_obj)) {
+ LOG(ERROR) << "Invalid gpu_mode=" << FLAGS_gpu_mode <<
+ " does not work with vm_manager=" << FLAGS_vm_manager;
+ return false;
+ }
+ tmp_config_obj.set_wayland_socket(FLAGS_wayland_socket);
tmp_config_obj.set_serial_number(FLAGS_serial_number);
@@ -498,6 +515,11 @@
SetCommandLineOptionWithMode("instance_dir",
default_instance_dir.c_str(),
google::FlagSettingMode::SET_FLAGS_DEFAULT);
+ auto default_wayland_socket = vsoc::DefaultEnvironmentPath(
+ "XDG_RUNTIME_DIR", default_instance_dir.c_str(), "wayland-0");
+ SetCommandLineOptionWithMode("wayland_socket",
+ default_wayland_socket.c_str(),
+ google::FlagSettingMode::SET_FLAGS_DEFAULT);
SetCommandLineOptionWithMode("hardware_name", "cutf_cvm",
google::FlagSettingMode::SET_FLAGS_DEFAULT);
SetCommandLineOptionWithMode("adb_mode", "vsock_tunnel",