Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 4 additions & 22 deletions base/cvd/cuttlefish/host/commands/assemble_cvd/graphics_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -624,38 +624,20 @@ Result<GpuMode> SelectGpuMode(
return selected_gpu_mode;
}

Result<bool> SelectGpuVhostUserMode(const GpuMode gpu_mode,
const std::string& gpu_vhost_user_mode_arg,
Result<bool> SelectGpuVhostUserMode(const std::string& gpu_vhost_user_mode_arg,
VmmMode vmm) {
CF_EXPECT(gpu_vhost_user_mode_arg == kGpuVhostUserModeAuto ||
gpu_vhost_user_mode_arg == kGpuVhostUserModeOn ||
gpu_vhost_user_mode_arg == kGpuVhostUserModeOff);
if (gpu_vhost_user_mode_arg == kGpuVhostUserModeAuto) {
if (IsGuestRenderingMode(gpu_mode)) {
VLOG(0) << "GPU vhost user auto mode: not needed for --gpu_mode="
<< GpuModeString(gpu_mode) << ". Not enabling vhost user gpu.";
return false;
}

if (!VmManagerIsCrosvm(vmm)) {
VLOG(0) << "GPU vhost user auto mode: not yet supported with " << vmm
<< ". Not enabling vhost user gpu.";
return false;
}

// Android built ARM host tools seem to be incompatible with host GPU
// libraries. Enable vhost user gpu which will run the virtio GPU device
// in a separate process with a VMM prebuilt. See b/200592498.
const auto host_arch = HostArch();
if (host_arch == Arch::Arm64) {
VLOG(0) << "GPU vhost user auto mode: detected arm64 host. Enabling "
"vhost user gpu.";
return true;
}

VLOG(0) << "GPU vhost user auto mode: not needed. Not enabling vhost "
"user gpu.";
return false;
VLOG(0) << "GPU vhost user auto mode: enabling vhost user gpu.";
return true;
}

return gpu_vhost_user_mode_arg == kGpuVhostUserModeOn;
Expand Down Expand Up @@ -939,7 +921,7 @@ Result<GpuMode> ConfigureGpuSettings(
const GpuMode gpu_mode = CF_EXPECT(
SelectGpuMode(gpu_mode_arg, vmm, guest_config, graphics_availability));
const bool enable_gpu_vhost_user =
CF_EXPECT(SelectGpuVhostUserMode(gpu_mode, gpu_vhost_user_mode_arg, vmm));
CF_EXPECT(SelectGpuVhostUserMode(gpu_vhost_user_mode_arg, vmm));

if (gpu_mode == GpuMode::Custom) {
std::vector<std::string> requested_types =
Expand Down
Loading