Skip to content

Add HEVC extension buffer wrappers, zero-init decode buffers, expose Display::handle - #40

Open
andreytkachenko wants to merge 2 commits into
chromeos:mainfrom
andreytkachenko:expose-display-handle
Open

andreytkachenko wants to merge 2 commits into
chromeos:mainfrom
andreytkachenko:expose-display-handle

Conversation

@andreytkachenko

Copy link
Copy Markdown

Two changes needed by VAAPI video decoders targeting the Intel iHD driver:

  1. Expose Display::handle — allow obtaining the raw VADisplay for direct libva FFI use.

  2. HEVC extension buffer wrappers + zero-initialized decode parameter buffers:

    • PictureParameterBufferHEVCExtension / SliceParameterBufferHEVCExtension wrappers over the *Extension FFI structs (base + rext, scc zeroed), plus PictureParameter::HEVCExtension / SliceParameter::HEVCExtension enum variants. For REXT/SCC profiles (sps profile_idc >= 4) the driver expects the full extension-size buffer attached as a plain picture/slice parameter type, matching FFmpeg vaapi_hevc.c.
    • Zero-initialize the VAPictureParameterBufferH264, VASliceParameterBufferH264, VASliceParameterBufferHEVC, VASliceParameterBufferHEVCRext and VADecPictureParameterBufferVP9 constructors instead of using struct literals: Rust struct literals leave implicit C padding bytes uninitialized, and iHD compares the whole mapped buffer byte-wise against FFmpeg's memset-zeroed buffers — uninitialized padding leaked garbage to the driver.

Used by the vacc VAAPI decoders. Interim until this merges and is released, the fork is published to crates.io as vacc-libva.

andreytkachenko and others added 2 commits September 2, 2026 12:25
…uctors

Two changes needed by VAAPI decoders targeting Intel iHD:

1. PictureParameterBufferHEVCExtension / SliceParameterBufferHEVCExtension
   wrappers over the *Extension FFI structs (base + rext, scc zeroed), plus
   PictureParameter::HEVCExtension / SliceParameter::HEVCExtension enum
   variants. For REXT/SCC profiles (sps profile_idc >= 4) the driver expects
   the full extension-size buffer attached as a plain picture/slice parameter
   type, matching FFmpeg vaapi_hevc.c.

2. Zero-initialize VAPictureParameterBufferH264, VASliceParameterBufferH264,
   VASliceParameterBufferHEVC, VASliceParameterBufferHEVCRext and
   VADecPictureParameterBufferVP9 constructors instead of using struct
   literals: Rust struct literals leave implicit C padding bytes
   uninitialized, and iHD compares the whole mapped buffer byte-wise against
   FFmpeg's memset-zeroed buffers. Uninitialized padding leaked garbage to
   the driver.
@google-cla

google-cla Bot commented Oct 12, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant