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
+4 -10
View File
@@ -128,8 +128,6 @@ extern "C"
{
double capture_fps; /* Runtime FPS measured from frames returned by gvfg_read_channel_frame(). */
uint64_t delivered_frames; /* Number of frames returned by gvfg_read_channel_frame(). */
/* Frames known by the SDK to have been lost before application delivery. */
uint64_t lost_frames;
} gvfg_runtime_info_t;
typedef struct
@@ -171,9 +169,7 @@ extern "C"
/* First complete frame after stream start, plug-in, or format recovery is ready. */
GVFG_EVENT_STREAM_READY = 3,
/* Input format is changing; pause use of resources created for the old format. */
GVFG_EVENT_FORMAT_CHANGE_BEGIN = 4,
/* One or more frames were known to be lost before application delivery. */
GVFG_EVENT_FRAME_LOSS = 5
GVFG_EVENT_FORMAT_CHANGE_BEGIN = 4
} gvfg_event_type_t;
typedef enum
@@ -183,16 +179,14 @@ extern "C"
GVFG_EVENT_MASK_SIGNAL_DISCONNECTED = 1u << 1,
GVFG_EVENT_MASK_STREAM_READY = 1u << 2,
GVFG_EVENT_MASK_FORMAT_CHANGE_BEGIN = 1u << 3,
GVFG_EVENT_MASK_FRAME_LOSS = 1u << 4,
GVFG_EVENT_MASK_ALL = (1u << 5) - 1u
GVFG_EVENT_MASK_ALL = (1u << 4) - 1u
} gvfg_event_mask_t;
typedef struct
{
/* Set to sizeof(gvfg_event_t) before calling gvfg_poll_channel_event(). */
uint32_t struct_size;
int32_t type; /* gvfg_event_type_t value. */
uint64_t count; /* Loss count for GVFG_EVENT_FRAME_LOSS; otherwise zero. */
int32_t type; /* gvfg_event_type_t value. */
uint64_t reserved[4];
} gvfg_event_t;
@@ -287,7 +281,7 @@ extern "C"
/*
* A handle may open both channels of the same device. The first call opens
* the Windows device; the second channel shares that device connection and
* owns independent capture, event, frame-ring, and zero-copy state.
* owns independent capture, event, frame, and zero-copy state.
*/
/*
+8 -5
View File
@@ -37,25 +37,28 @@ typedef struct
int backend_state;
uint64_t backend_frames_captured;
uint64_t backend_frames_delivered;
uint64_t backend_frames_dropped;
uint64_t backend_dma_errors;
uint64_t backend_interrupt_count;
uint64_t backend_wait_timeouts;
int backend_running;
int backend_capture_active;
uint32_t backend_pending_events;
uint64_t backend_latest_sequence;
uint64_t backend_delivered_sequence;
uint64_t backend_active_delivery_slot; /* UINT64_MAX when no frame is held by the caller. */
uint64_t backend_next_write_slot;
uint64_t backend_ring_size;
int get_frame_zero_copy;
uint64_t get_frame_timing_samples;
double get_frame_timing_average_us;
double get_frame_timing_max300_us;
double get_frame_timing_max_us;
uint64_t event_wait_timing_samples;
double event_wait_timing_average_us;
double event_wait_timing_max300_us;
double event_wait_timing_max_us;
uint64_t sdk_processing_timing_samples;
double sdk_processing_timing_average_us;
double sdk_processing_timing_max300_us;
double sdk_processing_timing_max_us;
} gvfg_debug_backend_stats_t;
/*