Commit Graph
51 Commits
Author SHA1 Message Date
Mark.lin cdd2f8a75b Release SDK 0.2.1 with unplug-safe zero-copy handling
Compared with SDK 0.2.0 (3cd7fbbb):

- Handle the zero-copy release race where the driver clears frame ownership before the SDK receives the unplug event. Wait up to 100 ms only after ERROR_BAD_COMMAND, accept the release as revoked only after a confirmed disconnect, and preserve all other release failures.

- Apply the same confirmed-unplug handling to normal frame release and pending-frame teardown without adding latency to successful per-frame releases.

- Add Debug-only audio event, frame, and byte counters across the Driver-to-SDK, SDK-to-APP, and APP-to-output boundaries, and show the concise totals in the internal diagnostic sample.

- Rename Release and Debug customer packages to the requested GVFG_Sample labels, use minute-resolution timestamps, and derive the package suffix from the root CMake project version.

- Bump the standalone SDK version to 0.2.1 and synchronize the public API examples and internal build guide.

Validation: git diff --check and focused source/diff inspection passed. No build, package generation, runtime capture, unplug stress test, or hardware validation was run.
2026-09-10 11:36:17 +08:00
Mark.lin 3cd7fbbb3f Expose common delivery timestamps for A/V sync
Compared with 7e5d3d2:

- Add monotonic timestamp_ns fields to public video and audio frame tokens so applications can compare delivery timing in one SDK clock domain.

- Stamp video delivery in the PCIe backend and audio delivery in the GVFG facade while preserving complete read/release token validation.

- Update x64 ABI assertions and bump the standalone SDK version to 0.2.0 for the public frame-structure change.

- Document timestamp semantics and limitations across the README, customer API references, internal ABI notes, and build guidance.

- Leave the standalone preview sample behavior unchanged; timestamp-based synchronization remains an application policy.

Validation: git diff --check and focused source inspection passed; no build, ABI consumer rebuild, recording, or hardware capture validation was run.
2026-09-08 15:20:40 +08:00
Mark.lin 8cde31feaf Harden GVFG signal recovery and preview lifecycle
Compared with d03f064:

- Pause the sample video and audio readers after signal disconnect events and resume them only after reconnect or stream-ready notification.

- Serialize plug, unplug, and format transitions against active reads and held zero-copy frames while keeping stop and close able to interrupt lifecycle waits.

- Treat ERROR_BAD_COMMAND as unplug-revoked zero-copy ownership only after the backend has confirmed signal loss, while preserving all other release failures for retry and diagnosis.

- Stop submitting frames when the user closes an independent preview window, account those frames as intentionally skipped, and resume submission when preview is reopened.

- Emit UTF-16 Windows debug output so localized Win32 error messages remain readable in Qt and debugger output.

- Add startup and first-frame timing diagnostics, reduce routine stream-ready logging, and update public and internal documentation for the new disconnect and ownership behavior.

Validation: git diff --check and focused symbol/document consistency searches passed; no build or hardware validation was run.
2026-09-08 12:20:39 +08:00
Mark.lin d03f064b4f Refine GVFG preview pacing and error reporting
- Replace non-blocking Present retries with Present(0, 0), allowing DXGI to
  wait for presentation dependencies on the dedicated preview worker.
- Change preview admission from newest-frame replacement to bounded FIFO
  delivery with three pending/upload reservations and one presenting slot.
- Expire queued preview frames after 50 ms before GPU processing and skip new
  preview submissions only when the bounded slot capacity is full.
- Track queue order and queue age without retaining SDK-owned frame memory;
  capture continues releasing each SDK frame after the synchronous upload.
- Service only synchronous Windows sent messages while waiting for preview
  mutexes, worker shutdown, idle drain, and capture-thread join to avoid an
  HWND-owner/DXGI deadlock without dispatching queued application callbacks.
- Preserve internal preview pacing and audio queue counters while removing
  expected busy, expired, and audio-eviction reports from the normal UI log.
- Reserve delivery error logs for preview/render failures, video or audio
  frame-ID anomalies, audio write failures, and final accounting mismatches.
- Remove the normal stop summary and the audio queue-drop field from the
  status display so expected pacing adjustments are not presented as faults.
- Update the public preview comments and diagnostic documentation for the FIFO
  capacity, queue-age boundary, blocking Present behavior, and log policy.
- Keep the capture SDK, driver interfaces, frame ownership, GPU conversion
  precision, and public delivery-statistics structure unchanged.

Validation:
- User testing reported approximately 18% GPU utilization for one 1920x1080
  Y210 10-bit preview channel. This was not independently benchmarked.
- A user-provided long-run log contained 13,715,695 received video frames with
  no preview render failures; periodic preview skips matched the confirmed
  60.000 FPS versus 59.94 Hz pacing difference.
- The same log showed periodic audio playback-queue eviction without audio
  frame-ID gaps or write failures; this is retained as internal diagnostic
  accounting rather than reported as a source-delivery error.
- Static source review and git diff --check passed. No application, shader, or
  driver build was performed by the agent, and runtime deadlock behavior has
  not been independently reproduced or validated.
2026-09-07 10:28:03 +08:00
Mark.lin 29b449fc6e Optimize GVFG GPU preview and clarify delivery diagnostics
- Render preview directly from the FP16 conversion target into the selected
  8-bit or 10-bit swapchain, removing the full-frame scene copy and the
  intermediate BGRA8 preview pass without capture-frame decimation.
- Simplify neutral YUY2/Y210 shaders to one packed texture load per pixel;
  preserve BT.709 conversion, 10-bit unpacking and odd-width chroma handling.
- Cache shader resource views per upload slot and update constant-buffer
  contents only when source dimensions change.
- Allocate only preview resources and skip export-only shader compilation
  for preview; retain the full BGRA8/RGB10A2/NV12 buffer conversion path.
- Unbind render targets before swapchain resize/release and serialize preview
  configuration and resource changes with GPU rendering.
- Bound startup Present retries and retry presentation without redrawing;
  retain actual skipped-frame counts when presentation remains busy.
- Add preview delivery counters for presented, replaced, busy, failed,
  cancelled and pending frames, including busy source and affected frame ID.
- Fix an uncounted pending-frame replacement and drain pending preview work
  at Stop and before a new run to keep per-run accounting separate.
- Track application audio delivery, dropped duration, read/write stalls and
  frame-ID anomalies while retaining the original 10-block audio queue.
- Stop the channel on audio write failure or two seconds of zero-write
  progress; distinguish cancelled data from runtime drops.
- Keep the existing compact UI; aggregate delivery issue logs at most once
  per five seconds and emit a stop summary with accounting errors only.
- Document diagnostic interpretation, GPU changes and validation boundaries.

Validation:
- User testing reported approximately 15% lower GPU utilization after the
  optimization. Baseline/final readings and relative versus percentage-point
  interpretation were not supplied; no independent benchmark was performed.
- Static source checks and git diff --check passed. No application or shader
  build was performed by the agent; 10-bit startup resolution and long-run
  zero-loss behavior have not been confirmed.
- Rebuild the preview DLL with its matching APP; the SDK GPU buffer converter
  also shares the modified shader source. Capture APIs and driver are unchanged.
2026-09-04 16:02:33 +08:00
Mark.lin 2b62a85912 Improve GVFG audio playback and event shutdown
- Split PCM acquisition from Qt audio playback in the preview sample.
- Copy SDK-owned audio frames into a bounded application queue before release.
- Track and display dropped audio queue entries.
- Add a dedicated stop event for the SDK event-monitor thread.
- Replace periodic event-monitor wakeups with an interruptible infinite wait.
- Poll public channel events every 200 ms for responsive format and signal updates.
- Preserve finite 200 ms video and audio reads for ownership-safe worker shutdown.
2026-09-03 18:34:39 +08:00
Mark.lin bfc598ed4d Redesign audio capture around frame ownership
- Remove the public stream-mask and caller-buffer audio APIs.
- Add explicit audio enable, format query, and frame read/release APIs.
- Move PCM buffer ownership into the SDK.
- Allow each channel to hold at most one audio frame at a time.
- Validate the complete audio frame token during release.
- Reset the audio frame ID when capture starts.
- Invalidate any held audio frame when capture stops.
- Migrate the Qt preview sample to the new audio frame API.
- Update the README, Customer API guide, API Reference, and giga_ioctl boundary documentation.
2026-09-01 17:10:25 +08:00
Mark.lin 3f905d8a09 Add CH0 audio capture and customer runtime diagnostics
Extend the internal driver ABI and public GVFG API for combined CH0 video/audio capture, PCM format discovery, blocking copy-out reads, extra-frame wake events, and coordinated teardown of video and audio readers.

Update the Qt sample with optional CH0 audio playback on a dedicated thread, customer-visible copy/zero-copy timing telemetry, mutually exclusive CH0/CH1 Y210 selection, and a refresh-safe temporary hide for the unsupported CH1 panel.

Harden Win32 error text conversion, document the new stream and ownership contracts, and package giga_ioctl plus the VC143 runtime in customer Debug/Release bundles.

Validation: git diff --check passed before commit. No build, package execution, runtime, audio-device, or capture-hardware test was run.
2026-09-01 12:26:27 +08:00
Mark.lin 226369df0e Add independent dual-channel preview controls
Compared with f380a8a:

- Let CH0 and CH1 open, start, stop, and preview independently while sharing one device connection.

- Give each channel its own capture worker, preview window, frame ownership, runtime status, and failure reporting.

- Expose channel-indexed zero-copy selection to match the driver IOCTL contract and keep output format selection independent per channel.

- Prevent immediate timeout responses from hot-looping and flooding the Qt event queue.

- Align the CH0 and CH1 controls in equal-width channel panels and update the public and internal documentation.

Validation: Qt uic parsing and git diff --check passed; no build or hardware validation was run.
2026-08-27 17:13:22 +08:00
Mark.lin f380a8a143 Simplify dual-channel capture and error handling
Compared with b5b045a:

- Model CH0 and CH1 as independent channel sessions sharing one device connection.

- Keep one outstanding frame per channel and tighten read/release ownership validation.

- Unify facade and PCIES2MM diagnostic details in a per-channel ChannelErrorState.

- Treat polling timeouts and stop wakeups as expected control flow instead of persistent faults.

- Report detailed errors only when an API operation actually fails.

- Remove obsolete preview timing/error diagnostics and the redundant debug error API.

- Refresh the public and internal API references, architecture diagrams, and learning guides.
2026-08-27 11:10:51 +08:00
Mark.lin ca19b4f276 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.
2026-08-21 17:52:22 +08:00
Mark.lin 1574e90b49 Refactor GVFG channel and driver access flow
- support only the new vfg100_0821c driver; legacy drivers and IOCTL contracts are intentionally unsupported
- use one SDK handle per physical device with independent CH0/CH1 sessions and selectable event masks
- expose Device Manager friendly names and remove redundant enumerated device indices
- align active capture IOCTLs with the new driver while omitting unsupported OPEN_VIDEO/CLOSE_VIDEO calls
- isolate IOCTL codes, request layouts, and DeviceIoControl calls in the new giga_ioctl DLL
- block reads of pure write-only registers while preserving dual-semantics interrupt status reads
- reduce duplicate signal register queries during open/start
- add zero-copy/copy driver GetFrame timing in microseconds and show it in the preview status
- update public/internal documentation for the revised lifecycle and channel APIs

Validation: static searches and git diff --check only; build intentionally not run.
2026-08-21 17:52:04 +08:00
Mark.lin f783e21476 stop 2026-08-21 10:13:48 +08:00
Mark.lin 024df690c3 Fix zero-copy frame lifecycle
Enable zero-copy through the public API before opening the device and configure a driver-owned zero-copy ring slot.

Return every delivered frame through IOCTL_GIGA_RELEASE_VIDEO_FRAME and validate the complete frame token before release.

Preserve ownership when the release IOCTL fails so stop, close, or the next start can retry instead of discarding the driver pointer.

Stop DMA and join the backend acquire/event thread before draining frames, preventing acquire from racing stop or disable.

Drain caller-held, ready, unread, and pending zero-copy frames before stop, restart, disable, device close, or process destruction.

Block restart and zero-copy disable when outstanding frames cannot be released successfully.

Release unread frames on signal unplug and before format or resolution changes rebuild the frame ring.

Propagate stop and release errors through the public API and report release failures in the standalone preview.

Document zero-copy ownership, lifecycle requirements, diagnostics, and data flow.

Verified with Standalone Debug and Release builds.
2026-08-19 15:34:37 +08:00
Mark.lin 61da467d83 Update GVFG for new driver capture flow
Use driver-managed video start/stop IOCTLs and request completed frames with MAXULONG instead of querying the done index. Add 300-frame timing statistics, lock format changes during GVFG streaming, and clear stale preview frames to black on signal loss. Document that this SDK revision requires the new PCIE S2MM driver.
2026-08-18 15:45:00 +08:00
Mark.lin 743acfb792 swap:false 2026-08-14 16:39:04 +08:00
Mark.lin d7500ed9fd feat(gvfg): add event-driven signal and format control
Expose gvfg_set_video_format() so applications select YUY2 or Y210 through the SDK while the backend temporarily writes absolute register 0x80 (0=YUY2, 1=Y210).

Define RX mode/timing lock registers and treat the input as connected only when both lock values equal one. Keep plug/unplug/format monitoring active for the complete open-channel lifetime, cache signal metadata, and avoid unnecessary resolution/format register queries.

Keep the driver-compatible GET_VIDEO_DONE_INDEX then GET_FRAME sequence, reject repeated consecutive DMA done indexes, and calculate capture FPS over a one-second delivery window instead of adjacent-frame timing.

Update the standalone Qt sample with YUY2/Y210 selection, event-driven signal state, no-signal Start blocking, streamlined diagnostics, and monitoring that remains active while capture is stopped.

Validation: Release builds completed for the Visual Studio and Qt Creator build trees; the Qt Creator DLL relink requires the consuming viewer to be closed when it is running.
2026-08-14 16:36:38 +08:00
Mark.lin 17fb9bfabd feat: align GVFG output with YUY2
- expose YUY2 across the public API, preview helper, backend, and GPU conversion paths while translating the legacy FPGA format value internally
- correct YUY2 chroma byte interpretation and update customer/internal documentation
- centralize the Standalone SDK version and expose it through gvfg_get_version
- show the SDK version in the sample and enable preview-window controls only after the first valid frame
- close and disable external preview windows when capture stops
2026-08-13 16:14:16 +08:00
Mark.lin a5b86e5872 Decouple preview presentation from capture 2026-08-13 13:55:03 +08:00
Mark.lin bab59efcb5 Diagnose preview stalls and FIFO frame loss
- add detailed FIFO loss and frame-hold timing diagnostics
- report slow preview calls and per-stage GPU timing
- reduce redundant preview pipeline and DXGI setup work
- move preview performance metrics into the sample status display
- avoid duplicate frame-loss warnings
2026-08-13 10:49:09 +08:00
Mark.lin aad8419c2a Improve capture startup, frame loss reporting, and preview diagnostics
- defer DMA capture until the first frame reader is waiting
- deliver FIFO frames in sequence order and overwrite the oldest unread frame
  when the three-slot FIFO is full
- report known frame loss through GVFG_EVENT_FRAME_LOSS and runtime statistics
- replace the enum-only event API with the extensible gvfg_event_t structure
- expose per-handle public error details
- add preview GPU resource preparation before capture starts
- move GPU preview timing from periodic logs to the status display
- remove the redundant stream descriptor channel field
- reorganize customer and internal documentation
- add a complete customer API reference
2026-08-12 17:30:56 +08:00
Mark.lin dc0b460792 Add GPU NV12 conversion APIs 2026-08-07 09:50:19 +08:00
Mark.lin 3309f822ec Integrate GPU conversion and update capture pipeline 2026-08-06 10:03:32 +08:00
Mark.lin 300cbdfd9b Update Y210 preview and debug tooling 2026-08-04 18:12:05 +08:00
Mark.lin 6bc7dd6815 Simplify frame layout metadata 2026-07-31 13:59:43 +08:00
Mark.lin 2b5e75ade9 Simplify GVFG API and frame diagnostics 2026-07-30 16:43:30 +08:00
Mark.lin 9124930e98 Remove obsolete capture pause events 2026-07-29 15:52:51 +08:00
Mark.lin d9f194c1ab Refine GVFG capture API 2026-07-28 17:38:44 +08:00
Mark.lin 5662d74df9 feat: separate customer and internal diagnostics 2026-07-27 14:49:57 +08:00
Mark.lin 747209fa87 feat: harden capture API and preview diagnostics 2026-07-27 11:10:59 +08:00
Mark.lin 2b2eeb7302 refactor: simplify PCIES2MM capture backend 2026-07-23 08:54:43 +08:00
Mark.lin 8914281d2e feat: migrate CaptureDemo capture flow into SDK 2026-07-22 09:23:26 +08:00
Mark.lin f7e5d20068 fix: handle FPGA Y210 payload and correct chroma order
- treat FPGA v210 format marker as Y210 payload
- calculate Y210 DMA frame size as width * height * 4
- route CaptureDemo preview frames through the Y210 path
- normalize FPGA Y0/V/Y1/U data to standard Y0/U/Y1/V
- apply the same chroma correction to preview and frame conversion
- reallocate capture buffers using the detected pixel format
2026-07-20 16:24:06 +08:00
Mark.lin 1719053b3d Add standard v210 preview support 2026-07-16 11:05:37 +08:00
Mark.lin 9639a797aa Rename backend to PCIES2MM and handle events 2026-07-13 16:56:03 +08:00
Mark.lin 3e02a374e0 Switch capture backend to PcieS2mm demo driver 2026-07-08 09:43:18 +08:00
Mark.lin 1161d97de6 Add optional callback capture mode
- Add frame and event callback types to the public capture API
- Add callback mode setup/start/stop APIs alongside the existing pull API
- Enforce mutual exclusion between pull mode and callback mode per handle
- Run callback frame delivery on an SDK-owned worker thread
- Auto-release callback frames after the frame callback returns
- Dispatch callback events through a separate SDK-owned event worker
- Document callback mode threading, lifetime, and mode exclusivity
2026-06-26 15:40:15 +08:00
Mark.lin 92b5fb1464 Add backend diagnostics for capture stalls
- add rotating XDMA backend and Qt preview logs
- expose IRQ, DMA, ring, and delivery debug state
- record IRQ wait heartbeats and register state
- make XDMA tracing configurable through CMake
- prevent preview status queries from blocking rendering
- recover from D3D swapchain and Present failures
- add debug API struct size validation
- avoid stale MainWindow object-size stack corruption
2026-06-18 10:24:34 +08:00
Mark.lin 42502ef701 Validate released frames and simplify CMake 2026-06-17 17:09:29 +08:00
Mark.lin fd0272b623 Add frame layout API and split conversion helper
- Add gvfg_get_frame_layout() and gvfg_frame_layout_t for per-plane
  frame metadata without extending gvfg_frame_t
- Update gvfg_preview to consume gvfg_get_frame_layout() before
  falling back to width-derived stride
- Add optional gvfg_convert helper DLL for explicit snapshot/export
  conversion outside the core capture API
- Support YUY2/Y210 conversion to BGRA8, RGB48, and RGBA64 helper
  frames
- Add SAL annotations to public capture, preview, convert, and debug
  headers
- Update Traditional Chinese API/package documentation for core,
  preview, and convert helper split
2026-06-16 16:59:39 +08:00
Mark.lin d2657a69cb Split GVFG customer API and preview helper
Refactor GVFG into a pull-based customer API with internal debug diagnostics in gvfg_debug.h. Move preview rendering into the separate gvfg_preview helper DLL and update the Qt sample to link it explicitly. Clean legacy callback/preview docs and removed SDK-internal render/log helper sources from the core GVFG DLL.
2026-06-15 17:06:12 +08:00
Mark.lin 97971e6242 Refactor SDK to pure pull-based capture API
- Remove customer-facing SDK preview APIs and preview structs
- Strip D3D preview/render pipeline from gvfg.dll
- Keep gvfg.dll focused on capture, frame ownership, runtime status, and events
- Move Qt preview rendering into sample-owned private renderer
- Update Qt preview sample to render frames after gvfg_read_frame()
- Refresh customer API docs around read_frame/release_frame/poll_event flow
- Update architecture notes to mark preview as app/internal-tool code
2026-06-15 14:03:21 +08:00
Mark.lin 6120a6b74f Refine GVFG customer API surface 2026-06-11 10:25:50 +08:00
Mark.lin 8a13e8b0e8 Use XDMA ring slots for frame delivery 2026-06-10 15:06:34 +08:00
Mark.lin 7918b79480 Simplify XDMA types and add fullscreen preview 2026-06-09 17:41:06 +08:00
Mark.lin 739d1fcf32 Deliver native callback frames 2026-06-09 16:05:27 +08:00
Mark.lin 31ace3693f Refine signal status API layout 2026-06-09 15:02:05 +08:00
Mark.lin aeef7860dd Remove legacy signal status fields 2026-06-09 14:19:06 +08:00
Mark.lin 71d4cf6a9b Remove unused GVFG internal code 2026-06-09 11:34:01 +08:00
Mark.lin f5c91f7eda Remove gcapture dependency from GVFG standalone 2026-06-09 10:25:48 +08:00