Skip to content
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

vhost-device-gpu: Expose more options as CLI flags #797

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mtjhrc
Copy link

@mtjhrc mtjhrc commented Jan 2, 2025

Summary of the PR

This PR allows the user to configure more flags, that are passed to Rutabaga. By specifying the individual capsets explicitly this also fixes a TODO, which hard-coded the number of enabled capsets.

Note: While you can enable some features using this, such as Venus or gfxstream-vulkan, these capsets are not really useful without blob resource support (to be added in other PR, depends on changes to QEMU) - you can enable the capsets, but not anything useful using them. This has been the case prior to this PR, but the capsets were just enabled implicitly.

Requirements

Before submitting your PR, please make sure you addressed the following
requirements:

  • All commits in this PR have Signed-Off-By trailers (with
    git commit -s), and the commit message has max 60 characters for the
    summary and max 75 characters for each description line.
  • All added/changed functionality has a corresponding unit/integration
    test.
  • All added/changed public-facing functionality has entries in the "Upcoming
    Release" section of CHANGELOG.md (if no such section exists, please create one).
  • Any newly added unsafe code is properly documented.

@mtjhrc mtjhrc changed the title vhost-user-gpu: Expose more options as CLI flags vhost-device-gpu: Expose more options as CLI flags Jan 2, 2025
.set_use_glx(gpu_config.flags().use_glx)
.set_use_gles(gpu_config.flags().use_gles)
.set_use_surfaceless(gpu_config.flags().use_surfaceless)
.set_use_render_server(gpu_config.requires_render_server())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to add an option for this set_use_vulkan(true) and also make it default for the gfxstream mode to set it automatically if vulkan usage hasn't been set. also I think we should set this set_use_vulkan(true) for the virglrenderer venus capset.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless something changes in Rutabaga, we don't really enable this manually, this is already enabled automatically by Rutabaga here:
https://github.com/google/crosvm/blob/078ef31b7a8c04529dcdfcb1badefea6f5245d9e/rutabaga_gfx/src/rutabaga_core.rs#L1327-L1336

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I didn't see that before. since it's already enabled by rutabaga we can leave it as it is.

Possible values:
- virgl: [virglrenderer] OpenGL implementation, superseded by Virgl2
- virgl2: [virglrenderer] OpenGL implementation
- venus: [virglrenderer] Vulkan implementation
Copy link
Contributor

@dorindabassey dorindabassey Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ResourceCreate2D and other gpu commands fails with Rutabaga component error when the venus capset is explicitly set, have you tried it with the resource_blob PR? maybe it needs it to function properly?

mtjhrc added 4 commits January 6, 2025 14:54
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.

If the user selects virglrender the capsets are configured the default capset
configuration is suitable for running virgl/venus guests. If the user select
gfxstream, by default vulkan is enabled, this is suitable for running
Android with gfxstream.

Signed-off-by: Matej Hrica <[email protected]>
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 <[email protected]>
This was an oversight, for the user to be able to use the crate as a
library, the start_backend should be part of the public API.

Signed-off-by: Matej Hrica <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants