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:
@@ -165,6 +165,27 @@ VAStatus RequestExportSurfaceHandle(VADriverContextP context,
|
||||
VASurfaceID surface_id, uint32_t mem_type,
|
||||
uint32_t flags, void *descriptor);
|
||||
|
||||
/*
|
||||
* iter5b-β Commit D: populate a surface's format-uniform destination_*
|
||||
* fields (planes_count, buffers_count, offsets, sizes, bytesperlines)
|
||||
* from driver_data's cached CAPTURE-side geometry. Idempotent: skip
|
||||
* if already filled (destination_planes_count != 0). Caller must
|
||||
* ensure driver_data->fmt_valid is true (CreateContext has run).
|
||||
*
|
||||
* Called by:
|
||||
* - context.c::RequestCreateContext after v4l2_get_format(CAPTURE)
|
||||
* populates the cache; walks the surface_heap and fills every
|
||||
* existing surface (covers surfaces created before CreateContext,
|
||||
* including the ffmpeg vaapi-copy case where surfaces_count=0 is
|
||||
* passed but surfaces exist in the heap from earlier
|
||||
* CreateSurfaces2 calls).
|
||||
* - surface.c::RequestCreateSurfaces2 after surface allocation,
|
||||
* covering the case where CreateContext fired before this
|
||||
* CreateSurfaces2 call (fmt cache is valid, fill immediately).
|
||||
*/
|
||||
void surface_fill_format_uniform(struct request_data *driver_data,
|
||||
struct object_surface *surface_object);
|
||||
|
||||
/*
|
||||
* Iter2 Fix 3: bind / unbind a CAPTURE-pool slot to an object_surface.
|
||||
* Called from picture.c::RequestBeginPicture (acquire+bind) and
|
||||
|
||||
Reference in New Issue
Block a user