Igalia / chromium

Old repo. See https://crbug.com/578890 instead.
https://chromium.googlesource.com/chromium/src.git
BSD 3-Clause "New" or "Revised" License
115 stars 16 forks source link

V4L2 video decoder codepath isn't reached #482

Closed Elyotna closed 6 years ago

Elyotna commented 6 years ago

I am trying to get chromium working with hardware decoding via a v4l2 m2m device.

I use Igalia/meta-browser, branch ozone/wayland/70.0.3509.0.r579363. Target is aarch64.

I added the following GN args:

use_v4l2_codec = true \
use_linux_v4l2_only = true \
proprietary_codecs = true \
ffmpeg_branding = "Chrome"

I also patched the source to allow the flag kDisableAcceleratedVideoDecode on linux, so that I can enable hw acceleration in chrome://flags.

chrome://gpu shows that the GPU has hardware acceleration enabled.

The v4l2 device is there (/dev/video0) and supports V4L2_PIX_FMT_H264.

Problem: The codepath for hw decoding seems to be never reached. Opening a H.264 video goes straight to software decoding. My device /dev/video0 isn't even opened. This means that functions like V4L2VideoDecodeAccelerator::GetSupportedProfiles and GpuVideoDecodeAcceleratorFactory::GetDecoderCapabilities aren't called at all.

Are there any more steps to ensure v4l2 decoding path is used ?

Thanks!

msisov commented 6 years ago

Hi. Try to ln for /dev/video0 to video0-dec

Chromium searches for the following paths - https://cs.chromium.org/chromium/src/media/gpu/v4l2/generic_v4l2_device.cc?type=cs&q=video-dec&g=0&l=510

Elyotna commented 6 years ago

Thank you!

I then followed to hit this error:

[2272:2302:0913/121329.113688:VERBOSE1:v4l2_video_decode_accelerator.cc(2293)] SetupFormats(): Image processor not available
[2272:2302:0913/121329.113841:ERROR:gpu_video_decode_accelerator.cc(369)] HW video decode not available for profile h264 high

But this could be fixed by forcing DRM_FORMAT_NV12 in GenericV4L2Device::CanCreateEGLImageFrom. By default it's only allowed with defined(ARCH_CPU_ARMEL)

Now the next issue is a v4l2 event not supported by my driver so I'll have to fix that.

msisov commented 6 years ago

You're welcome!

Elyotna commented 6 years ago

@msisov Thanks to your work I was able to showcase chromium-wayland-v4l2 recently, so thanks a bunch! :-)

https://www.youtube.com/watch?v=39TrUK0dUO8&feature=youtu.be&t=2h8m22s

msisov commented 6 years ago

awesome! thanks!