forked from marfrit/libva-v4l2-request-fourier
fresnel-fourier iter5b-β Phase 7 fix-forward commit D: destination_* for vaapi-copy late-surface flow
Phase 7 empirical: all 5 libva codecs returned all-zero because CreateContext's surfaces_ids[] walk was a no-op for ffmpeg-vaapi-copy which passes surfaces_count=0 to vaCreateContext (per the iter6 comment at context.c:262). Surfaces existed in driver_data's surface_heap but weren't in the param array → destination_* stayed at the zero initialization from CreateSurfaces2 β → BeginPicture's surface_bind_slot saw destination_planes_count=0 → no data assignment → copy_surface_to_image read all-zero. Fix: cache the format-uniform CAPTURE geometry in driver_data (fmt_valid, fmt_planes_count, fmt_buffers_count, fmt_format_height, fmt_sizes[], fmt_bytesperlines[]). Populate at CreateContext after v4l2_get_format(CAPTURE). Walk surface_heap (not just surfaces_ids[]) to fill every existing surface. Add lazy-fill in CreateSurfaces2 for surfaces created AFTER CreateContext. Invalidate cache in DestroyContext. New helper: surface_fill_format_uniform(driver_data, surface_object). Idempotent on destination_planes_count != 0. Signed-off-by: claude-noether <claude-noether@reauktion.de>
This commit is contained in:
@@ -90,7 +90,28 @@ struct request_data {
|
||||
* which is naturally one-shot per context cycle; no caching is
|
||||
* required. DestroyContext + next CreateContext rebuild from
|
||||
* scratch.
|
||||
*
|
||||
* iter5b-β Commit D: cache the format-uniform CAPTURE-side
|
||||
* geometry from v4l2_get_format so CreateSurfaces2 can populate
|
||||
* a newly-created surface's destination_* fields without
|
||||
* re-querying the device. Set by CreateContext after the
|
||||
* v4l2_get_format(CAPTURE) call; consumed by both:
|
||||
* 1. CreateContext's surface_heap walk (fills surfaces that
|
||||
* pre-exist when CreateContext fires);
|
||||
* 2. CreateSurfaces2's per-surface init (fills surfaces
|
||||
* created AFTER CreateContext, e.g. ffmpeg vaapi-copy
|
||||
* pool dynamics where the consumer passes surfaces_count=0
|
||||
* to vaCreateContext and creates surfaces lazily).
|
||||
*
|
||||
* fmt_valid is true once CreateContext has populated the cache;
|
||||
* CreateSurfaces2 only lazy-fills when fmt_valid is true.
|
||||
*/
|
||||
bool fmt_valid;
|
||||
unsigned int fmt_format_height;
|
||||
unsigned int fmt_planes_count;
|
||||
unsigned int fmt_buffers_count;
|
||||
unsigned int fmt_sizes[VIDEO_MAX_PLANES];
|
||||
unsigned int fmt_bytesperlines[VIDEO_MAX_PLANES];
|
||||
};
|
||||
|
||||
VAStatus VA_DRIVER_INIT_FUNC(VADriverContextP context);
|
||||
|
||||
Reference in New Issue
Block a user