Bug 248223 - REGRESSION(2.39.1): [GTK] Significant graphics performance regressions
Summary: REGRESSION(2.39.1): [GTK] Significant graphics performance regressions
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 249145
  Show dependency treegraph
 
Reported: 2022-11-22 06:33 PST by Kdwk
Modified: 2023-09-26 06:37 PDT (History)
10 users (show)

See Also:


Attachments
Results of webkit://gpu (393.60 KB, image/png)
2022-11-24 05:15 PST, Kdwk
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kdwk 2022-11-22 06:33:18 PST
With GTK4 Epiphany Technology Preview and WebKitGTK 2.37.90 (previously tested), MotionMark reports a score of 493.19. After updating Epiphany Technology Preview to use WebKitGTK 2.39.1, MotionMark reports a score of 298. In comparison, MotionMark reports a score of 218.72 for GTK3 Gnome Web with WebKitGTK 2.36.6.

The tests are run separately on the same computer in maximized window mode, with no other app running in the background.
Comment 1 Michael Catanzaro 2022-11-22 08:11:57 PST
So in summary, it's still way faster than GTK 3 was, but a huge regression from previous GTK 4 MotionMark results.

Would be useful to confirm that this regression was introduced by 2.39.1. You could test 2.38.2 by downgrading org.gnome.Platform and org.gnome.Epiphany.Devel to builds from, say, two days ago, following the instructions at https://github.com/flatpak/flatpak/wiki/Tips-&-Tricks#downgrading. That way we can be certain that the regression is due to 2.38.2 -> 2.39.1, and not something else that changed in the meantime, like a change in Epiphany or GTK itself.

BTW you mentioned on Matrix that you suspect the regression is caused by the switch to ANGLE for WebGL. I think that is mandatory now, but if not, maybe I could temporarily disable it to allow you to take 2.39.1 benchmarks with it turned off....
Comment 2 Zan Dobersek 2022-11-22 08:18:00 PST
The default MotionMark suite doesn't have tests leveraging WebGL, so changes in that area should not have any effect on the benchmark.
Comment 3 Miguel Gomez 2022-11-22 08:20:11 PST
I think motionmark doesn't test WebGL, just 2D canvas, CSS and SVG content.

Was threaded rendering enabled for WebKitGTK 2.37.90? Is it now disabled for WebKitGTK 2.39.1? Cause that affects CSS and SVG, and could be the reason of the increase in performance between those versions.
Comment 4 Michael Catanzaro 2022-11-22 08:25:28 PST
(In reply to Miguel Gomez from comment #3)
> Was threaded rendering enabled for WebKitGTK 2.37.90? Is it now disabled for
> WebKitGTK 2.39.1? Cause that affects CSS and SVG, and could be the reason of
> the increase in performance between those versions.

That seems like a pretty good guess. It was disabled in 256526@main which landed just before 2.39.1. But there is an environment variable override: you can use WEBKIT_NICOSIA_PAINTING_THREADS=4 to go back to the previous behavior, so you can benchmark again without needing to downgrade anything and see if that is to blame. Seems pretty likely.
Comment 5 Michael Catanzaro 2022-11-22 09:09:01 PST
(In reply to Michael Catanzaro from comment #4) 
> That seems like a pretty good guess. It was disabled in 256526@main which
> landed just before 2.39.1. But there is an environment variable override:
> you can use WEBKIT_NICOSIA_PAINTING_THREADS=4 to go back to the previous
> behavior, so you can benchmark again without needing to downgrade anything
> and see if that is to blame. Seems pretty likely.

Note that flatpak maybe filters out environment variables? Probably need to enter the flatpak environment using 'flatpak run --command=/bin/bash org.gnome.Epiphany.Devel' before setting the environment variable, rather than try running flatpak with that environment variable set.
Comment 6 Kdwk 2022-11-22 19:10:17 PST
(In reply to Michael Catanzaro from comment #1)
> So in summary, it's still way faster than GTK 3 was, but a huge regression
> from previous GTK 4 MotionMark results.
> 
> Would be useful to confirm that this regression was introduced by 2.39.1.
> You could test 2.38.2 by downgrading org.gnome.Platform and
> org.gnome.Epiphany.Devel to builds from, say, two days ago, following the
> instructions at
> https://github.com/flatpak/flatpak/wiki/Tips-&-Tricks#downgrading. That way
> we can be certain that the regression is due to 2.38.2 -> 2.39.1, and not
> something else that changed in the meantime, like a change in Epiphany or
> GTK itself.
> 
> BTW you mentioned on Matrix that you suspect the regression is caused by the
> switch to ANGLE for WebGL. I think that is mandatory now, but if not, maybe
> I could temporarily disable it to allow you to take 2.39.1 benchmarks with
> it turned off....

I run the benchmark pretty much every time WebKitGTK updates, and it’s still reporting near 500 in 2.38.1/2.
Comment 7 Kdwk 2022-11-22 22:29:55 PST
Not sure if it's related, but when I run Epiphany (WebKitGTK 2.39.1) from the terminal I get 3 lines of `ERR: Display.cpp:1006 (initialize): ANGLE Display::initialize error 12289: Failed to initialize system egl`.

I'll run the benchmarks with threaded rendering later.
Comment 8 Kdwk 2022-11-23 07:07:13 PST
I have run MotionMark again with WEBKIT_NICOSIA_PAINTING_THREADS=4 (Epiphany Technology Preview, WebKitGTK 2.39.1), and the score is 303.68. Not so different than with threaded rendering off.
Comment 9 Michael Catanzaro 2022-11-23 09:43:41 PST
OK, so it's not related to threaded rendering after all. I suppose something really *is* wrong with ANGLE if EGL initialization succeeded with 2.38.2 but fails with 2.39.1....
Comment 10 Carlos Garcia Campos 2022-11-24 02:10:02 PST
(In reply to kdwkleung from comment #7)
> Not sure if it's related, but when I run Epiphany (WebKitGTK 2.39.1) from
> the terminal I get 3 lines of `ERR: Display.cpp:1006 (initialize): ANGLE
> Display::initialize error 12289: Failed to initialize system egl`.

That error comes from ANGLE, so for some reason angle is indeed used when running motionmark, but it shouldn't.
Comment 11 Kdwk 2022-11-24 04:37:25 PST
(In reply to Carlos Garcia Campos from comment #10)
> (In reply to kdwkleung from comment #7)
> > Not sure if it's related, but when I run Epiphany (WebKitGTK 2.39.1) from
> > the terminal I get 3 lines of `ERR: Display.cpp:1006 (initialize): ANGLE
> > Display::initialize error 12289: Failed to initialize system egl`.
> 
> That error comes from ANGLE, so for some reason angle is indeed used when
> running motionmark, but it shouldn't.

I don't think it appeared when using MotionMark, it appeared when I visit apple.com and reddit.com
Comment 12 Carlos Garcia Campos 2022-11-24 04:58:30 PST
Could you share the results of webkit://gpu?
Comment 13 Kdwk 2022-11-24 05:15:53 PST
Created attachment 463708 [details]
Results of webkit://gpu

This is the webkit://gpu page
Comment 14 Kdwk 2023-01-17 06:07:23 PST
Note: this issues persists as of WebKitGTK 2.39.4, which resolves an ANGLE bug causing WebGL to not be available.
Comment 15 Kdwk 2023-03-28 05:32:19 PDT
Seems this can be solved by WEBKIT_NICOSIA_PAINTING_THREADS=4, which should be possible now that threaded safety has been solved and the crashes went away. I tested this env var for quite some time and seems pretty stable so far with big performance boost compared to without.
Comment 16 Michael Catanzaro 2023-03-28 06:52:10 PDT
I'll add this environment variable to Epiphany Tech Preview so we can test it there for a couple weeks before changing WebKit again. https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/1307

I'd be more confident if I knew more about what the painting thread is actually doing: what libraries does it use, and why are the safe to use on a thread.
Comment 17 Kdwk 2023-04-06 07:01:29 PDT
Fixed after latest Tech Preview env var change.
Comment 18 Michael Catanzaro 2023-04-06 07:18:00 PDT
I just added that for testing, though. I'll remove it now. We didn't notice crashes in practice, but I'm not confident that means it's really safe to do.