Eager CAPTURE format probe in RequestInit

Chromium's vaapi_video_decoder may call vaCreateContext with surfaces=NULL,
surfaces_count=0 and then create surfaces afterwards via vaCreateSurfaces2.
In that order driver_data->video_format is still NULL when CreateContext
runs and our early `video_format == NULL` guard returns OPERATION_FAILED.
Confirmed via temporary request_log() — Brave hits exactly that path on
ohm.

Move the probe out of RequestCreateSurfaces into a new
video_format_probe() helper in video.c, and call it eagerly from
RequestInit. RequestCreateSurfaces still re-probes if init came up NULL,
which preserves the original lazy behaviour for any caller that needs it.

Also small clean-up of surface.c since the probe block moved out: drop
the now-dead `bool found` local.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-25 22:03:38 +00:00
parent ac674b84ec
commit 0a3432ad64
4 changed files with 66 additions and 39 deletions
+1
View File
@@ -39,6 +39,7 @@ struct video_format {
};
struct video_format *video_format_find(unsigned int pixelformat, bool mplane);
struct video_format *video_format_probe(int video_fd);
bool video_format_is_linear(struct video_format *format);
#endif