summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
authorZach Reizner <zachr@google.com>2017-09-13 19:15:43 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-07-20 05:30:54 -0700
commit3a8100adc75d805300f23f7cff25e3e1d6b40b33 (patch)
tree08efcf2c527b429836d42d431ec84e7d096a94b0 /src/main.rs
parentf40bb190ece97c908f8dba2efc7c1aceb4fc0e0b (diff)
downloadcrosvm-3a8100adc75d805300f23f7cff25e3e1d6b40b33.tar
crosvm-3a8100adc75d805300f23f7cff25e3e1d6b40b33.tar.gz
crosvm-3a8100adc75d805300f23f7cff25e3e1d6b40b33.tar.bz2
crosvm-3a8100adc75d805300f23f7cff25e3e1d6b40b33.tar.lz
crosvm-3a8100adc75d805300f23f7cff25e3e1d6b40b33.tar.xz
crosvm-3a8100adc75d805300f23f7cff25e3e1d6b40b33.tar.zst
crosvm-3a8100adc75d805300f23f7cff25e3e1d6b40b33.zip
gpu: implement virtio-gpu
Basic 2D and 3D support is there. The drm_cursor_test and
null_platform_test in drm-tests should run to completion.

The extra device is hidden behind both a build time feature called 'gpu'
and the device is only added to a VM if the  '--gpu' flag is given.

TEST=build with --features=gpu;
     drm_cursor_test && null_platform_test
BUG=chromium:837073

Change-Id: Ic91acaaebbee395599d7e1ba41c24c9ed2d84169
Reviewed-on: https://chromium-review.googlesource.com/1036862
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 1b4fb64..63ad4e0 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -82,6 +82,7 @@ pub struct Config {
     multiprocess: bool,
     seccomp_policy_dir: PathBuf,
     cid: Option<u64>,
+    gpu: bool,
     plugin: Option<PathBuf>,
     plugin_root: Option<PathBuf>,
 }
@@ -105,6 +106,7 @@ impl Default for Config {
             multiprocess: !cfg!(feature = "default-no-sandbox"),
             seccomp_policy_dir: PathBuf::from(SECCOMP_POLICY_DIR),
             cid: None,
+            gpu: false,
             plugin: None,
             plugin_root: None,
         }
@@ -351,6 +353,9 @@ fn set_argument(cfg: &mut Config, name: &str, value: Option<&str>) -> argument::
                 }
             })?);
         }
+        "gpu" => {
+            cfg.gpu = true;
+        }
         "help" => return Err(argument::Error::PrintHelp),
         _ => unreachable!(),
     }
@@ -404,6 +409,8 @@ fn run_vm(args: std::env::Args) -> std::result::Result<(), ()> {
           Argument::value("tap-fd",
                           "fd",
                           "File descriptor for configured tap device.  Mutually exclusive with `host_ip`, `netmask`, and `mac`."),
+          #[cfg(feature = "gpu")]
+          Argument::flag("gpu", "(EXPERIMENTAL) enable virtio-gpu device"),
           Argument::short_flag('h', "help", "Print help message.")];
 
     let mut cfg = Config::default();