这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@xMeM
Copy link
Contributor

@xMeM xMeM commented Dec 9, 2024

These changes allow Mesa Turnip DRI3 to work without patches.

@twaik
Copy link
Member

twaik commented Dec 9, 2024

LGTM. By the way, can you please take a look at the reason why vkcube does not work with dri3+swrast?

@twaik
Copy link
Member

twaik commented Dec 9, 2024

And one more question. Is https://github.com/xMeM/termux-packages/tree/dev/wrapper ready? Issues are disabled in your fork.

@xMeM
Copy link
Contributor Author

xMeM commented Dec 9, 2024

LGTM. By the way, can you please take a look at the reason why vkcube does not work with dri3+swrast?

Maybe these changes will fix it? vkcube works fine with dri3+swrast now, it was a black screen before applying the changes.

@twaik
Copy link
Member

twaik commented Dec 9, 2024

Correct, it fixes vkcube with working dri3 and does not seem to break mesa so I'll merge it.

@twaik twaik merged commit d1990c5 into termux:master Dec 9, 2024
@twaik
Copy link
Member

twaik commented Dec 9, 2024

What about vulkan wrapper branch? Is it ready? Probably it is time to file a pull request to termux org repo.

@xMeM
Copy link
Contributor Author

xMeM commented Dec 9, 2024

What about vulkan wrapper branch? Is it ready? Probably it is time to file a pull request to termux org repo.

Ok, I'll open a pull request tomorrow.

@twaik
Copy link
Member

twaik commented Dec 10, 2024

@twaik
Copy link
Member

twaik commented Dec 10, 2024

I thought we need to mmap file descriptor we pass there with some offset we get from the image->base.offsets[0]. Or it always equals 0?

@xMeM
Copy link
Contributor Author

xMeM commented Dec 10, 2024

So this PR makes https://github.com/termux/termux-packages/blob/master/packages/mesa-vulkan-icd-freedreno-dri3/wsi-termux-x11.patch not needed, right?

Yes, mesa-vulkan-icd-freedreno should work now.

@xMeM
Copy link
Contributor Author

xMeM commented Dec 10, 2024

I thought we need to mmap file descriptor we pass there with some offset we get from the image->base.offsets[0]. Or it always equals 0?

It seems that only YUV formats have offsets, since those formats have multiple planes.

@Maxython
Copy link
Member

@xMeM, after your patch in termux-x11, mesa-glibc stopped working (all drivers). I already tried to rebuild mesa-glibc without wsi-termux-x11-v3.patch, but it did not fix the situation.

@xMeM
Copy link
Contributor Author

xMeM commented Dec 11, 2024

@Maxython
Copy link
Member

@xMeM, I rebuilt libxshmfence-glibc with futex disabled. It fixed the usual programs, like glmark2 or glxgears, but vkcube and other programs on vulkan still show a black screen (i.e. the problem is not fixed). In addition, I suspect that the new termux-x11 began to show less fps, but perhaps this is already a problem in mesa-glibc.

And also, could you look at the mesa-glibc package and tell me what needs to be done so that it can work normally with the new termux-x11 (if necessary). Just looking at your PR termux/termux-packages#22500, I think that mesa-glibc also needs reconfiguration.

@xMeM
Copy link
Contributor Author

xMeM commented Dec 11, 2024

@Maxython libxshmfence fallback to pthread shared mutex after futex is disabled, but glibc cannot share mutex with bionic.
If you can't make xshmfence work, you will have to remove the xshmfence call in mesa.

@twaik
Copy link
Member

twaik commented Dec 12, 2024

Is it possible to port pthread mutex-related code to glibc from bionic? It should be relatively easy.

@twaik
Copy link
Member

twaik commented Dec 12, 2024

I mean for using it only inside xshmfence lib.

@twaik
Copy link
Member

twaik commented Dec 12, 2024

It is weird, it looks like pthread uses futex internally (__NR_futex syscall).

@hansm629
Copy link

@xMeM
The mesa Turnip (mesa-vulkan-icd-freedreno) distributed in the Termux main-repo works fine without the DRI3 patch.

However, I build and tested mesa Turnip in the PRoot-Distro Debian environment without applying the DRI3 patch, and both vkcube and vkmark freezing and did not work.

The build process is as follows, but is there something I may have missed or done incorrectly?

vkcube.mp4
~$ BUILD_PREFIX=~/Desktop
~$ MESA_PREFIX=${BUILD_PREFIX}/mesa-mesa-24.3.1
~$ wget --continue --directory-prefix ${BUILD_PREFIX} https://gitlab.freedesktop.org/mesa/mesa/-/archive/mesa-24.3.1/mesa-mesa-24.3.1.tar.gz
~$ tar -xf ${BUILD_PREFIX}/*.tar.gz --directory ${BUILD_PREFIX}

~$ MESA_VER=$(cat ${MESA_PREFIX}/VERSION)
~$ DATE=$(date +"%F" | sed 's/-//g')
~$ MESA_64=${BUILD_PREFIX}/mesa-vulkan-kgsl_${MESA_VER}-${DATE}_arm64

~$ echo "\
[binaries]
c = 'arm-linux-gnueabihf-gcc'
cpp = 'arm-linux-gnueabihf-g++'
ar = 'arm-linux-gnueabihf-ar'
strip = 'arm-linux-gnueabihf-strip'
pkgconfig = 'arm-linux-gnueabihf-pkg-config'

[host_machine]
system = 'linux'
cpu_family = 'arm'
cpu = 'aarch64'
endian = 'little'
" > ${MESA_PREFIX}/arm.txt

~$ sudo meson build64/ --prefix /usr --libdir lib/aarch64-linux-gnu/ -D platforms=x11 -D gallium-drivers=freedreno -D vulkan-drivers=freedreno -D freedreno-kmds=msm,kgsl -D buildtype=release -D glx=disabled -D egl=disabled -D gles1=disabled -D gles2=disabled -D gallium-xa=disabled -D opengl=false -D b_lto=true -D b_ndebug=true -D cpp_rtti=false -D gbm=disabled -D llvm=disabled -D shared-llvm=disabled -D xmlconfig=disabled
~$ sudo meson compile -C build64/
~$ sudo meson install -C build64/ --destdir ${MESA_64}

~$ cd ${BUILD_PREFIX}
~$ sudo apt remove -y mesa-vulkan-drivers:arm64
~$ sudo apt download mesa-vulkan-drivers:arm64
~$ sudo dpkg-deb -e mesa-vulkan-drivers_*_arm64.deb ${MESA_64}/DEBIAN/
~$ sudo sed -ie "3s/.*/Version: ${MESA_VER}-${DATE}/g" ${MESA_64}/DEBIAN/control
~$ sudo rm mesa-vulkan-drivers_*_arm64.deb
~$ sudo rm ${MESA_64}/DEBIAN/md5sums ${MESA_64}/DEBIAN/triggers
~$ sudo rm -rf ${MESA_64}/usr/share/drirc.d
~$ sudo dpkg-deb --build --root-owner-group ${MESA_64}

@xMeM
Copy link
Contributor Author

xMeM commented Dec 14, 2024

@hansm629 For glibc build, it is still necessary to apply the DRI3 patch.

@Maxython
Copy link
Member

Frankly speaking, as a developer of glibc packages in Termux, I started to doubt whether these changes are right. Because the new termux-x11 does not simplify the compilation of the mesa-glibc package, but also limits the functionality of other packages. This is not good.

@xMeM
Copy link
Contributor Author

xMeM commented Dec 14, 2024

@Maxython Just keep the DRI3 patch for mesa-glibc, no changes to other packages are needed.

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.

4 participants