Does anyone understand what LayerScope actually does?

Discussions about the development and maturation of the platform code (UXP).
Warning: may contain highly-technical topics.

Moderators: trava90, athenian200

User avatar
athenian200
Contributing developer
Contributing developer
Posts: 1537
Joined: 2018-10-28, 19:56
Location: Georgia

Does anyone understand what LayerScope actually does?

Unread post by athenian200 » 2023-11-13, 00:22

I stumbled upon it while looking at things in our codebase that use protobuf, and I got curious as to what it does. I discovered the following things:

1. To use it, first you have to flip gfx.layerscope.enabled. This opens a WebSocket at ws://localhost:23456

2. The main UI for this feature is not in the browser at all, it's on GitHub: http://mozilla.github.io/layerscope/

3. The project is no longer active: https://github.com/mozilla/layerscope

4. The code has been removed by Mozilla upstream, without comment: https://bugzilla.mozilla.org/show_bug.cgi?id=1728193

I've looked at it, and I can't figure out what precisely this does or how to use the frame/layer data collected... is this anything that would actually help us with developing the CSS parser or debugging WebGL, or is it just some weird leftover from b2g that was primarily used for remote debugging?

Not a pressing priority, but I'm wondering if this is dead code that's just bloating the binary size, or a hidden feature we have yet to make use of.
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35651
Joined: 2011-08-28, 17:27
Location: Motala, SE

Re: Does anyone understand what LayerScope actually does?

Unread post by Moonchild » 2023-11-13, 01:47

athenian200 wrote:
2023-11-13, 00:22
I've looked at it, and I can't figure out what precisely this does
It seems to dump ordering and texture data for from the layer manager
athenian200 wrote:
2023-11-13, 00:22
how to use the frame/layer data collected
No idea.
athenian200 wrote:
2023-11-13, 00:22
is this anything that would actually help us with developing the CSS parser or debugging WebGL
Very unlikely. the layer manager deals with layer composition, that's like 2 levels deeper than either CSS or WebGL.
It would only be useful to debug issues with the underpinnings of HWA acceleration and the likes.
athenian200 wrote:
2023-11-13, 00:22
is it just some weird leftover from b2g that was primarily used for remote debugging?
No, this would apply to all OSes with accelerated compositing.
And the fact it uses a websocket doesn't mean it's remote debugging ;) It's regularly simpler to dump debugging data over a network port to whatever client than it is to display in the application itself. Especially if it touches very low-level stuff.
athenian200 wrote:
2023-11-13, 00:22
I'm wondering if this is dead code
Certainly doesn't seem like we'll ever use this in our development.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite