Commit Graph

9 Commits

Author SHA1 Message Date
Matej Hrica
37082de03a gpu: add CLI arguments for configuring Rutabaga builder
Add command line arguments for configuring which capsets and features are
enabled when configuring Rutabaga.

Since we now specify the capsets explicitly we can drop the MAX_NUM_CAPSETS
constant and fix the TODO.

The curently exposed capsets for virglrenderer are: virgl and virgl2.
For gfxstream they are: gfxstream-vulkan and gfxstream-gles.

Signed-off-by: Matej Hrica <mhrica@redhat.com>
2025-01-22 15:15:38 +01:00
Matej Hrica
432acbae1a gpu: move start_backend from main.rs into lib.rs
This was an oversight - for the user to be able to use the crate as a
library, the start_backend needs to be part of the public API.

Signed-off-by: Matej Hrica <mhrica@redhat.com>
2025-01-22 15:15:38 +01:00
Matej Hrica
4ae31e73d5 gpu: remove CI workarounds
Remove the workaround to disable compiling the code on non-gnu targets.
(the CI now doesn't attempt compiling on musl)

Signed-off-by: Matej Hrica <mhrica@redhat.com>
2025-01-22 15:15:38 +01:00
Matej Hrica
a2f0f91857 gpu: remove unused duplicate constants
Remove capset constants definitions in protocol.rs, these are unecessary,
because we use the constants defined in the Rutabaga crate.

Signed-off-by: Matej Hrica <mhrica@redhat.com>
2025-01-22 15:15:38 +01:00
Matej Hrica
4c090cf776 gpu: rename --gpu-mode virgl-renderer -> virglrenderer
The name of the project/backend is "virglrenderer", the dash was added by
clap. Adding the dash seems confusing to the user, the old name is kept
as a hidden alias.

Signed-off-by: Matej Hrica <mhrica@redhat.com>
2025-01-22 15:15:38 +01:00
Manos Pitsidianakis
0a5249b903 gpu: guard gfxstream dependency with a feature
Add a new compile-time feature, `gfxstream`, which is included in the
default features. The only thing that changes is that we can now build
without requiring the `gfxstream_backend` library on compilation time,
which helps in cases it is not packaged in a distro, or is not available
at a user's build machine.

Also update `README.md` with information about the build-time feature.

This commit does not change anything other than make gfxstream gpu mode
opt-out at build-time. Everything should continue to work the same.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2024-12-02 10:57:44 +01:00
Dorinda Bassey
5f4614e632 vhost-device-gpu: Fix clippy warnings in tests
cleanup tests by addressing clippy warnings

Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
2024-11-29 15:37:03 +00:00
Dorinda Bassey
ce5c02f9ab vhost-device-gpu: Add more tests for the crate
This commit adds more tests for uncovered code paths
This test also covers some gpu commands functionality

Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
2024-11-29 15:37:03 +00:00
Dorinda Bassey
391e32b82f vhost-device-gpu: Add Initial Implementation
This program is a vhost-user backend daemon that provides
VIRTIO GPU device emulation as specified in the VIRTIO Spec v.1.2
https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html
This crate utilizes the rutabaga crate from crosvm with some
minor modification to rutabaga crate to fix compilation.
This crate depends on this PR[rust-vmm/vhost#239]
that implements support for QEMU's vhost-user-gpu protocol.

This device uses the rutabaga_gfx crate to offer two rendering backends:
1. Virglrenderer:
   - Rutabaga translates OpenGL API and Vulkan calls to an intermediate
     representation and allows for OpenGL acceleration on the host.
2. Gfxstream:
   - GLES and Vulkan calls are forwarded to the host.

These backends can be used by simply changing the `--gpu-mode` command
line option.
This crate also includes some modifications from libkrun virtio-gpu device
https://github.com/containers/libkrun/tree/main/src/devices/src/virtio/gpu

Fixes: rust-vmm#598

Co-authored-by: Dorinda Bassey <dbassey@redhat.com>
Co-authored-by: Matej Hrica <mhrica@redhat.com>

Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
Signed-off-by: Matej Hrica <mhrica@redhat.com>
2024-11-20 15:02:02 +01:00