Skip to content

VQEnhancer/HQScaler/VideoConverter fail with AMF_DIRECTX_FAILED on wrapped D3D11 textures without D3D11_BIND_SHADER_RESOURCE (FRC handles them) #605

Description

@JuliusBairaktaris

Setup: Windows 11 Pro build 26200, Radeon RX 9070 XT (RDNA4), driver 32.0.31021.5001, AMF runtime from the driver.

Context: FFmpeg master's libavfilter AMF filters (vqe_amf, vpp_amf, sr_amf, frc_amf) with D3D11VA decoder input. After fixing a surface-format bug in FFmpeg (https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23874), the filters wrap the decoder's texture-array slices via CreateSurfaceFromDX11Native (+ AMFTextureArrayIndexGUID private data to select the slice). The AMF context is created from the same D3D11 device via InitDX11.

Observed — identical input surfaces (NV12, texture array, D3D11_BIND_DECODER only):

  • AMFFRC: SubmitInput/QueryOutput work, output is correct.
  • AMFVQEnhancer / AMFHQScaler / AMFVideoConverter: Init() succeeds, SubmitInput() succeeds, first QueryOutput() returns AMF_DIRECTX_FAILED (18), no further diagnostics.
  • The same components succeed when the decode textures are additionally created with D3D11_BIND_SHADER_RESOURCE (FFmpeg device option SHADER=1).
  • DXVA2/DX9 input via CreateSurfaceFromDX9Native: AMFVQEnhancer works with default decoder surfaces.

Repro with ffmpeg git master (patched with the PR above; fails):

ffmpeg -hwaccel d3d11va -hwaccel_output_format d3d11 -i input.mp4 -vf vqe_amf -c:v hevc_amf out.mp4

Works:

ffmpeg -init_hw_device d3d11va=dx11:,SHADER=1 -hwaccel d3d11va -hwaccel_device dx11 \
       -hwaccel_output_format d3d11 -i input.mp4 -vf vqe_amf -c:v hevc_amf out.mp4

Requests:

  1. Could the compute-based components internally handle inputs without SRV bind flags (e.g. an internal copy), as FRC apparently does? Typical D3D11VA decoder pools (FFmpeg's default, and many applications) are BIND_DECODER-only.
  2. If it must remain a hard requirement, document it in the VQ Enhancer / HQ Scaler / Video Converter API docs.
  3. A more specific error than AMF_DIRECTX_FAILED at QueryOutput would help — Init and SubmitInput both succeed, so the failure surfaces late with no hint at the cause.

Happy to test fixes or provide more traces (RDNA4 / Windows 11).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions