forked from marfrit/libva-v4l2-request-fourier
fresnel-fourier iter5b-β Phase 6 commit C: β refactor — OUTPUT lifecycle to CreateContext + CRIT-1 + CRIT-2
Strip OUTPUT-side V4L2 device-format lifecycle out of
RequestCreateSurfaces2 entirely. Move S_FMT(OUTPUT), CAPTURE-format
probe, cap_pool_init, per-surface destination_* fill into
RequestCreateContext where config_id (and therefore the bound
VAProfile) is known via config_object->pixelformat (wired by
commit B). The α' multi-CreateSurfaces2-mid-stream failure mode
disappears because β has no in-CreateSurfaces2 teardown branch;
each context cycle does its own setup, DestroyContext handles
teardown.
Phase 5 v2 review amendments:
- CRIT-1: removed video_format==NULL early-return at context.c:64-66
(would have rejected every first β CreateContext).
- CRIT-2: added request_pool_destroy() to DestroyContext before
REQBUFS(0). Pre-β only surface.c's resolution-change branch
called request_pool_destroy; β strips that, so DestroyContext
becomes the sole per-session teardown site.
- IMP-1: probe CAPTURE format first to derive output_type from
video_format->v4l2_mplane (eliminates the hardcoded mplane=true
hack from the Phase 4 v2 plan).
- IMP-2: surface_reset_format_cache() deleted (function + declaration
in surface.h + call in DestroyContext + last_output_{width,height}
fields in request.h). All dead under β.
CreateSurfaces2 now ~50 LOC (was ~250). Pure surface ID allocation
+ per-surface lifecycle bookkeeping; no V4L2 device state touched.
Signed-off-by: claude-noether <claude-noether@reauktion.de>
This commit is contained in:
+8
-16
@@ -82,23 +82,15 @@ struct request_data {
|
||||
struct cap_pool capture_pool;
|
||||
|
||||
/*
|
||||
* Per-driver-data cache of the OUTPUT format we've set on the
|
||||
* V4L2 device (iter5 Track E: was process-global static
|
||||
* LAST_OUTPUT_WIDTH/HEIGHT, which would race when two libva
|
||||
* driver_data instances share a process — e.g. Firefox playing
|
||||
* one tab while Chromium plays another, or two mpv processes
|
||||
* via the same dlopened backend). Kept per-driver_data because
|
||||
* the V4L2 device fd is per-driver_data; one fd, one current
|
||||
* format. Process-global was always wrong, just didn't surface
|
||||
* until iter5's audit.
|
||||
*
|
||||
* See surface.c::CreateSurfaces2 for the consumer pattern (mpv
|
||||
* probes with small surfaces then re-allocates at real
|
||||
* resolution; we re-set the OUTPUT format whenever this pair
|
||||
* changes).
|
||||
* iter5b-β: the pre-β last_output_{width,height} cache fields
|
||||
* and surface_reset_format_cache() helper are deleted. They
|
||||
* existed because CreateSurfaces2 owned the OUTPUT-side V4L2
|
||||
* device-format lifecycle and needed to gate re-S_FMT on
|
||||
* resolution change. β moves that lifecycle to CreateContext,
|
||||
* which is naturally one-shot per context cycle; no caching is
|
||||
* required. DestroyContext + next CreateContext rebuild from
|
||||
* scratch.
|
||||
*/
|
||||
unsigned int last_output_width;
|
||||
unsigned int last_output_height;
|
||||
};
|
||||
|
||||
VAStatus VA_DRIVER_INIT_FUNC(VADriverContextP context);
|
||||
|
||||
Reference in New Issue
Block a user