mirror of
https://github.com/rust-vmm/vhost-device.git
synced 2026-01-11 16:36:15 +00:00
gpu: Expose Venus capset for virglrenderer backend
Expose Venus capability set support using the virglrenderer backend, enabled by the new blob resource support. Signed-off-by: Matej Hrica <mhrica@redhat.com>
This commit is contained in:
parent
d9cabd8883
commit
6dcc71ef16
@ -154,10 +154,12 @@ impl VirglRendererAdapter {
|
||||
gpu_backend: GpuBackend,
|
||||
) -> Self {
|
||||
let capsets = config.capsets();
|
||||
let venus_enabled = capsets.contains(GpuCapset::VENUS);
|
||||
|
||||
let virglrenderer_flags = VirglRendererFlags::new()
|
||||
.use_virgl(true)
|
||||
.use_venus(true)
|
||||
.use_venus(venus_enabled)
|
||||
.use_render_server(venus_enabled)
|
||||
.use_egl(config.flags().use_egl)
|
||||
.use_gles(config.flags().use_gles)
|
||||
.use_glx(config.flags().use_glx)
|
||||
|
||||
@ -30,7 +30,7 @@ use log::info;
|
||||
#[cfg(feature = "backend-gfxstream")]
|
||||
use rutabaga_gfx::{RUTABAGA_CAPSET_GFXSTREAM_GLES, RUTABAGA_CAPSET_GFXSTREAM_VULKAN};
|
||||
#[cfg(feature = "backend-virgl")]
|
||||
use rutabaga_gfx::{RUTABAGA_CAPSET_VIRGL, RUTABAGA_CAPSET_VIRGL2};
|
||||
use rutabaga_gfx::{RUTABAGA_CAPSET_VENUS, RUTABAGA_CAPSET_VIRGL, RUTABAGA_CAPSET_VIRGL2};
|
||||
use thiserror::Error as ThisError;
|
||||
use vhost_user_backend::VhostUserDaemon;
|
||||
use vm_memory::{GuestMemoryAtomic, GuestMemoryMmap};
|
||||
@ -68,7 +68,9 @@ bitflags! {
|
||||
#[cfg(feature = "backend-virgl")]
|
||||
const VIRGL2 = 1 << RUTABAGA_CAPSET_VIRGL2 as u64;
|
||||
#[cfg(feature = "backend-virgl")]
|
||||
const ALL_VIRGLRENDERER_CAPSETS = Self::VIRGL.bits() | Self::VIRGL2.bits();
|
||||
const VENUS = 1 << RUTABAGA_CAPSET_VENUS as u64;
|
||||
#[cfg(feature = "backend-virgl")]
|
||||
const ALL_VIRGLRENDERER_CAPSETS = Self::VIRGL.bits() | Self::VIRGL2.bits() | Self::VENUS.bits();
|
||||
|
||||
#[cfg(feature = "backend-gfxstream")]
|
||||
const GFXSTREAM_VULKAN = 1 << RUTABAGA_CAPSET_GFXSTREAM_VULKAN as u64;
|
||||
@ -98,6 +100,8 @@ impl Display for GpuCapset {
|
||||
Self::VIRGL => write!(f, "virgl")?,
|
||||
#[cfg(feature = "backend-virgl")]
|
||||
Self::VIRGL2 => write!(f, "virgl2")?,
|
||||
#[cfg(feature = "backend-virgl")]
|
||||
Self::VENUS => write!(f, "venus")?,
|
||||
#[cfg(feature = "backend-gfxstream")]
|
||||
Self::GFXSTREAM_VULKAN => write!(f, "gfxstream-vulkan")?,
|
||||
#[cfg(feature = "backend-gfxstream")]
|
||||
@ -334,7 +338,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_default_num_capsets() {
|
||||
#[cfg(feature = "backend-virgl")]
|
||||
assert_eq!(GpuConfig::DEFAULT_VIRGLRENDER_CAPSET_MASK.num_capsets(), 2);
|
||||
assert_eq!(GpuConfig::DEFAULT_VIRGLRENDER_CAPSET_MASK.num_capsets(), 3);
|
||||
#[cfg(feature = "backend-gfxstream")]
|
||||
assert_eq!(GpuConfig::DEFAULT_GFXSTREAM_CAPSET_MASK.num_capsets(), 2);
|
||||
}
|
||||
|
||||
@ -24,6 +24,10 @@ pub enum CapsetName {
|
||||
#[cfg(feature = "backend-virgl")]
|
||||
Virgl2 = GpuCapset::VIRGL2.bits(),
|
||||
|
||||
/// [virglrenderer] Venus (Vulkan) implementation
|
||||
#[cfg(feature = "backend-virgl")]
|
||||
Venus = GpuCapset::VENUS.bits(),
|
||||
|
||||
/// [gfxstream] Vulkan implementation (partial support only){n}
|
||||
/// NOTE: Can only be used for 2D display output for now, there is no
|
||||
/// hardware acceleration yet
|
||||
|
||||
Loading…
Reference in New Issue
Block a user