Scale the WebRender profiler overlay to the viewport

RESOLVED FIXED in Firefox 67

Status

()

enhancement
RESOLVED FIXED
4 months ago
4 months ago

People

(Reporter: bholley, Assigned: bholley)

Tracking

unspecified
mozilla67
Points:
---

Firefox Tracking Flags

(firefox67 fixed)

Details

Attachments

(1 attachment)

Assignee

Description

4 months ago

On a sufficiently small screen, the WebRender profiler overlay gets truncated. For improved profiling on android, we should shrink it to fit within the bounds of the viewport, even if that means squinting to read the text.

Naively, it seems like we'd want to adjust the orthographic projection matrix of the debug renderer [1] to scale things appropriately. However, there are two problems:

(1) The ortho matrix is already based on the framebuffer size passed down into rendering [2], but that doesn't seem to be quite the right thing here. On Desktop, the scaling doesn't change when resizing the browser window, and debug display overflows the screen on the HD8.

(2) Some debug items shouldn't be scaled, i.e. the picture caching tiles. We could potentially stores those items separately and do two loops through the logic in DebugRenderer::render, but that's a bit gross. More-elegant solutions welcome.

[1] https://searchfox.org/mozilla-central/rev/2a6f3dde00801374d3b2a704232de54a132af389/gfx/wr/webrender/src/debug_render.rs#322
[2] https://searchfox.org/mozilla-central/rev/2a6f3dde00801374d3b2a704232de54a132af389/gfx/webrender_bindings/RendererOGL.cpp#121

Comment 1

4 months ago

I ran into this today and added a local hack before seeing this bug.

I changed the ortho matrix for the debug renderer - see https://searchfox.org/mozilla-central/rev/2a6f3dde00801374d3b2a704232de54a132af389/gfx/wr/webrender/src/debug_render.rs#322

In my case, I just hacked the viewport size to be * 1.5. This means that the ortho projection is only affected for the debug renderer, and allows scaling all the debug content to be smaller.

So, a simple solution / hack would be to expose a "debug overlay scale" in RendererOptions that gets applied to the viewport size in that function.

If we leave it at 1 by default, you get crisp pixel perfect debug overlays, with the option to scale them down as required by the device size.

Assignee

Comment 2

4 months ago

Adaptive sizing would be better, but this is the simplest path to
victory.

Attachment #9047799 - Attachment description: Bug 1531196 - Add a "small-screen" debug pref to shrink the overlay a bit. g=rw → Bug 1531196 - Add a "small-screen" debug pref to shrink the overlay a bit. r=gw
Attachment #9047799 - Attachment description: Bug 1531196 - Add a "small-screen" debug pref to shrink the overlay a bit. r=gw → Bug 1531196 - Add a "small-screen" debug pref to shrink the overlay a bit.

Comment 3

4 months ago
Pushed by bholley@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/690713aece13
Add a "small-screen" debug pref to shrink the overlay a bit. r=gw

Comment 4

4 months ago
bugherder
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
You need to log in before you can comment on or make changes to this bug.