mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-05 10:10:41 +00:00
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>
This commit is contained in:
parent
fb54f3ccd9
commit
028b8044bc
4 changed files with 18 additions and 16 deletions
|
@ -31,7 +31,7 @@ exclude = [
|
|||
]
|
||||
|
||||
[features]
|
||||
default = ["audio"]
|
||||
default = ["audio", "gpu"]
|
||||
chromeos = ["base/chromeos"]
|
||||
default-no-sandbox = []
|
||||
audio = ["devices/audio"]
|
||||
|
@ -43,8 +43,9 @@ video-decoder = ["devices/video-decoder"]
|
|||
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"]
|
||||
|
||||
|
|
|
@ -6,12 +6,13 @@ edition = "2018"
|
|||
|
||||
[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]
|
||||
|
|
|
@ -5,9 +5,9 @@ authors = ["The Chromium OS Authors"]
|
|||
edition = "2018"
|
||||
|
||||
[features]
|
||||
virgl_renderer = []
|
||||
virtio-gpu-next = []
|
||||
gfxstream = []
|
||||
virgl_renderer = []
|
||||
virgl_renderer_next = []
|
||||
|
||||
[dependencies]
|
||||
data_model = { path = "../data_model" }
|
||||
|
|
|
@ -134,7 +134,7 @@ fn export_query(resource_id: u32, export_fd: bool) -> RutabagaResult<Query> {
|
|||
|
||||
#[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 @@ fn map_func(resource_id: u32) -> ExternalMappingResult<(u64, usize)> {
|
|||
|
||||
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 @@ impl RutabagaComponent for VirglRenderer {
|
|||
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 @@ impl RutabagaComponent for VirglRenderer {
|
|||
resource_2d: None,
|
||||
})
|
||||
}
|
||||
#[cfg(not(feature = "virtio-gpu-next"))]
|
||||
#[cfg(not(feature = "virgl_renderer_next"))]
|
||||
Err(RutabagaError::Unsupported)
|
||||
}
|
||||
|
||||
|
@ -450,7 +450,7 @@ impl RutabagaComponent for VirglRenderer {
|
|||
|
||||
#[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 @@ impl RutabagaComponent for VirglRenderer {
|
|||
|
||||
Ok(map_info)
|
||||
}
|
||||
#[cfg(not(feature = "virtio-gpu-next"))]
|
||||
#[cfg(not(feature = "virgl_renderer_next"))]
|
||||
Err(RutabagaError::Unsupported)
|
||||
}
|
||||
|
||||
|
@ -482,7 +482,7 @@ impl RutabagaComponent for VirglRenderer {
|
|||
|
||||
#[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 @@ impl RutabagaComponent for VirglRenderer {
|
|||
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 @@ impl RutabagaComponent for VirglRenderer {
|
|||
handle_type: RUTABAGA_FENCE_HANDLE_TYPE_SYNC_FD,
|
||||
})
|
||||
}
|
||||
#[cfg(not(feature = "virtio-gpu-next"))]
|
||||
#[cfg(not(feature = "virgl_renderer_next"))]
|
||||
Err(RutabagaError::Unsupported)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue