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

3D hardware acceleration? #20

Open
kenderipa opened this issue Mar 18, 2024 · 35 comments
Open

3D hardware acceleration? #20

kenderipa opened this issue Mar 18, 2024 · 35 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@kenderipa
Copy link

kenderipa commented Mar 18, 2024

Hello again,

I'm trying to build a Lutris AppImage. After building and l;aunching, it has following output:

Vulkan is not available or your system isn't Vulkan capable

Vulkan is, of course, installed on my system. How do I expose it for the AppImage (it probably tries to call vulkaninfo).

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 18, 2024

Hi, this is a (sad) known issue... and a work in progress, see fsquillace/junest#344

Latelly I discovered that by installing libselinux (from AUR, in the AppImage... you need to enable $BASICSTUFF, $COMPILERS and the AUR key) and by adding the following line into the AppRun (before "EXEC=")...

export LD_LIBRARY_PATH=/lib/:/lib64/:/lib/x86_64-linux-gnu/:/usr/lib/:"${LD_LIBRARY_PATH}"'

something changes in the output messages.

However, I've not done furter experiments about this.

Would you try by yourself?

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 18, 2024

Right now I've tried to build SuperTuxKart by adding libselinux in "DEPENDENCES" and the line above in the AppRun, this is the message I have:

..:: Antarctica Rendering Engine 2.0 ::..
[info   ] [IrrDriver Logger]: ..:: Antarctica Rendering Engine 2.0 ::..
[info   ] [IrrDriver Logger]: Could not initialize display!
[info   ] [IrrDriver Logger]: ..:: Antarctica Rendering Engine 2.0 ::..
[info   ] [IrrDriver Logger]: Could not initialize display!
[info   ] [IrrDriver Logger]: ..:: Antarctica Rendering Engine 2.0 ::..
[info   ] [IrrDriver Logger]: Could not initialize display!
[info   ] [IrrDriver Logger]: ..:: Antarctica Rendering Engine 2.0 ::..
[info   ] [IrrDriver Logger]: Could not initialize display!
[fatal  ] irr_driver: Couldn't initialise irrlicht device. Quitting.

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 18, 2024

NOTE: without "libselinux" installed into the AppImage, exporting LD_LIBRARY_PATH is useless and destructive... the AppImage would not run at all. In some way, "libselinux" helps to run both the libraries from the AppImage and from the host.

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 18, 2024

UPDATE: also "libOpenGL libEGL libGLdispatch" must be included in "LIBSAVED="

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 18, 2024

UPDATE: I've included also "libX11.so" in "LIBSAVED=" and I have several errors like this

/lib/libX11.so.6: error: symbol lookup error: undefined symbol: _XIFreeDeviceInfo (fatal)

I can't see the bottom, the messages are too long for my terminal

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 18, 2024

UPDATE: I've included "libX" insead of "libX11.so" in "LIBSAVED=" and I have several errors related to all libraries libX* in the AppImage, like this

/lib/libX*: error: symbol lookup error: undefined symbol: _XIFreeDeviceInfo (fatal)

again, I can't see the bottom, the messages are too long for my terminal

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 18, 2024

UPDATE: in first I've included all libraries in /usr/lib, the game starts but not the gameplay

Then I've execute directly the whole JuNest without removals... same result.

So, I think that here the issue is to use "--bind" to let the AppImage use libraries from the host... or at least LD_PRELOAD

@kenderipa if you want to test this, I'll resume the lines you must change in the script:

  • Line 6, "DEPENDENCES=" must include "libselinux"
  • Uncomment lines 7 and 8 (i.e. BASICSTUFF and COMPILERS
  • Uncomment line 69 (to enable gpg --keyserver keyserver.ubuntu.com ..., needed for the AUR)
  • Do "ENTER" at line 90 and add the following line: export LD_LIBRARY_PATH=/lib/:/lib64/:/lib/x86_64-linux-gnu/:/usr/lib/:"${LD_LIBRARY_PATH}"
  • Line 234 (former line 233, see the step above), "LIBSAVED=" must include libOpenGL libEGL libGLdispatch libX

From here, I can't see furter improvements.

I hope you are luckier. Have fun.

EDIT: there could be fewer steps (the AUR related ones) if only "libselinux" was included by default in the AUR repositories (or in JuNest)

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 19, 2024

@kenderipa see fa7c6f6

From now all you need is:

  • Line 6, "DEPENDENCES=" must include "libselinux"
  • Line 243, "LIBSAVED=" must include libOpenGL libEGL libGLdispatch libX ...

all our tests can be done like this.

@kenderipa
Copy link
Author

kenderipa commented Mar 19, 2024

@kenderipa see fa7c6f6

From now all you need is:

* Line 6, "DEPENDENCES=" must include "`libselinux`"

* Line 243, "LIBSAVED=" must include `libOpenGL libEGL libGLdispatch libX` ...

all our tests can be done like this.

Thanks! I'll test it during the week. Don't have much time at the moment.

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 21, 2024

In the meantime the AppImages are Type3: no libfuse2 is needed on the host

@kenderipa
Copy link
Author

Interestingly, 3D acceleration works for ScummVm out of the box.

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 21, 2024

Does ScummVm requiring GL accelleration?

I know that 32bit games in WINE work quite well, also without these implementations. Maybe you're wrong.

@kenderipa
Copy link
Author

Does ScummVm requiring GL accelleration?

I know that 32bit games in WINE work quite well, also without these implementations. Maybe you're wrong.

That I may be, but I'm pretty sure that Longest Journey, a 3D game, with an enhanced texture pack requires at least OpenGL. Also, I can switch on OpenGL for ScummVM GUI. Only v-sync doesn't seem to work.

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 21, 2024

What GPU? I've an old Nvidia (so I'm pretty sure that it would not work for me out of the box)

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 21, 2024

Also you should see if your AppImage's /usr/lib/dri contains all drivers or just "swrast_dri.so"... or nothing.

If nothing or just "swrast_dri.so" is better.

@kenderipa
Copy link
Author

What GPU? I've an old Nvidia (so I'm pretty sure that it would not work for me out of the box)

1660 Ti

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 21, 2024

Can you do a test with SuperTuxKart?

@kenderipa
Copy link
Author

Can you do a test with SuperTuxKart?

Sure, in the next few days.

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 22, 2024

Steps I've done (for supertuxkart)

  • add libselinux in dependences
  • add GL libX in "LIBSAVED"
  • enable _include_swrast_dri

No audio, no gameplay... just menus and loading screen

@kenderipa
Copy link
Author

kenderipa commented Mar 22, 2024

So, Supertuxkart doesn't work for me, I have an endless loading screen.

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 22, 2024

Its the same for me, we need to found the reason because the game does not starts.

Try to run the AppImage using LD_DEBUG https://bnikolic.co.uk/blog/linux-ld-debug.html

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 24, 2024

@kenderipa maybe you're right. Maybe there is an issue only with SupertuxKart (we miss something in the bundle).

I've built the old car race game Torcs and works! I'll publish the new repo soon (just the time to fix missing audio issue).

EDIT: https://github.com/ivan-hc/Torcs-appimage

Just the time that this workflow run has finished.

@fsquillace this is really interesting.

Here we go!

https://github.com/ivan-hc/Torcs-appimage/releases/download/continuous/TORCS_1.3.7-6-archimage3.4-x86_64.AppImage

@kenderipa
Copy link
Author

@kenderipa maybe you're right. Maybe there is an issue only with SupertuxKart (we miss something in the bundle).

I've built the old car race game Torcs and works! I'll publish the new repo soon (just the time to fix missing audio issue).

I've built Astromenace and 0 A. D., they both run very slowly, about 5-10 FPS.

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 24, 2024

I've built Astromenace and 0 A. D., they both run very slowly, about 5-10 FPS.

you should run them using LD_DEBUG=libs

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 24, 2024

@kenderipa I've tried to install 0ad and got this error

WARNING: You are using 'llvmpipe (LLVM 17.0.6, 256 bits)' graphics driver, expect very poor performance!

I've done a search and found this https://wiki.archlinux.org/title/OpenGL

EDIT: also including mesa in "DEPENDENCES" does not take the required effect, so we have not to "bloat" the content of /usr/lib/dri. All depends on "llvmpipe"

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 25, 2024

This is the script I wrote for "0AD" 0ad-junest.txt (I had to rename it to .txt file because github does not allow .sh formats)

@andy5995 I'd like to have you in this Team, you're the expert of drivers support for this game

If you already had experienced with Archimages, all you have to do is to run the script I wrote to have a 1,8 GB AppImage of the "0AD" game, but we have an issue here to made it work with the host's drivers (being Archimage a Arch Linux container into an AppImage... we are trying to made it use the drivers of the host system).

@andy5995
Copy link

@ivan-hc I'm no expert regarding the drivers but thank you for the compliment.

The way I worked around this with the 0ad AppImage was build one using Ubuntu 22.04 (Jammy). With no changes to how I built the AppImage, the image detected Vulkan whereas the image built on Ubuntu 20.04 (focal) did not (see the link above for more details).

@ivan-hc
Copy link
Owner

ivan-hc commented Mar 25, 2024

@andy5995 sure, I remember this detail about the two different versions of Ubuntu.

In this case, Archimages are able to work also on old dritributions with at least the Linux kernel v2.6 (so distributions of 10 years ago or more).

The only thing this kind of packaging lacks is support for GPU accelleration, due to its container's nature.

However, to include the changes we are discovering in this issue, we are near to a solution.

In this example, 0ad runs and works but with a very low performaces and about 5-10 FPS... we have this message in the terminal (and on the UI):

WARNING: You are using 'llvmpipe (LLVM 17.0.6, 256 bits)' graphics driver, expect very poor performance!

Now, two would be the solutions:

  • on the Bublewrap side (needed to run the JuNest container inside the AppImage) whe have to use "--bind" to made a host's directory available into the container (this will overwrite the files in that path inside the AppImage and the app may not work as expected if we do something wrong);
  • alternativelly we have to "export" the correct variables. For example, we here have already exported "LD_LIBRARY_PATH" from the host to the AppImage... this is OK to made available some missing libraries... but what about MESA? VULKAN? Other GL* related variables?

Now, the responsible of the drivers is "libLLVM-17.so" in /usr/lib (into the AppImage) that asks for "swrast_dri.so" in /usr/lib/dri (always inside the AppImage).

We need a way to use our drivers on the host instead of let the AppImage rely on what its bundled into it.

@ivan-hc ivan-hc changed the title Exposing commands on my system 3D hardware accelleration? Jun 24, 2024
@ivan-hc ivan-hc changed the title 3D hardware accelleration? 3D hardware acceleration? Jun 24, 2024
@ivan-hc ivan-hc added help wanted Extra attention is needed good first issue Good for newcomers labels Jun 24, 2024
@ivan-hc ivan-hc pinned this issue Jun 24, 2024
@ivan-hc
Copy link
Owner

ivan-hc commented Jun 24, 2024

Just experienced that this issue only affects systems with proprietary Nvidia drivers, I've tried this in some Kde games at ivan-hc/KDE-games-suite-appimage#3 and in a pure Archimage-based Bottles version (not the hybrid one I've published, mixing Arch Linux + Debian).

3D gamse will work with Nouveau enabled, not with Nvidia propriatary drivers.

@ivan-hc
Copy link
Owner

ivan-hc commented Jun 24, 2024

@kenderipa how can I force an app using "nouveau" drivers instead of "nvidia"?

@kenderipa
Copy link
Author

kenderipa commented Jun 24, 2024

@kenderipa how can I force an app using "nouveau" drivers instead of "nvidia"?

No idea. You can, of course, uninstall the nVidia drivers and reinstall them again.

@ivan-hc
Copy link
Owner

ivan-hc commented Jun 24, 2024

@kenderipa how can I force an app using "nouveau" drivers instead of "nvidia"?

No idea. You can, of course, uninstall the nVidia drivers and reinstall them again.

its not a solution, but a workaroun... like the one I proposed.

No progresses in these months on this issue.

@Samueru-sama
Copy link

aisap binds the following to allow access to the GPU, maybe one of these is missing?

/sys/devices/pci000:00
/dev/nvidiactl
/dev/nvidia0

@qurious-pixel
Copy link

I was also trying to work this out, as this was the last thing I was stuck on, specifically for OBS using nVidia hardware acceleration. I had tested some theories, but they did not work out in the end. Back to the beginning.

@ivan-hc
Copy link
Owner

ivan-hc commented Jul 16, 2024

@qurious-pixel JuNest, and Archimages in general, use theiir internal copy of Bubblewrap to mount directories from the host system.

This is how the AppRun works in the latest version of my Archimages:

#!/bin/sh
HERE="$(dirname "$(readlink -f $0)")"
export UNION_PRELOAD=$HERE
export JUNEST_HOME=$HERE/.junest
export PATH=$PATH:$HERE/.local/share/junest/bin

if test -f /etc/resolv.conf; then ETC_RESOLV=' --bind /etc/resolv.conf /etc/resolv.conf '; fi
if test -d /media; then MNT_MEDIA_DIR=' --bind /media /media '; fi
if test -d /mnt; then MNT_DIR=' --bind /mnt /mnt '; fi
if test -d /opt; then OPT_DIR=' --bind /opt /opt '; fi
if test -d /run/user; then USR_LIB_LOCALE_DIR=' --bind /usr/lib/locale /usr/lib/locale '; fi
if test -d /usr/share/fonts; then USR_SHARE_FONTS_DIR=' --bind /usr/share/fonts /usr/share/fonts '; fi
if test -d /usr/share/themes; then USR_SHARE_THEMES_DIR=' --bind /usr/share/themes /usr/share/themes '; fi

BINDS=" $ETC_RESOLV $MNT_MEDIA_DIR $MNT_DIR $OPT_DIR $USR_LIB_LOCALE_DIR $USR_SHARE_FONTS_DIR $USR_SHARE_THEMES_DIR "

if test -f $JUNEST_HOME/usr/lib/libselinux.so; then export LD_LIBRARY_PATH=/lib/:/lib64/:/lib/x86_64-linux-gnu/:/usr/lib/:"${LD_LIBRARY_PATH}"; fi

EXEC=$(grep -e '^Exec=.*' "${HERE}"/*.desktop | head -n 1 | cut -d "=" -f 2- | sed -e 's|%.||g')
$HERE/.local/share/junest/bin/junest -n -b "$BINDS" -- $EXEC "$@"

where "$BINDS" are all mountpoints.

For example, "$USR_SHARE_THEMES_DIR" is --bind /usr/share/themes /usr/share/themes, in a normal JuNest installation it would appear like this, to launch (for example) "obs"

junest -n -b " --bind /usr/share/themes /usr/share/themes " -- obs

with this command you use "junest" to launch "obs", and the internal Bubblewrap "-b" mounts the "/usr/share/themes" of the host in the guest Arch Linux container.

The directory "/usr/share/themes" must exist in both, host and guest.

Once we mount the exact files and directories from the host into the guest, we solve this issue.

But as you can see, this is an issue opened from months, without significative progresses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants