Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to wlr scene-graph #50

Merged
merged 10 commits into from Jul 30, 2022
Merged

Switch to wlr scene-graph #50

merged 10 commits into from Jul 30, 2022

Conversation

ghost
Copy link

@ghost ghost commented Oct 30, 2021

It is still far from done, but apart from (not) raising view on focus it should be at least usable.

Depends on #44 (current commits from there are included) and wlroots 0.15 release.

TODOs –

  • whatever’s a TODO in the code
  • use the scene as much as possible (e.g. cursor focus, though that may require further progress of wlroots too)
  • WONTDO don’t make assumptions about new scene nodes (z-index, en/disabled…)
  • get rid of state duplication between the scene and kiwmi structs (positioning etc)
  • test it
  • LATER maybe provide replacements for view pre/post-render – but it might be saner to keep for later

@heavyrain266
Copy link

Definitely looks interesting, not sure what convinced them to use stuff from gamedev and vector graphics editors in 2d linux and bsd desktops though, Scene-graph is widely used practice in game engines and programs in style of Adobe Illustrator to easier view data structure, mayby it makes sense for them 🤔.

@ghost
Copy link
Author

ghost commented Nov 13, 2021

6bd805c doesn’t fix the problem i thought it would fix (TODO: remove it, no need to move to another PR). Oh wait, for some reason i built kiwmi with 9c3adf0, which of course doesn’t tell me if the later commit fixed it. I can’t seem to reproduce the crash the usual way, now that i build at the right commit.

I’m not very motivated to write any code at all these days, but i hope i’ll get into it again soon enough.

Here’s a basic-tasks checklist i’ve managed to think of; pls let me know / edit if you come up with something more.

  • scene
    • created and destroyed
    • bound to output layout
  • strata
    • created
    • correctly sorted
    • destroyed (automatically on scene destroy)
  • output
    • nodes created and destroyed
      • shouldn’t segfault with outputs destroyed later than the desktop
    • nodes moved when moving
      • test this thing
  • view
    • node created and destroyed
    • initially hidden, ideally bottom-most in the stratum
    • surface geom updated in scene (and it must be correct) – may be handled by wlr later
    • node moved when moving
    • unmaps when unmapped / hidden
    • subsurfaces handled correctly (should be done by wlroots)
  • layer
    • node created and destroyed
    • node moved when moving
    • node reparented on layer change
    • (un)mapping correctly handled
  • popup
    • node created
    • node destroyed (by wlroots)
    • node moved when moving (handled by wlroots)
    • correctly unconstrained
    • NOT re-unconstrained¹ (for xdg-shell v3, ref 039f990)
  • bg color
    • node (rect) created and destroyed (automatically on scene destroy)
    • node resized (and moved?) according to output layout
    • changed on user request (kiwmi:bg_color)
    • what about direct scanout (which will be automatically blocked by the scene_rect)? should we bother with it?
    • pure black → rect is hidden (should black be the default?)
  • not required for merge (IMO)
    • an alternative to view:pre/post_render

  1. From the xdg-shell protocol:

    For version 2 or older, the configure event for an xdg_popup is only ever sent once for the initial configuration. Starting with version 3, it may be sent again if the popup is setup with an xdg_positioner with set_reactive requested, or in response to xdg_popup.reposition requests.

    …and version 3+ is currently not supported by wlroots (there is wlroots!3514 for wlr 0.16)

kiwmi/desktop/desktop.c Outdated Show resolved Hide resolved
include/desktop/desktop.h Outdated Show resolved Hide resolved
include/desktop/toplevel.h Outdated Show resolved Hide resolved
include/desktop/output.h Outdated Show resolved Hide resolved
Comment on lines 91 to 82
// why does it have to be unsigned? and why can it be negative, then?
view_set_pos(struct kiwmi_view *view, uint32_t x, uint32_t y)
Copy link
Author

@ghost ghost Dec 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated, but this has been a mystery for me. Could you explain please?

kiwmi/input/cursor.c Outdated Show resolved Hide resolved
@ghost ghost mentioned this pull request Dec 22, 2021
@ghost
Copy link
Author

ghost commented Dec 22, 2021

Cleaned up the commit history so that it should now be easier to understand. However, there are still things to be done (see checklist in PR description).

@ghost ghost mentioned this pull request Jan 5, 2022
kiwmi/desktop/view.c Outdated Show resolved Hide resolved
include/desktop/toplevel.h Outdated Show resolved Hide resolved
@ghost
Copy link
Author

ghost commented Apr 3, 2022

This force-push is mostly renaming stuff and moving commits around iirc; there should be no real changes.

@ghost
Copy link
Author

ghost commented Apr 15, 2022

I’m planning only one change (plus the two minor TODOs somewhere in the code), namely getting rid of view::hidden. Just one TODO-question is left (it’s got a thread open somewhere above), can you pls help me decide on it?

The PR is ready for review, and if everything is okay, also for merge.

@ghost ghost marked this pull request as ready for review April 15, 2022 13:17
@ghost
Copy link
Author

ghost commented May 8, 2022

This force-push is mostly splitting commits; only minimal changes.

Comment on lines +24 to +26
KIWMI_STRATUM_LS_TOP,
KIWMI_STRATUM_LS_OVERLAY,
KIWMI_STRATUM_POPUPS,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other compositors have top, normal popups, fulscreen, overlay, overlay popups, but since kiwmi doesn’t support client-initiated fulscreen, i left it like this.

(This is just a note for later ig.)

@ghost ghost mentioned this pull request May 29, 2022
@ghost ghost mentioned this pull request Jun 20, 2022
include/desktop/desktop_surface.h Outdated Show resolved Hide resolved
tiosgz and others added 10 commits July 30, 2022 19:06
Also handle NULL output in output_damage().

Co-authored-by: Uks2 <tom@tomg.xyz>
This is a preparation for switching to the wlroots scene-graph. There is
no replacement planned for output:redraw() because it will no longer be
necessary (as far as i can tell), while scene-compatible replacements
for the view pre_render/post_render events are planned.
With the migration to wlr_scene, some objects (desktop, output etc)
will no longer have any reason to care about individual shells and
similar; handling each one on its own would introduce code that is,
from their perspective, over-complicated.

Strata (sg. stratum; this name was chosen to avoid confusion with the
over-used 'layer') represent logical layers of surfaces on the desktop,
such as every layer shell layer, one for xdg shell, another for popups.
At the moment it isn't used at all and a lot of data is duplicated. This
is a temporary state introduced for nicer diff separation into several
commits.
Apart from removing a lot of code, this commit also introduces (thanks
to wlr_scene) fine-grained damage tracking.

The lack of our own rendering code will only be an issue if the need for
custom effects (such as blur) arises; however, that's very unlikely and
it would probably require a lot of changes anyway.
Use it for getting the surface under cursor, position of surfaces, etc.
@buffet buffet merged commit 1781497 into buffet:master Jul 30, 2022
@buffet
Copy link
Owner

buffet commented Jul 30, 2022

Thank you very much!

@ghost ghost deleted the wlr-scene branch July 30, 2022 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants