Skip to content

cv500 ISP IRQ routing: 'ISP' platform IRQ resolves to VI_PROC0 (~1/8 fps), not VI_CAP0 (per-frame) #177

Description

@widgetii

Sub-task of #176. Surfaced by @widgetii during validation of the stacked FEND-extension branch.

Observation

On hi3516av300 (cv500 family) with majestic actively streaming a ~21 fps sensor, `/proc/interrupts` shows:

```
MIPI_RX IRQ 43: 64371 ← per-frame (matches sensor rate)
VI_CAP0 IRQ 45: 49609 ← high-rate ISP capture IRQ
VI_PROC0 IRQ 46: 1464 ← ~33× slower than VI_CAP0
VPSS IRQ 47: 1464
```

The ISP IRQ resolved by `osal_platform_get_irq_byname(pdev, "ISP")` and consumed by `isp_isr()` in `kernel/isp/arch/hi3516cv500/mkp/src/isp.c` fires at the VI_PROC0 rate (~1.5 Hz with 21 fps streaming), not VI_CAP0's per-frame rate.

A FEND-event hook attached inside that ISR therefore emits at ~1/8 the sensor rate, not 1:1 with FS. Time-pair measurement on av300 confirmed:

```
=== 114 events in 5.00 s ===
MIPI_FS : 101 (20.2 fps)
ISP_FEND : 13 ( 2.6 fps) ← ~7.8× slower
```

Hypotheses

Either:

  1. Wrong IRQ resolved by name. `osal_platform_get_irq_byname(pdev, "ISP")` may be picking VI_PROC0 instead of VI_CAP0 because of how the device-tree node enumerates its IRQs and the order in which the OSAL wrapper walks them. Verifiable by logging the resolved `isp_fe_irq` value at module init and cross-referencing `/proc/interrupts` indexes. If true: switch the lookup to VI_CAP0 by name (or by index, after auditing the DT binding).

  2. ISP back-end stall. The hardware may legitimately emit FEND only for frames the back-end pipeline can actually accept (DMA-bound, write-channel-bound). In that case FEND really is "frame fully delivered to ISP back end" — a semantically valid event, just not what we want for capture→encode timing. We'd need a different IRQ source for the per-frame back-end-ready signal.

Definition of done

  1. Identify which of (1) or (2) is the actual mechanism on cv500. Diagnostics: dump `isp_fe_irq` value at module load, dump full `/proc/interrupts` while streaming, correlate IRQ count growth with frame count from `MIPI_RX`.
  2. If (1): patch the cv500 ISP driver to resolve VI_CAP0 (or equivalent per-frame IRQ) for the FEND hook.
  3. If (2): document this and audit V4 (ev200/ev300) ISP to confirm the equivalent IRQ source there is per-frame; otherwise propose an alternative (e.g., piggyback on the VI driver's frame-done callback, or hook a different IP block).
  4. Once a per-frame FEND IRQ is identified, verify the FEND event from openipc_frame_ts: expose encoder-done / ISP frame-end event for per-segment latency decomposition #176's stacked branch fires 1:1 with FS over a 60 s capture on av300.

Notes

  • V4 (ev200/ev300) ISP IRQ topology may be cleaner — initial FEND-branch testing was only done on cv500. Worth checking V4 in parallel before deciding the design.
  • The vendor SDK's own ISP IRQ handler dispatches both `VI_PT0_INT_FSTART` and back-end-related interrupts inside a single `ISP_ISR` entry; the per-IP-block IRQ assignment is what differs across SoCs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions