Simplify capture to direct frame delivery

- support only the new vfg100_0821c driver; legacy driver behavior, done-index handling, and SDK frame-ring compatibility are intentionally unsupported
- replace the backend frame ring, slots, pending indices, and DMA acquisition worker with direct wait-event then GetFrame/Acquire delivery
- keep one copy buffer or one driver-owned zero-copy frame outstanding per channel and synchronize read completion during stop, format change, and teardown
- remove obsolete lost_frames, FRAME_LOSS events, dropped-frame counters, sample warnings, and related public/internal documentation
- remove periodic diagnostic register polling and let the event thread handle only format and plug state changes
- add separate GetFrame total, DMA event wait, driver IOCTL, and SDK processing timing statistics to the diagnostic status view
- clear stale DMA events before video start, preserve exact Win32 errors, and retry only documented transient not-ready/busy conditions within the caller timeout
- delete the obsolete DMA ring data-flow diagram and update architecture/API documentation for the direct frame path

Validation: user build exposed the Windows max macro conflict; corrected time_point::max with the macro-safe form. Final validation used static searches and git diff --check; no additional build was run.
This commit is contained in:
Mark.lin
2026-08-21 17:52:22 +08:00
parent 1574e90b49
commit ca19b4f276
14 changed files with 454 additions and 735 deletions
+2 -2
View File
@@ -36,7 +36,7 @@
<mxCell id="workers" parent="backendLayer" style="rounded=1;whiteSpace=wrap;html=1;arcSize=8;fillColor=#ffffff;strokeColor=#d6b656;fontSize=14;" value="single capture thread&lt;br&gt;WaitForMultipleObjects: DMA / format / plug events" vertex="1">
<mxGeometry height="52" width="280" x="510" y="173" as="geometry" />
</mxCell>
<mxCell id="pcies2mmSession" parent="backendLayer" style="rounded=1;whiteSpace=wrap;html=1;arcSize=8;fillColor=#ffffff;strokeColor=#d6b656;fontSize=14;" value="sdk/gvfg/src/backend/pcies2mm/pcies2mm_capture_session.cpp&lt;br&gt;internal session / workers / frame ring" vertex="1">
<mxCell id="pcies2mmSession" parent="backendLayer" style="rounded=1;whiteSpace=wrap;html=1;arcSize=8;fillColor=#ffffff;strokeColor=#d6b656;fontSize=14;" value="sdk/gvfg/src/backend/pcies2mm/pcies2mm_capture_session.cpp&lt;br&gt;internal session / events / direct frame read" vertex="1">
<mxGeometry height="58" width="340" x="420" y="65" as="geometry" />
</mxCell>
<mxCell id="e6" edge="1" parent="backendLayer" source="pcies2mmSession" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;endArrow=block;strokeWidth=2;" target="backendTypes" value="uses">
@@ -56,7 +56,7 @@
<mxCell id="facade" parent="1" style="rounded=1;whiteSpace=wrap;html=1;arcSize=8;fillColor=#ffffff;strokeColor=#82b366;fontSize=14;" value="sdk/gvfg/src/gvfg_capture.cpp&lt;br&gt;session facade / lifecycle / pull API" vertex="1">
<mxGeometry height="58" width="340" x="470" y="385" as="geometry" />
</mxCell>
<mxCell id="ring" parent="1" style="rounded=1;whiteSpace=wrap;html=1;arcSize=8;fillColor=#ffffff;strokeColor=#d6b656;fontSize=14;" value="frame_ring_&lt;br&gt;ready / in_use / sequence" vertex="1">
<mxCell id="ring" parent="1" style="rounded=1;whiteSpace=wrap;html=1;arcSize=8;fillColor=#ffffff;strokeColor=#d6b656;fontSize=14;" value="single frame buffer&lt;br&gt;read / held / release" vertex="1">
<mxGeometry height="58" width="270" x="880" y="610" as="geometry" />
</mxCell>
<mxCell id="eventFlow" parent="1" style="rounded=1;whiteSpace=wrap;html=1;arcSize=8;fillColor=#ffffff;strokeColor=#d6b656;fontSize=13;" value="Public event flow&lt;br&gt;driver format IRQ -&gt; FORMAT_CHANGE_BEGIN&lt;br&gt;first new frame published -&gt; STREAM_READY" vertex="1">
+2 -3
View File
@@ -183,8 +183,8 @@ Zero-copy mode 的 driver lifecycle 由 SDK 管理:open 時 enable,每次成
- `gvfg_get_channel_signal_status(handle, channel, &status)`:查詢指定 channel 的連線、尺寸、
原生格式與 bit depth。沒有輸入訊號是正常狀態:回傳 `GVFG_OK` 且
`connected == 0`。
- `gvfg_get_channel_runtime_info(handle, channel, &info)`:取得指定 channel 已交付 frame 數、SDK 能確定的
`lost_frames` 與依 read 間隔估算的 `capture_fps`。start 時統計值重設。
- `gvfg_get_channel_runtime_info(handle, channel, &info)`:取得指定 channel 已交付 frame 數與
依 read 間隔估算的 `capture_fps`。start 時統計值重設。
### Event
@@ -197,7 +197,6 @@ Zero-copy mode 的 driver lifecycle 由 SDK 管理:open 時 enable,每次成
| `GVFG_EVENT_SIGNAL_DISCONNECTED` | 停止使用目前影像內容 |
| `GVFG_EVENT_FORMAT_CHANGE_BEGIN` | 暫停使用依賴舊尺寸/格式的資源 |
| `GVFG_EVENT_STREAM_READY` | 第一個完整 frame 已就緒,可依新格式重建資源 |
| `GVFG_EVENT_FRAME_LOSS` | 記錄錄影內容可能不完整;`event.count` 是本次已知 loss 數量 |
呼叫前應將 `gvfg_event_t` 清零並設定 `struct_size = sizeof(gvfg_event_t)`。
事件是狀態通知,不取代 `gvfg_get_channel_signal_status()`;需要完整 metadata 時應重新查詢。
+3 -6
View File
@@ -77,7 +77,6 @@ register 與 DMA 實作不屬於本文件。
| ------------------ | ---------- | ------------------------------------------------------- |
| `capture_fps` | `double` | 依 `gvfg_read_channel_frame()` 成功交付時間估算並平滑化的 FPS;尚無足夠 frame 時為 0 |
| `delivered_frames` | `uint64_t` | 此次 running session 中成功交付給 caller 的 frame 數 |
| `lost_frames` | `uint64_t` | SDK 能確定在交付前遺失的 frame 數;目前包含 capture FIFO 覆蓋 |
### 1.8 `gvfg_frame_t`
@@ -124,11 +123,9 @@ Caller 不得修改任何欄位再 release。SDK 會將完整 token 與目前 he
| `GVFG_EVENT_SIGNAL_DISCONNECTED` | 2 | 輸入訊號中斷 |
| `GVFG_EVENT_STREAM_READY` | 3 | 啟動、重新接線或格式恢復後,第一個完整 frame 已就緒 |
| `GVFG_EVENT_FORMAT_CHANGE_BEGIN` | 4 | 輸入格式正在改變,應暫停使用舊格式資源 |
| `GVFG_EVENT_FRAME_LOSS` | 5 | SDK 確定一個或多個 frame 在交付前遺失 |
`gvfg_event_t` 是 `gvfg_poll_channel_event()` 的輸出。呼叫前將結構清零並把
`struct_size` 設為 `sizeof(gvfg_event_t)`。`type` 是上述事件型別;只有
`GVFG_EVENT_FRAME_LOSS` 使用 `count`,表示這筆事件合併的已知 loss 數量。
`struct_size` 設為 `sizeof(gvfg_event_t)`。`type` 是上述事件型別。
`gvfg_event_mask_t` 提供對應的 `GVFG_EVENT_MASK_*` bit,可在 channel open 前用
`gvfg_set_channel_event_mask()` 組合。預設為 `GVFG_EVENT_MASK_ALL`;mask 為 0
@@ -252,7 +249,7 @@ gvfg_status_t gvfg_read_channel_frame(gvfg_handle handle,
- `GVFG_ETIMEOUT`:期限內沒有 frame。
- `GVFG_EIO`/`GVFG_ENOTSUP`:frame/backend 無效或格式不支援。
Copy mode 回傳 SDK ring buffer;zero-copy mode 回傳 driver-owned buffer。兩者的
Copy mode 回傳 SDK 的單一 frame buffer;zero-copy mode 回傳 driver-owned buffer。兩者的
pointer 都只保證有效到對應的 `gvfg_release_channel_frame()`。
### 1.19 `gvfg_release_channel_frame`
@@ -265,7 +262,7 @@ gvfg_status_t gvfg_release_channel_frame(gvfg_handle handle,
- `handle`:取得該 frame 的同一個 handle。
- `frame`:`gvfg_read_channel_frame()` 原封不動回傳的完整 descriptor。
- `GVFG_OK`:成功歸還 frame;copy slot 可再次使用,或 zero-copy frame 已歸還 driver。
- `GVFG_OK`:成功歸還 frame;copy buffer 可再次使用,或 zero-copy frame 已歸還 driver。
- `GVFG_EINVAL`:NULL 或 token 內容與 held frame 不符。
- `GVFG_ESTATE`:沒有 backend、目前沒有 held frame,或 backend release 狀態不正確。
-52
View File
@@ -1,52 +0,0 @@
<mxfile host="app.diagrams.net" modified="2026-08-19T00:00:00.000Z" agent="Codex" version="24.7.17" type="device">
<diagram id="gvfg-dma-flow" name="GVFG Copy and Zero-Copy Flow">
<mxGraphModel dx="1600" dy="1000" grid="1" gridSize="10" page="1" pageScale="1" pageWidth="1600" pageHeight="1100">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="title" value="GVFG DMA delivery — copy and zero-copy modes" style="text;html=1;strokeColor=none;align=center;fontSize=26;fontStyle=1" vertex="1" parent="1"><mxGeometry x="300" y="25" width="1000" height="45" as="geometry"/></mxCell>
<mxCell id="abi" value="Requires new driver ABI: VIDEO_START/STOP, GET_FRAME(MAXULONG), ZERO-COPY ENABLE/ACQUIRE/RELEASE/DISABLE" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=13" vertex="1" parent="1"><mxGeometry x="300" y="80" width="1000" height="45" as="geometry"/></mxCell>
<mxCell id="hw" value="FPGA / driver DMA buffer&#xa;DMA complete interrupt" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontSize=14;fontStyle=1" vertex="1" parent="1"><mxGeometry x="100" y="160" width="240" height="80" as="geometry"/></mxCell>
<mxCell id="event" value="dma_event_ wakes&#xa;capture_thread_proc()&#xa;handle_dma_event(channel)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontSize=14" vertex="1" parent="1"><mxGeometry x="450" y="150" width="260" height="100" as="geometry"/></mxCell>
<mxCell id="mode" value="zero-copy enabled?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=14;fontStyle=1" vertex="1" parent="1"><mxGeometry x="850" y="145" width="220" height="110" as="geometry"/></mxCell>
<mxCell id="copyLane" value="COPY MODE — SDK 3-slot ring" style="swimlane;html=1;startSize=34;rounded=1;fillColor=#d5e8d4;strokeColor=#82b366;fontSize=17;fontStyle=1" vertex="1" parent="1"><mxGeometry x="60" y="310" width="700" height="500" as="geometry"/></mxCell>
<mxCell id="copySlot" value="Select writable FrameSlot&#xa;ready=false, in_use=false&#xa;ring pressure may drop oldest unread frame" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#82b366;fontSize=13" vertex="1" parent="1"><mxGeometry x="90" y="370" width="280" height="100" as="geometry"/></mxCell>
<mxCell id="copyGet" value="IOCTL_PCIES2MM_GET_FRAME&#xa;input {channel, 0xFFFFFFFF}&#xa;one copy: driver DMA → slot.data&#xa;GET_VIDEO_DONE_INDEX removed" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#82b366;fontSize=13;fontStyle=1" vertex="1" parent="1"><mxGeometry x="440" y="360" width="280" height="120" as="geometry"/></mxCell>
<mxCell id="copyPublish" value="publish_frame()&#xa;slot.ready=true, in_use=false&#xa;frame_cv_.notify_one()" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#82b366;fontSize=13" vertex="1" parent="1"><mxGeometry x="250" y="520" width="300" height="90" as="geometry"/></mxCell>
<mxCell id="copyRead" value="gvfg_read_channel_frame()&#xa;frame.data = slot.data.data()&#xa;SDK-owned until release" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=13" vertex="1" parent="1"><mxGeometry x="90" y="665" width="270" height="95" as="geometry"/></mxCell>
<mxCell id="copyRelease" value="gvfg_release_channel_frame()&#xa;validate token&#xa;slot.in_use=false&#xa;slot reusable" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=13;fontStyle=1" vertex="1" parent="1"><mxGeometry x="450" y="655" width="270" height="105" as="geometry"/></mxCell>
<mxCell id="zcLane" value="ZERO-COPY MODE — one outstanding driver frame" style="swimlane;html=1;startSize=34;rounded=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontSize=17;fontStyle=1" vertex="1" parent="1"><mxGeometry x="830" y="310" width="700" height="500" as="geometry"/></mxCell>
<mxCell id="zcEnable" value="Open device&#xa;ENABLE_FRAME_ZEROCOPY(channel)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#6c8ebf;fontSize=13" vertex="1" parent="1"><mxGeometry x="860" y="365" width="260" height="85" as="geometry"/></mxCell>
<mxCell id="zcHeld" value="frame ready or held?" style="rhombus;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=13" vertex="1" parent="1"><mxGeometry x="1220" y="355" width="230" height="105" as="geometry"/></mxCell>
<mxCell id="zcAcquire" value="No: ACQUIRE_VIDEO_FRAME_ZEROCOPY&#xa;input {channel, 0xFFFFFFFF}&#xa;output driver-owned pointer&#xa;no SDK payload copy" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#ffffff;strokeColor=#6c8ebf;fontSize=13;fontStyle=1" vertex="1" parent="1"><mxGeometry x="860" y="520" width="300" height="115" as="geometry"/></mxCell>
<mxCell id="zcSkip" value="Yes: skip this acquire event&#xa;keep held driver pointer valid&#xa;no loss statistic or event" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontSize=13" vertex="1" parent="1"><mxGeometry x="1210" y="525" width="270" height="95" as="geometry"/></mxCell>
<mxCell id="zcRead" value="gvfg_read_channel_frame()&#xa;returns driver pointer&#xa;valid until release" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=13" vertex="1" parent="1"><mxGeometry x="860" y="675" width="270" height="85" as="geometry"/></mxCell>
<mxCell id="zcRelease" value="gvfg_release_channel_frame()&#xa;validate token&#xa;RELEASE_VIDEO_FRAME(channel)" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=13;fontStyle=1" vertex="1" parent="1"><mxGeometry x="1210" y="665" width="290" height="95" as="geometry"/></mxCell>
<mxCell id="consumer" value="Before release: application may preview, convert, record, or copy. Return the frame descriptor unchanged." style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontSize=14" vertex="1" parent="1"><mxGeometry x="300" y="855" width="1000" height="60" as="geometry"/></mxCell>
<mxCell id="close" value="Stop / close / exit: release held frame first; zero-copy sends DISABLE_FRAME_ZEROCOPY(channel), then closes device" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f5f5f5;strokeColor=#666666;fontSize=14;fontStyle=1" vertex="1" parent="1"><mxGeometry x="450" y="960" width="700" height="70" as="geometry"/></mxCell>
<mxCell id="e1" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;strokeWidth=2" edge="1" parent="1" source="hw" target="event"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="e2" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;strokeWidth=2" edge="1" parent="1" source="event" target="mode"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="e3" value="no / copy" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;strokeWidth=2;strokeColor=#82b366" edge="1" parent="1" source="mode" target="copySlot"><mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="960" y="280"/><mxPoint x="230" y="280"/></Array></mxGeometry></mxCell>
<mxCell id="e4" value="yes / zero-copy" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;strokeWidth=2;strokeColor=#6c8ebf" edge="1" parent="1" source="mode" target="zcHeld"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="c1" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;strokeColor=#82b366" edge="1" parent="1" source="copySlot" target="copyGet"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="c2" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;strokeColor=#82b366" edge="1" parent="1" source="copyGet" target="copyPublish"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="c3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;strokeColor=#82b366" edge="1" parent="1" source="copyPublish" target="copyRead"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="c4" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;strokeColor=#9673a6" edge="1" parent="1" source="copyRead" target="copyRelease"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="c5" value="slot reusable" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;dashed=1;strokeColor=#82b366" edge="1" parent="1" source="copyRelease" target="copySlot"><mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="585" y="790"/><mxPoint x="40" y="790"/><mxPoint x="40" y="420"/></Array></mxGeometry></mxCell>
<mxCell id="z0" value="enabled at open" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;dashed=1;strokeColor=#6c8ebf" edge="1" parent="1" source="zcEnable" target="zcHeld"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="z1" value="no" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;strokeColor=#6c8ebf" edge="1" parent="1" source="zcHeld" target="zcAcquire"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="z2" value="yes" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;strokeColor=#d6b656" edge="1" parent="1" source="zcHeld" target="zcSkip"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="z3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;strokeColor=#6c8ebf" edge="1" parent="1" source="zcAcquire" target="zcRead"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="z4" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;strokeColor=#9673a6" edge="1" parent="1" source="zcRead" target="zcRelease"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="z5" value="driver frame reusable" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;dashed=1;strokeColor=#6c8ebf" edge="1" parent="1" source="zcRelease" target="zcHeld"><mxGeometry relative="1" as="geometry"><Array as="points"><mxPoint x="1355" y="790"/><mxPoint x="1510" y="790"/><mxPoint x="1510" y="407"/></Array></mxGeometry></mxCell>
<mxCell id="a1" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;dashed=1;strokeColor=#9673a6" edge="1" parent="1" source="copyRead" target="consumer"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="a2" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block;dashed=1;strokeColor=#9673a6" edge="1" parent="1" source="zcRead" target="consumer"><mxGeometry relative="1" as="geometry"/></mxCell>
<mxCell id="a3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;html=1;endArrow=block" edge="1" parent="1" source="consumer" target="close"><mxGeometry relative="1" as="geometry"/></mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
+12 -24
View File
@@ -3,7 +3,7 @@
## Driver IOCTL DLL 邊界
`gvfg.dll` 保留裝置列舉、`CreateFile`/`CloseHandle`、channel session、event、
thread 與 frame ring。Driver IOCTL code、request layout 及所有
event thread 與單一 frame buffer。Driver IOCTL code、request layout 及所有
`DeviceIoControl` 呼叫集中在內部 `giga_ioctl.dll`;GVFG 僅呼叫其具名 C API,
失敗時沿用 `GetLastError()`。`giga_ioctl.h` 是內部相依,不屬於客戶公開 API。
@@ -70,7 +70,7 @@ Created/Closed -> Opened -> Running -> Opened -> Destroyed
由 caller 序列化;若日後要宣告完整 thread-safe,必須先補足 open/start/stop/destroy
彼此的同步與 handle lifetime 保護。
## 4. DMA 與 frame ring
## 4. DMA 與單一 frame buffer
Copy mode 資料路徑:
@@ -78,28 +78,17 @@ Copy mode 資料路徑:
source frame
-> hardware/driver DMA buffer
-> DMA complete event
-> capture worker 收到 DMA complete event
-> IOCTL_GET_FRAME(frameIndex=0xFFFFFFFF) 複製到 SDK ring free slot
-> slot ready + sequence 更新 + frame_cv notify
-> wait_frame 選取 ready frame
-> facade 回傳指向 slot.data 的 gvfg_frame_t
-> 呼叫 gvfg_read_channel_frame() 的 thread 等待 DMA complete event
-> IOCTL_GET_FRAME(frameIndex=0xFFFFFFFF) 直接複製到 SDK 的單一 buffer
-> facade 回傳指向該 buffer 的 gvfg_frame_t
-> customer/preview/conversion
-> release_frame
-> slot 回到 free
-> buffer 可供下一次 read 使用
```
Backend stream descriptor 目前配置 3 個 SDK slots。Slot 邏輯狀態:
```text
Free ready=false, in_use=false
Writing ready=false, in_use=true
Ready ready=true, in_use=false
Delivered ready=false, in_use=true
```
ring 滿時的行為是即時擷取的 drop/backpressure policy,不是 lossless queue;應透過
internal stats 觀察 `frames_dropped`。不要將 slot 數、driver DMA buffer 數或 done-index
演算法暴露為客戶契約。
Backend 不做 frame queue、slot 切換或 done-index 查詢。每個 channel 同一時間只允許
一個 read,且成功取得的 frame 必須 release 後才能讀下一張。SDK 不把 driver DMA
buffer 數或 done-index 演算法暴露為客戶契約。
Zero-copy mode 資料路徑:
@@ -116,10 +105,9 @@ gvfg_create
-> close/destroy 時 IOCTL_GIGA_DISABLE_FRAME_ZEROCOPY(channel)
```
Zero-copy 同時只允許一張 outstanding frame。若下一個 DMA event 到達時 caller 尚未
release,backend 只會跳過該次 acquire,不會覆寫仍由 caller 使用的 driver pointer。
這種情況不計入 `frames_dropped`,也不送出 `GVFG_EVENT_FRAME_LOSS`;driver 目前沒有
提供可用來確認實際遺失 frame 的 sequence/drop counter。
Zero-copy 同時只允許一張 outstanding frame。Caller 必須 release 目前的
driver pointer,才能再次 read。SDK 不根據 read 間隔推算 frame loss;driver 目前也
沒有提供可用來確認實際遺失 frame 的 sequence/drop counter。
## 5. Frame token 與 ABI