aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-I Wu <olv@google.com>2021-04-12 09:47:38 -0700
committerCommit Bot <commit-bot@chromium.org>2021-04-17 03:03:01 +0000
commit91df65629142929f2d66d0b5944885cc50c730cb (patch)
treeeb153db861b9b4a3c6b8ddd5157b48d73cb66af5
parente25859becb6a7c68e65afe09fa69b5296b4c05a7 (diff)
downloadcrosvm-91df65629142929f2d66d0b5944885cc50c730cb.tar.gz
devices: disable vulkan by default
Because the default value for mode is GpuMode::ModeVirglRenderer, make the default value for use_vulkan false as well. Set use_vulkan to true when mode is set to GpuMode::ModeGfxstream for backward compatibility. BUG=b:178104043 TEST=cargo build Change-Id: Idf1417f04d23999cf5a03b0bf640973b69de93e7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2823012 Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Reviewed-by: David Riley <davidriley@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Chia-I Wu <olv@google.com> Commit-Queue: Chia-I Wu <olv@google.com>
-rw-r--r--devices/src/virtio/gpu/mod.rs2
-rw-r--r--src/main.rs19
2 files changed, 20 insertions, 1 deletions
diff --git a/devices/src/virtio/gpu/mod.rs b/devices/src/virtio/gpu/mod.rs
index 55ecbe94c..3367fe682 100644
--- a/devices/src/virtio/gpu/mod.rs
+++ b/devices/src/virtio/gpu/mod.rs
@@ -97,7 +97,7 @@ impl Default for GpuParameters {
renderer_use_surfaceless: true,
gfxstream_use_guest_angle: false,
gfxstream_use_syncfd: true,
- use_vulkan: true,
+ use_vulkan: false,
mode: GpuMode::ModeVirglRenderer,
cache_path: None,
cache_size: None,
diff --git a/src/main.rs b/src/main.rs
index 6ae5856e0..43434ea34 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -369,6 +369,10 @@ fn parse_gpu_options(s: Option<&str>) -> argument::Result<GpuParameters> {
#[cfg(feature = "gfxstream")]
{
+ if !vulkan_specified && gpu_params.mode == GpuMode::ModeGfxstream {
+ gpu_params.use_vulkan = true;
+ }
+
if vulkan_specified || syncfd_specified || angle_specified {
match gpu_params.mode {
GpuMode::ModeGfxstream => {}
@@ -2798,6 +2802,21 @@ mod tests {
#[cfg(all(feature = "gpu", feature = "gfxstream"))]
#[test]
+ fn parse_gpu_options_default_vulkan_support() {
+ assert!(
+ !parse_gpu_options(Some("backend=virglrenderer"))
+ .unwrap()
+ .use_vulkan
+ );
+ assert!(
+ parse_gpu_options(Some("backend=gfxstream"))
+ .unwrap()
+ .use_vulkan
+ );
+ }
+
+ #[cfg(all(feature = "gpu", feature = "gfxstream"))]
+ #[test]
fn parse_gpu_options_gfxstream_with_vulkan_specified() {
assert!(
parse_gpu_options(Some("backend=gfxstream,vulkan=true"))