-
Notifications
You must be signed in to change notification settings - Fork 71
vhost-device-gpu: Refactor vhost-device-gpu #890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
a99c82b to
bd23eff
Compare
|
Looks like CI is failing @dorindabassey |
Yeah, I already fixed it in the rust-vmm container, CI is probably still using an old image. |
bd23eff to
1f64df8
Compare
|
We just merged #892 with latest rust-vmm-ci, so I rebased this PR. |
No, I also need to update the container version? Will do thanks! |
@dorindabassey yep :-( see rust-vmm/rust-vmm-ci#196 |
99c5927 to
06e2ef3
Compare
|
It's been over a week since the rust-vmm-ci container changes were updated, @stefano-garzarella any idea why this is still building against the old container? |
|
@dorindabassey I guess you need to update the rust-vmm-ci submodule in this PR or rebase on main if we already updated it. |
267b971 to
b53a55f
Compare
|
@dorindabassey can you fix the coverage? (increasing tests or just adjusting the current value) |
Yes, I'm working on it. Since gfxstream tests cannot run in CI without GPU drivers, excluding them in CI caused the drop I will increase the coverage in other areas and probably adjust the current value to meet expectations. |
2df043d to
12d1f59
Compare
12d1f59 to
af3f072
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this work, I did a quick review, but IMO it's too much for a single commit.
Why not splitting it?
I left some comments about SPDX and changes that should be split, but I'd like to know if we can split even more. (not sure if we can, but would be nice, otherwise, at least for me, it's hard to review)
I considered splitting the commit, but given the scope of the changes, it would have been quite time-consuming due to how closely related the changes are. But you are right, to make it easy for review I will split it. |
f92b3b3 to
4abf678
Compare
If splitting doesn't make sense, you can avoid that. I just found 2 cases where IMO they must be split. |
|
@dorindabassey what package I should install on Fedora to build this? |
Rename the 'gfxstream' feature flag to 'backend-gfxstream' for consistency with the new modular backend architecture. Signed-off-by: Dorinda Bassey <[email protected]>
Add virglrenderer-rs as an optional dependency and introduce the backend-virgl feature flag to enable the virglrenderer backend. Signed-off-by: Dorinda Bassey <[email protected]>
This commit refactors vhost-device-gpu by separating
virglrenderer from rutabaga, and using gfxstream via
rutabaga, Simplifying future backend development.
This commit introduces a significant refactor of the
virtio-gpu backend architecture:
- Transition `gfxstream` support to use `Rutabaga`
abstraction.
- Decouple `virglrenderer` from `Rutabaga`, allowing
it to be used as standalone.
- Unify backend handling using thread-local storage
and macro-based runtime dispatch.
Key Changes:
VirglRenderer Backend:
- `virgl.rs` is now a standalone backend that
directly calls `libvirglrenderer` functions.
- Removed reliance on `rutabaga` for virgl path.
Gfxstream Backend via Rutabaga:
- Introduced `gfxstream.rs` backend using `rutabaga`
- Thread-local `GfxstreamAdapter` manages its own
`Rutabaga` instance, initialized lazily.
- Preserved internal `GfxstreamResource` tracking
with scanout support and memory handling.
Renderer Selection Logic:
- In `device.rs`, `lazy_init_and_handle_event()` now:
- Dispatches `VirglRendererAdapter` and
`GfxstreamAdapter` using thread-local storage(TLS)
- Introduced `extract_backend_and_vring()` helper for
reusing backend setup logic.
Code Deduplication:
- Abstracted common logic for both backends to common.rs.
- Shared helpers reused between gfxstream and virgl.
- Improved modularity with fewer duplicated error
handling branches.
Testing and Validation:
- Replaced `virtio_gpu.rs` testing paths with new unit
tests for `gfxstream.rs` and `virgl.rs`.
- Added code coverage for the new refactored crate.
- Update coverage file to reflect the drop in coverage
due to exclusion of some gfxstream tests from CI
since they can't run in CI without GPU drivers.
Signed-off-by: Dorinda Bassey <[email protected]>
This setup is no longer needed since: - The current build system and GPU backend integration have been restructured. - CI now works with the virglrenderer crate. - Environment variable overrides are no longer necessary to avoid CI failures. Signed-off-by: Dorinda Bassey <[email protected]>
you need virglrenderer, virglrenderer-devel, gfxstream and gfxstream-devel from fedora package. For gfxstream you could also install from source this tag v0.1.2-gfxstream-release |
4abf678 to
6716c6b
Compare
Summary of the PR
This PR refactors vhost-device-gpu by separating
virglrenderer from rutabaga, and using gfxstream via
rutabaga, Simplifying future backend development.
This PR introduces a significant refactor of the
virtio-gpu backend architecture:
gfxstreamsupport to useRutabagaabstraction.
virglrendererfromRutabaga, allowingit to be used as standalone.
and macro-based runtime dispatch.
Key Changes:
VirglRenderer Backend:
virgl.rsis now a standalone backend thatdirectly calls
libvirglrendererfunctions.rutabagafor virgl path.Gfxstream Backend via Rutabaga:
gfxstream.rsbackend usingrutabagaGfxstreamAdaptermanages its ownRutabagainstance, initialized lazily.GfxstreamResourcetrackingwith scanout support and memory handling.
Renderer Selection Logic:
device.rs,lazy_init_and_handle_event()now:VirglRendererAdapterandGfxstreamAdapterusing thread-local storage(TLS)extract_backend_and_vring()helper forreusing backend setup logic.
Code Deduplication:
handling branches.
Testing and Validation:
virtio_gpu.rstesting paths with new unittests for
gfxstream.rsandvirgl.rs.Requirements
Before submitting your PR, please make sure you addressed the following
requirements:
git commit -s), and the commit message has max 60 characters for thesummary and max 75 characters for each description line.
test.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafecode is properly documented.