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

Add options for 3d acceleration #1386

Merged
merged 2 commits into from Oct 26, 2021

Conversation

amezin
Copy link
Contributor

@amezin amezin commented Oct 20, 2021

When enabling video_accel3d, as graphics_gl is typically required, will
by default set it to true unless explicitly set to false.

Enabling these should result in a significant performance improvement
for any VM where the desktop is being used.

Fixes #893
Fixes #1009

@electrofelix
Copy link
Contributor

@amezin are the two of these options completely independent or should enabling one of them default to enabling both unless the other is explicitly disabled?

@amezin
Copy link
Contributor Author

amezin commented Oct 22, 2021

<gl enable='yes'/> is required for <acceleration accel3d='yes'/>. So yes, probably video_accel3d should imply graphics_gl

@electrofelix
Copy link
Contributor

I think a bit of work needed to get the xml generated to align with the tests, you should be able to run them locally by using the following steps at the base of the repo:

bundle install
bundle exec rspec --color --fail-fast --format documentation ./spec/unit/templates/domain_spec.rb

Once that passes, check:

bundle exec rspec --color --fail-fast --format documentation

@amezin
Copy link
Contributor Author

amezin commented Oct 22, 2021

If only I could make bundle install work...

compiling _libvirt.c
compiling common.c
common.c:27:10: fatal error: st.h: No such file or directory
   27 | #include <st.h>
      |          ^~~~~~
compilation terminated.
make: *** [Makefile:245: common.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/amezin/vagrant-libvirt/vendor/bundle/ruby/3.0.0/gems/ruby-libvirt-0.7.1 for inspection.
Results logged to /home/amezin/vagrant-libvirt/vendor/bundle/ruby/3.0.0/extensions/x86_64-linux/3.0.0/ruby-libvirt-0.7.1/gem_make.out

  /usr/lib/ruby/3.0.0/rubygems/ext/builder.rb:92:in `run'
  /usr/lib/ruby/3.0.0/rubygems/ext/builder.rb:43:in `block in make'
  /usr/lib/ruby/3.0.0/rubygems/ext/builder.rb:35:in `each'
  /usr/lib/ruby/3.0.0/rubygems/ext/builder.rb:35:in `make'
  /usr/lib/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:63:in `block in build'
  /usr/lib/ruby/3.0.0/tempfile.rb:317:in `open'
  /usr/lib/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:26:in `build'
  /usr/lib/ruby/3.0.0/rubygems/ext/builder.rb:158:in `build_extension'
  /usr/lib/ruby/3.0.0/rubygems/ext/builder.rb:192:in `block in build_extensions'
  /usr/lib/ruby/3.0.0/rubygems/ext/builder.rb:189:in `each'
  /usr/lib/ruby/3.0.0/rubygems/ext/builder.rb:189:in `build_extensions'
  /usr/lib/ruby/3.0.0/rubygems/installer.rb:837:in `build_extensions'
  /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/rubygems_gem_installer.rb:66:in `build_extensions'
  /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/rubygems_gem_installer.rb:26:in `install'
  /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/source/rubygems.rb:192:in `install'
  /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/installer/gem_installer.rb:54:in `install'
  /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/installer/gem_installer.rb:16:in `install_from_spec'
  /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/installer/parallel_installer.rb:186:in `do_install'
  /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/installer/parallel_installer.rb:177:in `block in worker_pool'
  /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/worker.rb:62:in `apply_func'
  /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/worker.rb:57:in `block in process_queue'
  /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/worker.rb:54:in `loop'
  /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/worker.rb:54:in `process_queue'
  /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.26/lib/bundler/worker.rb:91:in `block (2 levels) in create_threads'

An error occurred while installing ruby-libvirt (0.7.1), and Bundler cannot continue.

In Gemfile:
  vagrant-libvirt was resolved to 0.5.4.pre.41, which depends on
    fog-libvirt was resolved to 0.9.0, which depends on
      ruby-libvirt

But gem build vagrant-libvirt.gemspec + vagrant plugin install vagrant-libvirt-*.gem somehow works.

I've built a distro package (Arch) from patched ruby-libvirt (replacing <st.h> with <ruby/st.h>), installed it (system-wide), but bundler still tries to build its own version (maybe it's how it should work, idk, never tried to write anything other than a Vagrantfile in Ruby before).

Oops, I didn't notice that Vagrant runs on ruby 2.7, and the default one in the system is 3.0. With 2.7 everything installs/builds fine.

A script that runs the test suite in Docker/podman would help a lot.

@amezin amezin marked this pull request as ready for review October 22, 2021 19:22
@electrofelix
Copy link
Contributor

I'm only on mobile at the moment, so I can't fully test out anything. I suspect it's trying to install it's own gem of it to isolate the environment, I'm sure there is a way to tell bundler to use the system gem in this case.

The unit tests for this project bandaid ruby-libvirt to work around the problem as well in a different way, it might be possible to follow that instead?

@amezin
Copy link
Contributor Author

amezin commented Oct 23, 2021

@electrofelix no need for bandaids, with ruby 2.7 bundle install (bundle-2.7 install on Arch) works out of the box (and now that it works I've fixed the issues and the test suite passes)

@electrofelix electrofelix merged commit dcbfea2 into vagrant-libvirt:master Oct 26, 2021
amezin added a commit to ddterm/gnome-shell-extension-ddterm that referenced this pull request Oct 26, 2021
mmguero pushed a commit to mmguero-dev/vagrant-libvirt that referenced this pull request Nov 3, 2021
When enabling video_accel3d, as graphics_gl is typically required, will 
by default set it to true unless explicitly set to false.

Enabling these should result in a significant performance improvement 
for any VM where the desktop is being used.

Fixes: vagrant-libvirt#893
Fixes: vagrant-libvirt#1009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants