crosvm: clearer naming about GPU features
It's possible to compile the gpu device without virgl_renderer.
In fact, in many instances, this may be required.
This builds the gpu device default, but only with --gpu do I see
/dev/dri/renderN128, so this should be safe.
BUG=b:173630595
TEST=compile and run
Cq-Depend: chromium:2592111
Change-Id: I5fbf2de8a2f818a9ca2e5ac4a1a02c7797cff927
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2592089
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
diff --git a/Cargo.toml b/Cargo.toml
index 4a2eccd..be8e5e4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -31,7 +31,7 @@
]
[features]
-default = ["audio"]
+default = ["audio", "gpu"]
chromeos = ["base/chromeos"]
default-no-sandbox = []
audio = ["devices/audio"]
@@ -43,8 +43,9 @@
video-encoder = ["devices/video-encoder"]
wl-dmabuf = ["devices/wl-dmabuf", "gpu_buffer", "resources/wl-dmabuf"]
x = ["devices/x"]
-virtio-gpu-next = ["rutabaga_gfx/virtio-gpu-next"]
+virgl_renderer_next = ["rutabaga_gfx/virgl_renderer_next"]
composite-disk = ["protos/composite-disk", "protobuf", "disk/composite-disk"]
+virgl_renderer = ["devices/virgl_renderer"]
gfxstream = ["devices/gfxstream"]
gdb = ["gdbstub", "thiserror", "arch/gdb", "vm_control/gdb", "x86_64/gdb"]
diff --git a/devices/Cargo.toml b/devices/Cargo.toml
index 66aa19b..8c35682 100644
--- a/devices/Cargo.toml
+++ b/devices/Cargo.toml
@@ -6,12 +6,13 @@
[features]
audio = []
-gpu = ["gpu_buffer", "gpu_display", "rutabaga_gfx/virgl_renderer"]
+gpu = ["gpu_buffer", "gpu_display","rutabaga_gfx"]
tpm = ["protos/trunks", "tpm2"]
video-decoder = ["libvda"]
video-encoder = ["libvda"]
wl-dmabuf = []
x = ["gpu_display/x"]
+virgl_renderer = ["gpu", "rutabaga_gfx/virgl_renderer"]
gfxstream = ["gpu", "rutabaga_gfx/gfxstream"]
[dependencies]
diff --git a/rutabaga_gfx/Cargo.toml b/rutabaga_gfx/Cargo.toml
index bde3d82..14aed81 100644
--- a/rutabaga_gfx/Cargo.toml
+++ b/rutabaga_gfx/Cargo.toml
@@ -5,9 +5,9 @@
edition = "2018"
[features]
-virgl_renderer = []
-virtio-gpu-next = []
gfxstream = []
+virgl_renderer = []
+virgl_renderer_next = []
[dependencies]
data_model = { path = "../data_model" }
diff --git a/rutabaga_gfx/src/virgl_renderer.rs b/rutabaga_gfx/src/virgl_renderer.rs
index 95c476a..fa084c8 100644
--- a/rutabaga_gfx/src/virgl_renderer.rs
+++ b/rutabaga_gfx/src/virgl_renderer.rs
@@ -134,7 +134,7 @@
#[allow(unused_variables)]
fn map_func(resource_id: u32) -> ExternalMappingResult<(u64, usize)> {
- #[cfg(feature = "virtio-gpu-next")]
+ #[cfg(feature = "virgl_renderer_next")]
{
let mut map: *mut c_void = null_mut();
let map_ptr: *mut *mut c_void = &mut map;
@@ -147,13 +147,13 @@
Ok((map as u64, size as usize))
}
- #[cfg(not(feature = "virtio-gpu-next"))]
+ #[cfg(not(feature = "virgl_renderer_next"))]
Err(ExternalMappingError::Unsupported)
}
#[allow(unused_variables)]
fn unmap_func(resource_id: u32) {
- #[cfg(feature = "virtio-gpu-next")]
+ #[cfg(feature = "virgl_renderer_next")]
{
unsafe {
// Usually, process_gpu_command forces ctx0 when processing a virtio-gpu command.
@@ -412,7 +412,7 @@
resource_create_blob: ResourceCreateBlob,
mut iovecs: Vec<RutabagaIovec>,
) -> RutabagaResult<RutabagaResource> {
- #[cfg(feature = "virtio-gpu-next")]
+ #[cfg(feature = "virgl_renderer_next")]
{
let resource_create_args = virgl_renderer_resource_create_blob_args {
res_handle: resource_id,
@@ -436,7 +436,7 @@
resource_2d: None,
})
}
- #[cfg(not(feature = "virtio-gpu-next"))]
+ #[cfg(not(feature = "virgl_renderer_next"))]
Err(RutabagaError::Unsupported)
}
@@ -450,7 +450,7 @@
#[allow(unused_variables)]
fn map_info(&self, resource_id: u32) -> RutabagaResult<u32> {
- #[cfg(feature = "virtio-gpu-next")]
+ #[cfg(feature = "virgl_renderer_next")]
{
let mut map_info = 0;
let ret =
@@ -459,7 +459,7 @@
Ok(map_info)
}
- #[cfg(not(feature = "virtio-gpu-next"))]
+ #[cfg(not(feature = "virgl_renderer_next"))]
Err(RutabagaError::Unsupported)
}
@@ -482,7 +482,7 @@
#[allow(unused_variables)]
fn export_blob(&self, resource_id: u32) -> RutabagaResult<Arc<RutabagaHandle>> {
- #[cfg(feature = "virtio-gpu-next")]
+ #[cfg(feature = "virgl_renderer_next")]
{
let mut fd_type = 0;
let mut fd = 0;
@@ -505,13 +505,13 @@
handle_type: RUTABAGA_MEM_HANDLE_TYPE_DMABUF,
}))
}
- #[cfg(not(feature = "virtio-gpu-next"))]
+ #[cfg(not(feature = "virgl_renderer_next"))]
Err(RutabagaError::Unsupported)
}
#[allow(unused_variables)]
fn export_fence(&self, fence_id: u32) -> RutabagaResult<RutabagaHandle> {
- #[cfg(feature = "virtio-gpu-next")]
+ #[cfg(feature = "virgl_renderer_next")]
{
// Safe because the parameters are stack variables of the correct type.
let mut fd: i32 = 0;
@@ -526,7 +526,7 @@
handle_type: RUTABAGA_FENCE_HANDLE_TYPE_SYNC_FD,
})
}
- #[cfg(not(feature = "virtio-gpu-next"))]
+ #[cfg(not(feature = "virgl_renderer_next"))]
Err(RutabagaError::Unsupported)
}