intel / media-driver

Intel Graphics Media Driver to support hardware decode, encode and video processing.
https://github.com/intel/media-driver/wiki
Other
970 stars 345 forks source link

Very low frame rate due to extremely long execution time of vaMapBuffer in libva trace log file #1697

Closed BenFossil closed 5 months ago

BenFossil commented 1 year ago

Hi all,

I use Yocto project to build libva (https://github.com/intel/libva repo, v2.18-branch branch) and intel-media-driver (https://github.com/intel/media-driver repo, intel-media-23.1 branch) for my core-image-weston image. When I play video via HTML5 player on chromium, there are some screen hangs while playing. I checked libva log file and see that sometimes vaMapBuffer call takes up to several seconds to complete which is the reason for my screen hang issue. Here is an example in libva trace log file:

...... [23429.118482][ctx none]=========vaEndPicture ret = VA_STATUS_SUCCESS, success (no error) [23434.222300][ctx none]=========vaMapBuffer ret = VA_STATUS_SUCCESS, success (no error) [23434.222318][ctx none]=========vaUnmapBuffer ret = VA_STATUS_SUCCESS, success (no error) .......

That vaMapBuffer call takes about 5s to complete!!! There are other vaMapBuffer calls that take. such very long time as in the attached file. My hardware system is Intel J4215 with UHD Graphic 600 GPU

Please help how to troubleshoot why some vaMapBuffer calls take such extremely long time and causes very low frame rate

Thank you, Ben

libva.trace.log

XinfengZhang commented 1 year ago

it is a media driver issue, right? if you have no other concern, could I transfer it to media driver? ps: do you know which buffer you are mapping? and maybe need add log before the vaMapBuffer, suppose it is because of vaEndPicture instead of vaMapBuffer. is there gpu hang?

BenFossil commented 1 year ago

Hi ZinfengZhang,

Thank you for the response! I added two debug prints before & after vaMapBuffer call to double check as you suggested and see that vaMapBuffer is actually called in delay after vaEndPicture which causes delay to next frame. Eg: I added a new trace function call va_MyTrace1 which prints two messages before/after vaMapBuffer() call which are "My trace 1" and "My trace 2"

[2792.725253][ctx none]=========vaEndPicture ret = VA_STATUS_SUCCESS, success (no error) [2794.478749][ctx none]==========va_MyTrace1 [2794.478772][ctx none]My trace 1 [2794.478785][ctx none]==========va_MyTrace1 [2794.478787][ctx none]My trace 2 [2794.478797][ctx none]=========vaMapBuffer ret = VA_STATUS_SUCCESS, success (no error)

After vaEndPicture, it takes 2s to call vaMapBuffer. Hence the problem now is why chromium takes such 2s long to call vaMapBuffer.

If you have any ideas about how to analyse the unexpected delay between vaEndPicture and vaMapBuffer, please help. I attached new log which has my print debug. libva.134718.log

Thank you, Ben

Jexu commented 1 year ago

What is the codec and frame resolution of your content? Do you see any hang happen in dmesg log? How about other content playing?

Jexu commented 5 months ago

Prefix log [2794.478772] indicates to the timestamp that current function is called instead of time cost. Your log shows a big sw latency in chromium between vaEndPic and vaMapBuf, please report to chromium. I will close this issue since there is no response for long time, and help re-open it again if having any other problem.