Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FFmpeg-vaapi][vp9 10bit][decode] #629

Closed
fulinjie opened this issue May 20, 2019 · 5 comments
Closed

[FFmpeg-vaapi][vp9 10bit][decode] #629

fulinjie opened this issue May 20, 2019 · 5 comments
Assignees
Labels
Decode video decode related In Progress PR: still under discussion Won't Fix Issue: won't support platform/feature/request

Comments

@fulinjie
Copy link
Contributor

Tested on ICL with b88f49f , and it occurs in KBL, too.

CMD:
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -v verbose -i vp9_sf_10bit_CrowdRun_256x256_112x112_256x256.ivf -pix_fmt p010le -f rawvideo -y dump.yuv

Error Message:
[MOS]: CRITICAL - Mos_Specific_GetResourceInfo:2169: Invalid (nullptr) Pointer.
[CODEC]:CRITICAL - CodecHalGetResourceInfo:507: MOS returned error, eStatus = 0x5
[CODEC]:CRITICAL - InitPicStateMhwParams:1390: MOS returned error, eStatus = 0x5
[CODEC]:CRITICAL - DecodeStateLevel:533: MOS returned error, eStatus = 0x5
[CODEC]:CRITICAL - Execute:1264: State level decoding failed.
[LIBVA]:CRITICAL - EndPicture:719: DDI:DdiDecode_DecodeInCodecHal return failure.
[vp9 @ 0x2288380] Failed to end picture decode issue: 23 (internal decoding error).
[MOS]: CRITICAL - Mos_Specific_GetResourceInfo:2169: Invalid (nullptr) Pointer.
[CODEC]:CRITICAL - CodecHalGetResourceInfo:507: MOS returned error, eStatus = 0x5
[CODEC]:CRITICAL - InitPicStateMhwParams:1390: MOS returned error, eStatus = 0x5
[CODEC]:CRITICAL - DecodeStateLevel:533: MOS returned error, eStatus = 0x5
[CODEC]:CRITICAL - Execute:1264: State level decoding failed.
[LIBVA]:CRITICAL - EndPicture:719: DDI:DdiDecode_DecodeInCodecHal return failure.
[vp9 @ 0x2290780] Failed to end picture decode issue: 23 (internal decoding error).

Analysis:
In DdiDecodeVP9::ParsePicParams,
picParam->reference_frames[i] is passed correctly from FFmpeg level, but GetRenderTargetID falled to get the frameIdx.

frameIdx = GetRenderTargetID(&m_ddiDecodeCtx->RTtbl, refSurface);

The absence of reference id is the root cause of the failure in CodecHalGetResourceInfo.

@wangyan-intel wangyan-intel added the Decode video decode related label May 21, 2019
@wangyan-intel
Copy link

@fulinjie Could you please share your vp9_sf_10bit_CrowdRun_256x256_112x112_256x256.ivf? Thanks.

@wangyan-intel
Copy link

wangyan-intel commented May 28, 2019

@fulinjie I just submitted one patch to FFMPEG maillist. This issue comes from FFMPEG destroy VAAPI context when the resolution of the 2nd frame is different with the 1st frame. It will cause reference frame surface lost. Thanks.
http://ffmpeg.org/pipermail/ffmpeg-devel/2019-May/244711.html

@fulinjie
Copy link
Contributor Author

Update:

VP9 allows resolution changes per frame. Currently in VAAPI, resolution
changes leads to va context destroy and reinit. This will cause
reference frame surface lost and produce garbage.

Though refs surface id could be passed to media driver and found in
RTtbl, vp9RefList[] in hal layer has already been destroyed. Thus the
new created VaContext could only got an empty RefList.

As libva allows re-create surface separately without changing the
context, this issue could be handled by only recreating hw_frames_ctx.

https://patchwork.ffmpeg.org/patch/13895/

There is still possibility for reconstruct vp9RefList[].

Destroy/recreate context is a common pipeline for all hardware codec, specific code is hacky in general path.
As FFmpeg has the ability to pass the refs surface id to driver, I think maintainers would prefer have this fixed internally in driver.

@XinfengZhang XinfengZhang added the In Progress PR: still under discussion label Sep 2, 2019
@XinfengZhang
Copy link
Contributor

middle ware issue, should not traced here

@XinfengZhang XinfengZhang added the Won't Fix Issue: won't support platform/feature/request label May 28, 2020
@XinfengZhang
Copy link
Contributor

it is different, media driver will keep some inter-media variables for different frames, different codec should have different inter-media variable required. for example: for h264, MV of P frame should be kept for future B frame. application should not destroy/re-create the context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Decode video decode related In Progress PR: still under discussion Won't Fix Issue: won't support platform/feature/request
Projects
None yet
Development

No branches or pull requests

3 participants