Hardware acceleration

625 views
Skip to first unread message

disik

unread,
Mar 26, 2018, 2:25:17 AM3/26/18
to Android-x86
Hello developers,
as I can see on my Intel-based tablet, hardware video decoding is still not implemented. I see an effort was made towards ffmpeg, but it's still all-software.
I understand that you have a lot of work to do and that thing above is not a priority. So could you please give me a hint, what libs should I put to what place of the source tree and what configuration options to change. Then I can test it in any way.
The same question is for the UI, which slides are not as smooth as they could be.
Thanks.

Chih-Wei Huang

unread,
Mar 26, 2018, 2:35:43 AM3/26/18
to Android-x86
Hardware video decoding has been implemented
in 7.1-r1 via ffmpeg vaapi module.

What's your CPU and GPU exactly?
--
Chih-Wei
Android-x86 project
http://www.android-x86.org

disik

unread,
Mar 26, 2018, 3:41:37 AM3/26/18
to Android-x86
Apollo lake N3450
: Intel HD graphics 500

Florian E

unread,
Mar 26, 2018, 4:13:56 AM3/26/18
to Android-x86
How do you know it's not hw decoded?
Did you look at your cpu usage with top?
Are you on nougat or orea - as mentioned above only in 7.1 is hw decoding working well

I've a N3350 and hw decoding works just fine.

disik

unread,
Mar 27, 2018, 1:31:42 PM3/27/18
to Android-x86
I test it with Youtube.
Playing 480p video takes 33% CPU of "com.google.android.youtube" and 20% of "media.codec mediacodec".
Playing 720p60 video takes over 55% CPU of "com.google.android.youtube" and over 42% of "media.codec mediacodec".
Playing 1080p video takes over 50% CPU of "com.google.android.youtube" and over 25% of "media.codec mediacodec".
I assume offloading to GPU should look somewhat different?

Florian E

unread,
Mar 28, 2018, 1:55:47 AM3/28/18
to Android-x86
Those values seem absolutely normal.
Try MXPlayer/VLC/ijkplayer and set decoding to SW, you'll see the difference.

disik

unread,
Mar 28, 2018, 3:27:20 PM3/28/18
to Android-x86
Well now I'm confused. Just have made a test with MX Player.
A sample 1080p video with software decoding consumes 78% of CPU by "com.mxtech.videoplayer.ad".
The same sample with hardware decoding consumes 30% of CPU by "mediaserver" and 20% of CPU "media.codec mediacodec".
That tells that different techniques were used indeed.
Now I test a 1080p60 sample. With hardware decoding it consumes 24% of CPU by "mediaserver" and 49% of CPU "media.codec mediacodec", and it heavily skips frames, visually it shows less than 10 FPS.
Then I switch to software decoding and the video runs smoothly, "com.mxtech.videoplayer.ad" taking 190% of CPU (of 400% total).
I expected that hardware decoder should perform better than software one. Maybe something should be fixed?

Antony Stone

unread,
Mar 28, 2018, 3:40:17 PM3/28/18
to andro...@googlegroups.com
On Wednesday 28 March 2018 at 21:27:20, disik wrote:

> Well now I'm confused. Just have made a test with MX Player.
> A sample 1080p video

Which codec?

> with software decoding consumes 78% of CPU by "com.mxtech.videoplayer.ad".
> The same sample with hardware decoding consumes 30% of CPU by "mediaserver"
> and 20% of CPU "media.codec mediacodec".
> That tells that different techniques were used indeed.
> Now I test a 1080p60 sample.

Which codec?

> With hardware decoding it consumes 24% of CPU by "mediaserver" and 49% of
> CPU "media.codec mediacodec", and it heavily skips frames, visually it shows
> less than 10 FPS.
> Then I switch to software decoding and the video runs smoothly,
> "com.mxtech.videoplayer.ad" taking 190% of CPU (of 400% total).
> I expected that hardware decoder should perform better than software one.
> Maybe something should be fixed?

Maybe your hardware decoder doesn't support the codec used in the second
sample.


Antony.

--
If I needed my own advice, I wouldn't give it to others.

Please reply to the list;
please *don't* CC me.

disik

unread,
Mar 29, 2018, 2:45:50 AM3/29/18
to Android-x86
The sample videos were taken here: https://kodi.wiki/view/Sample_files file numbers 3.4 and 3.9.
mkvinfo reports that the same encodings were used on those samples:
|  + Codec ID: V_MPEG4/ISO/AVC
|  + Default duration: 40.000ms (25.000 frames/fields per second for a video track)
|  + Video track
|   + Pixel width: 1920
|   + Pixel height: 1080
|   + Display width: 1920
|   + Display height: 1080
|  + CodecPrivate, length 59 (h.264 profile: High @L4.1)

|  + Codec ID: V_MPEG4/ISO/AVC
|  + Default duration: 16.667ms (60.000 frames/fields per second for a video track)
|  + Video track
|   + Pixel width: 1920
|   + Pixel height: 1080
|   + Display width: 1920
|   + Display height: 1080
|  + CodecPrivate, length 48 (h.264 profile: High @L4.2)

More to say, this page https://en.wikipedia.org/wiki/Intel_HD_and_Iris_Graphics which gets info from https://www.intel.com/content/dam/www/public/us/en/documents/datasheets/pentium-celeron-n-series-j-series-datasheet-vol-1.pdf says N3450 is capable of hardware decoding of H.264 CBP, MP, HP L5.2 up to 1080p240, 4kx2kp60.

Kitsune

unread,
Apr 1, 2018, 3:02:37 PM4/1/18
to Android-x86
Yes. On Bay trail also hw decoding not work, i'm wrote about it. It need fix

Kitsune

unread,
Apr 1, 2018, 3:06:18 PM4/1/18
to Android-x86
Seems this problem is on all atom devices, on android x86

воскресенье, 1 апреля 2018 г., 22:02:37 UTC+3 пользователь Kitsune написал:

Chih-Wei Huang

unread,
Apr 1, 2018, 10:11:51 PM4/1/18
to Android-x86
2018-04-02 3:06 GMT+08:00 Kitsune <kitsu...@gmail.com>:
> Seems this problem is on all atom devices, on android x86

Hardware decoding works on all Baytrail and Cherrytrail
devices I have. Actually Baytrail (T100) is one of the first
device I developed and tested it.

How did you confirm it doesn't work?
In doubt, check if you have

05-09 11:00:40.626 1540 4537 I HWACCEL : hw codec h264 enabled:
s=0xf64a2c00 ist=0xf64a5f00 pix_fmts=53


> воскресенье, 1 апреля 2018 г., 22:02:37 UTC+3 пользователь Kitsune написал:
>>
>> Yes. On Bay trail also hw decoding not work, i'm wrote about it. It need
>> fix



Kitsune

unread,
Apr 2, 2018, 3:17:33 AM4/2/18
to Android-x86
I'm early wrote about it, but again write. On my tablet is atom Z3745.



How did you confirm it doesn't work?

1. If in MX Player i'm play video 1080x1920 (h264, mp4), high CPU load, frequency 1.87 GHz on all cores and 50-60% load. HW, HW+ decoder - no differences. In YouTube app, and other videoplayers - the same. With use SW decoder CPU load above, 80-85%. It seems right? But, high CPU load HW decoder, and see below.

2. If play 1080x1920 60 FPS (and other 1440x2560, 2160x3840) i'm not see 60 FPS, maximum 40, i'm see frame loss. CPU load 100% all time (HW+, SW). In Windows 10 i'm can play 2160x3840 60 FPS and cpu load ~10%.

3.


05-09 11:00:40.626  1540  4537 I HWACCEL : hw codec h264 enabled:
s=0xf64a2c00 ist=0xf64a5f00 pix_fmts=53
Hmm, this is in logcat, but why SoftFFmpegVideo write? And why high CPU load 50%? Why i'm can't play 60fps video, and more than 1080p quality? If using HW decoding in Windows CPU load is very small ~5-10%

4. In logcat, spam SoftFFmpegVideo for every frame, it mean Software Decoder using?
D SoftFFmpegVideo: drainOneOutputBuffer: frame_width=1920 frame_height=1080 buffer_width=1920 buffer_height=1080 ctx_width=1920 ctx_height=1080 mIsAdaptive=0
D SoftFFmpegVideo: drainOneOutputBuffer: frame_width=1920 frame_height=1080 buffer_width=1920 buffer_height=1080 ctx_width=1920 ctx_height=1080 mIsAdaptive=0
D SoftFFmpegVideo: drainOneOutputBuffer: frame_width=1920 frame_height=1080 buffer_width=1920 buffer_height=1080 ctx_width=1920 ctx_height=1080 mIsAdaptive=0



понедельник, 2 апреля 2018 г., 5:11:51 UTC+3 пользователь Chih-Wei Huang написал:

Kitsune

unread,
Apr 2, 2018, 3:21:56 AM4/2/18
to Android-x86
P.S.
5. I'm try on amd gpu in notebook, there HW work, and logcat not be this messages:

Chih-Wei Huang

unread,
Apr 2, 2018, 3:45:06 AM4/2/18
to Android-x86
2018-04-02 15:17 GMT+08:00 Kitsune <kitsu...@gmail.com>:
> I'm early wrote about it, but again write. On my tablet is atom Z3745.
>
>> How did you confirm it doesn't work?
>
>
> 1. If in MX Player i'm play video 1080x1920 (h264, mp4), high CPU load,
> frequency 1.87 GHz on all cores and 50-60% load. HW, HW+ decoder - no
> differences. In YouTube app, and other videoplayers - the same. With use SW
> decoder CPU load above, 80-85%. It seems right? But, high CPU load HW
> decoder, and see below.
>
> 2. If play 1080x1920 60 FPS (and other 1440x2560, 2160x3840) i'm not see 60
> FPS, maximum 40, i'm see frame loss. CPU load 100% all time (HW+, SW). In
> Windows 10 i'm can play 2160x3840 60 FPS and cpu load ~10%.

You can turn off HW decoding to see the difference.
Bartrail even can't play 1080p 30FPS with SW codec.

The CPU load is still high because the limitation
of our graphic stack.
See the discussion in android-x86-devel.

> 3.
>
>> 05-09 11:00:40.626 1540 4537 I HWACCEL : hw codec h264 enabled:
>> s=0xf64a2c00 ist=0xf64a5f00 pix_fmts=53

That means HW codec is using.

> Hmm, this is in logcat, but why SoftFFmpegVideo write? And why high CPU load
> 50%? Why i'm can't play 60fps video, and more than 1080p quality? If using
> HW decoding in Windows CPU load is very small ~5-10%
>
> 4. In logcat, spam SoftFFmpegVideo for every frame, it mean Software Decoder
> using?

No. It just means ffmpeg plugin (with vaapi) is using.

> D SoftFFmpegVideo: drainOneOutputBuffer: frame_width=1920 frame_height=1080
> buffer_width=1920 buffer_height=1080 ctx_width=1920 ctx_height=1080
> mIsAdaptive=0
> D SoftFFmpegVideo: drainOneOutputBuffer: frame_width=1920 frame_height=1080
> buffer_width=1920 buffer_height=1080 ctx_width=1920 ctx_height=1080
> mIsAdaptive=0
>
> D SoftFFmpegVideo: drainOneOutputBuffer: frame_width=1920 frame_height=1080
> buffer_width=1920 buffer_height=1080 ctx_width=1920 ctx_height=1080
> mIsAdaptive=0
>
> P.S.
> 5. I'm try on amd gpu in notebook, there HW work, and logcat not be this
> messages:

Only Intel CPU/GPU supports HW accelerated decoding
at this moment.

Kitsune

unread,
Apr 2, 2018, 4:00:25 AM4/2/18
to Android-x86

You can turn off HW decoding to see the difference.
Bartrail even can't play 1080p 30FPS with SW codec.

No problem with 1080p 30fps and SW. I'm wrote if use SW decoder CPU load above, 80-85%. Problem with 1080p 60fps and above on SW and HW decoder, it really fix?

Kitsune

unread,
Apr 2, 2018, 4:02:32 AM4/2/18
to Android-x86
Now i'm try Youtube app 1080p 60fps. CPU load ~50% and frame loss

disik

unread,
Apr 6, 2018, 3:52:33 PM4/6/18
to Android-x86
My tests show that HW decoder has only 15%-20% CPU usage improvement over SW decoding on Apollo Lake.
I can understand that developers may have no time for this issue, then I can try something myself, just show me where to dig? Maybe i915 module should be updated?  ffmpeg or libva or anything should somehow be fine-tuned? Where and how and what should I change and test?

Chih-Wei Huang

unread,
Apr 6, 2018, 9:31:01 PM4/6/18
to Android-x86
I have said that's due to the limitation of our graphic stack. To solve that, you need to implement a real hwcomposer.
Search related discussion in mesa-dev and android-x86-devel lists.


--
You received this message because you are subscribed to the Google Groups "Android-x86" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-x86...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-x86.
For more options, visit https://groups.google.com/d/optout.

Kitsune

unread,
Apr 14, 2018, 3:02:17 PM4/14/18
to Android-x86
It interesting. In sources i'm see hwcomposer https://osdn.net/projects/android-x86/scm/git/external-drm_hwcomposer/tree/nougat-x86/ What problem? Is link for discussion about it?

суббота, 7 апреля 2018 г., 4:31:01 UTC+3 пользователь Chih-Wei Huang написал:

Chih-Wei Huang

unread,
Apr 15, 2018, 1:49:02 AM4/15/18
to Android-x86
2018-04-15 3:02 GMT+08:00 Kitsune <kitsu...@gmail.com>:
> It interesting. In sources i'm see hwcomposer https://osdn.net/projects/android-x86/scm/git/external-drm_hwcomposer/tree/nougat-x86/ What problem? Is link for discussion about it?

Old discussion:
https://lists.freedesktop.org/archives/dri-devel/2017-September/153580.html

There is no much progress since then.

Mauro Rossi

unread,
Apr 15, 2018, 10:23:59 AM4/15/18
to Android-x86
Some additional info on testing progress for drm_hwcomposer (HWC1) + gbm_gralloc  
Logs for oreo-x86 are here: (for nougat-x86 they are quite similar, anyway):



i965 status:

Bootanimation starts and sometime completes but when top/bottom bars appear SurfaceFlinger dies. 


nouveau status:

With appropriate grub kernel parameter or forcing atomic in the kernel
and a necessary patch in drm_hwcomposer to check active  drm connector it is possible to boot nougat-x86 and oreo-x86,
but drm_hwcomposer is just not ready "to hwcompose", cursor has artifacts, the GUI is unstable and bootanimation restarts often and sevaral times GPU freezes

 
amdgpu status:

AMD DC required to support atomic (kernel 4.15 or later required)
Bonaire (GCN 2nd gen) or later required
For some unknown reason mode setting is not working, instead of graphic mode I get a cursor at top left of screen.
The funny thing is that boot is completed and launcher can be selected, but there is a wrong mode shown on the display and so it's not usable.

Mauro





 

Mauro Rossi

unread,
Sep 12, 2018, 4:36:18 PM9/12/18
to Android-x86
Hi Kitsune,
if you are still interested in seeing if hw decoding of h264 works better with drm_hwcomposer,
there are experimental hwc1 iso linked in the RGBA ISOs beta test thread and hwc1 is enabled also for Intel ( working with intel drivers supporting RGBA pixel format in drm primary planes. Skylake supports that.
Mauro

Faheem Ahmad

unread,
Sep 13, 2018, 2:03:10 AM9/13/18
to andro...@googlegroups.com
unsub

Antony Stone

unread,
Sep 13, 2018, 2:43:18 AM9/13/18
to andro...@googlegroups.com
On Thursday 13 September 2018 at 08:02:50, Faheem Ahmad wrote:

> unsub

Doesn't work like that.

See the footers of any email on the list (quoted below, for example).

Antony.
--
I wasn't sure about having a beard at first, but then it grew on me.
Reply all
Reply to author
Forward
0 new messages