FS#49752 - [virtualbox-guest-utils] No hardware 3D acceleration in the guest.

Attached to Project: Community Packages
Opened by Olivier (olive) - Friday, 17 June 2016, 16:10 GMT
Last edited by Toolybird (Toolybird) - Saturday, 01 April 2023, 01:45 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Christian Hesse (eworm)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 22
Private No

Details

Description:
By default, there is no hardware 3D acceleration in the guest as can be seen with glxinfo.

OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.8, 256 bits)

(hardware 3D accelerated should show "chromium"). This is apparently due to a change in the upstream package and there is a long discussion for what appear to be exactly the same problem here: https://www.virtualbox.org/ticket/12320 .
A hack that works (gathered from the previous link) is to add LD_PRELOAD=/lib/VBoxOGL.so in the environment. with "LD_PRELOAD=/lib/VBoxOGL.so glxinfo | grep -i render" ; I get:
OpenGL renderer string: Chromium
That's it!

Apparently upstream has a script that put the VBoxOGL.so library in a directory and refer to this directory in /etc/ld.so.conf.d . This is apparently done at runtime according to a detection of the availability of 3D that I don't fully understand. Anyway, I have had no success trying this trick; further investigation is needed.

Note: this was discussed in the forum, see: https://bbs.archlinux.org/viewtopic.php?pid=1635249#p1635249

Additional info:
* package version(s)
5.0.20-1
* config and/or log files etc.
See in the description.
Steps to reproduce:
See in the description.
This task depends upon

Closed by  Toolybird (Toolybird)
Saturday, 01 April 2023, 01:45 GMT
Reason for closing:  Fixed
Additional comments about closing:  Refer recent comments
Comment by Sébastien Luttringer (seblu) - Monday, 20 June 2016, 23:59 GMT
I made few tests tonight. Here is my first feedbacks.

1) There is working 3D hardware accell in the guest. That's not enabled by default but it's there;
2) The missing part seems to be the overrides of mesa libraries with vbox specific;
3) Selecting Vbox mesa library via LD_PRELOAD cause display issue with a default gnome environment.
4) Installing guest additions with the ISO overrides libEG.so and libELG.so using ld.so.conf.d.
Comment by Olivier (olive) - Tuesday, 21 June 2016, 07:46 GMT
I agree with your remark 1-2. I don't run Gnome, but I have had problems with chromium and I agree that LD_PRELOAD is not the best solution. Have you figured out a proper way to enable the 3D acceleration? What has to be put in ls.so.conf.d?

It seems that the iso does the configuration you mention at run time when the service is started (extract the installer and lok at the vboxadd script).

Anyway this 3D should be available if enabled in the Virtualbox GUI, as intended by upstream, so an update of the package is needed.
Comment by Olivier (olive) - Tuesday, 21 June 2016, 08:25 GMT
OK, after more test I have now understood what upstream does.

You need to create a separate directory with the VirtualBox libraries and make symbolic links libEGL.so.1 -> VBoxEGL.so and libGL.so.1 -> VBoxOGL.so. Then you need to put this directory in ld.so.conf. Note that the library VBoxEGL.so is not present in the package (but well in the upstream iso).

Upstream does that at run time only if the check "enable 3D" is made in the VirtualBox GUI. This is checked with "/usr/bin/VBoxClient --check3d". I think that the rationale is that if 3D is unchecked then you don't want to mess around with these potentially buggy libraries. (This is the vboxadd script).

All of this confirm that the 3D part is mispackaged

Comment by Sébastien Luttringer (seblu) - Tuesday, 21 June 2016, 21:13 GMT
Mispackaged? What a pleasure to read you...
I'm happy that you finally understand what upstream does and so my point 4.
Comment by Ashley Penney (apenney) - Thursday, 28 July 2016, 21:00 GMT
I don't understand, is anything going to happen to fix this out of the box? This is still a problem with 5.2.1 and I don't want to have to install via the ISO to get Cinnamon working.
Comment by Norbert Pfeiler (npfeiler) - Saturday, 20 August 2016, 00:20 GMT
I can’t agree on 3) above, sure some opengl apps are pretty buggy but gnome-shell+nautilus work fine.
Also if this is a reason to remove this feature, i don’t agree either since you have the ability to toggle 3D accel in the host vbox settings and therefore decide if you want glitchy accel or none at all.

Currently the feature to toggle overall 3D acceleration is just not present.
Comment by Sébastien Luttringer (seblu) - Saturday, 20 August 2016, 00:35 GMT
No feature has been removed on purpose, it was not implemented in the package.
Best way to get this fixed is to propose a patch.
Comment by Norbert Pfeiler (npfeiler) - Saturday, 20 August 2016, 04:23 GMT
The separate directory ld.so.conf way is working for libGL. libEGL is missing though and it doesn’t provide the toggle logic (i think).

What’s wrong with the upstream scripts?
Comment by Olivier (olive) - Saturday, 20 August 2016, 08:42 GMT
@seblu. I have told you what you should do. It is not just a simple patch but the fix doesn't seem that complicated either. I have finally installed upstream iso which work fine. You should manage to have the library VBoxEGL.so and VBoxOGL.so. You can take a precompiled version from the iso or it should not be awfully difficult to compile them (although I have not investigated this point). From this you can implement a simple bash script that does what I have mentioned or to use upstream script. What exactly is the problem?

@npfeiler (and @seblu). The toggle is implemented via a simple script. Basically. Put two symlinks libEGL.so.1 -> /opt/VBoxGuestAdditions-5.1.4/lib/VBoxEGL.so and libGL.so.1 -> /opt/VBoxGuestAdditions-5.1.4/lib/VBoxOGL.so in a directory; say following upstream: /var/lib/VBoxGuestAdditions/lib. Keep a file 00vboxvideo.conf (with a single line: /var/lib/VBoxGuestAdditions/lib) in a private directory; say /usr/share/vbox. Then include the following code (untested) in the script that is launched by systemd (before any other actions).

if /usr/bin/VBoxClient --check3d ; then
ln -sf /etc/ld.so.conf.d/00vboxvideo.conf /usr/share/vbox/00vboxvideo.conf
else
rm -f /etc/ld.so.conf.d/00vboxvideo.conf
fi
ldconfig

If problems remains, let's discuss it, but don't just left this doing nothing. What I have seen is that chromium seems incompatible with 3D (windows is white with black strip and nothing else). I have not tested it for Gnome that I don't use. Of course you can always disable the 3D for chromium only by launching it with the --no-gpu command line switch.
Comment by Sébastien Luttringer (seblu) - Monday, 22 August 2016, 21:11 GMT
please don't tell me what to do. Just do it! Then, send me a _PKGBUILD_ patch.
Comment by Omri Mor (omor1) - Saturday, 22 October 2016, 04:45 GMT
I tried opening a separate issue about the missing VBoxEGL.so, but was told that it was part of this one.
In any case, VBoxEGL.so isn't being packaged in virtualbox-guest-utils, despite being built.
The code for it's been around in SVN for about 10 months, though I think it was first released in 5.0.28.
`install -m755 VBoxEGL.so "$pkgdir/usr/lib"` needs to be added to package_virtualbox-guest-utils() in the PKGBUILD, right under where it installs VBoxOGL*.so.
Once that is done I can tackle getting setting up the script and ld.so.conf.
I've attached a patch for the PKGBUILD, but it's quite literally a one-line change.
Comment by Omri Mor (omor1) - Sunday, 30 October 2016, 05:45 GMT
I've created the necessary script and PKGBUILD patches. In short testing, it appears to work – the OpenGL renderer string now appears as Chromium, and glxgears is not using the CPU to render.
There may still be bugs – I haven't extensively tested. I would certainly recommend putting it in the testing repository before promoting it to the main community repository.
There are 4 components to this: PKGBUILD changes to install libEGL and the scripts, vboxservice.service changes to enable/disable the links when vboxservice starts up and shuts down, a script to setup the links for ldconfig when 3D is enabled in VirtualBox, and the ldconfig conf file.

Please tell me if there are any problems.
Comment by Cedric Girard (Xdark) - Monday, 30 January 2017, 13:53 GMT
I haven't been able to make it work with the patch. Is there anything else to change?
Comment by XazZ (XazZ) - Saturday, 15 April 2017, 13:04 GMT
did anybody get it working with the patches posted above?
it would be great to have 3D acceleration in Arch when used inside a VirtualBox guest.
Comment by Aaron Masover (amasover) - Monday, 18 June 2018, 22:06 GMT
I applied @omor1's patch on top of the latest package source, ran makepkg, and then installed via pacman -U. So far it seems to work well...less buggy then using LD_PRELOAD. The only snag I ran into is that I had to manually enable vboxservice.service for some reason. I have only tested this with i3wm. I would recommend others to test if you have a chance.
Comment by philanecros (philanecros) - Friday, 29 June 2018, 09:49 GMT
Applied @omor1's patch on the latest version 5.2.12-2 and it works to avoid cinnamon going into software rendering mode. (The patches need to be updated on latest package source.)
Comment by Nicholas K. (Keridos) - Saturday, 22 September 2018, 10:15 GMT
Can confirm this still happens on linux 4.18.9-arch1-1 and virtualbox-guest-modules-arch 5.2.18-11.
Comment by Shahab (shahab) - Wednesday, 14 November 2018, 16:25 GMT
The solution works for me too. However, it takes forever to compile. @Christian, is there any particular reason that you haven't integrated this solution?
Comment by Olivier (olive) - Sunday, 02 December 2018, 17:12 GMT
I have ceased to use this package for some time due to the disappointment I had with this issue and the way it is packaged. If installed from upstream the script responsible for doing this is /opt/VBoxGuestAdditions-5.2.22/init/vboxadd ; the check of the availability of 3D is simply done testing the return code of /usr/bin/VBoxClient --check3d.

Why don't repackage the upstream version? The upstream version works well and the philosophy of ArchLinux is to stay as close as upstream as possible. Rewriting the equivalent of upstream script in a way that may or may not work is not the proper solution IMHO. Is the purpose of a package not simply to ease the installation of upstream software? None of the "fixes" proposed seems to even try to achieve this. Upstream scripts are more complex than the simple 3-line scripts proposed in the patches, so other issues will inevitably arise.

Simply repackaging the upstream version shouldn't be that hard. I agree that upstream installer is meant to be run directly and cannot easily be used to make a package. But we could track which files are exactly installed and copy these files by hand.

If we want to compile from sources then simply replace the compiled files with the compiled version. I don't think upstream scripts are available outside the iso.
Comment by M. Greyson Christoforo (greyltc) - Sunday, 19 July 2020, 17:20 GMT
I think this is fixed today
Comment by Antonio Vázquez Blanco (antoniovazquezblanco) - Thursday, 09 June 2022, 21:06 GMT
After some research it seems this issue is no longer present.

Virtualbox version 6 provides 3D acceleration via VMSVGA without the need to package any `VBoxOGL` or `VBoxEGL` that no longer exist.

Should this issue be closed?

Thanks

Loading...