Skip to content

i6: treat MI_ISP_DisableUserspace3A as optional - #44

Merged
wberube merged 1 commit into
OpenIPC:masterfrom
Jamp:i6-isp-optional-symbol
Sep 24, 2026
Merged

wberube merged 1 commit into
OpenIPC:masterfrom
Jamp:i6-isp-optional-symbol

Conversation

@Jamp

@Jamp Jamp commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

On SSC323 with the infinity6 libmi_isp.so that OpenIPC ships
(sigmastar-osdrv-infinity6), divinus stops at startup:

[i6_isp] Failed to acquire symbol MI_ISP_DisableUserspace3A!
[media] HAL initialization failed with 0x1!
[hal] Failed to start SDK!

That library exports 218 symbols; of the 68 divinus resolves across the seven MI
libraries, only two are missing: MI_ISP_DisableUserspace3A and
MI_VENC_SetInputSourceConfig. The latter is already loaded as optional.
fnDisableUserspace3A is never called anywhere in the tree, so failing on it is
unnecessary. Loading it without the return EXIT_FAILURE lets the SDK start:
[media] SDK has started successfully!, and H.264 1080p20 streams over RTSP.

-    if (!(isp_lib->fnDisableUserspace3A = (int(*)(int channel))
-        hal_symbol_load("i6_isp", isp_lib->handle, "MI_ISP_DisableUserspace3A")))
-        return EXIT_FAILURE;
+    // Not exported by the infinity6 libmi_isp.so shipped by OpenIPC, and never called.
+    isp_lib->fnDisableUserspace3A = (int(*)(int channel))
+        hal_symbol_load("i6_isp", isp_lib->handle, "MI_ISP_DisableUserspace3A");

Tested on a Xiaomi/Chuangmi ipc017 (SSC323 + GC2053), divinus rev 1e92d52.

The infinity6 libmi_isp.so shipped by OpenIPC (sigmastar-osdrv-infinity6) does
not export MI_ISP_DisableUserspace3A, so on SSC323 the SDK never starts:
"Failed to acquire symbol MI_ISP_DisableUserspace3A" / "HAL initialization
failed with 0x1". The function pointer is never called anywhere, so load it
without failing, as i6_venc.h already does for MI_VENC_SetInputSourceConfig.

Tested on a Xiaomi/Chuangmi ipc017 (SSC323 + GC2053): SDK starts and streams
H.264 1080p20 over RTSP.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Successful startups report a failure 🐞 Bug ◔ Observability
Description
i6_isp_load resolves the now-optional symbol through hal_symbol_load, which unconditionally
emits a red HAL_DANGER message when dlsym returns null. On the targeted Infinity6 library where
the symbol is absent, initialization now continues successfully but every startup still prints
Failed to acquire symbol MI_ISP_DisableUserspace3A!, making healthy startup appear faulty.
Code

src/hal/star/i6_isp.h[R40-41]

+    isp_lib->fnDisableUserspace3A = (int(*)(int channel))
+        hal_symbol_load("i6_isp", isp_lib->handle, "MI_ISP_DisableUserspace3A");
Evidence
The changed loader calls hal_symbol_load without checking its null result, while that helper
always emits HAL_DANGER when dlsym cannot find a symbol. Therefore the library configuration
this PR explicitly supports reaches successful initialization only after printing a failure message.

src/hal/star/i6_isp.h[39-44]
src/hal/symbols.h[8-14]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The newly optional `MI_ISP_DisableUserspace3A` symbol is still resolved through a helper that logs every missing symbol as a failure. Expected absence should not produce a danger-level startup message.
## Fix Focus Areas
- src/hal/star/i6_isp.h[39-41]
- src/hal/symbols.h[8-14]
## Recommended Fix
Add or use a silent optional-symbol lookup path that returns null without emitting `HAL_DANGER`, and resolve `MI_ISP_DisableUserspace3A` through that path while retaining the current non-failing behavior.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can choose which labels appear on a finding, and whether they show icons or text

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread src/hal/star/i6_isp.h
Comment on lines +40 to +41
isp_lib->fnDisableUserspace3A = (int(*)(int channel))
hal_symbol_load("i6_isp", isp_lib->handle, "MI_ISP_DisableUserspace3A");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

1. Successful startups report a failure 🐞 Bug ◔ Observability

i6_isp_load resolves the now-optional symbol through hal_symbol_load, which unconditionally
emits a red HAL_DANGER message when dlsym returns null. On the targeted Infinity6 library where
the symbol is absent, initialization now continues successfully but every startup still prints
Failed to acquire symbol MI_ISP_DisableUserspace3A!, making healthy startup appear faulty.
Agent Prompt
## Issue description
The newly optional `MI_ISP_DisableUserspace3A` symbol is still resolved through a helper that logs every missing symbol as a failure. Expected absence should not produce a danger-level startup message.

## Fix Focus Areas
- src/hal/star/i6_isp.h[39-41]
- src/hal/symbols.h[8-14]

## Recommended Fix
Add or use a silent optional-symbol lookup path that returns null without emitting `HAL_DANGER`, and resolve `MI_ISP_DisableUserspace3A` through that path while retaining the current non-failing behavior.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, the red line still prints. It's the same one this library already produces for
MI_VENC_SetInputSourceConfig: i6_venc.h loads that optional symbol the same way,
and every divinus start on SSC323 logs both:

[i6_isp] Failed to acquire symbol MI_ISP_DisableUserspace3A!
[i6_venc] Failed to acquire symbol MI_VENC_SetInputSourceConfig!

I kept the existing pattern instead of changing hal_symbol_load() for every HAL. If
you'd rather have optional symbols load silently, I can add a quiet variant to
src/hal/symbols.h and use it for both, in this PR or a separate one.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Allow infinity6 startup without unused ISP symbol

🐞 Bug fix 🕐 Less than 10 minutes

Grey Divider

AI Description

• Treats the unused MI_ISP_DisableUserspace3A symbol as optional.
• Allows SSC323 devices using OpenIPC libraries to initialize and stream successfully.
Diagram

sequenceDiagram
    participant Media as Media Startup
    participant Loader as i6 ISP Loader
    participant ISP as libmi_isp.so
    Media->>Loader: Initialize HAL
    Loader->>ISP: Load library
    Loader->>ISP: Resolve optional symbol
    ISP-->>Loader: Symbol or null
    Loader->>ISP: Resolve required symbols
    ISP-->>Loader: Required pointers
    Loader-->>Media: Initialization result
Loading
High-Level Assessment

The minimal approach is appropriate because the function pointer is never invoked and optional loading matches the existing infinity6 VENC pattern. Removing the field would create unnecessary structural churn, while library-version detection would add complexity without improving runtime safety.

Files changed (1) +3 / -3

Bug fix (1) +3 / -3
i6_isp.hMake the userspace 3A disable symbol optional +3/-3

Make the userspace 3A disable symbol optional

• Removes the initialization failure when 'MI_ISP_DisableUserspace3A' is absent from 'libmi_isp.so'. The loader retains the function pointer when available but continues resolving required symbols when it is missing.

src/hal/star/i6_isp.h

@wberube

wberube commented Sep 24, 2026

Copy link
Copy Markdown
Member

Good evening, nice one! Muchas gracias por su contribución 🙂

@wberube
wberube merged commit b984318 into OpenIPC:master Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants