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>
This commit is contained in:
Chia-I Wu 2021-04-12 09:47:38 -07:00 committed by Commit Bot
parent e25859becb
commit 91df656291
2 changed files with 20 additions and 1 deletions

View file

@ -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,

View file

@ -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 => {}
@ -2796,6 +2800,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() {