Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

3 watching

Forks

Repository files navigation

Dolby (AIDL)

Dolby Atmos / DAX3 for Evolution-X, branch cnb-aidl. Used by device_xiaomi_sm8450-common (cnb-6.6, POCO F5 / marble).

Stack

  • DMS: vendor.dolby.dms AIDL (IDms/default), vendor.dolby.dms.service
    • libdmshal, libdlbdsservice, libdapparamstorage, libdlbpreg
  • Effects (audio effect HAL V2): libswdapaidl (software DAP), libdlbvolaidl (volume listener), libswgamedapaidl (game DAP)
  • Codec2: vendor.dolby.media.c2-default-service-dax (AC3/EAC3/EAC3-JOC/AC4)
  • App: XiaomiDolby (Lunaris-based), replaces MusicFX/AudioFX
  • Dolby Vision (optional, TARGET_INCLUDES_DolbyVision): HEVC and AVC decoders served over AIDL, see "Dolby Vision" below

Blobs

DAX3_3.7.0.8_r1. The whole stack is one Sony drop, the Xperia 1 VII (pdx256): DMS (vendor.dolby.dms.service, libdmshal, libdlbdsservice, libdapparamstorage, libdlbpreg, vendor.dolby.dms-V1-ndk, vendor.dolby.hardware.dms@2.0), Codec2 (vendor.dolby.media.c2-default-service-dax, libcodec2_store_dolby, libdeccfg, the AC-4 and DD+ decoders), the effect libraries and the tuning files. Every host library is the build the effect libraries were linked against, so no part of the stack is a different Dolby build than its neighbours. https://github.com/PinkSerenity/proprietary_vendor_sony_pdx256 (lineage-22.1)

The only blob not from that drop is libaudio_aidl_conversion_common_ndk_prebuilt.so, from kunzite (https://github.com/kunzite-stuff/vendor_xiaomi_kunzite, cnb). It is the same conversion library under a different name, because AOSP already builds a module called libaudio_aidl_conversion_common_ndk, so the Sony file cannot be installed under its own name. It exports the same 178 symbols as the Sony one, including the three that libswdapaidl and libswgamedapaidl import.

DAP: only the software DAP is shipped (libswdapaidl, libswgamedapaidl). It processes on the CPU and needs no DSP or GEF support.

  • No hardware DAP (libhwdapaidl) is shipped. It drives the DSP through GEF. The pdx256 build expects the new GEF interface, and the vendor libqtigefar (Sony-era) does not provide it, so parameters never apply and the device callback crashes the audio HAL. The kunzite build runs, but it re-pushes the full parameter set to every output device class on each parameter update (about 400 batches in 50 seconds after boot in one test log, which floods the audio HAL log), and PAL stores the baseline under a graph that has no DAP module, so the deep-buffer stream never receives it. The sm8850 build uses module tag 0x0C000033, which the marble ACDB does not carry, and installs under the same file name.
  • Both effect libraries link libaudio_aidl_conversion_common_ndk_prebuilt (shipped here).
  • The tuning is read from /vendor/etc/dolby/dax-default.xml.
  • Cross-checked against paulblazer15/vendor_sony_dolby (17, XQ-FS72): every Dolby blob there has the same BuildId as the pdx256 one. It only differs in carrying the propIsMatched patch below, and in shipping liboem_specific.so (a single dd_data symbol that nothing in this stack links), which is not taken.

Binary fixes applied to the pdx256 libswdapaidl.so / libswgamedapaidl.so:

  • DlbGenClass2::propIsMatched() forced true (mov w0, w19 -> mov w0, #1). Same patch as vendor_sony_dolby 5dd32bc, same offsets (0x2a81fc / 0x2982a4).

Properties (dolby.mk):

  • ro.vendor.dolby.dax.version=DAX3_3.7.0.8_r1
  • ro.vendor.dolby.dap_bypassed_on_tiny_volume=0: the default (1) latches DAP into bypass at boot while the volume is low and the profiles do nothing (found on emerald, crdroid-17 b868d52).

Init: dms-service.rc declares interface aidl vendor.dolby.dms.IDms/default.

App fixes (from halcyon packages_halcyon_apps_Dolby):

  • Never setEnabled(false) on the DAP: AudioFlinger STOPs the HAL effect, the drain returns -ENODATA, EffectHalAidl maps it to DEAD_OBJECT and the instance cannot be re-enabled. Use bypass param 18 + enable param instead.
  • Profile parameters are write-only registers on this DAP (read back 0), so the getters read the saved prefs first.

Tuning (marble stock)

configs/dax-default.xml is the stock marble image's file (missi_phone_cn V816.0.14.0.UMRCNXM), so profiles, IEQ and speaker/headphone tuning are marble's. It is the older 3.3.0 format; the pdx256 files are 3.4.0. The pdx256 libdlbdsservice parser is version-aware and reads 3.3.0 through its own path, so it is used as is:

pdx256 (3.4.0) marble stock (3.3.0)
format / tool version 3.4.0 / 3.6.0 3.3.0 / 3.5.0
IEQ preset ids numeric, id="2" name="balanced" string, id="ieq_balanced"
IEQ reference in profile <include ieq_preset="2"/> <include preset="ieq_balanced"/>
profiles 0-7 0-8 (8 = Voice)
headphone-virtualizer-mode, speaker-virtualizer-mode, advanced-{headphone,speaker}-virtualizer-rendering-config, advanced-speaker-virtualizer-start-bin present absent (3.4-only)
speaker_landscape_180 tuning present absent

What the parser does (disassembly of libdlbdsservice.so):

  • parsePreset and parseProfileEndpoint compare the file version with 3.3.0: an exact 3.3.0 file takes the preset include attribute (string ids), any other version takes ieq_preset (numeric ids).
  • parseProfile gates the virtualizer mode / rendering config tags on 3.4., so a 3.3.0 file without them is expected.
  • getIeqPresetIdByName maps preset names by substring (balanced -> 2 seen), which is how string ids such as ieq_balanced resolve to the 1/2/3 the app sends.

So the file does not need converting. Keep the header at exactly 3.3.0: any other version selects the ieq_preset path and breaks the includes. Static analysis only, not confirmed on device:

logcat -s dolby DolbyManagerService TuningFileParser | grep -iE "XML|IEQ|Invalid"

XML parses error or Invalid IEQ Preset Id would mean it was rejected.

Note: marble's volume leveler is enabled in 26 profile/endpoint entries. vendor_sony_dolby disables it in all of them (volume-leveler-enable -> false); not done here, to keep stock tuning.

Dolby Vision

Optional, off by default. Set TARGET_INCLUDES_DolbyVision := true before hardware/dolby/dolby.mk is inherited. Everything below is behind that flag.

The decoders are the marble stock Dolby Vision Codec2 libraries from V816.0.14.0.UMRCNXM (HEVC and AVC, normal and secure): c2.dolby.{avc.dec,avc.sec.dec,hevc.dec,hevc.sec.dec}, c2.dolby.store, c2.dolby.egl, libdolbyvision (patched to allocate its GraphicBuffer with the new size, mov w0, #0x100 -> #0xd30 at 0x35500) and libdolbyottcameracontrol, 64-bit only. dolby_vision.cfg is marble's (Tmax 900) and media_codecs_dolby_vision.xml declares c2.dolby.decoder.{hevc,avc}. The secure decoders stay in the store but are left out of the codec list, as protected playback does not get through the client bridge yet. The store also loads the c2.dolby.hevc.enc encoder from the same firmware and aborts when it is missing, so it is shipped, though no codec list declares it.

media.c2.hal.selection=aidl on 6.6 makes Codec2Client list AIDL stores only, so the stock HIDL client and services are replaced by two small pieces, and one HIDL service is added back:

  • c2.dolby.client (vision/DolbyC2Client.cpp) is rebuilt from source on android.hardware.media.c2-V1-ndk and libstagefright_aidl_bufferpool2. It keeps the exported symbols and the public field layout (offsets 0x00 to 0x58, checked by static_assert) that the decoder libraries read directly, and delegates hardware decoding to the AIDL QTI store (default). Work is converted with the stock ToAidl and FromAidl helpers, so there is no HIDL buffer pool and no objcpy().
  • dolbycodec2 (vision/DolbyCodec2Service.cpp) serves c2.dolby.store as AIDL android.hardware.media.c2.IComponentStore/dolby. The instance is declared in vision/vendor.dolbyvision.media.c2-service.xml and in compatibility_matrix_dolby_c2.xml, next to default9, the Dolby audio store. It keeps vndbinder active for the EGL and gralloc clients inside libdolbyvision.

The third piece is the standalone dvs-hal-service, with its interface library vendor.dolby.dvs@1.0 and the matching init rc and vintf manifest. It serves HIDL vendor.dolby.dvs@1.0::IDvs/dvs-hal-service, the interface whose client stubs are built into libdolbyvision, and keeps the Dolby Vision session count and mode (persist.vendor.dolbyv.mode). It is not on stock marble; the blobs come from the Motorola Dolby Vision stack. Its clients are mediacodec, the graphics composer, surfaceflinger, mediaserver, system_server, platform_app and platform_app_36 (hal_dvs, hwservice_contexts). The instance is declared optional in compatibility_matrix_dolby_dvs.xml.

Device wiring, in addition to the audio steps below:

  • TARGET_INCLUDES_DolbyVision := true
  • media.c2.hal.selection=aidl
  • include the Vision codecs next to the audio ones: <Include href="media_codecs_dolby_vision.xml" />
  • ro.vendor.display.dolbyvision.support=true, read by the hardware_qcom_display composer, so HWC advertises Hdr::DOLBY_VISION (the Dolby Vision tone mapping runs in the Codec2 EGL pipeline, not in libsdmextension)

Debugging:

logcat -s dolbycodec2 dvs-hal-service DolbyC2Client C2DolbyHevcDec QC2V4l2Codec QC2Interface
dumpsys media.codec | grep -i dolby

Device wiring

Inherit hardware/dolby/dolby.mk and keep the manifest/matrix variables += in BoardConfig. dolby.mk installs VINTF manifests via PRODUCT_COPY_FILES, so set BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES := true. Include the codecs from your media_codecs XMLs:

<Include href="media_codecs_dolby_audio.xml" />

Audio effects (audio_effects_config.xml, v2.0). The AIDL effect factory needs the Sony type UUID to resolve the effects:

<library name="dap" path="libswdapaidl.so"/>
<library name="dvl" path="libdlbvolaidl.so"/>
<library name="gamedap" path="libswgamedapaidl.so"/>

<effect name="dap" library="dap" uuid="9d4921da-8225-4f29-aefa-39537a04bcaa" type="fa81de0e-588b-11ed-9b6a-0242ac120002"/>
<effect name="dlb_music_listener" library="dvl" uuid="40f66c8b-5aa5-4345-8919-53ec431aaa98" type="fa81de0e-588b-11ed-9b6a-0242ac120002"/>
<effect name="dlb_ring_listener" library="dvl" uuid="21d14087-558a-4f21-94a9-5002dce64bce" type="fa81de0e-588b-11ed-9b6a-0242ac120002"/>
<effect name="dlb_alarm_listener" library="dvl" uuid="6aff229c-30c6-4cc8-9957-dbfe5c1bd7f6" type="fa81de0e-588b-11ed-9b6a-0242ac120002"/>
<effect name="gamedap" library="gamedap" uuid="3783c334-d3a0-4d13-874f-0032e5fb80e2" type="fa81de0e-588b-11ed-9b6a-0242ac120002"/>

marble keeps the stock volume_listener helpers on the post-process streams instead of dlb_music_listener (see device_xiaomi_sm8450-common a212830). vendor_sony_dolby additionally defines dlb_notification_listener (1f0091e3-6ad8-40fe-9b09-5948f9a26e7e); not used here.

The stock libqtigefar is kept, so the audio HAL must initialize its legacy API (hardware_qcom_audio-ar 2cd9e3cabc73).

References

Credits

HELLBOY017, adithya2306, johnmart19, userariii, saku-bruh, ahnet-69, paulblazer15, swiitchOFF, Halcyon Project, FlamingoOS / AOSPA (app base)

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages