From f8256e6c2d91fe80ecdbddae954981e057766034 Mon Sep 17 00:00:00 2001 From: claude-noether Date: Tue, 12 May 2026 09:08:33 +0000 Subject: [PATCH] =?UTF-8?q?fresnel-fourier=20iter5b=20Phase=206=20commit?= =?UTF-8?q?=20B:=20state-tracking=20=E2=80=94=20request.h=20field=20+=20co?= =?UTF-8?q?nfig.c=20wire-up?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit request.h: add last_output_pixelformat to struct request_data, alongside the existing last_output_{width,height} V4L2 device state cache. Gates re-S_FMT on codec change in addition to resolution change. config.c::RequestCreateConfig: wire up object_config->pixelformat (previously dead field at config.h:46) by calling pixelformat_for_profile on the active profile. The pixelformat field becomes the source of truth that surface.c reads in commit C. Signed-off-by: claude-noether --- src/config.c | 10 ++++++++++ src/request.h | 14 ++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/config.c b/src/config.c index b4c6cfb..a0da521 100644 --- a/src/config.c +++ b/src/config.c @@ -36,6 +36,7 @@ #include +#include "codec.h" #include "utils.h" #include "v4l2.h" @@ -97,6 +98,15 @@ VAStatus RequestCreateConfig(VADriverContextP context, VAProfile profile, config_object->profile = profile; config_object->entrypoint = entrypoint; + /* + * iter5b: cache the V4L2 OUTPUT-side FOURCC for this profile so + * surface.c::CreateSurfaces2 can read it without re-running the + * profile→pixelformat mapping. Wires up the previously-dead + * pixelformat field at config.h:46. Returns 0 for unhandled + * profiles, which the switch above already rejects via + * VA_STATUS_ERROR_UNSUPPORTED_PROFILE. + */ + config_object->pixelformat = pixelformat_for_profile(profile); config_object->attributes[0].type = VAConfigAttribRTFormat; config_object->attributes[0].value = VA_RT_FORMAT_YUV420; config_object->attributes_count = 1; diff --git a/src/request.h b/src/request.h index ac1f419..b0c2045 100644 --- a/src/request.h +++ b/src/request.h @@ -96,9 +96,23 @@ struct request_data { * probes with small surfaces then re-allocates at real * resolution; we re-set the OUTPUT format whenever this pair * changes). + * + * iter5b: extended with last_output_pixelformat so the gate + * also fires on codec change (consumer decodes H.264 first, + * HEVC second on the same driver_data). Pre-iter5b the OUTPUT + * pixel format was hardcoded V4L2_PIX_FMT_H264_SLICE in + * CreateSurfaces2, so codec change was silent and HEVC / VP9 / + * VP8 saw the kernel hantro driver substitute MPEG2_DECODER + * codec_mode (when bound to hantro) or rkvdec silently drop + * the decode (when bound to rkvdec). Same bug class as iter4's + * unconditional h264_start_code; both fixes thread the active + * profile into codec-specific kernel state. + * + * 0 = uninitialized; non-zero = FOURCC of current OUTPUT format. */ unsigned int last_output_width; unsigned int last_output_height; + unsigned int last_output_pixelformat; }; VAStatus VA_DRIVER_INIT_FUNC(VADriverContextP context);