RESOLVED FIXED 260654
[Nvidia][GStreamer][GTK] Unable to play any video whatsoever
https://bugs.webkit.org/show_bug.cgi?id=260654
Summary [Nvidia][GStreamer][GTK] Unable to play any video whatsoever
Kdwk
Reported 2023-08-24 05:28:10 PDT
Supersedes https://bugs.webkit.org/show_bug.cgi?id=260456 With Epiphany 45.beta-40-g17c238bbb+/ WebKitGTK 2.41.91, no matter what environment variable set, no video can be played (without crashing). With no environment variable set, the web view cannot be shown. With WEBKIT_DISABLE_DMABUF_RENDERER=1, sites with video crash. With WEBKIT_GST_DMABUF_SINK_DISABLED=1, sites don't crash but videos are black or refuse to be played. Disabling the GL sink (forgot the environment variable), the video plays for a few seconds then Epiphany receives SIGSEGV, with backtrace that looks like "??()". GST_PLUGIN_FEATURE_RANK=nvav1dec:MAX,nvh264dec:MAX,nvh265dec:MAX,nvjpegdec:MAX,nvmpeg2videodec:MAX,nvmpeg4videodec:MAX,nvmpegvideodec:MAX,nvvp8dec:MAX,nvvp9dec:MAX does not appear to make any difference. This only happens in Epiphany Technology Preview/ WebKitGTK 2.41.x, but not in Gnome Web/ WebKitGTK 2.40.x, where video playback works and hardware-accelerated decode works as well.
Attachments
Videos are now green (105.19 KB, image/png)
2024-03-03 18:45 PST, Kdwk
no flags
Compressed dots folder (215.57 KB, application/zip)
2024-03-05 02:13 PST, Kdwk
no flags
Compressed dots folder (DMABuf renderer) (60.24 KB, application/zip)
2024-07-03 05:48 PDT, Kdwk
no flags
gst-inspect-1.0 nvvp9dec.txt (6.67 KB, text/plain)
2024-07-03 06:48 PDT, Kdwk
no flags
Requested gst logs (272.16 KB, text/x-log)
2024-08-08 06:34 PDT, Kdwk
no flags
gst-play-1.0 dots (17.92 KB, application/zip)
2024-08-12 07:11 PDT, Kdwk
no flags
gst log when using philn's patch (267.33 KB, text/x-log)
2024-08-13 03:28 PDT, Kdwk
no flags
Compressed dots folder when using philn's patch (132.03 KB, application/zip)
2024-08-13 03:29 PDT, Kdwk
no flags
webkit-gpu.txt (17.40 KB, text/plain)
2024-08-15 07:07 PDT, Kdwk
no flags
Kdwk
Comment 1 2023-08-24 05:28:51 PDT
*** Bug 260456 has been marked as a duplicate of this bug. ***
Erik Kurzinger
Comment 2 2023-11-08 12:21:46 PST
Based on the discussion from https://bugs.webkit.org/show_bug.cgi?id=261874 at least part of the problem is that current versions of the NVIDIA driver do not support allocating GBM buffers with the R8 format. However, the next release (550) will support this. So it may be worth re-testing when that goes public later this year.
Kdwk
Comment 3 2024-03-03 18:45:58 PST
Created attachment 470157 [details] Videos are now green Erik, I have retested this with the 550.54.14 driver and videos became green instead
Philippe Normand
Comment 4 2024-03-04 13:14:14 PST
It would be interesting to know which format the video decoder outputs and which format the video sink negotiates... Can you share pipeline dumps?
Kdwk
Comment 5 2024-03-05 01:47:59 PST
How can I get that information?
Kdwk
Comment 7 2024-03-05 02:13:01 PST
Created attachment 470179 [details] Compressed dots folder Thanks. Here's the compressed dot directory after running the command with youtube.com and playing a few videos there.
Philippe Normand
Comment 8 2024-03-05 02:36:17 PST
So the decoder outputs raw NV12 and for rendering we convert that to DMABufs within WebKit. That might be where the problem is.
Philippe Normand
Comment 9 2024-03-06 12:38:27 PST
> With WEBKIT_GST_DMABUF_SINK_DISABLED=1, sites don't crash but videos are black or refuse to be played. Is this still happening?
Kdwk
Comment 10 2024-03-07 04:35:03 PST
Currently, with WEBKIT_GST_DMABUF_SINK_DISABLED=1 videos aren't black but simply don't play. Without this environment variable, videos seemingly can play, but they are green.
Kdwk
Comment 11 2024-04-01 21:18:02 PDT
Erik, this issue still persists with Nvidia driver 550. Though GBM buffers with R8 formats are now supported, there remains a problem with converting raw NV12 to DMABufs. Nvidia users cannot view any video in WebKitGTK apps until this is resolved.
Erik Kurzinger
Comment 12 2024-04-04 16:39:50 PDT
> there remains a problem with converting raw NV12 to DMABufs Could you clarify what you mean by this? With the 550 driver it should be possible to allocate an NV12 GBM buffer and export it as a pair of DMA-BUFs. Note, though, that support for this format in our EGL driver is "external only". So if an NV12 buffer is imported as an EGLImage, that image can only be bound to GL_TEXTURE_EXTERNAL_OES (not, for example, GL_TEXTURE_2D). Could that maybe be the problem?
Kdwk
Comment 13 2024-07-02 07:23:14 PDT
I used flatpak run --command=/bin/bash com.github.kdwk.Spidey to enter the Flatpak runtime then gst-play-1.0 to play local video files. This works fine. WebKitGTK 2.45.4/ GStreamer 1.24/
Philippe Normand
Comment 14 2024-07-02 08:31:59 PDT
(In reply to Kdwk from comment #10) > Currently, with WEBKIT_GST_DMABUF_SINK_DISABLED=1 videos aren't black but > simply don't play. Without this environment variable, videos seemingly can > play, but they are green. If that still happens we'd need gst logs.
Kdwk
Comment 15 2024-07-03 05:48:24 PDT
Created attachment 471804 [details] Compressed dots folder (DMABuf renderer) I have the new dots folder when playing videos with the DMABuf renderer. It now shows a black screen instead of green after the update of Nvidia drivers from 550 to 555. Sound works as usual (playback works except video).
Philippe Normand
Comment 16 2024-07-03 06:42:33 PDT
That's not with nvidia decoder, but openh264... try with GST_PLUGIN_FEATURE_RANK=openh264dec:0 ?
Philippe Normand
Comment 17 2024-07-03 06:45:17 PDT
Sorry i was looking at the wrong pipeline :) What's the output of gst-inspect-1.0 nvvp9dec ? Having pipeline dump for gst-play would be nice too.
Kdwk
Comment 18 2024-07-03 06:48:25 PDT
Created attachment 471805 [details] gst-inspect-1.0 nvvp9dec.txt Here's the output of gst-inspect-1.0 nvvp9dec
Philippe Normand
Comment 19 2024-07-03 07:07:16 PDT
GST_DEBUG="nv*:6,videodec*:6" logs too please
Philippe Normand
Comment 20 2024-07-03 07:08:41 PDT
(In reply to Philippe Normand from comment #8) > So the decoder outputs raw NV12 and for rendering we convert that to DMABufs > within WebKit. That might be where the problem is. Still same issue. Once we understand why the decoder negotiates raw NV12 instead of GLMemories with the sink, the issue will be closer to resolution.
Kdwk
Comment 21 2024-07-03 07:20:30 PDT
(In reply to Philippe Normand from comment #17) > Having pipeline dump for gst-play would be nice too. I am unable to get this dump because it keeps insisting the files and directories don't exist.
Kdwk
Comment 22 2024-07-03 07:21:43 PDT
However, gst-play-1.0 keep complaining about WARNING A lot of buffers are being dropped. WARNING debug information: ../libs/gst/base/gstbasesink.c(3147): gst_base_sink_is_too_late (): /GstPlayBin3:playbin/GstPlaySink:playsink/GstBin:vbin/GstAutoVideoSink:videosink/GstGLImageSinkBin:videosink-actual-sink-glimage/GstGLImageSink:sink: There may be a timestamping problem, or this computer is too slow.
Philippe Normand
Comment 23 2024-07-03 08:10:57 PDT
(In reply to Kdwk from comment #21) > (In reply to Philippe Normand from comment #17) > > > Having pipeline dump for gst-play would be nice too. > > I am unable to get this dump because it keeps insisting the files and > directories don't exist. Are you setting the dangerous env var? See https://docs.webkit.org/Ports/WebKitGTK%20and%20WPE%20WebKit/Multimedia.html#flatpak-apps
Carlos Garcia Campos
Comment 24 2024-07-09 03:20:46 PDT
(In reply to Philippe Normand from comment #20) > (In reply to Philippe Normand from comment #8) > > So the decoder outputs raw NV12 and for rendering we convert that to DMABufs > > within WebKit. That might be where the problem is. > > Still same issue. Once we understand why the decoder negotiates raw NV12 > instead of GLMemories with the sink, the issue will be closer to resolution. Because we always claim to support NV12?
Philippe Normand
Comment 25 2024-07-09 04:26:05 PDT
Yes... There's two different issues I think. - with our GL sink we should ideally behave almost the same as gst-play (with glimagesink) and negotiate GLMemories all the way from decoder to sink. - with our DMABuf sink I'm not sure how to proceed, but video/x-raw negotiation should be avoided... we'd need a dmabufupload (or maybe glupload can handle GLMemory conversion to DMABuf now) that would convert CUDA or GLMemories from the decoder to DMABufs.
Carlos Garcia Campos
Comment 26 2024-07-09 06:16:40 PDT
(In reply to Philippe Normand from comment #25) > Yes... > > There's two different issues I think. > > - with our GL sink we should ideally behave almost the same as gst-play > (with glimagesink) and negotiate GLMemories all the way from decoder to sink. If you know how to do that... > - with our DMABuf sink I'm not sure how to proceed, but video/x-raw > negotiation should be avoided... we'd need a dmabufupload (or maybe glupload > can handle GLMemory conversion to DMABuf now) that would convert CUDA or > GLMemories from the decoder to DMABufs. This is how I think the DMABuf sink works: We claim to support a fixed list of formats, which are the ones that can be handled by the texture mapper. Then two things can happen: 1) gst can provide one of the formats as DMABuf: In this case we just import the DMABUf as textures and render them into the texture mapper. 2) gst can't provide the formats as DMABuf: in this case we receive a raw video frame in one the formats we claimed in caps. We allocate a GBM buffer and upload the video frame there, then we do as if the DMABuf was provided by gst and import it as textures to render them into the texture mapper. So, in both cases, I wonder what happens if the buffer format (and modifiers) is not supported by the driver. I guess in the first case we will fail to import the DMABuf and in the second case we will fail to allocate the buffer. I guess we should claim to support only the formats supported by the driver, the same way we do in the renderer. Do we know where exactly is failing? And in case of not getting a DMABuf from gst, is it really more efficient to allocate, upload and then import the DMABuf? Can't we just fallback to GL or non-accelerated video?
Philippe Normand
Comment 27 2024-07-10 01:55:19 PDT
Having the decoder output raw video (in main memory, not GPU) should be avoided, otherwise CPU usage might increase significantly... Our hand-rolled GBM to DMABuf upload in the player is meant for software decoders... @Kdwk: Can you get gst logs please? `GST_DEBUG="3,nv*:6`
Philippe Normand
Comment 28 2024-07-10 04:05:01 PDT
Also for testing purpose can you disable the WebProcess sandbox? I suspect it might block access from the nv decoder to the cuda device...
Kdwk
Comment 29 2024-08-08 06:34:16 PDT
Created attachment 472080 [details] Requested gst logs I have collected the requested logs
Philippe Normand
Comment 30 2024-08-12 06:48:28 PDT
Having a pipeline graph dump for gst-play-1.0 scenario would be nice so we can compare... Currently in WebKit the decoder negotiates sysmem on its src pad, instead of GL.
Kdwk
Comment 31 2024-08-12 07:11:56 PDT
Created attachment 472121 [details] gst-play-1.0 dots Here is the compressed dots directory when playing an H.264 video with gst-play-1.0
Kdwk
Comment 32 2024-08-13 03:28:30 PDT
Created attachment 472133 [details] gst log when using philn's patch gst log when using philn's patch
Kdwk
Comment 33 2024-08-13 03:29:10 PDT
Created attachment 472134 [details] Compressed dots folder when using philn's patch Compressed dots folder when using philn's patch
Philippe Normand
Comment 34 2024-08-14 12:26:22 PDT
So with that patch at least GL mem is attempted, but then... "OpenGL context is not CUDA-compatible, fallback to system memory"... :/
Philippe Normand
Comment 35 2024-08-15 02:05:46 PDT
(In reply to Philippe Normand from comment #34) > So with that patch at least GL mem is attempted, but then... "OpenGL context > is not CUDA-compatible, fallback to system memory"... :/ Can you share your webkit://gpu infos?
Kdwk
Comment 36 2024-08-15 07:07:59 PDT
Created attachment 472174 [details] webkit-gpu.txt Here's webkit://gpu
Philippe Normand
Comment 37 2024-08-23 12:12:55 PDT
This is more graphics-related at this point, I don't think I can help further. The GL version reported by webkit://gpu seems compatible with what nvvp9dec would expect (>= 3.0) so I don't know what else to do.
Philippe Normand
Comment 38 2024-10-02 15:29:14 PDT
This seems fixed in 2.46.1. Closing.
Note You need to log in before you can comment on or make changes to this bug.