I deleted my post because I don’t want to poison this beautiful thread.
Day 21, Season 2
Continuing wifi and video playback…
# find / -type f -iname \*.so -exec grep -q "is not a supported pixel format" {} \; -print
/vendor/lib/libqc2vppfilter.so
/vendor/lib/libqcodec2_v4l2codec.so
/vendor/lib64/libqc2vppfilter.so
/vendor/lib64/libqcodec2_v4l2codec.so
So no sources here.
However, droid media should have info on pixel formats.
(It does have one YV12 reference but I don’t get how the constant is used.)
setprop debug.stagefright.ccodec
with values 1 thorugh 4 does not help.
Doing lsof on the above libraries shows this service using the 32-bit ones
6345 mediacod {vendor.qti.medi} media.hwcodec /vendor.qti.media.c2@1.0-service
Changing /odm/lib/ links to bind mounts as in the previous day for lib64… no different video deocoding output.
I should try GST_DEBUG=
I remember there was this env variable.
Also, for wifi, it crossed my mind that I echoed 1 to some /dev/…/fs_ready device. Maybe I shouldn’t have done that manually.
Let’s systemctl mask wifiservice.service
, remove that echo 1 from droid-hal-early-init.sh and reboot and manually check dmesg if “cold boot calibration” was done.
Hmm… There’s a chance… Let’s unmask it and reboot, but before that, make really sure it runs after droid-hal-init
It is already declared “After=droid-hal-init.service”
So… Unmasked, reboot. It does not crash - but it does not start wifi either. Modprobe fails because of CBC.
Journal shows that droid-init-done is signaled and fs_ready is set to 1 after 10 more seconds, on “post-fs-data” stage.
Then the vendor init scripts try to modprobe the qca_cld_wlan…
Hmm… I could write a post-fs-data init.rc file or… just bind mount my driver to the /vendor/lib/ one… which one would be faster…?
(Or wait 10 seconds which is less than ideal, because I would have to add some additional time)
So, I have this driver
# ls -l /lib/modules/$(uname -r)/qca_cld3_wlan.ko
-rw-r--r-- 1 root root 13253840 May 9 11:36 /lib/modules/5.4.61-qgki-perf-geb682b239d51/qca_cld3_wlan.ko
And Android has this one
ls -l /vendor/lib/modules/qca_cld3_wlan.ko
-rw-r--r-- 1 root root 13386176 Jan 1 2009 /vendor/lib/modules/qca_cld3_wlan.ko
So I add to my droid-hal-early-init
mount -o bind /lib/modules/$(uname -r)/qca_cld3_wlan.ko /vendor/lib/modules/qca_cld3_wlan.ko
And mask wifiservice again and fingers crossed.
It boots… but it consumes much power
Adding my /etc/WCNSS_qcom_cfg.ini again
Also, video playback is broken, doesn’t even start, because I removed all the links from /odm/lib.
Let’s add bind mounts instead.
# Instead of ln -s
for library in libandroidicu libicuuc libicui18n libnativehelper; do
rm -f /odm/lib/${library}.so
touch /odm/lib/${library}.so
mount -o bind /apex/com.android.art/lib/${library}.so /odm/lib/${library}.so
done
That wifi… ssh started to be a little choppy. But power is still 200+ mA…
Those bind mounts? they didn’t work. The com.android.art only exists after linkerconfig did its job
Moving them to wait-for-linkerconfig script from previous days?
This time, the bind mounts work but the result is the same, gallery does not play more than a dozen frames.
Finally remembered that there was an youtube video that didn’t play, so browser also gives errors on some videos (altough Gallery does on many more - all?)
gecko-camera[16036]: droid-codec error:774 – Hardware error 4
For the same journal error, logcat goes crazy like Ubuntu Pastebin
The familiar “Format changed from codec” that we saw in gallery logs.
This time it’s “YUV420P is not a supported pixel format”
Also, after format changed, a message “Got EOS” is logged, which does this:
// Prevent new frames from being queued.
codec->m_src->drain();
Which would explain video locking.
Let’s remove that line, shall we :)?
Then
[HABUILD_SDK]$ make -j$(nproc --all) droidmedia
[PlatformSDK]$ rpm/dhd/helpers/build_packages.sh --gg
Cross checking:
ls -l out/target/product/sake/system/lib64/libdroidmedia.so
-rwxr-xr-x 1 vlad vlad 116400 May 27 03:30 out/target/product/sake/system/lib64/libdroidmedia.so
It has the same length as the file in the droidmedia rpm in droid-local-repo
.
Let’s scp it. Did I mention that some recent changes made ssh very flaky? Just as it is on my current device.
(Maybe wifi learned how to sleep. Fingerscrossed. Reboot with droidmedia change.)
Now the behaviour is … different. Gallery the same, but the browser video linked in the log above does not spill the ton of screaming “A buffer we don’t know about is being finished!”
I now get
05-27 00:44:10.043 10000 142 D BufferPoolAccessor2.0: bufferpool2 0x7c702f9f68 : 5(82944000 size) total buffers - 4(66355200 size) used buffers - 394/399 (recycle/alloc) - 5/396 (fetch/transfer)
05-27 00:44:10.414 10000 137 E Codec2-types: Null BaseBlock::nativeBlock.
05-27 00:44:10.414 10000 137 E Codec2-types: Invalid WorkBundle::baseBlocks[0].
05-27 00:44:10.444 10000 137 E Codec2-types: Null BaseBlock::nativeBlock.
05-27 00:44:10.445 10000 137 E Codec2-types: Invalid WorkBundle::baseBlocks[0].
05-27 00:44:10.485 10000 137 E Codec2-types: Null BaseBlock::nativeBlock.
05-27 00:44:10.485 10000 137 E Codec2-types: Invalid WorkBundle::baseBlocks[0].
05-27 00:44:10.523 10000 137 E Codec2-types: Null BaseBlock::nativeBlock.
05-27 00:44:10.524 10000 137 E Codec2-types: Invalid WorkBundle::baseBlocks[0].
05-27 00:44:10.574 10000 137 E Codec2-types: Null BaseBlock::nativeBlock.
05-27 00:44:10.575 10000 137 E Codec2-types: Invalid WorkBundle::baseBlocks[0].
which might be related to the fact that I didn’t “drain” those 5 buffers?
This would be a fuller snippet: Ubuntu Pastebin
Next thing tried: reverting that whole commit which introduces the line. This doesn’t work well either.
In hindisght, I think looking into droidmedia for a fix was somewhat misleading.
The video playback doesn’t work well in Waydroid too - which does not use droidmedia, but may suffer from hybris patches (or lack of) or any misconfiguration in the subset of droid services we’re spinning up…
Also, waiting for WIFI Cold-Boot-Calibration to be done by android services did not help either, as I’m writing this I’ve already tested for many hours and it still drains battery. Probably Lineage build itself needs to be flashed to grab logs…
Day 22, Season 2
Stracing mediacod startup (as root for starters) /vendor/bin/hw/vendor.qti.media.c2@1.0-service
Some of the files opened:
/vendor/etc/media_lahaina/video_system_specs.json
/vendor/etc/seccomp_policy/codec2.vendor.base-arm.policy
/vendor/etc/seccomp_policy/codec2.vendor.ext-arm.policy
That “libqc2vppfilter.so” - VPP filter… Video Post Processing?
The video_system_specs.json lists
// list of codec plugin libraries to be loaded into codec registry "QC2CodecPlugins": [ "libqc2vppfilter.so" ], // List of HW codecs enabled for this target "codecs-available": { "decoders": [ "c2.qti.avc.decoder", "c2.qti.avc.decoder.low_latency", "c2.qti.avc.decoder.secure", "c2.qti.hevc.decoder", "c2.qti.hevc.decoder.low_latency", "c2.qti.hevc.decoder.secure", "c2.qti.vp9.decoder", "c2.qti.vp9.decoder.secure", "c2.qti.mpeg2.decoder" ], "encoders": [ "c2.qti.avc.encoder", // "c2.qti.avc.encoder.secure", "c2.qti.hevc.encoder", "c2.qti.hevc.encoder.cq", "c2.qti.heic.encoder" ] }
Let’s take a whole logcat of that service by killing all processes by user mediacod: Ubuntu Pastebin
Now a playback (video in the browser that stops playing) Ubuntu Pastebin
05-27 20:36:32.788 12437 167 D CCodec : allocate(c2.qti.avc.decoder)
05-27 20:36:32.792 12437 167 I CCodec : setting up 'default' as default (vendor) store
05-27 20:36:32.792 12437 167 E Codec2Client: createComponent(c2.qti.avc.decoder) -- transaction failed.
05-27 20:36:32.792 12437 167 W Codec2Client: "create:c2.qti.avc.decoder" failed for service "qti.c2.store" due to transaction failure. (Service may have crashed.) Retrying...
# find /vendor -type f -exec grep qti.c2.store {} \; -prin
/vendor/lib/libqcodec2_core.so
Strings:
/data/vendor/media/qc2_diag/components
libutils.so
libcutils.so
libcodec2_vndk.so
libqcodec2_base.so
libqcodec2_hooks.so
libqcodec2_utils.so
libqcodec2_platform.so
libqcodec2_basecodec.so
libc++.so
libm.so
libdl.so
libqcodec2_core.so
lsof
23671 mediacod {vendor.qti.medi} media.hwcodec /vendor.qti.media.c2@1.0-service
That qc2_diag/ file does not exist…
Also “createComponent(c2.qti.avc.decoder” is not found in frameworks/av/media/codec2/components/cmds/codec2.cpp
but createComponent("c2.android.avc.decoder"
is…
(There a blog post about this call? Codec2client :: Createcomponent process analysis - Programmer Sought)
Let’s grab logcat from reboot. Too large to share yet…
05-27 21:25:08.867 6169 6905 E vppservice: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/apps_std_imp.c:596:Error 0xffffffff: apps_std getenv failed: ADSP_LIBRARY_PATH Unknown error -1
Oh, neural processing Snapdragon Neural Processing Engine SDK: DSP Runtime Environment
(I do have “/system/vendor/lib/rfsa/adsp/” but no “libsnpe”
Detour: # setprop ctl.stop vendor.qti.vibrator
(service vendor.qti.vibrator /vendor/bin/hw/vendor.qti.hardware.vibrator.service)
Maybe vibra works correctly?
05-27 21:25:15.905 6577 6948 D MediaCodecsXmlParser: parsing /vendor/etc/media_codecs_lahaina.xml…
05-27 21:25:15.906 6577 6948 D MediaCodecsXmlParser: parsing /vendor/etc/media_codecs_google_c2_video.xml…
05-27 21:25:15.906 6577 6948 D MediaCodecsXmlParser: MediaCodec: cannot add existing codec at line 70 of /vendor/etc/media_codecs_google_c2_video.xml
At line 70 there’s <Alias name="OMX.google.vp9.decoder" />
, but the same type is associated in lahaia to “”. Or is it because /apex/com.android.media.swcodec/etc/media_codecs.xml
already lists the google decoder.
05-27 21:25:15.907 6162 6919 I QC2CompStore: Created interface(c2.qti.avc.decoder) id(0)
but
05-27 21:25:15.928 6162 7972 E QC2CompStore: Failed to locate interface with name c2.android.avc.decoder
Anyway, I entered waydroid to test vibration after stopping that service.
To my surprise, it does not have the same video playback errors. It does skip frames when playing back recorded videos.
But it does not fail and the video I tested on youtube plays nicely. Hmm
So I recalled wrongly that waydroid was suffering from the same problem - it was a similar problem, but different.
So… this means I should go back to debugging DroidMedia:)
Well, on the flip side, I think I figured out vibration slopiness.
Echoing 1 to activate_mode
was just boosting the gain for some unrelated reason, but it was causing a miss on some touches.
The real solution was to leave it as it is, as 0, and write to brightness
from ngfd
, instead of activate
- which I thought I already did.
The culprit was that the brightness
is set system:system
(so no write for user ngfd
) by /system/etc/init/hw/init.rc
Now somebody does change that to system:input
, for most paths, but not brightness…
For now, removing activate_mode makes vibration stable (though weak) I need to hunt down who is setting (or not) permissions on brightness.
Well, the vibration enhancement solution was once again based on mal’s work.
That manual is very odd, it has unnecessary repetitions, spelling mistakes and seems not to be written by a human. But the basic approach seems to be not to unrealistic since I’ve found similar descriptions on other websites. So it seems to be a usual way for other phones.
On these other pages I read about commands like “fastboot OEM unlock” and the like. I tried them all which didn’t work so far.
However, if it were possible, then I gues I’m already failing at the point to enable “OEM unlock” in developer settings. This setting is simply not there even if search function claims to have found it. It is also mentioned in Asus forum by other people.
Yes, that’s what I found, too. I guess the Unlocking Tool is the equivalent to this toggle which other manufacturers have.