Bug 107992 - xf86-video-amdgpu-18.1.0: video freezes in firefox
Summary: xf86-video-amdgpu-18.1.0: video freezes in firefox
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/AMDgpu (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: xf86-video-ati maintainers
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-19 20:18 UTC by Alexander Tsoy
Modified: 2018-09-28 15:35 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Xorg.1.log (45.32 KB, text/plain)
2018-09-19 20:18 UTC, Alexander Tsoy
no flags Details
firefox about:support (22.71 KB, text/plain)
2018-09-21 07:50 UTC, Alexander Tsoy
no flags Details
glxinfo (143.17 KB, text/plain)
2018-09-21 07:51 UTC, Alexander Tsoy
no flags Details
xrandr --verbose (5.50 KB, text/plain)
2018-09-21 07:52 UTC, Alexander Tsoy
no flags Details
dmesg (75.25 KB, text/plain)
2018-09-21 07:53 UTC, Alexander Tsoy
no flags Details

Description Alexander Tsoy 2018-09-19 20:18:30 UTC
Created attachment 141654 [details]
Xorg.1.log

I get constant video freezes in firefox (e.g. on youtube) with xf86-video-amdgpu-18.1.0. This is a regression since 18.0.1. Long freezes can be stopped by hovering mouse cursor over the video.


$ git bisect bad
739181c8d3334ff14b5a607895dfdeb29b0d9020 is the first bad commit
commit 739181c8d3334ff14b5a607895dfdeb29b0d9020
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Jul 25 13:00:15 2018 +0200

    Add amdgpu_drm_handle_event wrapper for drmHandleEvent
    
    Instead of processing DRM events directly from drmHandleEvent's
    callbacks, there are three phases:
    
    1. drmHandleEvent is called, and signalled events are re-queued to
       _signalled lists from its callbacks.
    2. Signalled page flip completion events are processed.
    3. Signalled vblank events are processed.
    
    This should make sure that we never call drmHandleEvent from one of its
    callbacks, which would usually result in blocking forever.

:040000 040000 02eec05d22520cd515a137b18ab912a7f2fdc77e cec6036a94d5f35eceb772a8de0b86c2b62cf913 M	src


$ git bisect log
git bisect start
# good: [9f37a44473ded8c669897379acbc750362c15ec6] Bump version for 18.0.1 release
git bisect good 9f37a44473ded8c669897379acbc750362c15ec6
# bad: [d5e17dc4c78aee5d37de399728066b9be881e044] Bump version for the 18.1.0 release
git bisect bad d5e17dc4c78aee5d37de399728066b9be881e044
# good: [14db71a606128c4a207f43298809af279b77e2a8] modesetting: Record non-desktop kernel property at PreInit time
git bisect good 14db71a606128c4a207f43298809af279b77e2a8
# good: [7f65a8c9e03bddf2378aaa928460632ed6b1a688] glamor: Check glamor module version for depth 30 support
git bisect good 7f65a8c9e03bddf2378aaa928460632ed6b1a688
# bad: [34e851d1f284da5afcfe449f349cf1eb5e962408] Use AC_CONFIG_MACRO_DIR instead of AC_CONFIG_MACRO_DIRS
git bisect bad 34e851d1f284da5afcfe449f349cf1eb5e962408
# bad: [e52872da69ecc84dafb3355839e35b0383f0d228] Defer vblank event handling while waiting for a pending flip
git bisect bad e52872da69ecc84dafb3355839e35b0383f0d228
# good: [6029794e8a35417faf825491a89b85f713c77fc1] Add amdgpu_drm_wait_pending_flip function
git bisect good 6029794e8a35417faf825491a89b85f713c77fc1
# bad: [739181c8d3334ff14b5a607895dfdeb29b0d9020] Add amdgpu_drm_handle_event wrapper for drmHandleEvent
git bisect bad 739181c8d3334ff14b5a607895dfdeb29b0d9020
# first bad commit: [739181c8d3334ff14b5a607895dfdeb29b0d9020] Add amdgpu_drm_handle_event wrapper for drmHandleEvent
Comment 1 Michel Dänzer 2018-09-20 08:52:27 UTC
I'm unable to reproduce the problem. Please attach the following:

* The output of about:support in Firefox
* The output of glxinfo, xrandr --verbose and dmesg

Can you provide an URL of a video which reproduces the problem? Does it only happen if the video is (not) in fullscreen? How long after starting playback does it start freezing?

Does only the video itself freeze, or also the rest of the Firefox window, or even the whole desktop?
Comment 2 Dudu Edri 2018-09-20 17:59:25 UTC
Can confirm that the problem reproduces to me too. It happens on youtube or other HTML5 videos, as well as when scrolling around on webpages. It's not constant though - there could be several seconds without hangs, but the overall experience is sluggish.

The freezes only happen when hardware acceleration is enabled in Firefox (OpenGL under "Compositing" in about:support. It could be enabled by changing "layers.acceleration.force-enabled" to "true" in about:config).

As for your question, the whole Firefox window becomes unresponsive for a second or two.
Comment 3 Alexander Tsoy 2018-09-20 19:27:03 UTC
(In reply to Dudu Edri from comment #2)
> The freezes only happen when hardware acceleration is enabled in Firefox
> (OpenGL under "Compositing" in about:support. It could be enabled by
> changing "layers.acceleration.force-enabled" to "true" in about:config).

Confirming this. Can't reproduce the bug with hardware compositing disabled (layers.acceleration.force-enabled = false).

> 
> As for your question, the whole Firefox window becomes unresponsive for a
> second or two.

I sometimes have much longer freezes.


(In reply to Michel Dänzer from comment #1)
> I'm unable to reproduce the problem. Please attach the following:
> 
> * The output of about:support in Firefox
> * The output of glxinfo, xrandr --verbose and dmesg

Do you still need this info?

> Can you provide an URL of a video which reproduces the problem?

I did bisect using the following video:
https://www.youtube.com/watch?v=jJ_dPh6wcA0

> Does it only happen if the video is (not) in fullscreen?

Both fullscreen and non-fullscreen.

> How long after starting playback does it start freezing?

It's random. Maybe ~10 seconds.

> Does only the video itself freeze, or also the rest of the Firefox window,
> or even the whole desktop?

The whole firefox window. Not sure about the whole desktop - when I move mouse to gnome shell panel firefox unfreezes.
Comment 4 Alexander Tsoy 2018-09-20 21:31:53 UTC
I see similar freezes in Steam client when playing videos on the store pages. But unlike firefox this doesn't happen in fullscreen mode.
Comment 5 Michel Dänzer 2018-09-21 07:19:46 UTC
(In reply to Alexander Tsoy from comment #3)
> > * The output of about:support in Firefox
> > * The output of glxinfo, xrandr --verbose and dmesg
> 
> Do you still need this info?

Yes, please.

I have hardware acceleration enabled in my Firefox configurations as well, but am still unable to reproduce.
Comment 6 Alexander Tsoy 2018-09-21 07:50:20 UTC
Created attachment 141667 [details]
firefox about:support
Comment 7 Alexander Tsoy 2018-09-21 07:51:22 UTC
Created attachment 141668 [details]
glxinfo
Comment 8 Alexander Tsoy 2018-09-21 07:52:07 UTC
Created attachment 141669 [details]
xrandr --verbose
Comment 9 Alexander Tsoy 2018-09-21 07:53:07 UTC
Created attachment 141670 [details]
dmesg
Comment 10 Michel Dänzer 2018-09-21 17:00:33 UTC
Thanks. I was able to reproduce the problem after all. It's actually gnome-shell/mutter that freezes, not Firefox itself. My best guess so far is that it's somehow related to delivery / processing of X11 events, but I'm not sure yet what's going on.

A possible workaround might be having something in the session which updates regularly. E.g. I suspect I might not have noticed this before myself because I usually have gkrellm running in my session.
Comment 11 Michel Dänzer 2018-09-24 17:05:34 UTC
I suspect this is the same issue as bug 108008 => https://gitlab.freedesktop.org/xorg/lib/libx11/issues/79 .
Comment 12 Michel Dänzer 2018-09-25 15:21:38 UTC
This libX11 patch fixes it for me: https://gitlab.freedesktop.org/xorg/lib/libx11/merge_requests/1
Comment 13 Alexander Tsoy 2018-09-25 19:11:51 UTC
(In reply to Michel Dänzer from comment #12)
> This libX11 patch fixes it for me:
> https://gitlab.freedesktop.org/xorg/lib/libx11/merge_requests/1
Thanks! It fixes it for me as well.
Comment 14 Dudu Edri 2018-09-27 21:43:02 UTC
(In reply to Michel Dänzer from comment #12)
> This libX11 patch fixes it for me:
> https://gitlab.freedesktop.org/xorg/lib/libx11/merge_requests/1

Can confirm that this patch fixes the problem for me as well.
Comment 15 Michel Dänzer 2018-09-28 15:35:15 UTC
Thanks for the report and for testing the fix, which has now landed in libX11 Git master:

commit 406afe4b0f1b655c0db19bbc9a0c48da9a46acf5
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue Sep 25 17:10:58 2018 +0200

    poll_for_response: Call poll_for_event again if xcb_poll_for_reply fails


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.