"Hardware acceleration" for videos ?

AmigaOne X5000 platform specific issues related to Linux only.
Post Reply
Roland
Posts: 825
Joined: Tue May 02, 2017 7:23 am

"Hardware acceleration" for videos ?

Post by Roland »

When I saw the famous picture of a Sam460 with AmigaOS4.1running two 4K videos simultaneously, with only 8% CPU usage, I was shocked...

If I run in X5000/20 (Ubuntu 16.04) with VLC a 720p (1280x720, 25 fps) MP4 video, the CPU usage is c. 80% per core! So is there something wrong in my system, or is the "hardware acceleration" in PPC Linux some sort of joke?!

I have a HD 5450 card, which should be to be supported by Linux. And in VLC (2.2.2) I have chosen the options which Christian has recommended here many times:

- GLX video output (XCB).
- VA-API video decoder via DRM
- Accelerated video outout

In VLC 3.0.4 (Fienix) that last option is not at all present at the Tools/Preferences/Video/Display!
- Roland -
User avatar
xeno74
Posts: 9379
Joined: Fri Mar 23, 2012 7:58 am

Re: "Hardware acceleration" for videos ?

Post by xeno74 »

Playing a 1080p h264 mov file on a X5000/40 with a Radeon HD6970 (Cayman XT):

Image
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
Roland
Posts: 825
Joined: Tue May 02, 2017 7:23 am

Re: "Hardware acceleration" for videos ?

Post by Roland »

xeno74 wrote: Tue Mar 31, 2020 12:46 pm Playing a 1080p h264 mov file on a X5000/40 with a Radeon HD6970 (Cayman XT):
Also your CPU usage is very high, taking into account you have 4 cores... With 2 cores it would be difficult to run that video decently.

When I tested with Ubuntu to turn off the 'Accelerated video output' in VLC 2.2.2, I still got the same CPU usage, around 80% / core !? Just like the acceleration would not have any effect... How do you explain these results?

I cannot currently test the CPU usage in Fienix as there is the problem with Mate components, until Casey gets the deposits arranged again. Is there some other tool for measuring CPU usage?
- Roland -
User avatar
xeno74
Posts: 9379
Joined: Fri Mar 23, 2012 7:58 am

Re: "Hardware acceleration" for videos ?

Post by xeno74 »

I think the CPU decodes the video instead of the Radeon HD UVD.
AMD's hardware UVD is used by Mesa's VDPAU. It contains VDPAU bindings for r300, r600 and radeonsi, for VA API there is a VDPAU backend.
Link to an interesting thread: *** click ***
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
caseycullen
Posts: 521
Joined: Sat Dec 17, 2016 7:12 am
Location: Madison, WI USA
Contact:

Re: "Hardware acceleration" for videos ?

Post by caseycullen »

Roland wrote: Tue Mar 31, 2020 7:55 am
I have a HD 5450 card, which should be to be supported by Linux. And in VLC (2.2.2) I have chosen the options which Christian has recommended here many times:

- GLX video output (XCB).
- VA-API video decoder via DRM
- Accelerated video outout

In VLC 3.0.4 (Fienix) that last option is not at all present at the Tools/Preferences/Video/Display!
Accelerated video output is an option on old versions of VLC because hardware acceleration was still experimental until version 3.0. Current versions of VLC don't have that option because its always on by default.
Roland wrote: Tue Mar 31, 2020 4:03 pm Also your CPU usage is very high, taking into account you have 4 cores... With 2 cores it would be difficult to run that video decently.

When I tested with Ubuntu to turn off the 'Accelerated video output' in VLC 2.2.2, I still got the same CPU usage, around 80% / core !? Just like the acceleration would not have any effect... How do you explain these results?
Did you check if the videos that you're playing are a format supported by your hardware? Hardware video acceleration ASICs don't decode every video format out there past, present and future; they support specific formats, profiles, and level. The HD5000 series was developed in 2009-2010 so they're going to support the formats/profiles/levels that were around at the time.

Install and run "vdpauinfo" to see what formats/profiles/levels your hardware video decoding supports. The level refers to the maximum decoding speed per format/profile. For example, if you're playing a 720p video at 25 fps, then you need at least level 31 decoding of whatever format/profile the video is for hardware acceleration to work. See Levels for more information (the chart I linked to shows the level in decimal form whereas vdpauinfo doesn't - but 1.1 is the same as 11, 2.1 is the same as 21, etc.).

You also need to make sure you don't have any post-processing enabled because then your CPU would be re-processing the video even if it was already decoded by your GPU.

I'm sure the Sam460 had a newer card with a newer version of UVD - 4K wasn't supported until UVD 5. But where is this picture? The Sam460 has a 4 lane PCIe interface for its graphics card (compared to 16 lanes for the X5000) - I don't even know if that's enough bandwidth for one 4K video let alone 2.
-Casey
User avatar
caseycullen
Posts: 521
Joined: Sat Dec 17, 2016 7:12 am
Location: Madison, WI USA
Contact:

Re: "Hardware acceleration" for videos ?

Post by caseycullen »

Here are my vdpauinfo results:
Image

Looking at my vdpauinfo, I can see that if I'm playing a MPEG2 main profile video, and I want hardware video decoding, I can play up to level 3, which is a maximum resolution of 720×576 at 25.0 fps (per the link I provided).

If I'm playing an H264 main profile video, and I want hardware video decoding, I can play up to level 41, so 1,920×1,080 at 30.1 fps.

Notice that even for my HD6870, HEVC video (aka H.265, aka x265, aka MPEG-H) is not supported by my hardware video decoding.

In my experience it appears hardware video decoding works fine, but unless we get support for newer GPUs at some point we're very restricted by which formats are available.

I hope this helps.
-Casey
User avatar
xeno74
Posts: 9379
Joined: Fri Mar 23, 2012 7:58 am

Re: "Hardware acceleration" for videos ?

Post by xeno74 »

Hi Casey,

Thanks a lot for your explanation.

Some vdpauinfo results for the Radeon HD6970 (Cayman XT):

Code: Select all

display: :0   screen: 0
API version: 1
Information string: G3DVL VDPAU Driver Shared Library version 1.0

Video surface:

name   width height types
-------------------------------------------
420    16384 16384  NV12 YV12 
422    16384 16384  UYVY YUYV 
444    16384 16384  Y8U8V8A8 V8U8Y8A8 

Decoder capabilities:

name                        level macbs width height
----------------------------------------------------
MPEG1                          --- not supported ---
MPEG2_SIMPLE                    3  9216  2048  1152
MPEG2_MAIN                      3  9216  2048  1152
H264_BASELINE                  41  9216  2048  1152
H264_MAIN                      41  9216  2048  1152
H264_HIGH                      41  9216  2048  1152
VC1_SIMPLE                      1  9216  2048  1152
VC1_MAIN                        2  9216  2048  1152
VC1_ADVANCED                    4  9216  2048  1152
MPEG4_PART2_SP                  3  9216  2048  1152
MPEG4_PART2_ASP                 5  9216  2048  1152
DIVX4_QMOBILE                  --- not supported ---
DIVX4_MOBILE                   --- not supported ---
DIVX4_HOME_THEATER             --- not supported ---
DIVX4_HD_1080P                 --- not supported ---
DIVX5_QMOBILE                  --- not supported ---
DIVX5_MOBILE                   --- not supported ---
DIVX5_HOME_THEATER             --- not supported ---
DIVX5_HD_1080P                 --- not supported ---
H264_CONSTRAINED_BASELINE       0  9216  2048  1152
H264_EXTENDED                  --- not supported ---
H264_PROGRESSIVE_HIGH          --- not supported ---
H264_CONSTRAINED_HIGH          --- not supported ---
H264_HIGH_444_PREDICTIVE       --- not supported ---
HEVC_MAIN                      --- not supported ---
HEVC_MAIN_10                   --- not supported ---
HEVC_MAIN_STILL                --- not supported ---
HEVC_MAIN_12                   --- not supported ---
HEVC_MAIN_444                  --- not supported ---

Output surface:

name              width height nat types
----------------------------------------------------
B8G8R8A8         16384 16384    y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 A4I4 I4A4 A8I8 I8A8 
R8G8B8A8         16384 16384    y  NV12 YV12 UYVY YUYV Y8U8V8A8 V8U8Y8A8 A4I4 I4A4 A8I8 I8A8 

Bitmap surface:

name              width height
------------------------------
B8G8R8A8         16384 16384
R8G8B8A8         16384 16384
A8               16384 16384

Video mixer:

feature name                    sup
------------------------------------
DEINTERLACE_TEMPORAL             y
DEINTERLACE_TEMPORAL_SPATIAL     -
INVERSE_TELECINE                 -
NOISE_REDUCTION                  y
SHARPNESS                        y
LUMA_KEY                         y
HIGH QUALITY SCALING - L1        y
HIGH QUALITY SCALING - L2        -
HIGH QUALITY SCALING - L3        -
HIGH QUALITY SCALING - L4        -
HIGH QUALITY SCALING - L5        -
HIGH QUALITY SCALING - L6        -
HIGH QUALITY SCALING - L7        -
HIGH QUALITY SCALING - L8        -
HIGH QUALITY SCALING - L9        -

parameter name                  sup      min      max
-----------------------------------------------------
VIDEO_SURFACE_WIDTH              y        48     2048
VIDEO_SURFACE_HEIGHT             y        48     1152
CHROMA_TYPE                      y  
LAYERS                           y         0        4

attribute name                  sup      min      max
-----------------------------------------------------
BACKGROUND_COLOR                 y  
CSC_MATRIX                       y  
NOISE_REDUCTION_LEVEL            y      0.00     1.00
SHARPNESS_LEVEL                  y     -1.00     1.00
LUMA_KEY_MIN_LUMA                y  
LUMA_KEY_MAX_LUMA                y  
Cheers,
Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
Roland
Posts: 825
Joined: Tue May 02, 2017 7:23 am

Re: "Hardware acceleration" for videos ?

Post by Roland »

caseycullen wrote: Fri Apr 03, 2020 12:25 am
Did you check if the videos that you're playing are a format supported by your hardware? Hardware video acceleration ASICs don't decode every video format out there past, present and future; they support specific formats, profiles, and level. The HD5000 series was developed in 2009-2010 so they're going to support the formats/profiles/levels that were around at the time.

Install and run "vdpauinfo" to see what formats/profiles/levels your hardware video decoding supports. The level refers to the maximum decoding speed per format/profile. For example, if you're playing a 720p video at 25 fps, then you need at least level 31 decoding of whatever format/profile the video is for hardware acceleration to work. See Levels for more information (the chart I linked to shows the level in decimal form whereas vdpauinfo doesn't - but 1.1 is the same as 11, 2.1 is the same as 21, etc.).

You also need to make sure you don't have any post-processing enabled because then your CPU would be re-processing the video even if it was already decoded by your GPU.
Thank you for the information! That was totally new for me... Unfortunately I cannot yet test my card with vpauinfo as I'm now away from my X5000 for several weeks :-(. The 720p video I used to get that 80% cpu usage was a MP4 one, see the attachment to see what VLC tells about it.
I'm sure the Sam460 had a newer card with a newer version of UVD - 4K wasn't supported until UVD 5. But where is this picture? The Sam460 has a 4 lane PCIe interface for its graphics card (compared to 16 lanes for the X5000) - I don't even know if that's enough bandwidth for one 4K video let alone 2.
Here is link to the picture:
https://dl.dropboxusercontent.com/s/7e5 ... m460ex.jpg
Attachments
Screenshot at 2020-04-03 16-26-53.png
- Roland -
Post Reply