-
Notifications
You must be signed in to change notification settings - Fork 231
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
Vulkan support [APK included] #596
base: master
Are you sure you want to change the base?
Conversation
Added an APK for people wanting to test. It defaults to vo_gpu + Vulkan, vo_gpu_next is present too (both vk and gl) and you can switch by editing mpv.conf as usual. |
Device: HuaWei Mate 20 pro MPV crashed when open a file. My mpv.config as below:
|
I can only diagnose issues with logcat output. |
Looks like you're missing support for timeline semaphores which means your phone/GPU is not supported. |
Ok, thanks for your explaining. |
Any updates on this? And, api is already bumped up right? Can strike off the first check box. |
I will revisit this sometime to work on the rest. |
I'm looking forward to getting a new modern build once the vulkan issue is fixed. Here's an old debug build from the source with working vulkan.mpv_vukan.apk |
How old is this? |
2019 but vulkan works. |
No surprise, this project might be able to work around the requirement in the future but I haven't investigated that yet.
I can't see any settings being applied in the log but you probably forgot to set
Again no surprise as this is a totally regular build. |
|
Thankfully, it is more stable than master when I use I can't even apply |
When building libplacebo, the build fails when the android toolchain tries to include <shaderc/shaderc.h>. This fixes the issue: syphyr@b8c7260 All of the other pkg-config files have a prefix of "/usr/local". The shaderc pkg-config was the only one with a prefix of "/usr". There must have been some conflict with the Android toolchain and the search path. |
Even though vulkan does not seem to be supported on my older Android tablet, I also wanted to mention that vo=gpu-next seems to work better than vo=gpu. |
There are actually two separate issues i encountered when building libplacebo. The first issue is that $prefix_dir/lib does not get created for shaderc, so it fails copying libs. The second issue is with the path inside the shaderc pkgconfig file mentioned previously. Edit: my build machine does not have any local shaderc.h files, so maybe that is why I'm noticing this problem with the pkgconfig file. |
I tested this branch just yesterday and there were no issues with shaderc. |
The issue i had with the include path for shaderc.h might be because of a difference with my build environment. I also just started noticing that vo=gpu-next is causing random freezing in the video playback, but the audio keeps going. |
@sfan5 the shaderrc problem is there when building with the github actions build, but is fixed with syphrs patch, yesterday i forked mpv-android to do some dilly-dallying. Btw how to build arm64v8a with gh actions? |
It looks like you need to add a line before this one to build arm64 variant.
mpv-android/buildscripts/.travis.sh Line 79 in ebc2f2a
|
When building libplacebo separately, the build fails when shaderc attempts to copy libs to The Android NDK r25c contains shaderc v2022.1. The official Google shaderc repo has updated to v2023.5. This commit builds libplacebo with latest official google shaderc repo with updated 3rdparty libs. Also, using the google shaderc repo allows for including faster bugfixes and pinning versions. Edit: Updated links to include fixing copying shaderc header files. When |
Since this pr also seems to involve gpu-next, i bring this issue to the notice of the devs : On my Samsung t505 tablet, with the given apk in the first comment here and also the apk built from syphrs' fork which uses latest versions of many deps, with the following config
I notice very high number of frame drops with hwdec=auto(defaults to mediacodec), lesser drops with hwdec=no, and least with hwdec=auto-copy(mediacodec-copy), note that my device supports hardware vp9 decoding, but even with mediacodec-copy im getting 200+ framedrops for a 100 sec video. The video in question is here |
no, there is no audio video desync with the config i mentioned above, but using
yes it does, but the order of framedrops is different mediacodec-copy>mediacodec>software
do i use termux to execute that? ps - i forgot to mention that this issue is non-existant with the stock play store release with no config |
actually nvm it's just as bad with this version, also i don't believe using termux's version of ffmpeg to test out regression is plausible |
Where and how did you find this fork version of mpv android which includes gpu-next? |
mpvlog.txt |
Probably has to be fixed inside mpv, small issue.
mediacodec-copy can be higher quality than mediacodec since it leaves the RGB conversion to mpv (whether this matters depends on the driver). |
Okay, this is a weird one. I encountered a problem that one of the scalers may have helped catch. On the stable version, ewa_lanczos looked funky and I didn't want to bother tuning it so I just ended up using spline36. With gpu-next however, I thought the defaults for ewa_lanczos looked "fine", that is until I opened an external subtitle file for a video and immediately noticed the quality change. What I later discovered is upon first opening a video with mpv, the scaler probably functions as expected, but if you minimize the app into recents and go back OR do something from within the app that launches another activity, opening a subtitle file for example - the scaler behavior changes. See this screenshot comparison.
|
Looks like either some sort of GPU (driver) bug or a bug in libplacebo, that was probably already fixed in the meantime since the APK in OP is so outdated... |
I'm keen on testing if a new APK is available with updated libplacebo. |
There's one now. |
Hi, thanks for the new build. Unfortunately, the thing with scalers is still there. I can live with not minimizing the app and getting around having external subtitles by renaming them to be the same as video files. The more pressing issue seems to be the loss of video output (screen goes purple) after 10+ minutes of playback. Looking around, I found a similar issue that was filed here mpv-player/mpv#11721 However, something else that may be of interest that is present in my log is this Not sure if these two issues are actually the same as the original is referring to a video "freeze" whereas here, the screen goes purple. Full log: |
Feel free to report that to haasn then, sounds like a real issue. New build uploaded btw. |
Previously it seemed like the audio underrun issue somehow led to the OpenGL OOM error but that might be a red herring because the audio underrun doesn't occur if speakers are used, only during USB-out. It probably has something to do with the device's audio HAL:
I've previously had an app that would cause these warnings to show up when AudioTrack API was selected but not for AAudio or OpenSL. In any case, it's probably not really something worth looking into if the warning is actually harmless. I'm opening an issue on the mpv repo about the video playback issue. Not sure if the libplacebo repo would've been more appropriate but I'm hoping there'd be more eyes on the thing that way. Btw, this is quite spammy on the last build:
|
Since you just added libplacebo to the regular build, isn't shaderc a dependency of libplacebo? |
Only for Vulkan support. |
Needs to make sure Vulkan is actually enabled. diff --git a/buildscripts/scripts/mpv.sh b/buildscripts/scripts/mpv.sh
index feb85c9..c3e097f 100755
--- a/buildscripts/scripts/mpv.sh
+++ b/buildscripts/scripts/mpv.sh
@@ -18,7 +18,7 @@ unset CC CXX # meson wants these unset
meson setup $build --cross-file "$prefix_dir"/crossfile.txt \
--default-library shared \
-Diconv=disabled -Dlua=enabled \
- -Dlibmpv=true -Dcplayer=false \
+ -Dlibmpv=true -Dcplayer=false -Dvulkan=enabled \
-Dmanpage-build=disabled
ninja -C $build -j$cores and also in mpv, to make Vulkan context available. There is no pc for vulkan so it fallback to system detection and this doesn't have version. Could generate custom .pc to workaround. diff --git a/meson.build b/meson.build
index 0ff16b42d9..75b0cc89bb 100644
--- a/meson.build
+++ b/meson.build
@@ -1248,7 +1248,7 @@ vulkan_opt = get_option('vulkan').require(
libplacebo.get_variable('pl_has_vulkan', default_value: '0') == '1',
error_message: 'libplacebo compiled without vulkan support!',
)
-vulkan = dependency('vulkan', version: '>= 1.1.70', required: vulkan_opt)
+vulkan = dependency('vulkan', required: vulkan_opt)
features += {'vulkan': vulkan.found()}
if features['vulkan']
dependencies += vulkan |
Enabling vulkan on api <= 24 will cause segfault at runtime. |
I used to do this to make libplacebo happy but then it was no longer necessary. |
Opening this PR to keep track of the required changes to merge Vulkan support.
Checklist:
Figure out if we can avoid bumping the API minimum¹(no)¹ Raising the API to 24 would lose us 1.0% of our Google Play install base.
APK ->