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

如何编译 #1

Closed
Tungstend opened this issue Apr 16, 2022 · 27 comments
Closed

如何编译 #1

Tungstend opened this issue Apr 16, 2022 · 27 comments
Labels
good first issue Good for newcomers

Comments

@Tungstend
Copy link

我又又来了。。能麻烦发下编译命令吗,还有virgl分支的。。boat更新后的表现确实让人眼馋

@CosineMath
Copy link
Collaborator

添加一个交叉编译配置文件aarch64-android,可参考mesa的文档:

[binaries]
    ar = 'aarch64-linux-android-ar'
    c = ['ccache', 'aarch64-linux-android26-clang']
    cpp = ['ccache', 'aarch64-linux-android26-clang++', '-fno-exceptions', '-fno-unwind-tables', '-fno-asynchronous-unwind-tables', '-static-libstdc++']
    strip = 'aarch64-linux-android-strip'
    # Android doesn't come with a pkg-config, but we need one for meson to be happy not
    # finding all the optional deps it looks for.  Use system pkg-config pointing at a
    # directory we get to populate with any .pc files we want to add for Android
    pkgconfig = ['env', 'PKG_CONFIG_LIBDIR=<你的各种包的.pc文件,参考pkgconfig的用法>', '/usr/bin/pkg-config']

    [host_machine]
    system = 'linux'
    cpu_family = 'arm'
    cpu = 'armv8'
    endian = 'little'

在源码顶级目录执行meson进行配置:

meson <你的编译目录,任意指定但不要放在源码里> \
    --cross-file <前面写好的交叉编译文件> \
    --prefix=<安装目录,任意指定,之后会把整理好的库放在这里> \
    -Dgallium-drivers=<可选用swrast,zink和virgl,多个请用逗号分割,swrast必选> \
    -Dvulkan-drivers= -Ddri-drivers= -Ddri3=disabled -Dshared-glapi=enabled -Dopengl=true \
    -Dgles1=enabled -Dgles2=enabled -Degl=enabled -Dglx=dri -Dglx-fake=true \
    -Dgbm=disabled -Dglvnd=false -Dllvm=disabled -Dlibunwind=disabled \
    -Dplatforms=swdroid -Dplatform-sdk-version=26

也可以将 \ 删除并把命令改成一行。

在生成的编译目录里执行ninja install,等待编译完成。之后可在安装目录里找到各种库。

绝对不要把安装目录指定为/usr之类的

@CosineMath CosineMath added the good first issue Good for newcomers label Apr 17, 2022
@CosineMath CosineMath pinned this issue Apr 17, 2022
@Tungstend
Copy link
Author

太奇怪了,缺少一堆头文件。。可否麻烦直接发下编译好的库。。

@CosineMath
Copy link
Collaborator

。。。github发文件貌似不是很方便?额外的依赖只有expat不至于缺少很多头文件吧。你编译输出信息发出来看看?

@Tungstend
Copy link
Author

-3409d846408ec2c3
可否麻烦发个release

@Tungstend
Copy link
Author

或者我们也许可以通过其他平台传文件,比如QQ

@CosineMath
Copy link
Collaborator

CosineMath commented Apr 17, 2022

额,请使用ndk r21e的clang,(仔细看一下啊,我前面都说了用clang)

@Tungstend
Copy link
Author

太难了,,我觉得还是发个release简单些[doge]

@Tungstend
Copy link
Author

为什么编译出来一堆库,就是没有libOSMesa。。
RFVDO1M(QXG_DR)1)HMN{U8

@CosineMath
Copy link
Collaborator

本来就不需要osmesa好吗。。。不是编译出来了libEGL.so.1 libGL.so.1。。。

@Tungstend
Copy link
Author

好了,可是这帧数是不是。。还是说少加了什么变量
03E17C970DA359F17C255604FC412189

@CosineMath
Copy link
Collaborator

你这个帧数已经很好了,毕竟我用softpipe连游戏都进不去(笑)

GALLIUM_DRIVER指定你要的渲染器,除了softpipe还有virpipe和zink可用。

@Tungstend
Copy link
Author

lost connection to rendering server on 8 read -1 22
virgl是不是有个 VIRGL_VTEST_SOCKET_NAME 变量,该如何解决?

@Tungstend
Copy link
Author

确实默认的渲染器很感人,设置为virpipe就会出现上面的报错
668EA11382C3CFFF3ABC4BD501C905A7

@CosineMath
Copy link
Collaborator

确实默认的渲染器很感人,设置为virpipe就会出现上面的报错 668EA11382C3CFFF3ABC4BD501C905A7

这又是什么渲染器啊。。。

@Tungstend
Copy link
Author

这就是一开始的softpipe,换了个手机,设置为virpipe后会有这个报错
lost connection to rendering server on 8 read -1 22

@CosineMath
Copy link
Collaborator

你得用一个进程开启vtest server

[
    [ "patchLinker" ],
    [ "strdef", "home", "/sdcard/boat" ],
    [ "strdef", "runtime_path", "/data/user/0/jackpal.androidterm/app_HOME/boat_runtime/aarch64" ],
    [ "strdef", "virgl_install", "${runtime_path}/virgl-0.9.1" ],
    [ "redirectStdio", "${home}/vtest_output.txt" ],
    [ "setenv", "HOME", "${home}" ],
    [ "setenv", "TMPDIR", "${tmpdir}" ],
    [ "strdef", "vtest_socket", "${tmpdir}/vtest-socket" ],
    [ "dlopen", "${virgl_install}/lib/libepoxy.so.0" ],
    [ "dlopen", "${virgl_install}/lib/libvirglrenderer.so.1" ],
    [ "chdir", "${home}" ],
    [ "dlexec",
        "${virgl_install}/bin/virgl_test_server",
        "--no-loop-or-fork",
        "--use-gles",
        "--socket-name",
        "${vtest_socket}"
    ],
]

然后使用virpipe驱动

[
    [ "strdef", "vtest_socket", "${tmpdir}/vtest-socket" ],
    [ "strdef", "mesa_install", "${runtime_path}/mesa-virgl" ],
    [ "setenv", "VIRGL_DEBUG", "verbose" ],
    [ "setenv", "LIBGL_DEBUG", "verbose" ],
    [ "setenv", "MESA_DEBUG", "incomplete_tex,incomplete_fbo,context" ],
    [ "setenv", "LIBGL_DRIVERS_PATH", "${mesa_install}/lib/dri" ],
    [ "setenv", "MESA_GL_VERSION_OVERRIDE", "3.2" ],
    [ "setenv", "MESA_GLSL_VERSION_OVERRIDE", "150" ],
    [ "setenv", "VIRGL_VTEST_SOCKET_NAME", "${vtest_socket}" ],
    [ "setenv", "GALLIUM_DRIVER", "virpipe" ],
    [ "setenv", "MESA_GLSL_CACHE_DIR", "${tmpdir}" ],	 
    [ "dlopen", "${mesa_install}/lib/libexpat.so.1" ],
    [ "dlopen", "${mesa_install}/lib/libglapi.so.0" ],
    [ "dlopen", "${mesa_install}/lib/libEGL.so.1" ],
    [ "dlopen", "${mesa_install}/lib/libGL.so.1" ],
    [ "dlopen", "${mesa_install}/lib/dri/swrast_dri.so" ],
    
    [ "strcat", "library_path", 
        "${mesa_install}/lib:"
    ],
]

@Tungstend
Copy link
Author

这样写有什么问题吗,有没有少什么,为何会报错
image
0 S2E2M8E@75AW8X7~QQPU7
O@T36CNPNZ(QGRZX_AK8$SS

@Tungstend
Copy link
Author

Tungstend commented Apr 18, 2022

重新编译了一下,之前的server是可执行文件所以没法dlopen,改成so了。非常感谢你的帮助,就是mesa的渲染都有通病,对我的手机不友好。。这是virpipe。。
BB851DA5124EBC68B2319D5FD6F4EE3A

@CosineMath
Copy link
Collaborator

我用可执行文件可以直接dlexec没问题。。。

从这个图来看,有可能是分辨率搞错了,也就是说mesa内部的缓冲区大小和你的显示用的ANativeWindow的缓冲区大小不匹配。你可以打印一下两个缓冲区的大小看看。(源码自己翻咯,我又没有你的手机)

@CosineMath
Copy link
Collaborator

你不回复我就当你修复了。

@Tungstend
Copy link
Author

没事关了吧,这个问题和gl4es红屏问题估计一时半会也解决不了了,等将来有空再慢慢解决了,感谢你的帮助

@Tungstend
Copy link
Author

突然想起来,是不是还有zink可用,刚刚试了一下,闪退了,是有啥注意事项还是压根没适配zink

@CosineMath
Copy link
Collaborator

闪退你得看日志说了什么。我这边 1.16.5 用 zink 没问题。

@Tungstend
Copy link
Author

~4876TC4Z{FMJ%}%VIPIDT5
6PE)UP7)KN0JBO6PNU{Y2JJ
6~46ZN8CPZ%9 {JY96G0Q}L
OX_XB_7}_0C~52A8$47NI{P
又试了一下确实不行,代码是不是少什么

@CosineMath
Copy link
Collaborator

我也不知道。virgl能用zink就不会有问题才对。1.12.2 我也是能用的,请你自行调试一下。

@Tungstend
Copy link
Author

话说,支持硬件加速吗,帧数和virgl比怎么样

@Tungstend
Copy link
Author

D8BB100B9569BF4B00F2AE2E75F140FE
焯,田鸡直接跑起来了,骁龙的问题,pojavlauncher的zink也是骁龙的问题,不过这个帧数和virgl也是旗鼓相当

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
Projects
None yet
Development

No branches or pull requests

2 participants