Merge changes If55cda43,I13116154
* changes:
Enable f2fs sparse images.
Revert "Revert qcow + android sparse cuttlefish changes"
diff --git a/host/commands/run_cvd/launch.cc b/host/commands/run_cvd/launch.cc
index 3c92959..dc2e108 100644
--- a/host/commands/run_cvd/launch.cc
+++ b/host/commands/run_cvd/launch.cc
@@ -110,7 +110,8 @@
cmd->AddParameter("-keyboard_fd=", keyboard_server);
cvd::SharedFD frames_server;
- if (config.gpu_mode() == vsoc::kGpuModeDrmVirgl) {
+ if (config.gpu_mode() == vsoc::kGpuModeDrmVirgl ||
+ config.gpu_mode() == vsoc::kGpuModeGfxStream) {
frames_server = CreateUnixInputServer(instance.frames_socket_path());
} else {
frames_server = cvd::SharedFD::VsockServer(SOCK_STREAM);
diff --git a/host/libs/config/cuttlefish_config.cpp b/host/libs/config/cuttlefish_config.cpp
index 9274780..c133a62 100644
--- a/host/libs/config/cuttlefish_config.cpp
+++ b/host/libs/config/cuttlefish_config.cpp
@@ -163,6 +163,7 @@
const char* const kGpuModeGuestSwiftshader = "guest_swiftshader";
const char* const kGpuModeDrmVirgl = "drm_virgl";
+const char* const kGpuModeGfxStream = "gfxstream";
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 1ff76f4..f78327d 100644
--- a/host/libs/config/cuttlefish_config.h
+++ b/host/libs/config/cuttlefish_config.h
@@ -386,4 +386,5 @@
// GPU modes
extern const char* const kGpuModeGuestSwiftshader;
extern const char* const kGpuModeDrmVirgl;
+extern const char* const kGpuModeGfxStream;
} // namespace vsoc
diff --git a/host/libs/screen_connector/screen_connector.cpp b/host/libs/screen_connector/screen_connector.cpp
index 906435a..39c0fa3 100644
--- a/host/libs/screen_connector/screen_connector.cpp
+++ b/host/libs/screen_connector/screen_connector.cpp
@@ -26,7 +26,8 @@
ScreenConnector* ScreenConnector::Get(int frames_fd) {
auto config = vsoc::CuttlefishConfig::Get();
- if (config->gpu_mode() == vsoc::kGpuModeDrmVirgl) {
+ if (config->gpu_mode() == vsoc::kGpuModeDrmVirgl ||
+ config->gpu_mode() == vsoc::kGpuModeGfxStream) {
return new WaylandScreenConnector(frames_fd);
} else if (config->gpu_mode() == vsoc::kGpuModeGuestSwiftshader) {
return new SocketBasedScreenConnector(frames_fd);
diff --git a/host/libs/vm_manager/crosvm_manager.cpp b/host/libs/vm_manager/crosvm_manager.cpp
index 8a2bdc0..63dd3ed 100644
--- a/host/libs/vm_manager/crosvm_manager.cpp
+++ b/host/libs/vm_manager/crosvm_manager.cpp
@@ -84,6 +84,15 @@
"androidboot.hardware.vulkan=pastel",
};
}
+ if (gpu_mode == vsoc::kGpuModeGfxStream) {
+ return {
+ "androidboot.hardware.gralloc=minigbm",
+ "androidboot.hardware.hwcomposer=ranchu",
+ "androidboot.hardware.egl=emulation",
+ "androidboot.hardware.vulkan=ranchu",
+ "androidboot.hardware.gltransport=virtio-gpu-pipe",
+ };
+ }
return {};
}
@@ -108,8 +117,12 @@
});
crosvm_cmd.AddParameter("run");
- if (config_->gpu_mode() == vsoc::kGpuModeDrmVirgl) {
- crosvm_cmd.AddParameter("--gpu=",
+ auto gpu_mode = config_->gpu_mode();
+
+ if (gpu_mode == vsoc::kGpuModeDrmVirgl ||
+ gpu_mode == vsoc::kGpuModeGfxStream) {
+ crosvm_cmd.AddParameter(gpu_mode == vsoc::kGpuModeGfxStream ?
+ "--gpu=gfxstream," : "--gpu=",
"width=", config_->x_res(), ",",
"height=", config_->y_res(), ",",
"egl=true,surfaceless=true,glx=false,gles=false");
diff --git a/shared/config/task_profiles.json b/shared/config/task_profiles.json
index 29bcf30..b883c46 100644
--- a/shared/config/task_profiles.json
+++ b/shared/config/task_profiles.json
@@ -33,12 +33,12 @@
{
"Name": "UClampMin",
"Controller": "cpu",
- "File": "cpu.util.min"
+ "File": "cpu.uclamp.min"
},
{
"Name": "UClampMax",
"Controller": "cpu",
- "File": "cpu.util.max"
+ "File": "cpu.uclamp.max"
}
],
diff --git a/shared/device.mk b/shared/device.mk
index 327e9fb..5b1065a 100644
--- a/shared/device.mk
+++ b/shared/device.mk
@@ -104,7 +104,22 @@
# GL implementation for virgl
PRODUCT_PACKAGES += \
- libGLES_mesa
+ libGLES_mesa \
+
+# GL/Vk implementation for gfxstream
+PRODUCT_PACKAGES += \
+ vulkan.ranchu \
+ hwcomposer.ranchu \
+ libandroidemu \
+ libOpenglCodecCommon \
+ libOpenglSystemCommon \
+ libGLESv1_CM_emulation \
+ lib_renderControl_enc \
+ libEGL_emulation \
+ libGLESv2_enc \
+ libvulkan_enc \
+ libGLESv2_emulation \
+ libGLESv1_enc
#
# Packages for the Vulkan implementation
diff --git a/shared/sepolicy/vendor/file_contexts b/shared/sepolicy/vendor/file_contexts
index bc9ab47..f44f0be 100644
--- a/shared/sepolicy/vendor/file_contexts
+++ b/shared/sepolicy/vendor/file_contexts
@@ -86,3 +86,16 @@
/vendor/lib(64)?/hw/vulkan.pastel.so u:object_r:same_process_hal_file:s0
/vendor/lib(64)?/libcuttlefish_fs.so u:object_r:same_process_hal_file:s0
/vendor/lib(64)?/vsoc_lib.so u:object_r:same_process_hal_file:s0
+
+# gfxstream (to be better factored (fewer libraries?))
+/vendor/lib(64)?/hw/vulkan\.ranchu\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libEGL_emulation\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libGLESv1_CM_emulation\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libGLESv2_emulation\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libOpenglCodecCommon\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libOpenglSystemCommon\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/lib_renderControl_enc\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libGLESv1_enc\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libGLESv2_enc\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libvulkan_enc\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libandroidemu\.so u:object_r:same_process_hal_file:s0
diff --git a/shared/sepolicy/vendor/genfs_contexts b/shared/sepolicy/vendor/genfs_contexts
index 76d034d..36a5a07 100644
--- a/shared/sepolicy/vendor/genfs_contexts
+++ b/shared/sepolicy/vendor/genfs_contexts
@@ -4,9 +4,6 @@
genfscon sysfs /devices/platform/rtc-test.0/rtc/rtc0/hctosys u:object_r:sysfs_rtc:s0
genfscon sysfs /devices/platform/rtc-test.1/rtc/rtc1/hctosys u:object_r:sysfs_rtc:s0
genfscon sysfs /devices/platform/rtc-test.2/rtc/rtc2/hctosys u:object_r:sysfs_rtc:s0
-genfscon sysfs /devices/platform/rtc-test.1/rtc/rtc1/wakeup1 u:object_r:sysfs_wakeup:s0
-genfscon sysfs /devices/platform/rtc-test.1/wakeup/wakeup0 u:object_r:sysfs_wakeup:s0
-genfscon sysfs /devices/platform/rtc-test.2/wakeup/wakeup2 u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/pci0000:00/0000:00:04.0/virtio2/net u:object_r:sysfs_net:s0 # qemu buried_eth0 & wlan0
genfscon sysfs /devices/pci0000:00/0000:00:05.0/virtio3/net u:object_r:sysfs_net:s0 # qemu rmnet0
genfscon sysfs /devices/pci0000:00/0000:00:07.0/virtio6/net u:object_r:sysfs_net:s0 # crosvm buried_eth0 & wlan0
@@ -16,3 +13,12 @@
genfscon sysfs /devices/pci0000:00/0000:00:0a.0/subsystem_vendor u:object_r:sysfs_gpu:s0
genfscon sysfs /devices/pci0000:00/0000:00:0a.0/uevent u:object_r:sysfs_gpu:s0
genfscon sysfs /devices/pci0000:00/0000:00:0a.0/vendor u:object_r:sysfs_gpu:s0
+
+# TODO(b/148802006): Work around core policy sysfs_wakeup label not working
+# All kernels
+genfscon sysfs /devices/platform/rtc-test.1/wakeup/wakeup0 u:object_r:sysfs_wakeup:s0
+genfscon sysfs /devices/platform/rtc-test.2/wakeup/wakeup2 u:object_r:sysfs_wakeup:s0
+# Kernels <=5.5
+genfscon sysfs /devices/platform/rtc-test.1/rtc/rtc1/wakeup1 u:object_r:sysfs_wakeup:s0
+# Kernels >5.5
+genfscon sysfs /devices/platform/rtc-test.1/rtc/rtc1/alarmtimer.0.auto/wakeup/wakeup1 u:object_r:sysfs_wakeup:s0
diff --git a/shared/sepolicy/vendor/hal_graphics_composer_default.te b/shared/sepolicy/vendor/hal_graphics_composer_default.te
index 6b89710..c3a7cab 100644
--- a/shared/sepolicy/vendor/hal_graphics_composer_default.te
+++ b/shared/sepolicy/vendor/hal_graphics_composer_default.te
@@ -1,3 +1,4 @@
+hal_client_domain(hal_graphics_composer_default, hal_graphics_allocator);
vndbinder_use(hal_graphics_composer_default)
allow hal_graphics_composer_default self:netlink_kobject_uevent_socket { bind create read };