termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.09k stars 3k forks source link

The mesa-vulkan-icd-freedreno-dri3 patch does not apply to the Adreno 750 branch and causes artifacts in OpenGL ES3.2 when applied to the existing Adreno7xx branch. #19165

Closed hansm629 closed 6 months ago

hansm629 commented 8 months ago

Problem description

@licy183 @xMeM

https://github.com/termux/termux-packages/tree/master/packages/mesa-vulkan-icd-freedreno-dri3

  1. Download wsi-termux-x11.patch and tu_kgsl_export_dmabuf.patch from the link above.

  2. Build mesa Turnip in PRoot-Distro Ubuntu environment

  3. The branch is https://gitlab.freedesktop.org/Danil/mesa/-/tree/feature/turnip/a750

  4. Failure to apply wsi-termux-x11.patch as shown Screenshot_2024-02-07_00-46-33

hsm@localhost:~/Desktop/mesa-feature-turnip-a750$ git apply -v wsi-termux-x11.patch
Checking patch src/vulkan/wsi/wsi_common_x11.c...
error: while searching for:
   for (uint32_t i = 0; i < chain->base.image_count; i++) {
      if (!chain->images[i].busy) {
         /* We found a non-busy image */
         xshmfence_await(chain->images[i].shm_fence);
         *image_index = i;
         chain->images[i].busy = true;
         chain->present_poll_acquire_count++;

error: patch failed: src/vulkan/wsi/wsi_common_x11.c:1417
error: src/vulkan/wsi/wsi_common_x11.c: patch does not apply

By purchasing Galaxy S24 Ultra I was trying to build mesa Turnip running on PRoot-Distro Linux.

The dri3 patch is not being applied in the Adreno750 branch.

Will the dri3 patch need to be updated to support Adreno750?

Next is the second problem.

https://gitlab.freedesktop.org/Danil/mesa/-/tree/turnip/feature/a7xx-basic-support

We build mesa Turnip by applying wsi-termux-x11.patch and tu_kgsl_export_dmabuf.patch from the branch above.

Applying the latest patch Artifacts no longer occur when running vkmark on the Adreno7xx series!

but

There is no problem with glmark2 (OpenGL4.6), confirmed that artifacts occur when running glmark2-es2 (OpenGL ES3.2) on the Adreno7xx series.

https://github.com/termux/termux-packages/assets/101167173/b41cf861-f5fb-4ee0-8fc2-f9462ba3e312

If you apply the past wsi-termux-x11 v3.patch, no artifacts will occur when running glmark2-es2 (OpenGL ES3.2).

Instead, wsi-termux-x11 v3.patch produced artifacts in vkmark (Vulkan).

Issue of not being able to apply dri3 patch on Adreno750 and Should the dri3 patch be modified to resolve OpenGL ES3.2 artifact issues?

What steps will reproduce the bug?

The branch is https://gitlab.freedesktop.org/Danil/mesa/-/tree/feature/turnip/a750 Failure to apply wsi-termux-x11.patch as shown

What is the expected behavior?

No response

System information

termux-info:

PRoot-Distro Ubuntu
xMeM commented 8 months ago

Setting the environment variable MESA_VK_WSI_PRESENT_MODE=mailbox for glmark2-es2 should help.

hansm629 commented 8 months ago

Setting the environment variable MESA_VK_WSI_PRESENT_MODE=mailbox for glmark2-es2 should help.

@xMeM thank you! MESA_VK_WSI_PRESENT_MODE=mailbox Adding this environment variable fixed the glmark2-es2 (OpenGL ES3.2) artifact issue on Adreno 740!

glmark2 (OpenGL4.6), glmark2-es2 (OpenGL ES3.2), vkmark (Vulkan) Everything runs perfectly!

Do I need a patch update to apply the dri3 patch to my Adreno 750?

xMeM commented 8 months ago

Setting the environment variable MESA_VK_WSI_PRESENT_MODE=mailbox for glmark2-es2 should help.

@xMeM thank you! MESA_VK_WSI_PRESENT_MODE=mailbox Adding this environment variable fixed the glmark2-es2 (OpenGL ES3.2) artifact issue on Adreno 740!

glmark2 (OpenGL4.6), glmark2-es2 (OpenGL ES3.2), vkmark (Vulkan) Everything runs perfectly!

Do I need a patch update to apply the dri3 patch to my Adreno 750?

wsi-termux-x11-main.patch.txt

hansm629 commented 8 months ago

@xMeM

thank you The newly modified DRI3 patch was successfully applied to the Adreno 750 branch.

However, errors occurred in several benchmarks after build. T_T

The symptom occurs in mesa-23.3.5-1 distributed in debian sid. The same happens with the latest mesa-24.1.0-devel.

Is there any solution?

It appears to be the same symptom as the dri3 patch without A7xx support that you made in the early days. (patch before v3)

T_T

glmark2 error

hsm@localhost:~$ LD_LIBRARY_PATH=/usr/lib glmark2
ATTENTION: default value of option vblank_mode overridden by environment.
=======================================================
    glmark2 2023.01
=======================================================
    OpenGL Information
    GL_VENDOR:      Mesa
    GL_RENDERER:    zink Vulkan 1.3(Turnip Adreno (TM) 750 (MESA_TURNIP))
    GL_VERSION:     4.6 (Compatibility Profile) Mesa 24.1.0-devel
    Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=0 samples=0
    Surface Size:   800x600 windowed
=======================================================
[build] use-vbo=false: FPS: 246 FrameTime: 4.075 ms
[build] use-vbo=true: FPS: 400 FrameTime: 2.503 ms
[texture] texture-filter=nearest: FPS: 291 FrameTime: 3.439 ms
[texture] texture-filter=linear: FPS: 350 FrameTime: 2.861 ms
[texture] texture-filter=mipmap: FPS: 308 FrameTime: 3.253 ms
[shading] shading=gouraud: FPS: 291 FrameTime: 3.441 ms
[shading] shading=blinn-phong-inf: FPS: 297 FrameTime: 3.372 ms
[shading] shading=phong: FPS: 310 FrameTime: 3.228 ms
[shading] shading=cel: FPS: 269 FrameTime: 3.726 ms
[bump] bump-render=high-poly: FPS: 262 FrameTime: 3.830 ms
[bump] bump-render=normals:TU: error: vk_kgsl_sync_import_sync_file: dup failed: Too many open files
MESA: error: zink: swapchain killed 0x3000e98f80
X Error of failed request:  GLXBadCurrentWindow
  Major opcode of failed request:  149 (GLX)
  Minor opcode of failed request:  11 (X_GLXSwapBuffers)
  Serial number of failed request:  66149
  Current serial number in output stream:  66149

glmark2-es2 error

hsm@localhost:~$ LD_LIBRARY_PATH=/usr/lib glmark2-es2
ATTENTION: default value of option vblank_mode overridden by environment.
=======================================================
    glmark2 2023.01
=======================================================
    OpenGL Information
    GL_VENDOR:      Mesa
    GL_RENDERER:    zink Vulkan 1.3(Turnip Adreno (TM) 750 (MESA_TURNIP))
    GL_VERSION:     OpenGL ES 3.2 Mesa 24.1.0-devel
    Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=0 samples=0
    Surface Size:   800x600 windowed
=======================================================
[build] use-vbo=false: FPS: 666 FrameTime: 1.502 ms
[build] use-vbo=true: FPS: 908 FrameTime: 1.102 ms
[texture] texture-filter=nearest: FPS: 782 FrameTime: 1.279 ms
[texture] texture-filter=linear: FPS: 778 FrameTime: 1.286 ms
[texture] texture-filter=mipmap:TU: error: vk_kgsl_sync_import_sync_file: dup failed: Too many open files
MESA: error: MESA: failed to import sync file 'Invalid argument'
MESA: error: zink: swapchain killed 0x30004994c0

vkmark error

hsm@localhost:~$ vkmark
ERROR:             VkInstanceCreateInfo::pApplicationInfo::apiVersion has value of 0 which is not permitted. If apiVersion is not 0, then it must be greater than or equal to the value of VK_API_VERSION_1_0 [VUID-VkApplicationInfo-apiVersion]
Segmentation Fault,
xMeM commented 8 months ago

@xMeM

thank you The newly modified DRI3 patch was successfully applied to the Adreno 750 branch.

However, errors occurred in several benchmarks after build. T_T

The symptom occurs in mesa-23.3.5-1 distributed in debian sid. The same happens with the latest mesa-24.1.0-devel.

Is there any solution?

It appears to be the same symptom as the dri3 patch without A7xx support that you made in the early days. (patch before v3)

T_T

glmark2 error

hsm@localhost:~$ LD_LIBRARY_PATH=/usr/lib glmark2
ATTENTION: default value of option vblank_mode overridden by environment.
=======================================================
    glmark2 2023.01
=======================================================
    OpenGL Information
    GL_VENDOR:      Mesa
    GL_RENDERER:    zink Vulkan 1.3(Turnip Adreno (TM) 750 (MESA_TURNIP))
    GL_VERSION:     4.6 (Compatibility Profile) Mesa 24.1.0-devel
    Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=0 samples=0
    Surface Size:   800x600 windowed
=======================================================
[build] use-vbo=false: FPS: 246 FrameTime: 4.075 ms
[build] use-vbo=true: FPS: 400 FrameTime: 2.503 ms
[texture] texture-filter=nearest: FPS: 291 FrameTime: 3.439 ms
[texture] texture-filter=linear: FPS: 350 FrameTime: 2.861 ms
[texture] texture-filter=mipmap: FPS: 308 FrameTime: 3.253 ms
[shading] shading=gouraud: FPS: 291 FrameTime: 3.441 ms
[shading] shading=blinn-phong-inf: FPS: 297 FrameTime: 3.372 ms
[shading] shading=phong: FPS: 310 FrameTime: 3.228 ms
[shading] shading=cel: FPS: 269 FrameTime: 3.726 ms
[bump] bump-render=high-poly: FPS: 262 FrameTime: 3.830 ms
[bump] bump-render=normals:TU: error: vk_kgsl_sync_import_sync_file: dup failed: Too many open files
MESA: error: zink: swapchain killed 0x3000e98f80
X Error of failed request:  GLXBadCurrentWindow
  Major opcode of failed request:  149 (GLX)
  Minor opcode of failed request:  11 (X_GLXSwapBuffers)
  Serial number of failed request:  66149
  Current serial number in output stream:  66149

glmark2-es2 error

hsm@localhost:~$ LD_LIBRARY_PATH=/usr/lib glmark2-es2
ATTENTION: default value of option vblank_mode overridden by environment.
=======================================================
    glmark2 2023.01
=======================================================
    OpenGL Information
    GL_VENDOR:      Mesa
    GL_RENDERER:    zink Vulkan 1.3(Turnip Adreno (TM) 750 (MESA_TURNIP))
    GL_VERSION:     OpenGL ES 3.2 Mesa 24.1.0-devel
    Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=0 samples=0
    Surface Size:   800x600 windowed
=======================================================
[build] use-vbo=false: FPS: 666 FrameTime: 1.502 ms
[build] use-vbo=true: FPS: 908 FrameTime: 1.102 ms
[texture] texture-filter=nearest: FPS: 782 FrameTime: 1.279 ms
[texture] texture-filter=linear: FPS: 778 FrameTime: 1.286 ms
[texture] texture-filter=mipmap:TU: error: vk_kgsl_sync_import_sync_file: dup failed: Too many open files
MESA: error: MESA: failed to import sync file 'Invalid argument'
MESA: error: zink: swapchain killed 0x30004994c0

vkmark error

hsm@localhost:~$ vkmark
ERROR:             VkInstanceCreateInfo::pApplicationInfo::apiVersion has value of 0 which is not permitted. If apiVersion is not 0, then it must be greater than or equal to the value of VK_API_VERSION_1_0 [VUID-VkApplicationInfo-apiVersion]
Segmentation Fault,

test.patch.txt maybe useful

hansm629 commented 8 months ago

@xMeM thank you The newly modified DRI3 patch was successfully applied to the Adreno 750 branch. However, errors occurred in several benchmarks after build. T_T The symptom occurs in mesa-23.3.5-1 distributed in debian sid. The same happens with the latest mesa-24.1.0-devel. Is there any solution? It appears to be the same symptom as the dri3 patch without A7xx support that you made in the early days. (patch before v3) T_T glmark2 error

hsm@localhost:~$ LD_LIBRARY_PATH=/usr/lib glmark2
ATTENTION: default value of option vblank_mode overridden by environment.
=======================================================
    glmark2 2023.01
=======================================================
    OpenGL Information
    GL_VENDOR:      Mesa
    GL_RENDERER:    zink Vulkan 1.3(Turnip Adreno (TM) 750 (MESA_TURNIP))
    GL_VERSION:     4.6 (Compatibility Profile) Mesa 24.1.0-devel
    Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=0 samples=0
    Surface Size:   800x600 windowed
=======================================================
[build] use-vbo=false: FPS: 246 FrameTime: 4.075 ms
[build] use-vbo=true: FPS: 400 FrameTime: 2.503 ms
[texture] texture-filter=nearest: FPS: 291 FrameTime: 3.439 ms
[texture] texture-filter=linear: FPS: 350 FrameTime: 2.861 ms
[texture] texture-filter=mipmap: FPS: 308 FrameTime: 3.253 ms
[shading] shading=gouraud: FPS: 291 FrameTime: 3.441 ms
[shading] shading=blinn-phong-inf: FPS: 297 FrameTime: 3.372 ms
[shading] shading=phong: FPS: 310 FrameTime: 3.228 ms
[shading] shading=cel: FPS: 269 FrameTime: 3.726 ms
[bump] bump-render=high-poly: FPS: 262 FrameTime: 3.830 ms
[bump] bump-render=normals:TU: error: vk_kgsl_sync_import_sync_file: dup failed: Too many open files
MESA: error: zink: swapchain killed 0x3000e98f80
X Error of failed request:  GLXBadCurrentWindow
  Major opcode of failed request:  149 (GLX)
  Minor opcode of failed request:  11 (X_GLXSwapBuffers)
  Serial number of failed request:  66149
  Current serial number in output stream:  66149

glmark2-es2 error

hsm@localhost:~$ LD_LIBRARY_PATH=/usr/lib glmark2-es2
ATTENTION: default value of option vblank_mode overridden by environment.
=======================================================
    glmark2 2023.01
=======================================================
    OpenGL Information
    GL_VENDOR:      Mesa
    GL_RENDERER:    zink Vulkan 1.3(Turnip Adreno (TM) 750 (MESA_TURNIP))
    GL_VERSION:     OpenGL ES 3.2 Mesa 24.1.0-devel
    Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=0 samples=0
    Surface Size:   800x600 windowed
=======================================================
[build] use-vbo=false: FPS: 666 FrameTime: 1.502 ms
[build] use-vbo=true: FPS: 908 FrameTime: 1.102 ms
[texture] texture-filter=nearest: FPS: 782 FrameTime: 1.279 ms
[texture] texture-filter=linear: FPS: 778 FrameTime: 1.286 ms
[texture] texture-filter=mipmap:TU: error: vk_kgsl_sync_import_sync_file: dup failed: Too many open files
MESA: error: MESA: failed to import sync file 'Invalid argument'
MESA: error: zink: swapchain killed 0x30004994c0

vkmark error

hsm@localhost:~$ vkmark
ERROR:             VkInstanceCreateInfo::pApplicationInfo::apiVersion has value of 0 which is not permitted. If apiVersion is not 0, then it must be greater than or equal to the value of VK_API_VERSION_1_0 [VUID-VkApplicationInfo-apiVersion]
Segmentation Fault,

test.patch.txt maybe useful

@xMeM

Thank you for the new patch.

I build mesa Turnip by applying the new patch and tu_kgsl_export_dmabuf.patch to the Adreno750 branch, but glmark2, glmark2-es2, vkcube, etc. do not run with the new patch.

Please confirm. T_T

hsm@localhost:~$ glmark2
ATTENTION: default value of option vblank_mode overridden by environment.
MESA: error: CreateSwapchainKHR failed with VK_ERROR_INITIALIZATION_FAILED
MESA: error: zink: could not create swapchain
glmark2: ../src/gallium/drivers/zink/zink_kopper.c:1039: zink_kopper_set_swap_interval: Assertion `res->obj->dt' failed.
hsm@localhost:~$ glmark2-es2
libEGL warning: DRI3: Screen seems not DRI3 capable
ATTENTION: default value of option vblank_mode overridden by environment.
MESA: error: CreateSwapchainKHR failed with VK_ERROR_INITIALIZATION_FAILED
MESA: error: zink: could not create swapchain
glmark2-es2: ../src/gallium/drivers/zink/zink_kopper.c:1039: zink_kopper_set_swap_interval: Assertion `res->obj->dt' failed.
hsm@localhost:~$ vkcube
Selected GPU 0: Turnip Adreno (TM) 750, type: IntegratedGpu
vkcube: ./cube/cube.c:1409: demo_prepare_buffers: Assertion `!err' failed.
hsm@localhost:~$ vkmark
ERROR:             VkInstanceCreateInfo::pApplicationInfo::apiVersion has value of 0 which is not permitted. If apiVersion is not 0, then it must be greater than or equal to the value of VK_API_VERSION_1_0 [VUID-VkApplicationInfo-apiVersion]
Segmentation Fault
xMeM commented 8 months ago
hsm@localhost:~$ glmark2-es2
libEGL warning: DRI3: Screen seems not DRI3 capable
ATTENTION: default value of option vblank_mode overridden by environment.
MESA: error: CreateSwapchainKHR failed with VK_ERROR_INITIALIZATION_FAILED
MESA: error: zink: could not create swapchain
glmark2-es2: ../src/gallium/drivers/zink/zink_kopper.c:1039: zink_kopper_set_swap_interval: Assertion `res->obj->dt' failed.
hsm@localhost:~$ vkcube
Selected GPU 0: Turnip Adreno (TM) 750, type: IntegratedGpu
vkcube: ./cube/cube.c:1409: demo_prepare_buffers: Assertion `!err' failed.
hsm@localhost:~$ vkmark
ERROR:             VkInstanceCreateInfo::pApplicationInfo::apiVersion has value of 0 which is not permitted. If apiVersion is not 0, then it must be greater than or equal to the value of VK_API_VERSION_1_0 [VUID-VkApplicationInfo-apiVersion]
Segmentation Fault

The last patch does not contain the previous patch, so you still need to apply the previous patch.

hansm629 commented 8 months ago
hsm@localhost:~$ glmark2-es2
libEGL warning: DRI3: Screen seems not DRI3 capable
ATTENTION: default value of option vblank_mode overridden by environment.
MESA: error: CreateSwapchainKHR failed with VK_ERROR_INITIALIZATION_FAILED
MESA: error: zink: could not create swapchain
glmark2-es2: ../src/gallium/drivers/zink/zink_kopper.c:1039: zink_kopper_set_swap_interval: Assertion `res->obj->dt' failed.
hsm@localhost:~$ vkcube
Selected GPU 0: Turnip Adreno (TM) 750, type: IntegratedGpu
vkcube: ./cube/cube.c:1409: demo_prepare_buffers: Assertion `!err' failed.
hsm@localhost:~$ vkmark
ERROR:             VkInstanceCreateInfo::pApplicationInfo::apiVersion has value of 0 which is not permitted. If apiVersion is not 0, then it must be greater than or equal to the value of VK_API_VERSION_1_0 [VUID-VkApplicationInfo-apiVersion]
Segmentation Fault

The last patch does not contain the previous patch, so you still need to apply the previous patch.

@xMeM

Excellent!

Applying 3 patches to Adreno 750 branch Results of testing a new build of mesa Turnip

glmark2, glmark2-es2, glxgears, and vkcube all run well!

But there was one problem. vkmark is not working yet.

An error appears as below.

hsm@localhost:~$ vkmark
ERROR:             VkInstanceCreateInfo::pApplicationInfo::apiVersion has value of 0 which is not permitted. If apiVersion is not 0, then it must be greater than or equal to the value of VK_API_VERSION_1_0 [VUID-VkApplicationInfo-apiVersion]
Segmentation Fault
xMeM commented 8 months ago
hsm@localhost:~$ vkmark
ERROR:             VkInstanceCreateInfo::pApplicationInfo::apiVersion has value of 0 which is not permitted. If apiVersion is not 0, then it must be greater than or equal to the value of VK_API_VERSION_1_0 [VUID-VkApplicationInfo-apiVersion]
Segmentation Fault

I can't reproduce this, but this error is related to vulkan-loader, you can try switching its version.

hansm629 commented 8 months ago
hsm@localhost:~$ vkmark
ERROR:             VkInstanceCreateInfo::pApplicationInfo::apiVersion has value of 0 which is not permitted. If apiVersion is not 0, then it must be greater than or equal to the value of VK_API_VERSION_1_0 [VUID-VkApplicationInfo-apiVersion]
Segmentation Fault

I can't reproduce this, but this error is related to vulkan-loader, you can try switching its version.

@xMeM

Is there a version you recommend?

Currently, "libvulkan1_1.3.275.0-1_arm64.deb" distributed by debian sid repo is installed.

hansm629 commented 8 months ago
hsm@localhost:~$ vkmark
ERROR:             VkInstanceCreateInfo::pApplicationInfo::apiVersion has value of 0 which is not permitted. If apiVersion is not 0, then it must be greater than or equal to the value of VK_API_VERSION_1_0 [VUID-VkApplicationInfo-apiVersion]
Segmentation Fault

I can't reproduce this, but this error is related to vulkan-loader, you can try switching its version.

@xMeM

S24U PRoot-Distro Debian Linux is libvulkan1_1.3.275.0-1_arm64.deb distributed from Debian sid repo was installed.

I manually installed libvulkan-dev_1.3.250.0-1_arm64.deb distributed in the Ubuntu 23.10 repo instead.

As a result, the error message below was no longer displayed.

ERROR:             VkInstanceCreateInfo::pApplicationInfo::apiVersion has value of 0 which is not permitted. If apiVersion is not 0, then it must be greater than or equal to the value of VK_API_VERSION_1_0 [VUID-VkApplicationInfo-apiVersion]

https://github.com/termux/termux-packages/assets/101167173/b0581002-30c8-43ae-aee1-46ece9ff94b3

However, if I still enter the vkmark and vulkaninfo commands, It does not run with a Segmentation Fault error. (00:30~00:35)

I installed the build mesa Turnip on Galaxy Tab S9 Ultra (8G2 A740) PRoot-Distro Debian Linux, and both vkmark and vulkaninfo ran well.

However, the following error message was displayed when running vkmark(libvulkan1_1.3.275.0-1_arm64.deb is installed) 스크린샷_2024-02-09_00-23-43

The vkmark benchmark ran well and achieved an average score of 1700.

mesa Turnip, built from the Adreno 750 branch with three patches applied, seems to work very well on GPUs below Adreno 740.

I'm carefully guessing that maybe the DRI3 patch needs a little more modification for Adreno 750 support.

Please give me your opinion.

hansm629 commented 6 months ago

@xMeM

hello. sir

that you made

wsi-termux-x11-main.patch tu_kgsl_export_dmabuf.patch test.patch

I finally did it with 3 patches!

It is a deleted branch now, but

https://gitlab.freedesktop.org/Danil/mesa/-/archive/fix/turnip/a750-android-protected-reg-write/mesa-fix-turnip-a750-android-protected-reg-write.tar. gz

Apply 3 types of patches

In PRoot-Distro Debian12 environment on Galaxy S24 Ultra

blender, kdenlive, glmark2, glmark2-es2, vulkaninfo, vkmark, vkcube, vkmark, etc Everything works fine!

Screenshot_2024-03-21_17-30-06 Screenshot_2024-03-21_17-35-14 Screenshot_2024-03-21_17-34-21 Screenshot_2024-03-21_17-40-40 Screenshot_2024-03-21_17-30-29 Screenshot_2024-03-21_17-31-39

The performance of glmark2 and glmark2-es2 is lower than Adreno 740, but for vkmark, Adreno 750 has about 25% higher performance than Adreno 740. (Adreno 750 support seems to be still unstable in the Zink environment.)

It's all thanks to sir!

https://gitlab.freedesktop.org/Danil/mesa/-/tree/fix/turnip/a750-tess-param-and-factor-size-regs

However, a new branch supporting Adreno 750 was recently uploaded, so after the dri3 patch, I tried to build the deb package, but

An error occurs when applying tu_kgsl_export_dmabuf.patch as shown below.

hsm@localhost:~/Desktop/mesa-fix-turnip-a750-tess-param-and-factor-size-regs$ git apply -v '/home/hsm/download/wsi-termux-x11-main.patch' 
Checking patch src/vulkan/wsi/wsi_common_x11.c...
Hunk #5 succeeded at 1670 (offset 50 lines).
Hunk #6 succeeded at 1951 (offset 50 lines).
Hunk #7 succeeded at 2031 (offset 50 lines).
Hunk #8 succeeded at 2052 (offset 50 lines).
Hunk #9 succeeded at 2068 (offset 50 lines).
Applied patch src/vulkan/wsi/wsi_common_x11.c cleanly.
hsm@localhost:~/Desktop/mesa-fix-turnip-a750-tess-param-and-factor-size-regs$ git apply -v '/home/hsm/download/test.patch' 
Checking patch src/vulkan/wsi/wsi_common_drm.c...
Applied patch src/vulkan/wsi/wsi_common_drm.c cleanly.
hsm@localhost:~/Desktop/mesa-fix-turnip-a750-tess-param-and-factor-size-regs$ git apply -v '/home/hsm/download/tu_kgsl_export_dmabuf.patch' 
Checking patch src/freedreno/vulkan/tu_device.cc...
Hunk #1 succeeded at 2770 (offset 146 lines).
Checking patch src/freedreno/vulkan/tu_knl.h...
error: while searching for:
   TU_BO_ALLOC_ALLOW_DUMP = 1 << 0,
   TU_BO_ALLOC_GPU_READ_ONLY = 1 << 1,
   TU_BO_ALLOC_REPLAYABLE = 1 << 2,
};

/* Define tu_timeline_sync type based on drm syncobj for a point type

error: patch failed: src/freedreno/vulkan/tu_knl.h:21
error: src/freedreno/vulkan/tu_knl.h: patch does not apply
Checking patch src/freedreno/vulkan/tu_knl_kgsl.cc...
Hunk #3 succeeded at 70 (offset 1 line).
Hunk #4 succeeded at 132 (offset 1 line).
Hunk #5 succeeded at 182 (offset 1 line).
Hunk #6 succeeded at 238 (offset 7 lines).
Hunk #7 succeeded at 249 (offset 7 lines).
Hunk #8 succeeded at 258 (offset 7 lines).
error: while searching for:
   if (bo->map)
      munmap(bo->map, bo->size);

   struct kgsl_gpumem_free_id req = {
      .id = bo->gem_handle
   };

error: patch failed: src/freedreno/vulkan/tu_knl_kgsl.cc:210
error: src/freedreno/vulkan/tu_knl_kgsl.cc: patch does not apply
hsm@localhost:~/Desktop/mesa-fix-turnip-a750-tess-param-and-factor-size-regs$ 

Could you please make a new updated patch?

xMeM commented 6 months ago

Could you please make a new updated patch?

tu_kgsl_export_dmabuf.patch.txt

hansm629 commented 6 months ago

@xMeM thank you! The patch applies well!

However, turnip build from that branch does not seem to work on Adreno 750 devices.

An error message appears as follows: vkmark, vkcube, glmark2, and glmark2-es2 all did not work.

hsm@localhost:~$ vkmark
=======================================================
    vkmark 2017.08
=======================================================
    Vendor ID:      0x5143
    Device ID:      0x43051401
    Device Name:    Turnip Adreno (TM) 750
    Driver Version: 100663395
    Device UUID:    a04cd8e1a8a7713fcd060df36d4b42f1
=======================================================
[vertex] device-local=true:terminate called after throwing an instance of 'vk::DeviceLostError'
  what():  vk::Device::waitIdle: ErrorDeviceLost
Aborted
hsm@localhost:~$ vkcube
Selected GPU 0: Turnip Adreno (TM) 750, type: IntegratedGpu
vkcube: ./cube/cube.c:711: demo_flush_init_cmd: Assertion `!err' failed.
Aborted
hsm@localhost:~$ glmark2
=======================================================
    glmark2 2023.01
=======================================================
    OpenGL Information
    GL_VENDOR:      Collabora Ltd
    GL_RENDERER:    zink (Turnip Adreno (TM) 750)
    GL_VERSION:     4.6 (Compatibility Profile) Mesa 22.3.6
    Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=0 samples=0
    Surface Size:   800x600 windowed
=======================================================
[build] use-vbo=false:Segmentation fault
hsm@localhost:~$ glmark2-es2
=======================================================
    glmark2 2023.01
=======================================================
    OpenGL Information
    GL_VENDOR:      Collabora Ltd
    GL_RENDERER:    zink (Turnip Adreno (TM) 750)
    GL_VERSION:     OpenGL ES 3.2 Mesa 22.3.6
    Surface Config: buf=32 r=8 g=8 b=8 a=8 depth=24 stencil=0 samples=0
    Surface Size:   800x600 windowed
=======================================================
[build] use-vbo=false:MESA: error: ZINK: vkQueueSubmit failed (VK_ERROR_DEVICE_LOST)

The turnip build from that branch worked well on Adreno 740 device (Galaxy Tab S9 Ultra).

If so, it's probably because Adreno 750 support is still unstable in that branch, right?

First, I reverted back to the deb package built from the now-deleted mesa-fix-turnip-a750-android-protected-reg-write branch.

twaik commented 6 months ago

Closing this because:

  1. xMeM sent a new patch for this case.
  2. Patches written for termux-packages are guaranteed to work with termux-packages and not with some third-party code people can find all over the Internet.