iter39 Option B revert of 63fed87: P010 advertisement gated on is_10bit again

Phase 7 fix 63fed87 (unconditional P010 in QueryImageFormats) broke
HEVC 8-bit on fresnel: ffmpeg-vaapi picked P010 for the HEVC hwframe
pool, vaEndPicture SEGV'd when consumer-side P010 expectations met
the 8-bit NV12 CAPTURE buffer. Exit 139 (SIGSEGV) on first frame.

Original reasoning for 63fed87 (advertise early so ffmpeg's pre-
CreateContext query sees P010) doesn't apply with Option B in place —
Hi10P + Main10 are dropped from RequestQueryConfigProfiles, so no
10-bit decode pipeline reaches QueryImageFormats. The gate on
is_10bit (false for all enumerated profiles post-Option-B) correctly
returns NV12-only.

Verified on fresnel post-revert: HEVC bit-exact PASS sha
108f925bb6cbb6c9 restored; iter38 5/5 baseline intact.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-17 16:52:36 +00:00
parent 6bc12fe7e4
commit c9f32aff49
+15 -13
View File
@@ -372,19 +372,21 @@ VAStatus RequestQueryImageFormats(VADriverContextP context,
formats[n].bits_per_pixel = 12;
n++;
/* iter39 fresnel fix: advertise P010 UNCONDITIONALLY (was gated on
* driver_data->is_10bit). ffmpeg-vaapi's hwcontext_vaapi calls
* vaQueryImageFormats during hwframes context setup, BEFORE
* vaCreateContext fires (so is_10bit isn't set yet). If P010 isn't
* in the format catalog at that early query, hwdownload rejects
* pix_fmt=p010le with "Invalid output format" and decode fails
* before our backend even sees the 10-bit context.
* Reporting P010 unconditionally is safe: consumers ask for it only
* when their decode pipeline actually needs 10-bit, and our P010
* unpack path in copy_surface_to_image gates on
* image->format.fourcc == VA_FOURCC_P010 (independent of is_10bit). */
(void)driver_data;
if (n < V4L2_REQUEST_MAX_IMAGE_FORMATS) {
/*
* iter39 Option B revert (2026-05-17): P010 advertisement is
* gated on driver_data->is_10bit again. Previously advertised
* unconditionally (63fed87) so ffmpeg-vaapi's early
* vaQueryImageFormats (pre-vaCreateContext) could see it for
* 10-bit profiles — but that broke HEVC 8-bit on fresnel:
* ffmpeg-vaapi picked P010 for the HEVC hwframe pool, EndPicture
* SEGV'd in the .so when the consumer-side P010 expectations met
* an 8-bit NV12 CAPTURE buffer.
* Safe because Option B drops VAProfileHEVCMain10 + Hi10P from
* enumeration — no 10-bit decode pipeline will reach this catalog
* query so the gate-on-is_10bit (which stays false for 8-bit
* profiles) correctly returns NV12-only.
*/
if (driver_data->is_10bit && n < V4L2_REQUEST_MAX_IMAGE_FORMATS) {
memset(&formats[n], 0, sizeof(formats[n]));
formats[n].fourcc = VA_FOURCC_P010;
formats[n].byte_order = VA_LSB_FIRST;