aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurchetan Singh <gurchetansingh@google.com>2024-02-28 11:26:20 -0800
committerGurchetan Singh <gurchetansingh@google.com>2024-02-29 14:49:44 -0800
commite2562b2702b39c0778bd73076c129a55898be914 (patch)
tree47f0e47dc9d47b07a369561eab1143a63ab3ec48
parent29601f2cae48d941fa1bdaf4f87ede9820f0779a (diff)
downloadcuttlefish-e2562b2702b39c0778bd73076c129a55898be914.tar.gz
cuttlefish: enable gfxstream + QEMU by default
We can't enable gfxstream when: - we have QEMU + ARM64 host (since we don't build QEMU8 for arm64) - an QEMU + arm64 guest (I don't know why, but that was prior behavior) Otherwise, on x86 hosts, QEMU8 is available and we should use it. BUG=327408955 TEST=compile Change-Id: I12180c8048922cdc855fd9b1431f590b28ca7979
-rw-r--r--host/commands/assemble_cvd/graphics_flags.cc12
-rw-r--r--host/commands/assemble_cvd/graphics_flags.h3
-rw-r--r--host/libs/config/config_utils.cpp10
-rw-r--r--host/libs/config/config_utils.h2
4 files changed, 22 insertions, 5 deletions
diff --git a/host/commands/assemble_cvd/graphics_flags.cc b/host/commands/assemble_cvd/graphics_flags.cc
index 19aebc519..c56e3da5c 100644
--- a/host/commands/assemble_cvd/graphics_flags.cc
+++ b/host/commands/assemble_cvd/graphics_flags.cc
@@ -255,9 +255,10 @@ Result<std::string> SelectGpuMode(
LOG(INFO) << "GPU auto mode: detected prerequisites for accelerated "
<< "rendering support.";
- if (vm_manager == vm_manager::QemuManager::name()) {
- LOG(INFO) << "Enabling --gpu_mode=drm_virgl.";
- return kGpuModeDrmVirgl;
+
+ if (vm_manager == vm_manager::QemuManager::name() && !UseQemu8()) {
+ LOG(INFO) << "Not using QEMU8: selecting guest swiftshader";
+ return kGpuModeGuestSwiftshader;
} else if (!guest_config.gfxstream_supported) {
LOG(INFO) << "GPU auto mode: guest does not support gfxstream, "
"enabling --gpu_mode=guest_swiftshader";
@@ -284,6 +285,11 @@ Result<std::string> SelectGpuMode(
"function correctly. Please consider switching to "
"--gpu_mode=auto or --gpu_mode=guest_swiftshader.";
}
+
+ if (vm_manager == vm_manager::QemuManager::name() && !UseQemu8()) {
+ LOG(INFO) << "Not using QEMU8: selecting guest swiftshader";
+ return kGpuModeGuestSwiftshader;
+ }
}
return gpu_mode_arg;
diff --git a/host/commands/assemble_cvd/graphics_flags.h b/host/commands/assemble_cvd/graphics_flags.h
index 69b1d7485..6a96dccb3 100644
--- a/host/commands/assemble_cvd/graphics_flags.h
+++ b/host/commands/assemble_cvd/graphics_flags.h
@@ -19,6 +19,7 @@
#include "common/libs/utils/result.h"
#include "host/commands/assemble_cvd/flags.h"
+#include "host/libs/config/config_utils.h"
#include "host/libs/config/cuttlefish_config.h"
namespace cuttlefish {
@@ -28,4 +29,4 @@ Result<std::string> ConfigureGpuSettings(
const std::string& vm_manager, const GuestConfig& guest_config,
CuttlefishConfig::MutableInstanceSpecific& instance);
-} // namespace cuttlefish \ No newline at end of file
+} // namespace cuttlefish
diff --git a/host/libs/config/config_utils.cpp b/host/libs/config/config_utils.cpp
index 0ee99118f..9197877dc 100644
--- a/host/libs/config/config_utils.cpp
+++ b/host/libs/config/config_utils.cpp
@@ -111,10 +111,18 @@ std::string HostBinaryDir() {
return DefaultHostArtifactsPath("bin");
}
-std::string DefaultQemuBinaryDir() {
+bool UseQemu8() {
const std::string target_prod_str = StringFromEnv("TARGET_PRODUCT", "");
if (HostArch() == Arch::X86_64 &&
target_prod_str.find("arm") == std::string::npos) {
+ return true;
+ }
+
+ return false;
+}
+
+std::string DefaultQemuBinaryDir() {
+ if (UseQemu8()) {
return HostBinaryDir();
}
return "/usr/bin";
diff --git a/host/libs/config/config_utils.h b/host/libs/config/config_utils.h
index 1f9ca2843..8107f5e9b 100644
--- a/host/libs/config/config_utils.h
+++ b/host/libs/config/config_utils.h
@@ -59,4 +59,6 @@ std::string DefaultEnvironmentPath(const char* environment_key,
// Whether the host supports qemu
bool HostSupportsQemuCli();
+// Whether to use QEMU8
+bool UseQemu8();
}