[mythtv-users] How to reduce VAAPI GLVidPerf Swap?

Mark Kendall mark.kendall at gmail.com
Thu Feb 25 10:20:26 UTC 2021

On Thu, 25 Feb 2021 at 01:59, Josh Rosenberg <mythtv at desh.info> wrote:
> Hello, all. Sometimes I notice a stutter in my VAAPI video playback. When it happens, I always have a log line with a non-zero value for "Swap", like this:
> mythfrontend.real: mythfrontend[1093]: I CoreContext opengl/mythopenglperf.cpp:84 (LogSamples) GLVidPerf: Upload:0.0000 Clear:0.0000 Render:0.0033 Flush:0.0123 Swap:0.0012 Total fps: 59.8134
> The rest of the time, during smooth playback, Swap is zero.
> What's going on here? Is there anything I can do to reduce swap or otherwise improve performance? Any Xorg directives or MythTV config options? I've found very, very little info on configuring VAAPI anywhere...

To be honest, you shouldn't need to configure anything (I've never
found the need to tweak any VAAPI setup on either Intel or AMD).

It's pretty hard to identify the root cause of issues like this as
there are so many variables in play.

Can you post the full output of 'mythfrontend -v
playback,gpuvideo,gpu' from startup to the end of playback?

I'd try and break it down into different possible areas and see what
you can eliminate (this is very much a disorganised brain dump!):-

1 - System/hardware
 - is the display refresh rate matched to the video source? I have one
monitor that is notionally 60Hz but actually reports 59.8Hz - which
means there is always a frame dropped every few seconds.
 - network/disk read issues - unlikely in this case I would think
 - latest stable drivers installed?
 - no other visual opengl/display/driver issues

2 - Source material
 - stream errors - does it happen at a consistent point in the file?
if so, that would suggest a decoding glitch.
 - codec - is it consistent across mpeg2, h264 etc? different decoders
will stress the hardware in different ways
 - bitrate - unlikely
 - refresh rate - as above
 - audio - do those log lines coincide with any other audio/video
buffering/avsync messages?

3 - MythTV software issue
 - add some extra logging - is there anything else obviously happening
at or around the same time as the stutter? i.e. is there something
potentially running in the main thread that is briefly stalling
playback - or otherwise a background activity that is causing a stall.

4 - System software issue
 - what else is running on the system that might be causing a
decoder/gpu/display stall.

One thing you could test, to ensure you are getting the max
performance from the card, is to run mythfrontend without X or

Switch to a spare terminal (something like CTRL-ALT-F3) and try
'mythfrontend -platform eglfs'. You may need to adjust some
permissions to make sure mouse/keyboards work - ensure you can ssh
into the machine in case you have a problem. You'll probably want to
redirect log output to a file as well.


More information about the mythtv-users mailing list