Closed Bug 1832692 Opened 1 year ago Closed 1 year ago

Remove MOZ_DEBUG_PAINTS

Categories

(Core :: Widget: Gtk, task)

task

Tracking

()

RESOLVED FIXED
115 Branch
Tracking Status
firefox115 --- fixed

People

(Reporter: dholbert, Assigned: dholbert)

Details

Attachments

(2 files)

I ran across MOZ_DEBUG_PAINTS when looking at bug 437749 (which was in the list of old "triage decision needed" bugs on https://bugdash.moz.tools/ ).

That environmental variable is only used in one place, quoted below, where it just makes us call gdk_window_set_debug_updates:

https://searchfox.org/mozilla-central/rev/ee6ab6eb2d222e0004604de62206baa67cac33af/widget/gtk/nsAppShell.cpp#365-367

if (PR_GetEnv("MOZ_DEBUG_PAINTS")) {
  gdk_window_set_debug_updates(TRUE);
}

If I set that environmental variable and run Firefox, I don't notice anything different, so I'm not sure gdk_window_set_debug_updates does anything at this point? Also, https://docs.gtk.org/gdk3/type_func.Window.set_debug_updates.html says this API is deprecated and not to use it in newly-written code.

Probably best to remove it, unless we're aware of it being useful for some purpose.

As noted in the bug, this var just made us call a GDK function that is now
deprecated (and which doesn't obviously have any effect on my own linux
system).

Assignee: nobody → dholbert
Status: NEW → ASSIGNED

A few more notes on "does it do anything"... The API docs say that gdk_window_set_debug_updates changes how gdk_window_invalidate_region behaves -- in particular:

With update debugging enabled, calls to gdk_window_invalidate_region() clear the invalidated region of the screen to a noticeable color, and GDK pauses for a short time before sending exposes to windows during gdk_window_process_updates(). The net effect is that you can see the invalid region for each window and watch redraws as they occur. This allows you to diagnose inefficiencies in your application.

We don't have any direct calls to gdk_window_invalidate_region, but we do have some calls to the convenience wrapper function gdk_window_invalidate_rect, which I assume would be similarly-affected:
https://searchfox.org/mozilla-central/search?q=gdk_window_invalidate_rect&path=
(Calls are in moz_container_wayland_invalidate, and in the nsWindow methods Invalidate, OnSizeAllocate, and SetInputRegion.)

Nonetheless, I can't seem to trigger any of the "noticeable color" paints that the documentation mentions when messing around with Firefox Nightly, with this environmental variable set. But I do notice it making window resizes quite janky (presumably because of the "pauses for a short time" that the documentation mentions).

Anyway: I think this is supposed to trigger a sort of "paint flashing" type feature, but it doesn't seem to do that anymore. If nobody's using it in practice "to diagnose inefficiencies" in Firefox and we're not aware of how-it-could-be-used-to-do-that, then probably we should just remove it.

Aha, I got it to do something, when running Gnome under Xorg. It looks like this just has no effect for Wayland, but it does have some effect under Xorg. It makes certain windows and popups flash red, though only some of the time.

I'll attach a screencast.

Anyway: I still tend to think we should just remove this if no one uses it, since it's orthogonal to most of our actual invalidation/repaint logic these days. But I'll defer to stransky's judgement and am also happy to leave things as they are if there's a chance someone might find this environmental variable useful.

stransky, what do you think?

Flags: needinfo?(stransky)
Attachment #9333219 - Attachment description: screencast showing what this environmental variable looks like in practice, in Firefox on Xorg → screencast showing the effects of this environmental variable, in Firefox on Xorg

Fee free to remove it. It's attached to Gtk draw/expose event (nsWindow::OnExposeEvent()) but we don't rely on that as we use refresh driver to update window content.

Flags: needinfo?(stransky)

Thanks!

Pushed by dholbert@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c6c0d1b8ce3a
Remove support for MOZ_DEBUG_PAINTS environmental variable. r=stransky
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 115 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: