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

hwcomposer: Use dummy buffer as window background in subsurface mode #12

Merged
merged 4 commits into from
Aug 26, 2022

Conversation

dos1
Copy link
Contributor

@dos1 dos1 commented Aug 19, 2022

HWC assumes that there's an implicit solid black layer below all the other layers to compose onto. Since we already have a dummy buffer attached to the xdg-toplevel surface, it can be used to provide that background in single window mode, which fixes some apps having transparent background in unexpected places. Thanks to wp_viewporter, the buffer can still be just a single pixel, which gets upscaled to cover the whole window by the compositor.

Since multi window mode relies on the background being transparent, keep it that way there by allowing to specify window background color in create_window.

When the background is transparent, we don't want it to consume any input events.

Similarly, when the background is fully opaque, we know that the whole surface is opaque too, so we can mark it as such to allow the Wayland compositor to optimize its drawing.

Also, don't leak the dummy wl_buffer on window destroy.

@aleasto
Copy link
Member

aleasto commented Aug 25, 2022

There's some viewport references that i think were meant for #22 that makes this not compile.

Perhaps prepare a merge request with all the commits rebased to avoid further conflicts

This merges and builds clean after #22 that defines the viewporter, but #22 is broken for me.

@dos1
Copy link
Contributor Author

dos1 commented Aug 26, 2022

Rebased and fixed. This MR doesn't depend on #22, I just messed it up when splitting things out.

HWC assumes that there's an implicit solid black layer below all the
other layers to compose onto. Since we already have a dummy buffer
attached to the xdg-toplevel surface, it can be used to provide
that background in single window mode, which fixes some apps having
transparent background in unexpected places. Thanks to wp_viewporter,
the buffer can still be just a single pixel, which gets upscaled to
cover the whole window by the compositor.

Since multi window mode relies on the background being transparent,
keep it that way there by allowing to specify window background color
in create_window.
When the background is transparent, we don't want it to consume
any input events.

Similarly, when the background is fully opaque, we know that
the whole surface is opaque too, so we can mark it as such
to allow the Wayland compositor to optimize its drawing.
@aleasto aleasto merged commit 242bb20 into waydroid:lineage-17.1 Aug 26, 2022
@aleasto
Copy link
Member

aleasto commented Aug 29, 2022

@dos1 looks like the ubports compositor doesn't implement viewporter so this (as well as your other changes involving the viewporter) breaks compositing there...

@dos1
Copy link
Contributor Author

dos1 commented Aug 30, 2022

Ah, yeah. Any reasonably modern compositor should already support viewports, but well, UBport's Mir sure doesn't qualify to such title...

Won't be a big deal though, it's just a matter of sprinkling stuff with bunch of ifs. Of course crops will stay broken on such compositors, but at least the background can still be provided by creating a full-sized buffer instead.

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