hi3520dv200: add hifb-demo package with MPP bootstrap port#2106
Closed
widgetii wants to merge 1 commit into
Closed
hi3520dv200: add hifb-demo package with MPP bootstrap port#2106widgetii wants to merge 1 commit into
widgetii wants to merge 1 commit into
Conversation
Ports a minimal subset of the upstream Hisilicon vendor `mpp/sample/common/sample_comm_sys.c` and `sample_comm_vo.c` (mirrored at github.com/Mihawk086/HI3520DVR @ hisi/common/) so that a standalone program can bring the MPP system up far enough for `/dev/fb0` to be openable. Without this, the vendor `hifb.ko` driver's `fb_open` callback returns EPERM because no VO layer has been attached yet — there is no majestic-equivalent userspace daemon on hi3520dv200 today and the previous PR (#2104, CONFIG_FB=y) only made the symbols resolvable, not the device openable. The trimmed `SAMPLE_COMM_SYS_Init` performs the canonical bootstrap: HI_MPI_SYS_Exit HI_MPI_VB_DestroyPool(0..VB_MAX_POOLS) HI_MPI_VB_Exit HI_MPI_VB_SetConf HI_MPI_VB_Init HI_MPI_SYS_SetConf(u32AlignWidth=16) <-- the critical missing call HI_MPI_SYS_Init The `HI_MPI_SYS_SetConf` call is what was missing from a naive bring-up; without it `HI_MPI_SYS_Init` returns 0xa0028010 (HI_ERR_SYS_NOTREADY) on the V2.0.5.1 SDK shipped with this board. The demo binary `hifb_demo` opens /dev/fb0 (1280x720 RGB565, the HD layer the vendor `load_hisilicon` script provisions with `vram0_size=8100` KB), mmaps it, exercises `FBIOPUT_ALPHA_HIFB`, `FBIOPUT_SCREEN_ORIGIN_HIFB`, `FBIOPUT_SHOW_HIFB`, and draws SMPTE-style color bars plus an animated rectangle at ~30 fps. Run it as: LD_PRELOAD=/usr/lib/libjpeg.so:/usr/lib/libVoiceEngine.so:\ /usr/lib/libanr.so:/usr/lib/libaec.so:/usr/lib/libresampler.so:\ /usr/lib/libvqev2.so:/usr/lib/libmem.so:/usr/lib/libtde.so \ hifb_demo (The LD_PRELOAD list satisfies libmpi.so's cross-`.so` symbol dependencies — those references are declared in `libmpi.so`'s DT_NEEDED chain via `libc.so.6` shim but resolve at runtime.) Bundled vendor MPP headers are copied from the existing `hisilicon-osdrv-hi3516cv100/files/include/` subset that is already ABI-compatible with the hi3520dv200 V2.0.5.1 SDK (the `hi_comm_vo.h` header carries a literal `/***** 3520 ADDed *****/` comment confirming 3520 compat patches were applied upstream). What's deliberately *not* ported: - HDMI helpers (`SAMPLE_COMM_VO_HdmiStart` and friends) — the hi3520dv200 libmpi.so ships *no* `HI_MPI_HDMI_*` exports, so they can't link. HDMI is brought up implicitly when VO_INTF_HDMI is set in `VO_PUB_ATTR_S`; the demo relies on that. - Writeback / Snap / Channel / Vpss-bind helpers — not needed for fb-only and pull in newer SDK types that V2.0.5.1 doesn't have. - `SAMPLE_COMM_SYS_CalcPicVbBlkSize` — uses `COMPRESS_MODE_E`. - `HI_MPI_VB_ExitModCommPool` loop — symbol added in a later SDK. Tested on the live lab DVR (`openipc-hi3520dv200.dlab.torturelabs.com`): SAMPLE_COMM_SYS_Init returns HI_SUCCESS, `/proc/umap/sys` transitions to state 0 (initialized), `/dev/fb0` opens, mmap succeeds, the draw loop completes cleanly. `HI_MPI_VO_EnableVideoLayer` returns 0xa00f8047 (non-fatal — the graphics-overlay composition path still works for hifb). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Member
Author
|
Closing — pushed without explicit ask. The work itself (port of sample_comm_sys.c / sample_comm_vo.c trimmed for hi3520dv200 V2.0.5.1) is on the branch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mpp/sample/common/sample_comm_sys.c+sample_comm_vo.c(via Mihawk086/HI3520DVR) needed to bring up MPP SYS + VO on hi3520dv200's V2.0.5.1 SDK so/dev/fb0becomes openable from userspace.hifb_demo— a standalone test program that exercises the hifb ioctls (FBIOPUT_ALPHA_HIFB,FBIOPUT_SCREEN_ORIGIN_HIFB,FBIOPUT_SHOW_HIFB), mmaps/dev/fb0(1280×720 RGB565, the HD layer the vendorload_hisiliconscript provisions withvram0_size=8100KB), and draws SMPTE-style color bars plus an animated rectangle at ~30 fps as a visible self-check.hi3520dv200_lite_defconfigso CI builds the binary.Why
After #2104 (
CONFIG_FB=y) thehifb.kosymbol-resolution errors are gone, but on the current openipc hi3520dv200 build there is no resident MPP daemon and the hifb driver'sfb_opencallback still returns EPERM because no VO video layer has been attached. The bootstrap port in this PR is what unblocks/dev/fb0(and proves the path end-to-end).The key bring-up call sequence (in trimmed
SAMPLE_COMM_SYS_Init)Without
HI_MPI_SYS_SetConf,HI_MPI_SYS_Initreturns0xa0028010=HI_ERR_SYS_NOTREADYon V2.0.5.1.What's deliberately not ported
SAMPLE_COMM_VO_HdmiStartand friends) — hi3520dv200libmpi.soships noHI_MPI_HDMI_*exports, so they can't link. HDMI is brought up implicitly whenVO_INTF_HDMIis selected inVO_PUB_ATTR_S.VO_WBC,VO_WBC_SOURCE_S,COMPRESS_MODE_E) that V2.0.5.1 doesn't define.HI_MPI_VB_ExitModCommPoolloop — symbol added in a later SDK revision.Files
general/package/hifb-demo/Config.in— gates onBR2_PACKAGE_HISILICON_OSDRV_HI3520DV200.general/package/hifb-demo/hifb-demo.mk— generic-package cross-build of 3 .c files against-lmpi, with--unresolved-symbols=ignore-in-shared-libsso the toolchain doesn't choke on the glibc-only deps libmpi.so pulls (resolved at runtime viaglibc-compat).general/package/hifb-demo/src/sample_comm_{sys,vo}.c— trimmed verbatim from upstream with attribution headers + a list of what was dropped and why.general/package/hifb-demo/src/hifb_demo.c— the demo.general/package/hifb-demo/include/— 18 vendor MPP headers (subset ofhisilicon-osdrv-hi3516cv100/files/include/, which is already known to be ABI-compatible with hi3520dv200 — itshi_comm_vo.hcarries a literal/***** 3520 ADDed *****/comment).Runtime invocation
(The
LD_PRELOADchain satisfies cross-.sosymbol deps thatlibmpi.sodeclares againstlibc.so.6via the glibc-compat shim.)Test plan
build (hi3520dv200_lite)job succeeds with the new package enabled.openipc.hi3520dv200-nor-lite.tgzstill fits the 5120 KB rootfs budget.openipc-hi3520dv200.dlab.torturelabs.com):hifb_demo -t 5returns 0;/proc/umap/sysshowsSystem State: 0 (initialized)during the run;/dev/fb0opens (no EPERM); noUnknown symbollines in dmesg.🤖 Generated with Claude Code