aboutsummaryrefslogtreecommitdiff
path: root/host/libs
diff options
context:
space:
mode:
Diffstat (limited to 'host/libs')
-rw-r--r--host/libs/config/cuttlefish_config.cpp8
-rw-r--r--host/libs/config/cuttlefish_config.h12
-rw-r--r--host/libs/config/cuttlefish_config_instance.cpp19
-rw-r--r--host/libs/config/known_paths.cpp8
-rw-r--r--host/libs/config/known_paths.h2
-rw-r--r--host/libs/vm_manager/crosvm_manager.cpp8
-rw-r--r--host/libs/vm_manager/gem5_manager.cpp4
-rw-r--r--host/libs/vm_manager/qemu_manager.cpp52
8 files changed, 81 insertions, 32 deletions
diff --git a/host/libs/config/cuttlefish_config.cpp b/host/libs/config/cuttlefish_config.cpp
index 091b59160..ab11c98e2 100644
--- a/host/libs/config/cuttlefish_config.cpp
+++ b/host/libs/config/cuttlefish_config.cpp
@@ -306,6 +306,14 @@ bool CuttlefishConfig::enable_automotive_proxy() const {
return (*dictionary_)[kEnableAutomotiveProxy].asBool();
}
+static constexpr char kVhalProxyServerPort[] = "vhal_proxy_server_port";
+void CuttlefishConfig::set_vhal_proxy_server_port(int port) {
+ (*dictionary_)[kVhalProxyServerPort] = port;
+}
+int CuttlefishConfig::vhal_proxy_server_port() const {
+ return (*dictionary_)[kVhalProxyServerPort].asInt();
+}
+
static constexpr char kEnableHostNfc[] = "enable_host_nfc";
void CuttlefishConfig::set_enable_host_nfc(bool enable_host_nfc) {
(*dictionary_)[kEnableHostNfc] = enable_host_nfc;
diff --git a/host/libs/config/cuttlefish_config.h b/host/libs/config/cuttlefish_config.h
index f23148d0a..23d05f7b3 100644
--- a/host/libs/config/cuttlefish_config.h
+++ b/host/libs/config/cuttlefish_config.h
@@ -154,6 +154,10 @@ class CuttlefishConfig {
void set_enable_automotive_proxy(bool enable_automotive_proxy);
bool enable_automotive_proxy() const;
+ // The vsock port used by vhal_proxy_server
+ void set_vhal_proxy_server_port(int port);
+ int vhal_proxy_server_port() const;
+
// Bluetooth is enabled by bt_connector and rootcanal
void set_enable_host_bluetooth_connector(bool enable_host_bluetooth);
bool enable_host_bluetooth_connector() const;
@@ -621,6 +625,7 @@ class CuttlefishConfig {
std::string gpu_renderer_features() const;
std::string gpu_context_types() const;
std::string guest_vulkan_driver() const;
+ bool guest_uses_bgra_framebuffers() const;
std::string frames_socket_path() const;
std::string gpu_vhost_user_mode() const;
@@ -688,6 +693,8 @@ class CuttlefishConfig {
bool bootconfig_supported() const;
std::string filename_encryption_mode() const;
ExternalNetworkMode external_network_mode() const;
+
+ bool start_vhal_proxy_server() const;
};
// A view into an existing CuttlefishConfig object for a particular instance.
@@ -838,6 +845,7 @@ class CuttlefishConfig {
void set_gpu_renderer_features(const std::string& features);
void set_gpu_context_types(const std::string& context_types);
void set_guest_vulkan_driver(const std::string& driver);
+ void set_guest_uses_bgra_framebuffers(bool uses_bgra);
void set_frames_socket_path(const std::string& driver);
void set_enable_gpu_udmabuf(const bool enable_gpu_udmabuf);
@@ -895,6 +903,10 @@ class CuttlefishConfig {
void set_filename_encryption_mode(const std::string& userdata_format);
void set_external_network_mode(ExternalNetworkMode network_mode);
+ // Whether we should start vhal_proxy_server for the guest-side VHAL to
+ // connect to.
+ void set_start_vhal_proxy_server(bool enable_vhal_proxy_server);
+
private:
void SetPath(const std::string& key, const std::string& path);
};
diff --git a/host/libs/config/cuttlefish_config_instance.cpp b/host/libs/config/cuttlefish_config_instance.cpp
index 2bc2a3a36..1311e7e3f 100644
--- a/host/libs/config/cuttlefish_config_instance.cpp
+++ b/host/libs/config/cuttlefish_config_instance.cpp
@@ -797,6 +797,16 @@ void CuttlefishConfig::MutableInstanceSpecific::set_guest_vulkan_driver(
(*Dictionary())[kVulkanDriver] = driver;
}
+static constexpr char kGuestUsesBgraFramebuffers[] =
+ "guest_uses_bgra_framebuffers";
+bool CuttlefishConfig::InstanceSpecific::guest_uses_bgra_framebuffers() const {
+ return (*Dictionary())[kGuestUsesBgraFramebuffers].asBool();
+}
+void CuttlefishConfig::MutableInstanceSpecific::
+ set_guest_uses_bgra_framebuffers(bool uses_bgra) {
+ (*Dictionary())[kGuestUsesBgraFramebuffers] = uses_bgra;
+}
+
static constexpr char kRestartSubprocesses[] = "restart_subprocesses";
bool CuttlefishConfig::InstanceSpecific::restart_subprocesses() const {
return (*Dictionary())[kRestartSubprocesses].asBool();
@@ -1840,6 +1850,15 @@ void CuttlefishConfig::MutableInstanceSpecific::set_wifi_mac_prefix(
(*Dictionary())[kWifiMacPrefix] = wifi_mac_prefix;
}
+static constexpr char kStartVhalProxyServer[] = "start_vhal_proxy_server";
+void CuttlefishConfig::MutableInstanceSpecific::set_start_vhal_proxy_server(
+ bool start_vhal_proxy_server) {
+ (*Dictionary())[kStartVhalProxyServer] = start_vhal_proxy_server;
+}
+bool CuttlefishConfig::InstanceSpecific::start_vhal_proxy_server() const {
+ return (*Dictionary())[kStartVhalProxyServer].asBool();
+}
+
std::string CuttlefishConfig::InstanceSpecific::factory_reset_protected_path() const {
return PerInstanceInternalPath("factory_reset_protected.img");
}
diff --git a/host/libs/config/known_paths.cpp b/host/libs/config/known_paths.cpp
index a5bfb0c9a..37e7b4ef5 100644
--- a/host/libs/config/known_paths.cpp
+++ b/host/libs/config/known_paths.cpp
@@ -132,4 +132,12 @@ std::string AutomotiveProxyBinary() {
return HostBinaryPath("automotive_vsock_proxy");
}
+std::string VhalProxyServerBinary() {
+ return HostBinaryPath("vhal_proxy_server");
+}
+
+std::string VhalProxyServerConfig() {
+ return DefaultHostArtifactsPath("etc/automotive/vhalconfig");
+}
+
} // namespace cuttlefish
diff --git a/host/libs/config/known_paths.h b/host/libs/config/known_paths.h
index 355d255d7..7895b20e9 100644
--- a/host/libs/config/known_paths.h
+++ b/host/libs/config/known_paths.h
@@ -52,5 +52,7 @@ std::string WebRtcSigServerProxyBinary();
std::string WmediumdBinary();
std::string WmediumdGenConfigBinary();
std::string AutomotiveProxyBinary();
+std::string VhalProxyServerBinary();
+std::string VhalProxyServerConfig();
} // namespace cuttlefish
diff --git a/host/libs/vm_manager/crosvm_manager.cpp b/host/libs/vm_manager/crosvm_manager.cpp
index d5475b609..a0b2c7603 100644
--- a/host/libs/vm_manager/crosvm_manager.cpp
+++ b/host/libs/vm_manager/crosvm_manager.cpp
@@ -74,6 +74,8 @@ CrosvmManager::ConfigureGraphics(
{"androidboot.hardware.gralloc", "minigbm"},
{"androidboot.hardware.hwcomposer", instance.hwcomposer()},
{"androidboot.hardware.hwcomposer.display_finder_mode", "drm"},
+ {"androidboot.hardware.hwcomposer.display_framebuffer_format",
+ instance.guest_uses_bgra_framebuffers() ? "bgra" : "rgba"},
{"androidboot.hardware.egl", "angle"},
{"androidboot.hardware.vulkan", "pastel"},
{"androidboot.opengles.version", "196609"}, // OpenGL ES 3.1
@@ -85,6 +87,8 @@ CrosvmManager::ConfigureGraphics(
{"androidboot.hardware.hwcomposer", "ranchu"},
{"androidboot.hardware.hwcomposer.mode", "client"},
{"androidboot.hardware.hwcomposer.display_finder_mode", "drm"},
+ {"androidboot.hardware.hwcomposer.display_framebuffer_format",
+ instance.guest_uses_bgra_framebuffers() ? "bgra" : "rgba"},
{"androidboot.hardware.egl", "mesa"},
// No "hardware" Vulkan support, yet
{"androidboot.opengles.version", "196608"}, // OpenGL ES 3.0
@@ -110,6 +114,8 @@ CrosvmManager::ConfigureGraphics(
{"androidboot.hardware.gralloc", "minigbm"},
{"androidboot.hardware.hwcomposer", instance.hwcomposer()},
{"androidboot.hardware.hwcomposer.display_finder_mode", "drm"},
+ {"androidboot.hardware.hwcomposer.display_framebuffer_format",
+ instance.guest_uses_bgra_framebuffers() ? "bgra" : "rgba"},
{"androidboot.hardware.egl", gles_impl},
{"androidboot.hardware.vulkan", "ranchu"},
{"androidboot.hardware.gltransport", gfxstream_transport},
@@ -121,6 +127,8 @@ CrosvmManager::ConfigureGraphics(
{"androidboot.hardware.gralloc", "minigbm"},
{"androidboot.hardware.hwcomposer", instance.hwcomposer()},
{"androidboot.hardware.hwcomposer.display_finder_mode", "drm"},
+ {"androidboot.hardware.hwcomposer.display_framebuffer_format",
+ instance.guest_uses_bgra_framebuffers() ? "bgra" : "rgba"},
{"androidboot.hardware.egl", "angle"},
{"androidboot.hardware.vulkan", instance.guest_vulkan_driver()},
{"androidboot.hardware.gltransport", "virtio-gpu-asg"},
diff --git a/host/libs/vm_manager/gem5_manager.cpp b/host/libs/vm_manager/gem5_manager.cpp
index fb7f033e3..78f3e8044 100644
--- a/host/libs/vm_manager/gem5_manager.cpp
+++ b/host/libs/vm_manager/gem5_manager.cpp
@@ -229,6 +229,8 @@ Gem5Manager::ConfigureGraphics(
{"androidboot.hardware.hwcomposer", "ranchu"},
{"androidboot.hardware.hwcomposer.mode", "noop"},
{"androidboot.hardware.hwcomposer.display_finder_mode", "gem5"},
+ {"androidboot.hardware.hwcomposer.display_framebuffer_format",
+ instance.guest_uses_bgra_framebuffers() ? "bgra" : "rgba"},
{"androidboot.hardware.egl", "angle"},
{"androidboot.hardware.vulkan", "pastel"},
{"androidboot.opengles.version", "196609"}, // OpenGL ES 3.1
@@ -240,6 +242,8 @@ Gem5Manager::ConfigureGraphics(
{"androidboot.hardware.gralloc", "minigbm"},
{"androidboot.hardware.hwcomposer", "ranchu"},
{"androidboot.hardware.hwcomposer.display_finder_mode", "gem5"},
+ {"androidboot.hardware.hwcomposer.display_framebuffer_format",
+ instance.guest_uses_bgra_framebuffers() ? "bgra" : "rgba"},
{"androidboot.hardware.egl", "emulation"},
{"androidboot.hardware.vulkan", "ranchu"},
{"androidboot.hardware.gltransport", "virtio-gpu-pipe"},
diff --git a/host/libs/vm_manager/qemu_manager.cpp b/host/libs/vm_manager/qemu_manager.cpp
index 2da484a77..1bbcc331b 100644
--- a/host/libs/vm_manager/qemu_manager.cpp
+++ b/host/libs/vm_manager/qemu_manager.cpp
@@ -130,6 +130,8 @@ QemuManager::ConfigureGraphics(
{"androidboot.hardware.gralloc", "minigbm"},
{"androidboot.hardware.hwcomposer", instance.hwcomposer()},
{"androidboot.hardware.hwcomposer.display_finder_mode", "drm"},
+ {"androidboot.hardware.hwcomposer.display_framebuffer_format",
+ instance.guest_uses_bgra_framebuffers() ? "bgra" : "rgba"},
{"androidboot.hardware.egl", "angle"},
{"androidboot.hardware.vulkan", "pastel"},
// OpenGL ES 3.1
@@ -142,6 +144,8 @@ QemuManager::ConfigureGraphics(
{"androidboot.hardware.hwcomposer", "ranchu"},
{"androidboot.hardware.hwcomposer.mode", "client"},
{"androidboot.hardware.hwcomposer.display_finder_mode", "drm"},
+ {"androidboot.hardware.hwcomposer.display_framebuffer_format",
+ instance.guest_uses_bgra_framebuffers() ? "bgra" : "rgba"},
{"androidboot.hardware.egl", "mesa"},
// No "hardware" Vulkan support, yet
// OpenGL ES 3.0
@@ -162,6 +166,8 @@ QemuManager::ConfigureGraphics(
{"androidboot.hardware.gralloc", "minigbm"},
{"androidboot.hardware.hwcomposer", instance.hwcomposer()},
{"androidboot.hardware.hwcomposer.display_finder_mode", "drm"},
+ {"androidboot.hardware.hwcomposer.display_framebuffer_format",
+ instance.guest_uses_bgra_framebuffers() ? "bgra" : "rgba"},
{"androidboot.hardware.egl", gles_impl},
{"androidboot.hardware.vulkan", "ranchu"},
{"androidboot.hardware.gltransport", gltransport},
@@ -205,7 +211,8 @@ QemuManager::ConfigureBootDevices(
case Arch::X86_64: {
// QEMU has additional PCI devices for an ISA bridge and PIIX4
// virtio_gpu precedes the first console or disk
- int pci_offset = 2 + num_gpu - VmManager::kDefaultNumHvcs;
+ // TODO(schuffelen): Simplify this logic when crosvm uses multiport
+ int pci_offset = 3 + num_gpu - VmManager::kDefaultNumHvcs;
return ConfigureMultipleBootDevices("pci0000:00/0000:00:", pci_offset,
num_disks);
}
@@ -243,12 +250,8 @@ Result<std::vector<MonitorCommand>> QemuManager::StartCommands(
qemu_cmd.AddParameter("-chardev");
qemu_cmd.AddParameter("null,id=hvc", hvc_num);
qemu_cmd.AddParameter("-device");
- qemu_cmd.AddParameter(
- "virtio-serial-pci-non-transitional,max_ports=1,id=virtio-serial",
- hvc_num, ",bus=hvc-bridge,addr=", fmt::format("{:0>2x}", hvc_num + 1));
- qemu_cmd.AddParameter("-device");
- qemu_cmd.AddParameter("virtconsole,bus=virtio-serial", hvc_num,
- ".0,chardev=hvc", hvc_num);
+ qemu_cmd.AddParameter("virtconsole,bus=virtio-serial.0,chardev=hvc",
+ hvc_num);
hvc_num++;
};
auto add_serial_sink = [&qemu_cmd, &serial_num]() {
@@ -280,36 +283,24 @@ Result<std::vector<MonitorCommand>> QemuManager::StartCommands(
qemu_cmd.AddParameter("file,id=hvc", hvc_num, ",path=", output,
",append=on");
qemu_cmd.AddParameter("-device");
- qemu_cmd.AddParameter(
- "virtio-serial-pci-non-transitional,max_ports=1,id=virtio-serial",
- hvc_num, ",bus=hvc-bridge,addr=", fmt::format("{:0>2x}", hvc_num + 1));
- qemu_cmd.AddParameter("-device");
- qemu_cmd.AddParameter("virtconsole,bus=virtio-serial", hvc_num,
- ".0,chardev=hvc", hvc_num);
+ qemu_cmd.AddParameter("virtconsole,bus=virtio-serial.0,chardev=hvc",
+ hvc_num);
hvc_num++;
};
auto add_hvc = [&qemu_cmd, &hvc_num](const std::string& prefix) {
qemu_cmd.AddParameter("-chardev");
qemu_cmd.AddParameter("pipe,id=hvc", hvc_num, ",path=", prefix);
qemu_cmd.AddParameter("-device");
- qemu_cmd.AddParameter(
- "virtio-serial-pci-non-transitional,max_ports=1,id=virtio-serial",
- hvc_num, ",bus=hvc-bridge,addr=", fmt::format("{:0>2x}", hvc_num + 1));
- qemu_cmd.AddParameter("-device");
- qemu_cmd.AddParameter("virtconsole,bus=virtio-serial", hvc_num,
- ".0,chardev=hvc", hvc_num);
+ qemu_cmd.AddParameter("virtconsole,bus=virtio-serial.0,chardev=hvc",
+ hvc_num);
hvc_num++;
};
auto add_hvc_serial = [&qemu_cmd, &hvc_num](const std::string& prefix) {
qemu_cmd.AddParameter("-chardev");
qemu_cmd.AddParameter("serial,id=hvc", hvc_num, ",path=", prefix);
qemu_cmd.AddParameter("-device");
- qemu_cmd.AddParameter(
- "virtio-serial-pci-non-transitional,max_ports=1,id=virtio-serial",
- hvc_num, ",bus=hvc-bridge,addr=", fmt::format("{:0>2x}", hvc_num + 1));
- qemu_cmd.AddParameter("-device");
- qemu_cmd.AddParameter("virtconsole,bus=virtio-serial", hvc_num,
- ".0,chardev=hvc", hvc_num);
+ qemu_cmd.AddParameter("virtconsole,bus=virtio-serial.0,chardev=hvc",
+ hvc_num);
hvc_num++;
};
@@ -434,13 +425,6 @@ Result<std::vector<MonitorCommand>> QemuManager::StartCommands(
qemu_cmd.AddParameter("none");
}
- qemu_cmd.AddParameter("-device");
- if (is_x86) {
- qemu_cmd.AddParameter("pcie-pci-bridge,id=hvc-bridge,addr=01.2");
- } else {
- qemu_cmd.AddParameter("pcie-pci-bridge,id=hvc-bridge");
- }
-
if (instance.hwcomposer() != kHwComposerNone) {
auto display_configs = instance.display_configs();
CF_EXPECT(display_configs.size() >= 1);
@@ -491,6 +475,10 @@ Result<std::vector<MonitorCommand>> QemuManager::StartCommands(
}
}
+ qemu_cmd.AddParameter("-device");
+ qemu_cmd.AddParameter(
+ "virtio-serial-pci-non-transitional,max_ports=31,id=virtio-serial");
+
// /dev/hvc0 = kernel console
// If kernel log is enabled, the virtio-console port will be specified as
// a true console for Linux, and kernel messages will be printed there.