Bug 232925 - [GTK] cannot play video with accelerated compositing enabled and gstreamer-vaapi installed
Summary: [GTK] cannot play video with accelerated compositing enabled and gstreamer-va...
Status: RESOLVED MOVED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: Other
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-10 00:15 PST by Tic2929014466
Modified: 2021-11-17 09:56 PST (History)
4 users (show)

See Also:


Attachments
screenshot (527.94 KB, image/png)
2021-11-10 06:32 PST, Vicente
no flags Details
logs with gstreamer-vaapi (1.32 MB, text/x-log)
2021-11-10 06:33 PST, Vicente
no flags Details
logs without gstreamer-vaapi (1.13 MB, text/x-log)
2021-11-10 06:34 PST, Vicente
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tic2929014466 2021-11-10 00:15:05 PST
Epiphany, Eolie, etc. with WebkitGTK 2.34.1 cannot load video or get sound played well with a green-colored glitch graph.
command : "gsettings set org.gnome.Epiphany.web:/ hardware-acceleration-policy 'never'" make Epiphany play video correctly.
OS is latest Arch linux, laptop with Intel integrated graphs and NVIDIA standalone, both xorg and wayland session, flatpak version also tested, the issue is same.
firefox performs normally with hardware acceleration.
Comment 1 Michael Catanzaro 2021-11-10 06:10:50 PST
Can you take a debug log following the instructions at https://trac.webkit.org/wiki/WebKitGTK/Debugging#Debuggingmultimediastuff please?

Also make sure to uninstall gstreamer1-vaapi if you  have it.
Comment 2 Vicente 2021-11-10 06:32:06 PST
Created attachment 443809 [details]
screenshot
Comment 3 Vicente 2021-11-10 06:33:16 PST
Created attachment 443810 [details]
logs with gstreamer-vaapi
Comment 4 Vicente 2021-11-10 06:34:01 PST
Created attachment 443811 [details]
logs without gstreamer-vaapi
Comment 5 Vicente 2021-11-10 06:34:19 PST
Epiphany on Arch Linux
Comment 6 Michael Catanzaro 2021-11-10 06:55:48 PST
(In reply to Vicente from comment #2)
> Created attachment 443809 [details]
> screenshot

So it's broken both with and without gstreamer-vaapi, and it really is caused by whether the page uses accelerated compositing rather than hardware video decoding. Interesting.
Comment 7 Michael Catanzaro 2021-11-10 06:56:30 PST
Moving this back to GTK component since it smells more like a graphics problem than a multimedia problem....
Comment 8 Vicente 2021-11-10 07:22:25 PST
(In reply to Michael Catanzaro from comment #6)
> So it's broken both with and without gstreamer-vaapi, and it really is
> caused by whether the page uses accelerated compositing rather than hardware
> video decoding. Interesting.

No: without gstreamer-vaapi works well
Comment 9 Tic2929014466 2021-11-10 08:00:33 PST
(In reply to Michael Catanzaro from comment #1)
> Can you take a debug log following the instructions at
> https://trac.webkit.org/wiki/WebKitGTK/Debugging#Debuggingmultimediastuff
> please?
> 
> Also make sure to uninstall gstreamer1-vaapi if you  have it.

well
uninstall gstreamer-vaapi fix it
Comment 10 Vicente 2021-11-10 08:03:22 PST
(In reply to Tic2929014466 from comment #9)
> well
> uninstall gstreamer-vaapi fix it

That is no solution... hardware video decoding is *necessary*
Comment 11 Tic2929014466 2021-11-10 08:10:36 PST
(In reply to Vicente from comment #10)
> (In reply to Tic2929014466 from comment #9)
> > well
> > uninstall gstreamer-vaapi fix it
> 
> That is no solution... hardware video decoding is *necessary*

i understand
otherwise switch to firefox fix all xd
Comment 12 Michael Catanzaro 2021-11-10 08:15:50 PST
Ah, OK. Can you please report this at https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/ then? Getting your issue to the correct issue tracker is essential if you want it fixed. :) Please include the two debug logs you attached above with your gstreamer-vaapi bug report, since they could be useful, and be sure to mention this only occurs when used in combination with WebKit's accelerated compositing mode.

We've seen plenty of similar bugs in the past, but since they're inevitably hardware-specific there's not much we can do about it here. This is the first time someone has identified that it depends on WebKit's accelerated compositing mode, though.
Comment 13 Tic2929014466 2021-11-15 20:04:24 PST
Hi, I found running epiphany with environment variable "WEBKIT_FORCE_SANDBOX=0 WEBKIT_DISABLE_COMPOSITING_MODE=1", video plays well without any glitch and in intel_gpu_top, both Video and VideoEnhance channel has value changed, shows hardware acceleration in use.

Therefore I think the issue may not relate to GStreamer. I've seen glitch graph always relate to page content, perhaps there's something wrong in WebKit's GPU Render.

Here's discussion from GStreamer
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/877
Comment 14 Michael Catanzaro 2021-11-16 06:30:07 PST
It looks like the GStreamer devs have reproduced the issue without WebKit involved at all [1].

We already established that the bug requires accelerated compositing mode. As to why WEBKIT_FORCE_SANDBOX makes a difference, I don't know, but maybe the sandbox is blocking access to something that vaapi needs, "fixing" the issue? Hi Victor, any thoughts on that?

[1] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/877#note_1154667
Comment 15 Tic2929014466 2021-11-16 07:06:22 PST
(In reply to Michael Catanzaro from comment #14)
> It looks like the GStreamer devs have reproduced the issue without WebKit
> involved at all [1].
> 
> We already established that the bug requires accelerated compositing mode.
> As to why WEBKIT_FORCE_SANDBOX makes a difference, I don't know, but maybe
> the sandbox is blocking access to something that vaapi needs, "fixing" the
> issue? Hi Victor, any thoughts on that?
> 
> [1]
> https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/877#note_1154667

I didn't expect WEBKIT_FORCE_SANDBOX fix the problem, that was because I wanted to make Epiphany perform more like WebKit MiniBrowser. Now I think hardware compositing and hardware video acceleration are two different modules, and they have a mystic conflict when both enabled. Sandbox plays a role, though.
Comment 16 Víctor M. Jáquez L. 2021-11-17 09:56:43 PST
(In reply to Michael Catanzaro from comment #14)
> It looks like the GStreamer devs have reproduced the issue without WebKit
> involved at all [1].
> 
> We already established that the bug requires accelerated compositing mode.
> As to why WEBKIT_FORCE_SANDBOX makes a difference, I don't know, but maybe
> the sandbox is blocking access to something that vaapi needs, "fixing" the
> issue? Hi Victor, any thoughts on that?
> 
> [1]
> https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/877#note_1154667

I added some notes in the gstreamer issue:

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/877#note_1160747

Yet, it's pending to verify if the sandbox affects the output.

A preliminary conclusion is, when WebKitGLVideoSink is used (when composite is enabled) with gstreamer-vaapi garbage is rendered. While with the new gstva ements are used (with vapostproc), only the color space is not handled correctly (if no vapostproc is added, only the va decoder, the rendering is correct).

I wonder if WebKitGLVideoSink requests the correct number of retained frames to upstream in pool negotiation, and if gstreamer-vaapi frames lifetimes are handled right.