iter2 step3: HEVC EXT_SPS_*_RPS UAPI header + runtime probe
src/hevc-ctrls/v4l2-hevc-ext-controls.h (NEW, MIT, ~95 LOC):
Verbatim mirror of Linux 7.0 V4L2_CID_STATELESS_HEVC_EXT_SPS_ST_RPS
and _LT_RPS control IDs + struct definitions + flag macros. Each
symbol is ifndef-guarded so when ampere's linux-api-headers
eventually bumps to 7.0+, the kernel header takes precedence and
this shim silently no-ops. Citation block links the upstream
Casanova v8 series.
Per LGPL section 3.b, kernel UAPI struct definitions are excepted
from GPL inheritance, so copying them into MIT userspace is fine.
src/request.h: added has_hevc_ext_sps_rps_rkvdec + _hantro bool
fields on struct request_data — pair-of-flags layout mirrors
video_fd_rkvdec / video_fd_hantro (iter38 multi-device-probe
pattern, per feedback_multi_device_probe_design). Phase 5 review
identified single-scalar storage as a silent-misbehavior risk
across device-switch boundaries.
src/request.c:
- new probe_hevc_ext_sps_rps_controls(fd) helper: queries the two
new CIDs via VIDIOC_QUERYCTRL; returns true iff both register.
RK3399 rkvdec (linux 6.x or 7.x without VDPU381/383 bindings)
returns false; RK3588 rkvdec (VDPU381/383) returns true.
- probe each driver_data->video_fd_rkvdec / _hantro after the
iter38 multi-device-probe block at VA_DRIVER_INIT time
- log-line if rkvdec supports it - diagnostic for Phase 7
src/meson.build: added the new UAPI header to the headers list.
Build verified: ninja -C build clean, .so produced. The new probe
runs at driver init and stores the result, but nothing CONSUMES the
result yet — that's Step 4 (h265_set_controls wiring).
Per ampere-kernel-decoders campaign iter2 Phase 4 step 3 (amended
by Phase 5 review item 'per-fd storage').
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* v4l2-hevc-ext-controls.h — verbatim mirror of Linux 7.0+ V4L2 stateless
|
||||
* HEVC extended-SPS RPS control definitions, shipped as an internal
|
||||
* header so this libva backend can be built against pre-7.0
|
||||
* linux-api-headers packages (currently ampere ships 6.19-1).
|
||||
*
|
||||
* Upstream source: linux kernel, include/uapi/linux/v4l2-controls.h
|
||||
* As-of: Linux 7.0-rc3 (Detlev Casanova / Collabora "VDPU381/VDPU383"
|
||||
* series, see lkml.org/lkml/2026/1/9/1334). The two CIDs + two structs
|
||||
* + two flag macros below are byte-for-byte the kernel UAPI definitions.
|
||||
*
|
||||
* Once linux-api-headers >= 7.0 is the floor across the fleet, this
|
||||
* shim becomes redundant — `<linux/v4l2-controls.h>` will provide the
|
||||
* same symbols. The include order in h265.c is: this header BEFORE
|
||||
* <linux/v4l2-controls.h>, so when the system catches up, the macro
|
||||
* guards below silently no-op and we use the system definitions.
|
||||
*
|
||||
* License: MIT (matches backend's COPYING.MIT). Per LGPL § 3.b., the
|
||||
* kernel UAPI struct definitions themselves are excepted from the
|
||||
* kernel's overall GPL and may be copied verbatim into userspace
|
||||
* binaries without inheriting GPL.
|
||||
*
|
||||
* Rationale + iter2 plan: see
|
||||
* ~/src/ampere-kernel-decoders/phase4_plan_iter2.md (§Step 3)
|
||||
* ~/src/ampere-kernel-decoders/phase0_findings_iter2.md
|
||||
*/
|
||||
|
||||
#ifndef LIBVA_V4L2_REQUEST_FOURIER_V4L2_HEVC_EXT_CONTROLS_H
|
||||
#define LIBVA_V4L2_REQUEST_FOURIER_V4L2_HEVC_EXT_CONTROLS_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/v4l2-controls.h>
|
||||
|
||||
#ifndef V4L2_CID_STATELESS_HEVC_EXT_SPS_ST_RPS
|
||||
# define V4L2_CID_STATELESS_HEVC_EXT_SPS_ST_RPS \
|
||||
(V4L2_CID_CODEC_STATELESS_BASE + 408)
|
||||
#endif
|
||||
|
||||
#ifndef V4L2_CID_STATELESS_HEVC_EXT_SPS_LT_RPS
|
||||
# define V4L2_CID_STATELESS_HEVC_EXT_SPS_LT_RPS \
|
||||
(V4L2_CID_CODEC_STATELESS_BASE + 409)
|
||||
#endif
|
||||
|
||||
#ifndef V4L2_HEVC_EXT_SPS_ST_RPS_FLAG_INTER_REF_PIC_SET_PRED
|
||||
# define V4L2_HEVC_EXT_SPS_ST_RPS_FLAG_INTER_REF_PIC_SET_PRED 0x1
|
||||
#endif
|
||||
|
||||
#ifndef V4L2_HEVC_EXT_SPS_LT_RPS_FLAG_USED_LT
|
||||
# define V4L2_HEVC_EXT_SPS_LT_RPS_FLAG_USED_LT 0x1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* struct v4l2_ctrl_hevc_ext_sps_st_rps — HEVC short-term RPS parameters.
|
||||
*
|
||||
* Dynamic-size 1-dimension array. Number of elements is
|
||||
* v4l2_ctrl_hevc_sps::num_short_term_ref_pic_sets
|
||||
* Can contain up to 65 elements (the H.265 spec § 7.4.3.2.1 maximum).
|
||||
*/
|
||||
#ifndef V4L2_HEVC_EXT_SPS_ST_RPS_DEFINED
|
||||
# define V4L2_HEVC_EXT_SPS_ST_RPS_DEFINED 1
|
||||
struct v4l2_ctrl_hevc_ext_sps_st_rps {
|
||||
__u8 delta_idx_minus1;
|
||||
__u8 delta_rps_sign;
|
||||
__u8 num_negative_pics;
|
||||
__u8 num_positive_pics;
|
||||
__u32 used_by_curr_pic;
|
||||
__u32 use_delta_flag;
|
||||
__u16 abs_delta_rps_minus1;
|
||||
__u16 delta_poc_s0_minus1[16];
|
||||
__u16 delta_poc_s1_minus1[16];
|
||||
__u16 flags;
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* struct v4l2_ctrl_hevc_ext_sps_lt_rps — HEVC long-term RPS parameters.
|
||||
*
|
||||
* Dynamic-size 1-dimension array. Number of elements is
|
||||
* v4l2_ctrl_hevc_sps::num_long_term_ref_pics_sps
|
||||
* Can contain up to 33 elements (the H.265 spec § 7.4.3.2.1 maximum).
|
||||
*/
|
||||
#ifndef V4L2_HEVC_EXT_SPS_LT_RPS_DEFINED
|
||||
# define V4L2_HEVC_EXT_SPS_LT_RPS_DEFINED 1
|
||||
struct v4l2_ctrl_hevc_ext_sps_lt_rps {
|
||||
__u16 lt_ref_pic_poc_lsb_sps;
|
||||
__u16 flags;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* LIBVA_V4L2_REQUEST_FOURIER_V4L2_HEVC_EXT_CONTROLS_H */
|
||||
Reference in New Issue
Block a user