Latest gpu drivers 32.7.x cause some flickering and unstable under vita3k Emulator

You can use the prebuild binary here

See the video Initial test aarch64 dynarmic linux vita3k - vita emulator - YouTube

This not happen under jetpack 32.6.1 blobs

The only differences from 32.6. to 32.7.x
It now supports memory mapping by VK_EXT_external_memory
The emulator it’s use memory mapping when supported

What can be wrong here for the nvidia l4t driver? Thank you.
It completely breaks the graphics when we use this extension on this device.
Regards
Carlos

Hi _Diablo,

Thanks for reporting this issue.
I will forward this issue to our internal team to do further investigating to see if can have the fix.

hi We are testing another alternative using page table for drivers not supported or oldest without VK_EXT_external_memory

Edit For drivers without VK_EXT_external_memory we can fixed it with latest commit
however latest drivers 32.7.x with VK_EXT_external_memory unusual behavior keeps happening.
We haven’t found a solution yet .

Hi,
Since it works without using VK_EXT_external_memory, is it possible not to use it as a quick solution?

Yeah
With 32.6.x blobs it’s fast solution though not perfect in fews things it keeps flickering They do opposite behaviors with or without.

With 32.7 it will would block not loading the VK_EXT_external_memory implementation
But it would be nice to understand why it flickers as this issue does not happen on other hardware that we have tested in our internal tests and users have reported to us.

We will have found the limitation it’s happn on nintendo switch too.
it’s does not have a memory type that is both coherent and cached, so performance is kind of bad with the pagetable implementation
and it explains the flickering with external host buffer too!!!
for now it’s very low priority for us due hard pain work on this maybe in the futur will rework.

Or What alternative is here? If something occurs to you let me know.

Hi,
We will check this on Orin. On Jetson Nano, please not to use the extension as a quick solution.

Hi _Diablo,

Are you got below errors when build the project from sources?
$ cmake --build build/linux-ninja-clang

[85/756] Building CXX object external/dynarmic/src/dynarmic/CMakeFiles/dynarmic.dir/Debug/cmake_pch.hxx.pch
FAILED: external/dynarmic/src/dynarmic/CMakeFiles/dynarmic.dir/Debug/cmake_pch.hxx.pch 
/usr/bin/clang++ -DDYNARMIC_ENABLE_CPU_FEATURE_DETECTION=1 -DFMT_USE_USER_DEFINED_LITERALS=1 -DCMAKE_INTDIR=\"Debug\" -I/home/nvidia/Bug3999516/Soruces-0309/Vita3K/external/dynarmic/src/dynarmic/.. -I/home/nvidia/Bug3999516/Soruces-0309/Vita3K/external/dynarmic/externals/oaknut/include -I/home/nvidia/Bug3999516/Soruces-0309/Vita3K/external/fmt/include -I/home/nvidia/Bug3999516/Soruces-0309/Vita3K/external/dynarmic/externals/mcl/src/../include -I/home/nvidia/Bug3999516/Soruces-0309/Vita3K/external/dynarmic/externals/robin-map/include -g -std=c++2a -Wall -Wextra -Wcast-qual -pedantic -pedantic-errors -Wno-missing-braces -fbracket-depth=1024 -Winvalid-pch -Xclang -emit-pch -Xclang -include -Xclang /home/nvidia/Bug3999516/Soruces-0309/Vita3K/build/linux-ninja-clang/external/dynarmic/src/dynarmic/CMakeFiles/dynarmic.dir/Debug/cmake_pch.hxx -x c++-header -MD -MT external/dynarmic/src/dynarmic/CMakeFiles/dynarmic.dir/Debug/cmake_pch.hxx.pch -MF external/dynarmic/src/dynarmic/CMakeFiles/dynarmic.dir/Debug/cmake_pch.hxx.pch.d -o external/dynarmic/src/dynarmic/CMakeFiles/dynarmic.dir/Debug/cmake_pch.hxx.pch -c /home/nvidia/Bug3999516/Soruces-0309/Vita3K/build/linux-ninja-clang/external/dynarmic/src/dynarmic/CMakeFiles/dynarmic.dir/cmake_pch.hxx.cxx
In file included from <built-in>:1:
In file included from /home/nvidia/Bug3999516/Soruces-0309/Vita3K/build/linux-ninja-clang/external/dynarmic/src/dynarmic/CMakeFiles/dynarmic.dir/Debug/cmake_pch.hxx:5:
/home/nvidia/Bug3999516/Soruces-0309/Vita3K/external/dynarmic/externals/oaknut/include/oaknut/oaknut.hpp:6:10: fatal error: 'bit' file not found
#include <bit>
         ^~~~~
1 error generated.
[90/756] Building C object external/unicorn/CMakeFiles/armeb-softmmu.dir/Debug/qemu/target-arm/translate.c.o
ninja: build stopped: subcommand failed.

Reference link: Vita3K/building.md at master · Vita3K/Vita3K · GitHub

With what clang version?
seems to be using an old clang
We recommended using clang-14
If you have under bionic will needed add this ppa sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update

wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 14

Also will be needed install libstdc+±10-dev due not installed by default under bionic/focal ubuntu when install clang.

And try

cmake --preset linux-ninja-clang14
cmake --build build/linux-ninja-clang14 --config Release

the --config flags is optional for perfomance speed.
Only use Debug if you need it.

Ah you will needed rebuild ffmpeg files or apply this Add support for aarch64 linux by mrcmunir · Pull Request #4 · Vita3K/ffmpeg-core · GitHub
and rebuild libtomcrypt GitHub - KorewaWatchful/libtomcrypt at f7518374b9bdc7f43c8f60d82ed16f0d5af53a19
and copy libtomcrypt.a into build/lib/

Tell me that helped you solve your problem when building

Regards

Carlos.

Hi _Diablo,

I got below errors this time:

$ cmake --build build/linux-ninja-clang --config Release
[0/2] Re-checking globbed directories...
ninja: error: '/home/nvidia/Bug3999516/Sources-0320/Vita3K/external/ffmpeg/linux/aarch64/libavcodec.a', needed by 'bin/Release/Vita3K', missing and no known rule to make it

My steps:

  1. Build libtomcrypt from:
    GitHub - KorewaWatchful/libtomcrypt at f7518374b9bdc7f43c8f60d82ed16f0d5af53a19
  2. Download the Vita3K:
    $ git clone --recursive GitHub - Vita3K/Vita3K: Experimental PlayStation Vita emulator
    $ cd Vita3K/external/ffmpeg
  3. Reference this page to apply change and add linux_arm64.sh script
    $ vim CMakeLists.txt
    $ vim linux_arm64.sh
    $ cp libtomcrypt/libtomcrypt.a ./external/psvpfstools/libtomcrypt/build/lib/libtomcrypt.a
  4. Run below command to building:
    $ cmake --preset linux-ninja-clang
    $ cmake --build build/linux-ninja-clang --config Release

Do I missing what steps?
or can you provide the Vita3K that can run on Jetson Nano for us directly?
Thanks!

Hi please check the script ffmpeg create some extra folders we not needed it you only needed it the *.a files in linux/aarch64/

Hi _Diablo,

Got below errors again :(

[150/842] Building CXX object external/dynarmic/src/dynarmic/CMakeFiles/dynarmic.dir/Debug/cmake_pch.hxx.pch
FAILED: external/dynarmic/src/dynarmic/CMakeFiles/dynarmic.dir/Debug/cmake_pch.hxx.pch 
/usr/bin/clang++ -DDYNARMIC_ENABLE_CPU_FEATURE_DETECTION=1 -DFMT_USE_USER_DEFINED_LITERALS=1 -DCMAKE_INTDIR=\"Debug\" -I/home/nvidia/Bug3999516/Sources-0320/Vita3K/external/dynarmic/src/dynarmic/.. -I/home/nvidia/Bug3999516/Sources-0320/Vita3K/external/dynarmic/externals/oaknut/include -I/home/nvidia/Bug3999516/Sources-0320/Vita3K/external/fmt/include -I/home/nvidia/Bug3999516/Sources-0320/Vita3K/external/dynarmic/externals/mcl/src/../include -I/home/nvidia/Bug3999516/Sources-0320/Vita3K/external/dynarmic/externals/robin-map/include -g -std=c++2a -Wall -Wextra -Wcast-qual -pedantic -pedantic-errors -Wno-missing-braces -fbracket-depth=1024 -Winvalid-pch -Xclang -emit-pch -Xclang -include -Xclang /home/nvidia/Bug3999516/Sources-0320/Vita3K/build/linux-ninja-clang/external/dynarmic/src/dynarmic/CMakeFiles/dynarmic.dir/Debug/cmake_pch.hxx -x c++-header -MD -MT external/dynarmic/src/dynarmic/CMakeFiles/dynarmic.dir/Debug/cmake_pch.hxx.pch -MF external/dynarmic/src/dynarmic/CMakeFiles/dynarmic.dir/Debug/cmake_pch.hxx.pch.d -o external/dynarmic/src/dynarmic/CMakeFiles/dynarmic.dir/Debug/cmake_pch.hxx.pch -c /home/nvidia/Bug3999516/Sources-0320/Vita3K/build/linux-ninja-clang/external/dynarmic/src/dynarmic/CMakeFiles/dynarmic.dir/cmake_pch.hxx.cxx
In file included from <built-in>:1:
In file included from /home/nvidia/Bug3999516/Sources-0320/Vita3K/build/linux-ninja-clang/external/dynarmic/src/dynarmic/CMakeFiles/dynarmic.dir/Debug/cmake_pch.hxx:5:
/home/nvidia/Bug3999516/Sources-0320/Vita3K/external/dynarmic/externals/oaknut/include/oaknut/oaknut.hpp:6:10: fatal error: 'bit' file not found
#include <bit>
         ^~~~~
1 error generated.
[155/842] Building C object external/unicorn/CMakeFiles/armeb-softmmu.dir/Debug/qemu/target-arm/translate.c.o
ninja: build stopped: subcommand failed.

You are installed sudo apt-get install libstdc+±10-dev??? this package have bit header .

Hi @_Diablo

Could you share the build steps from fresh jetpack build? We don’t have much resources to check build issue. Please start from scratch and share us the build steps so that we can focus on the real issue to check.

Thanks.

The base from jetpack I’m used

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update && sudo apt-get upgrade .
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 14
Install depndences sudo apt install git cmake ninja-build libsdl2-dev pkg-config libgtk-3-dev xdg-desktop-portal openssl libstdc+±10-dev
git clone https://github.com/Vita3K/Vita3K
cd Vita3K
git submodule --init --recursive 
cd Vita3K/external/ffmpeg and Apply ffmpeg prebuild binaryees Only needed *.a files from linker fine in aarch64 folder and change Cmakelist.txt for this https://github.com/Vita3K/ffmpeg-core/pull/4
Rebuild external/libtomcrypt and copy into external/libtomcrypt/build/lib/tomcrypt.a .
cmake --preset linux-ninja-clang14
cmake --build build/linux-ninja-clang14 --config Release

I’m created docker if you needed the base stuff.

xhost +
sudo docker run -it --rm --net=host --runtime nvidia -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix  cestrague/l4t-bionic-development
same binary working too on Focal  host tested for me using the same steps

Hi _Diablo,

Thanks for your detail steps.
Follow your steps, but got below errors:

/home/nvidia/Bug3999516/Sources-0320/Vita3K/vita3k/main.cpp:166:21: error: use of undeclared identifier 'SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE'
        SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, "1");
                    ^
/home/nvidia/Bug3999516/Sources-0320/Vita3K/vita3k/main.cpp:167:21: error: use of undeclared identifier 'SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE'
        SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, "1");
                    ^
/home/nvidia/Bug3999516/Sources-0320/Vita3K/vita3k/main.cpp:170:21: error: use of undeclared identifier 'SDL_HINT_JOYSTICK_HIDAPI_SWITCH'
        SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH, "1");
                    ^
/home/nvidia/Bug3999516/Sources-0320/Vita3K/vita3k/main.cpp:171:21: error: use of undeclared identifier 'SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS'
        SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "1");
                    ^
4 errors generated.
[421/842] Building CXX object vita3k/CMakeFiles/vita3k.dir/Release/interface.cpp.o
ninja: build stopped: subcommand failed.

Hi,
We would like to check this on Orin but have faced certain issues. Since now you are using Jetson Nano and not sure if you have future plan to use Orin series. If yes, we can then resume checking this on Orin. Many thanks for your help.

ah sorry I missed libsdl2-dev does not meet the minimum version requirements in bionic/focal .
sudo remove libsdl2-dev and it will compile from external
remove folder to rebuild again thanks.

Now it’s just giving you the error libsdl2 library doesn’t have that entry so I will recommended remove it and rebuild it without libsdl2-dev (remove cmakecache)

Or you can install dpkg -i libsdl2 arm64 debs add SDL2 2.26.1 ARMhf and ARM64 debs · cobalt2727/L4T-Megascript@2d1f60d · GitHub

It would be good to check if it happens in orin or not to rule out if it is Nano specific or not then we would have it easy for us to block only “nano”.

executing via the helper script is also a quick way to install the SDL2 2.26.1 packages

bash <( curl https://raw.githubusercontent.com/cobalt2727/L4T-Megascript/master/helper.sh ) "scripts/sdl2_install_helper.sh"

I’ve simplified a bit for whoever wants to run it on l4t bionic/focal (ffmpeg , libtompcrypt) into GitHub - mrcmunir/Vita3K: Experimental PlayStation Vita emulator

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update && sudo apt-get upgrade .
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 14
Install dependences :
sudo apt install git cmake ninja-build pkg-config libgtk-3-dev xdg-desktop-portal libssl-dev libstdc+±10-dev
Install update sdl2 from :
bash <( curl https://raw.githubusercontent.com/cobalt2727/L4T-Megascript/master/helper.sh ) "scripts/sdl2_install_helper.sh"
git clone https://github.com/mrcmunir/Vita3K
cd Vita3K
git submodule --init --recursive 
cmake --preset linux-ninja-clang14
cmake --build build/linux-ninja-clang14 --config Release

I hope this makes it easier for nvidia debug this to build the binary without problems.