Closed Bug 1783987 Opened 2 years ago Closed 2 years ago

Firefox cannot detect pinebook pro vaapi

Categories

(Core :: Audio/Video: Playback, enhancement)

Firefox 105
ARM64
Linux
enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1783005

People

(Reporter: monkeyboyted, Unassigned)

References

(Blocks 2 open bugs)

Details

Attachments

(3 files)

Attached file about_support_22_08_09

User Agent: Mozilla/5.0 (X11; Linux aarch64; rv:103.0) Gecko/20100101 Firefox/103.0

Steps to reproduce:

Open firefox
Open about:support

Error Failure log
#1 glxtest: VA-API test failed: failed to initialise VAAPI connection.

Actual results:

MOZ_LOG="Dmabuf:5" ./firefox-bin
[GFX1-]: glxtest: DRM render node not clearly detectable. Falling back to using the only one that was found.
[GFX1-]: glxtest: VA-API test failed: failed to initialise VAAPI connection.
[Parent 2126: Main Thread]: D/Dmabuf wl_drm is available.

[Parent 2126: Main Thread]: D/Dmabuf zwp_linux_dmabuf_v1 is available.
[Parent 2126: Main Thread]: D/Dmabuf Using DRM device /dev/dri/renderD128
[Parent 2126: Main Thread]: D/Dmabuf nsDMABufDevice::Configure()
[Parent 2126: Main Thread]: D/Dmabuf Loading DMABuf system library libgbm.so.1 ...
[Parent 2126: Main Thread]: D/Dmabuf DMABuf is enabled
[GFX1-]: Failed to create EGLContext!: 0x3009

Expected results:

v4l2-ctl --list-ctrls --device /dev/video1

Codec Controls

                 h264_level 0x00990a67 (menu)   : min=0 max=15 default=0 value=0 (1)
               h264_profile 0x00990a6b (menu)   : min=0 max=4 default=2 value=2 (Main)
                vp9_profile 0x00990b00 (menu)   : min=0 max=0 default=0 value=0 (0)

Stateless Codec Controls

           h264_decode_mode 0x00a40900 (menu)   : min=1 max=1 default=1 value=1 (Frame-Based)
            h264_start_code 0x00a40901 (menu)   : min=1 max=1 default=1 value=1 (Annex B Start Code)
h264_sequence_parameter_set 0x00a40902 (h264-sps): value=unsupported payload type flags=has-payload
 h264_picture_parameter_set 0x00a40903 (h264-pps): value=unsupported payload type flags=has-payload
        h264_scaling_matrix 0x00a40904 (h264-scaling-matrix): value=unsupported payload type flags=has-payload
     h264_decode_parameters 0x00a40907 (h264-decode-params): value=unsupported payload type flags=has-payload
vp9_frame_decode_parameters 0x00a40a2c (unknown): type=261 value=unsupported payload type flags=has-payload
  vp9_probabilities_updates 0x00a40a2d (unknown): type=260 value=unsupported payload type flags=has-payload

[doop@hostname firefox]$ export LIBVA_DRIVER_NAME=v4l2_request
[doop@hostname firefox]$ export LIBVA_V4L2_REQUEST_VIDEO_PATH=/dev/video1
[doop@hostname firefox]$ MOZ_LOG="Dmabuf:5" ./firefox-bin

[GFX1-]: glxtest: DRM render node not clearly detectable. Falling back to using the only one that was found.
[Parent 3466: Main Thread]: D/Dmabuf wl_drm is available.
[Parent 3466: Main Thread]: D/Dmabuf zwp_linux_dmabuf_v1 is available.
[Parent 3466: Main Thread]: D/Dmabuf Using DRM device /dev/dri/renderD128
[Parent 3466: Main Thread]: D/Dmabuf nsDMABufDevice::Configure()
[Parent 3466: Main Thread]: D/Dmabuf Loading DMABuf system library libgbm.so.1 ...
[Parent 3466: Main Thread]: D/Dmabuf DMABuf is enabled
[GFX1-]: Failed to create EGLContext!: 0x3009

ls /dev/video*
/dev/video0 /dev/video1 /dev/video2 /dev/video3 /dev/video4 /dev/video5

v4l2-ctl --list-ctrls --device /dev/video0

User Controls

            horizontal_flip 0x00980914 (bool)   : default=0 value=0
              vertical_flip 0x00980915 (bool)   : default=0 value=0
                     rotate 0x00980922 (int)    : min=0 max=270 step=90 default=0 value=0 flags=modify-layout
           background_color 0x00980923 (int)    : min=0 max=16777215 step=1 default=0 value=0

[doop@hostname firefox]$ v4l2-ctl --list-ctrls --device /dev/video1

Codec Controls

                 h264_level 0x00990a67 (menu)   : min=0 max=15 default=0 value=0 (1)
               h264_profile 0x00990a6b (menu)   : min=0 max=4 default=2 value=2 (Main)
                vp9_profile 0x00990b00 (menu)   : min=0 max=0 default=0 value=0 (0)

Stateless Codec Controls

           h264_decode_mode 0x00a40900 (menu)   : min=1 max=1 default=1 value=1 (Frame-Based)
            h264_start_code 0x00a40901 (menu)   : min=1 max=1 default=1 value=1 (Annex B Start Code)
h264_sequence_parameter_set 0x00a40902 (h264-sps): value=unsupported payload type flags=has-payload
 h264_picture_parameter_set 0x00a40903 (h264-pps): value=unsupported payload type flags=has-payload
        h264_scaling_matrix 0x00a40904 (h264-scaling-matrix): value=unsupported payload type flags=has-payload
     h264_decode_parameters 0x00a40907 (h264-decode-params): value=unsupported payload type flags=has-payload
vp9_frame_decode_parameters 0x00a40a2c (unknown): type=261 value=unsupported payload type flags=has-payload
  vp9_probabilities_updates 0x00a40a2d (unknown): type=260 value=unsupported payload type flags=has-payload

[doop@hostname firefox]$ v4l2-ctl --list-ctrls --device /dev/video2

JPEG Compression Controls

        compression_quality 0x009d0903 (int)    : min=5 max=100 step=1 default=50 value=50
             active_markers 0x009d0904 (bitmask): max=0x00070001 default=0x00070001 value=458753

[doop@hostname firefox]$ v4l2-ctl --list-ctrls --device /dev/video3
vp8_frame_parameters 0x00a409c8 (vp8-frame): value=unsupported payload type flags=has-payload
mpeg_2_sequence_header 0x00a409dc (mpeg2-sequence): value=unsupported payload type flags=has-payload
mpeg_2_picture_header 0x00a409dd (mpeg2-picture): value=unsupported payload type flags=has-payload
mpeg_2_quantisation_matrices 0x00a409de (mpeg2-quantisation): value=unsupported payload type flags=has-payload
[doop@hostname firefox]$ v4l2-ctl --list-ctrls --device /dev/video4

User Controls

                 brightness 0x00980900 (int)    : min=-64 max=64 step=1 default=0 value=0
                   contrast 0x00980901 (int)    : min=0 max=64 step=1 default=32 value=32
                 saturation 0x00980902 (int)    : min=0 max=128 step=1 default=64 value=64
                        hue 0x00980903 (int)    : min=-40 max=40 step=1 default=0 value=0
    white_balance_automatic 0x0098090c (bool)   : default=1 value=1
                      gamma 0x00980910 (int)    : min=72 max=500 step=1 default=100 value=100
                       gain 0x00980913 (int)    : min=0 max=100 step=1 default=0 value=0
       power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=1 value=1 (50 Hz)
  white_balance_temperature 0x0098091a (int)    : min=2800 max=6500 step=1 default=4600 value=4600 flags=inactive
                  sharpness 0x0098091b (int)    : min=0 max=240 step=1 default=68 value=68
     backlight_compensation 0x0098091c (int)    : min=0 max=2 step=1 default=1 value=1

Camera Controls

              auto_exposure 0x009a0901 (menu)   : min=0 max=3 default=3 value=3 (Aperture Priority Mode)
     exposure_time_absolute 0x009a0902 (int)    : min=1 max=5000 step=1 default=156 value=156 flags=inactive
 exposure_dynamic_framerate 0x009a0903 (bool)   : default=0 value=1

[doop@hostname firefox]$ v4l2-ctl --list-ctrls --device /dev/video5

https://forum.pine64.org/showthread.php?tid=9171

LIBVA_V4L2_REQUEST_VIDEO_PATH=/dev/video1
LIBVA_DRIVER_NAME=v4l2_request

I open a VP9 youtube video

[2022-08-10T02:14:18Z ERROR mp4parse] Found 2 nul bytes in "\0\0"
[2022-08-10T02:14:18Z ERROR mp4parse] Found 2 nul bytes in "\0\0"
[2022-08-10T02:14:18Z ERROR mp4parse] Found 2 nul bytes in "\0\0"
[2022-08-10T02:14:18Z ERROR mp4parse] Found 2 nul bytes in "\0\0"
[RDD 5316: MediaPDecoder #1]: D/Dmabuf Using DRM device /dev/dri/renderD128
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
[Child 5091: Main Thread]: D/Dmabuf Using DRM device /dev/dri/renderD128
[Child 5091: Main Thread]: D/Dmabuf Failed to open drm render node /dev/dri/renderD128 error Permission denied

$ LIBVA_DRIVER_NAME=v4l2_request LIBVA_V4L2_REQUEST_VIDEO_PATH=/dev/video2

These variables do not show in firefox about support.

[ 6.632274] hantro-vpu ff650000.video-codec: registered rockchip,rk3399-vpu-dec as /dev/video3

export LIBVA_V4L2_REQUEST_VIDEO_PATH=/dev/video3
[doop@hostname firefox]$ MOZ_LOG="Dmabuf:5" ./firefox-bin
[GFX1-]: glxtest: DRM render node not clearly detectable. Falling back to using the only one that was found.
[Parent 6285: Main Thread]: D/Dmabuf wl_drm is available.
[Parent 6285: Main Thread]: D/Dmabuf zwp_linux_dmabuf_v1 is available.
[Parent 6285: Main Thread]: D/Dmabuf Using DRM device /dev/dri/renderD128
[Parent 6285: Main Thread]: D/Dmabuf nsDMABufDevice::Configure()
[Parent 6285: Main Thread]: D/Dmabuf Loading DMABuf system library libgbm.so.1 ...
[Parent 6285: Main Thread]: D/Dmabuf DMABuf is enabled
[GFX1-]: Failed to create EGLContext!: 0x3009
[2022-08-10T02:26:28Z ERROR mp4parse] Found 2 nul bytes in "\0\0"
[2022-08-10T02:26:28Z ERROR mp4parse] Found 2 nul bytes in "\0\0"
[2022-08-10T02:26:28Z ERROR mp4parse] Found 2 nul bytes in "\0\0"
[2022-08-10T02:26:28Z ERROR mp4parse] Found 2 nul bytes in "\0\0"
[RDD 6648: MediaPDecoder #1]: D/Dmabuf Using DRM device /dev/dri/renderD128
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed
libva error: /usr/lib/dri/v4l2_request_drv_video.so init failed

I attempted to use /dev/video3. It doesn't seem to work either

https://video.blender.org/w/hNNYsHW3hYWbTLDgXuhP8t
Codecs avc1.64001f / mp4a.40.2

Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core

Thanks for writing this all down. Unfortunately libva-v4l2-request seems to be dead - and for good reasons. VAAPI apparently doesn't map work over V4L2.

So we either start supporting V4L2 directly - or try to push driver makers to implement Vulkan decoding extensions in Mesa. I personally see the later option as the best investment of rare developer time, especially as that way we have Nvidia on board and will have a single API eventually.

Depends on: egl-linux-v4l

try to push driver makers to implement Vulkan decoding extensions in Mesa. I personally see the later option as the best investment of rare developer time

Does the Vulkan decoding extension system map to both stateful and stateless v4l2 devices? For example, why does the mismatch between libva and v4l2 that killed libva-v4l2 not apply to Vulkan? Do devices with v4l2 and mesa drivers have typically good Vulkan support? While freedreno mesa driver is well supported, I see open issues for bringing up Vulkan on certain hardware generations stating that the existing vulkan support only targets a "single generation with a small deviations of sub-generations" https://gitlab.freedesktop.org/mesa/mesa/-/issues/6954.

So I'm unsure if taking an extra dependency on Vulkan would actually help. ffmpeg and gstreamer seem to have v4l2 integration, might those be easier to target?

I suggest to discuss this idea in detail with robclark who maintains the freedreno mesa drivers and is active on #aarch64-laptops IRC.

especially as that way we have Nvidia on board and will have a single API eventually.

Could you provide more details/a reference on Nvidia's commitment you are referring to?

$ ffmpeg -decoders | grep -i v4
ffmpeg version n5.0.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12.1.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-shared --enable-version3 --host-cflags='"-fPIC"'
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100
V..... h263_v4l2m2m V4L2 mem2mem H.263 decoder wrapper (codec h263)
V..... h264_v4l2m2m V4L2 mem2mem H.264 decoder wrapper (codec h264)
V..... hevc_v4l2m2m V4L2 mem2mem HEVC decoder wrapper (codec hevc)
V..... mpeg1_v4l2m2m V4L2 mem2mem MPEG1 decoder wrapper (codec mpeg1video)
V..... mpeg2_v4l2m2m V4L2 mem2mem MPEG2 decoder wrapper (codec mpeg2video)
V..... mpeg4_v4l2m2m V4L2 mem2mem MPEG4 decoder wrapper (codec mpeg4)
VF...D rv40 RealVideo 4.0
V....D v408 Uncompressed packed QT 4:4:4:4
VFS..D v410 Uncompressed 4:4:4 10-bit
V..... vc1_v4l2m2m V4L2 mem2mem VC1 decoder wrapper (codec vc1)
V..... vp8_v4l2m2m V4L2 mem2mem VP8 decoder wrapper (codec vp8)
V..... vp9_v4l2m2m V4L2 mem2mem VP9 decoder wrapper (codec vp9)
V....D yuv4 Uncompressed packed 4:2:0

I am not sure if this comment is useful. Decode on linux is a bit messy.

MOZ_LOG="PlatformDecoderModule:5" ./firefox-bin
[GFX1-]: glxtest: DRM render node not clearly detectable. Falling back to using the only one that was found.
[GFX1-]: glxtest: VA-API test failed: failed to initialise VAAPI connection.
[GFX1-]: Failed to create EGLContext!: 0x3009

105.0a1

OS: Unspecified → Linux
Hardware: Unspecified → ARM64
Version: Firefox 103 → Firefox 105

(In reply to Leonard Lausen from comment #7)

Does the Vulkan decoding extension system map to both stateful and stateless v4l2 devices?

I recently talked to some Gstreamer devs who basically said: should be feasible - there's just little market demand right now.

For example, why does the mismatch between libva and v4l2 that killed libva-v4l2 not apply to Vulkan?

VAAPI was designed for Intel hardware - I'd assume that the Vulkan extensions are designed more cross-vendor friendly, if they are to become official.

Do devices with v4l2 and mesa drivers have typically good Vulkan support? While freedreno mesa driver is well supported, I see open issues for bringing up Vulkan on certain hardware generations stating that the existing vulkan support only targets a "single generation with a small deviations of sub-generations" https://gitlab.freedesktop.org/mesa/mesa/-/issues/6954.

No, surely not yet. However I don't see this feature (V4L2 stateful/stateless support) materializing anytime soon if not somebody from the community steps up to implement and maintain it. So IMO we should look for long-term solutions directly. My main argument would be that FF on Linux has a bad history of half-baked implementations which turned out to never get enabled by default because 80-20 etc. That is also my experience from pushing the GLX->EGL switch, which involved quite some upstream coordination - but IMO payed out in the end.

So I'm unsure if taking an extra dependency on Vulkan would actually help. ffmpeg and gstreamer seem to have v4l2 integration, might those be easier to target?

It would need to be ffmpeg as I don't see FF switching back to gstreamer. If the differences compared to ffmpegs VAAPI implementation is not too big (and somebody does the work hint) it might be feasible :) However, as said before, I'd be very careful of increasing the feature matrix in FF-Linux - it's already quite bad, even though we made some progress over the last years unifying code paths.

I suggest to discuss this idea in detail with robclark who maintains the freedreno mesa drivers and is active on #aarch64-laptops IRC.

Yeah, should surely get more opinions from driver devs.

Could you provide more details/a reference on Nvidia's commitment you are referring to?

AFAIK they are the only ones implementing it already in some form, see e.g. https://github.com/nvpro-samples/vk_video_samples

Type: defect → enhancement

FWIW, I had some more discussions regarding this topic and was told that Vulkan decoding is very far out and using the ffmpeg v4l backend(s) shouldn't add much complexity on top of what we already have. Let's track this work in bug 1783005.

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → DUPLICATE
No longer depends on: egl-linux-v4l
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: