summary refs log tree commit diff
path: root/devices/src/virtio/mod.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 /devices/src/virtio/mod.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 'devices/src/virtio/mod.rs')
-rw-r--r--devices/src/virtio/mod.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/devices/src/virtio/mod.rs b/devices/src/virtio/mod.rs
index 99907f0..8e8e4b6 100644
--- a/devices/src/virtio/mod.rs
+++ b/devices/src/virtio/mod.rs
@@ -10,6 +10,8 @@ mod mmio;
 mod block;
 mod rng;
 mod net;
+#[cfg(feature = "gpu")]
+mod gpu;
 mod wl;
 
 pub mod vhost;
@@ -20,6 +22,8 @@ pub use self::mmio::*;
 pub use self::block::*;
 pub use self::rng::*;
 pub use self::net::*;
+#[cfg(feature = "gpu")]
+pub use self::gpu::*;
 pub use self::wl::*;
 
 const DEVICE_ACKNOWLEDGE: u32 = 0x01;
@@ -33,9 +37,13 @@ const TYPE_NET: u32 = 1;
 const TYPE_BLOCK: u32 = 2;
 const TYPE_RNG: u32 = 4;
 const TYPE_BALLOON: u32 = 5;
+#[allow(dead_code)]
+const TYPE_GPU: u32 = 16;
 const TYPE_VSOCK: u32 = 19;
 const TYPE_WL: u32 = 30;
 
+const VIRTIO_F_VERSION_1: u32 = 32;
+
 const INTERRUPT_STATUS_USED_RING: u32 = 0x1;
 const INTERRUPT_STATUS_CONFIG_CHANGED: u32 = 0x2;