Merge "Allow the launcher to select the GLES implementation" into cuttlefish-testing
diff --git a/host/commands/launch/flags.cc b/host/commands/launch/flags.cc
index a761a74..ed50269 100644
--- a/host/commands/launch/flags.cc
+++ b/host/commands/launch/flags.cc
@@ -88,10 +88,10 @@
     vm_manager, vm_manager::CrosvmManager::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}");
+    gpu_mode, vsoc::kGpuModeGuestSwiftshader,
+    "What gpu configuration to use, one of {guest_swiftshader, drm_virgl}");
 DEFINE_string(wayland_socket, "",
-    "Location of the wayland socket to use for *_drm gpu_modes.");
+    "Location of the wayland socket to use for drm_virgl gpu_mode.");
 
 DEFINE_string(system_image_dir, vsoc::DefaultGuestImagePath(""),
               "Location of the system partition images.");
@@ -281,9 +281,6 @@
   }
   tmp_config_obj.set_wayland_socket(FLAGS_wayland_socket);
 
-  // TODO(b/77276633): This should be handled as part of the GPU configuration
-  tmp_config_obj.add_kernel_cmdline("androidboot.hardware.egl=swiftshader");
-
   vm_manager::VmManager::ConfigureBootDevices(&tmp_config_obj);
 
   tmp_config_obj.set_serial_number(FLAGS_serial_number);
diff --git a/host/libs/config/cuttlefish_config.cpp b/host/libs/config/cuttlefish_config.cpp
index dceb94e..55f0891 100644
--- a/host/libs/config/cuttlefish_config.cpp
+++ b/host/libs/config/cuttlefish_config.cpp
@@ -171,8 +171,8 @@
 
 namespace vsoc {
 
-const char* const kGpuModeGuestAshmem = "guest_ashmem";
-const char* const kGpuModeGuestDrm = "guest_drm";
+const char* const kGpuModeGuestSwiftshader = "guest_swiftshader";
+const char* const kGpuModeDrmVirgl = "drm_virgl";
 
 std::string DefaultEnvironmentPath(const char* environment_key,
                                    const char* default_value,
diff --git a/host/libs/config/cuttlefish_config.h b/host/libs/config/cuttlefish_config.h
index db28a2a..4d495f0 100644
--- a/host/libs/config/cuttlefish_config.h
+++ b/host/libs/config/cuttlefish_config.h
@@ -379,6 +379,6 @@
 bool HostSupportsVsock();
 
 // GPU modes
-extern const char* const kGpuModeGuestAshmem;
-extern const char* const kGpuModeGuestDrm;
+extern const char* const kGpuModeGuestSwiftshader;
+extern const char* const kGpuModeDrmVirgl;
 }  // namespace vsoc
diff --git a/host/libs/vm_manager/crosvm_manager.cpp b/host/libs/vm_manager/crosvm_manager.cpp
index 669d43f..8ae3359 100644
--- a/host/libs/vm_manager/crosvm_manager.cpp
+++ b/host/libs/vm_manager/crosvm_manager.cpp
@@ -58,16 +58,18 @@
   // the HAL search path allows for fallbacks, and fallbacks in conjunction
   // with properities lead to non-deterministic behavior while loading the
   // HALs.
-  if (config->gpu_mode() == vsoc::kGpuModeGuestDrm) {
+  if (config->gpu_mode() == vsoc::kGpuModeDrmVirgl) {
     config->add_kernel_cmdline("androidboot.hardware.gralloc=minigbm");
     config->add_kernel_cmdline("androidboot.hardware.hwcomposer=drm_minigbm");
+    config->add_kernel_cmdline("androidboot.hardware.egl=mesa");
     return true;
   }
-  if (config->gpu_mode() == vsoc::kGpuModeGuestAshmem) {
+  if (config->gpu_mode() == vsoc::kGpuModeGuestSwiftshader) {
     config->add_kernel_cmdline(
         "androidboot.hardware.gralloc=cutf_ashmem");
     config->add_kernel_cmdline(
         "androidboot.hardware.hwcomposer=cutf_cvm_ashmem");
+    config->add_kernel_cmdline("androidboot.hardware.egl=swiftshader");
     return true;
   }
   return false;
@@ -95,7 +97,7 @@
   cvd::Command command(config_->crosvm_binary());
   command.AddParameter("run");
 
-  if (config_->gpu_mode() != vsoc::kGpuModeGuestAshmem) {
+  if (config_->gpu_mode() != vsoc::kGpuModeGuestSwiftshader) {
     command.AddParameter("--gpu");
     command.AddParameter("--wayland-sock=", config_->wayland_socket());
   }
diff --git a/host/libs/vm_manager/qemu_manager.cpp b/host/libs/vm_manager/qemu_manager.cpp
index f2cde65..ac83972 100644
--- a/host/libs/vm_manager/qemu_manager.cpp
+++ b/host/libs/vm_manager/qemu_manager.cpp
@@ -56,7 +56,7 @@
 const std::string QemuManager::name() { return "qemu_cli"; }
 
 bool QemuManager::ConfigureGpu(vsoc::CuttlefishConfig *config) {
-  if (config->gpu_mode() != vsoc::kGpuModeGuestAshmem) {
+  if (config->gpu_mode() != vsoc::kGpuModeGuestSwiftshader) {
     return false;
   }
   // Override the default HAL search paths in all cases. We do this because
@@ -66,6 +66,8 @@
   config->add_kernel_cmdline("androidboot.hardware.gralloc=cutf_ashmem");
   config->add_kernel_cmdline(
       "androidboot.hardware.hwcomposer=cutf_ivsh_ashmem");
+  config->add_kernel_cmdline(
+      "androidboot.hardware.egl=swiftshader");
   return true;
 }