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

[WIP] bumpmaps - rework and turn on #8428

Closed
wants to merge 20 commits into from
Closed

Conversation

brownsr
Copy link
Member

@brownsr brownsr commented Feb 27, 2019

This reworks, enables, and extends the previous background effect facility that was turned off in the past as it was broken.

There are two possible background effects - bumpmap and blur. Both are turned on by CSS, and can be layered on each other if desired.
example CSS

background-bumpmap: url("/usr/share/cinnamon/bumpmaps/hex.png");
background-blur: 1px;

Note that the size of the blur is treated as an iteration count. So background-blur: 1px is the basic effect, while background-blur: 2px applies the effect again on top of itself, and so on. The basic blur is relatively mild, twice is stronger, anything above 3 is overkill IMO.
Speeds seem fine with no noticeable speed penalty unless a large blur count is put in for test purposes.

The blur effect is probably the more useful. The bumpmap effect looks dramatic on a background, but rubbish over something like a text file being edited.

The effect works by snapshotting the screen underneath an actor, applying the effect to it, and then drawing it out as the lowest layer in the process of drawing an actor. There are no restrictions as to what can be layered on it, though clearly you won't want to put something without transparency over it or the effect would be hidden.

In the screenshots below the bumpmap is shown with nothing layered on it. The blur is shown with a semi-transparent background-gradient on top of it.

screenshot from 2018-04-08 13-59-20

screenshot from 2018-04-08 13-58-16

NB screenshots were taken before the masking code to allow rounded corners was added.

Copy link
Contributor

@jaszhix jaszhix left a comment

Choose a reason for hiding this comment

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

Hi @brownsr, I was seeing if I could test this with Cinnamenu, and it appears to only show the desktop wallpaper. I'm applying this to the popup-menu-content class (only one that seemed to show the bump map), and opacifying every actor underneath.

image

Speeds seem fine with no noticeable speed penalty unless a large blur count is put in for test purposes.

I'm also concerned about performance. My initial impression with no effects applied to CSS is performance is regressing and window rendering becomes further out of sync with the cursor. This is noticeable for me on my Xeon/Nvidia desktop I do most benchmarking on.

I am applying this on top of master + linuxmint/muffin#410 + linuxmint/muffin#397 + #8269 + #8300. At least the first issue might be a base branch cause, but at the same time could also be Cinnamenu's actor hierarchy, so not sure but can test more this weekend, along with some compositing benchmarks. When returning to Cinnamon without this PR applied, I can only describe it as "much snappier".

// bumpmap_path,
// NULL);
{
if ((theme_node->background_blur > 0 || theme_node->background_bumpmap)
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be good to do these logical comparisons when the change in CSS is detected, instead of on every paint.

Copy link
Member Author

@brownsr brownsr Mar 24, 2019

Choose a reason for hiding this comment

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

Perhaps, if I could work out how to do that, but there's only a couple of very fast and cheap tests here, so I can't imagine any practicable difference.

Copy link
Member Author

@brownsr brownsr Mar 24, 2019

Choose a reason for hiding this comment

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

i.e. the work to set up the effects is only done the first time through, and after that there there is just a check to see if it exists. So only the first time through takes time if either of the effect types are there in the CSS, and after that there is just a simple if test, which should take a miniscule time. I can't see any effect on performance myself if the effects are not in the CSS.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see an impact on performance immediately upon using Cinnamon with no CSS changes. You are adding a lot of code to St's paint function. Please try testing in higher resolutions.

src/st/st-widget.c Outdated Show resolved Hide resolved
src/st/st-widget.c Outdated Show resolved Hide resolved
{
st_widget_recompute_style (widget, old_theme_node);

st_widget_add_background_effects(widget, old_theme_node);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can check if the theme node is eligible before calling st_widget_add_background_effects? We should know after st_widget_recompute_style.

Copy link
Member Author

@brownsr brownsr Mar 24, 2019

Choose a reason for hiding this comment

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

I think that will just move the tests in the function to be done preceding it. I don't think there will be any improvement.

Copy link
Contributor

Choose a reason for hiding this comment

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

After #8230 is merged, you could piggy-back off of the change condition I added, to give some idea. I find it hard to believe you can say there will be no improvement on something you haven't tried yet.

static void st_widget_add_background_effects (StWidget *widget,
StThemeNode *old_theme_node )
{
StThemeNode *new_theme_node = st_widget_get_theme_node (widget);
Copy link
Contributor

Choose a reason for hiding this comment

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

We could probably make st_widget_recompute_style return the new_theme_node passed as an argument to this function and avoid a function invocation in the paint cycle.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but this function is also called without being preceded by recompute_style, so that won't work in that instance.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds like a lot of overhead for a feature maybe 25% of Cinnamon users will take advantage of (optimistically).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but remember I am only re-implementing something that was already there and had to be turned off last time because it was broken. There's no hurry as far as I am concerned. With all the major performance / latency stuff that you've done, the last thing I want to do is to compromise that. So right now I am waiting for the dust to settle, maybe next release, before looking at this PR again and seeing how it might be improved.

src/st/st-widget.c Outdated Show resolved Hide resolved
{
if (widget->priv->background_blur_effect != NULL)
{
g_object_run_dispose (G_OBJECT (widget->priv->background_blur_effect));
Copy link
Contributor

Choose a reason for hiding this comment

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

In st_widget_recompute_style, we know if the style has changed, so it might be good to use that boolean state instead of assuming any processing is needed because there is an old theme node.

Copy link
Member Author

@brownsr brownsr Mar 24, 2019

Choose a reason for hiding this comment

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

Yes, I can see that might be possible in that case. But this function is also called when there is no style change. Could potentially separate out into two functions, perhaps i.e. have one dedicated to just the case where there is a style change. I can't see there would be a speed improvement, but it could possibly make the code a tiny bit easier to follow, probably at the cost of a bit more code.

Copy link
Contributor

Choose a reason for hiding this comment

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

We have a private struct used by this class, so we can check if the style has changed, and guard this more. This is a paint function, and it will impact latency, even when the user is not interacting with the Cinnamon UI - it is part of the stage.

src/st/st-background-effect.c Outdated Show resolved Hide resolved
@brownsr
Copy link
Member Author

brownsr commented Mar 7, 2019 via email

@clefebvre
Copy link
Member

Hi guys, I'm prefixing it as WIP for the time being.

@clefebvre clefebvre changed the title background effects - rework and turn on [WIP] bumpmaps - rework and turn on Mar 19, 2019
@brownsr
Copy link
Member Author

brownsr commented Mar 24, 2019

Just working through some of these now. Yes, it does show some odd things if you put it on .popup-menu-content. Not quite sure where .popup-menu-content fits in the processing for popups, but putting it here does not shapshot the screen background, perhaps something to do with the processing of the various layers in the menu. It also does not use the radiused corners of the popup as a whole, presumably because this element of CSS does not need to have matching radiused corners defined generally. It works fine in .menu though.

@linuxmint linuxmint deleted a comment Mar 24, 2019
@brownsr brownsr changed the title [WIP] bumpmaps - rework and turn on bumpmaps - rework and turn on Mar 30, 2019
@brownsr brownsr changed the title bumpmaps - rework and turn on [Next] bumpmaps - rework and turn on Jun 12, 2019
@clefebvre clefebvre changed the title [Next] bumpmaps - rework and turn on bumpmaps - rework and turn on Aug 19, 2019
@brownsr
Copy link
Member Author

brownsr commented Oct 16, 2019

@clefebvre I'm not planning further work on this, as far as I am concerned it's been ready to pull since the last changes in March.

@brownsr brownsr changed the title bumpmaps - rework and turn on [WIP]bumpmaps - rework and turn on Oct 29, 2019
@brownsr
Copy link
Member Author

brownsr commented Oct 29, 2019

Segfault during testing, so back to WIP.

@clefebvre clefebvre changed the title [WIP]bumpmaps - rework and turn on [WIP] bumpmaps - rework and turn on Nov 20, 2019
@HiroshiAhsan
Copy link

Brownsr, any progress on this PR?

@filuslolol
Copy link

Is this still being worked on?

@KAMI911
Copy link

KAMI911 commented Nov 7, 2021

What an interesting feature. It is sad to see that the development stalled.

@akirapink
Copy link

if this isn't being worked on by @brownsr anymore, would it be fair for someone else to come in, take the proposed changes from this, and finish the implementation work?

@aMyTimed
Copy link

I would love to see this implemented into Cinnamon! Windows like the terminal would look so much better with transparency and blur.

@echuber2
Copy link

echuber2 commented May 5, 2022

Segfault during testing, so back to WIP.

Is there information about what exactly had segfaulted? Is there a test case that's still reproducible? Does this need to be started over from scratch given how much time has passed?

@rdlf4
Copy link

rdlf4 commented Aug 1, 2022

Segfault during testing, so back to WIP.

Is there information about what exactly had segfaulted? Is there a test case that's still reproducible? Does this need to be started over from scratch given how much time has passed?

We're left with no answers. No way to reproduce, no info on repository, let alone what is required and what dependencies need to be taken care of, cinnamon compilation instructions, additional files or github links. Nada.
It's almost as if the foundation of Cinnamon were so sensitive that they don't feel like sharing anything about it or letting anyone in. And when we look for those answers ourselves, we typically end up with a NOT FOUND page or a project lost in time, which was started by a random person (not the linuxmint team, of course) and then "real life called, and they had to abandon it".
And that's exactly how your linux mint 21 experience is going to be like, just as the previous version.

@akirapink
Copy link

akirapink commented Aug 2, 2022

god, i can't believe linux mint dev team bad¹
[1] don't have enough resources or at worst are putting them in the wrong places and thus doing work that has somewhat subpar results

which, is a shame!! because cinnamon is a really cool desktop environment imo - it's a bit buggy, but it gets way less love than it deserves and xapps are like...the only competition to gnome apps i've found to be comfortable at all

( i really hope what happened to firefox/mozilla doesn't happen to linux mint, where the once gold standard loses its focus from bad management but noone has the resources to fork it properly and now they're making....5 built-in themes with bad text contrast, for a limited time? with all that donation money ( are last update's mint-y tweaks comparable to colorways? ) )

@rdlf4 so like, what do you suggest we (not me or anyone specific, people somewhat critical of mint in general) do about it?

@rdlf4
Copy link

rdlf4 commented Aug 3, 2022

god, i can't believe linux mint dev team bad¹ [1] don't have enough resources or at worst are putting them in the wrong places and thus doing work that has somewhat subpar results

which, is a shame!! because cinnamon is a really cool desktop environment imo - it's a bit buggy, but it gets way less love than it deserves and xapps are like...the only competition to gnome apps i've found to be comfortable at all

( i really hope what happened to firefox/mozilla doesn't happen to linux mint, where the once gold standard loses its focus from bad management but noone has the resources to fork it properly and now they're making....5 built-in themes with bad text contrast, for a limited time? with all that donation money ( are last update's mint-y tweaks comparable to colorways? ) )

@rdlf4 so like, what do you suggest we (not me or anyone specific, people somewhat critical of mint in general) do about it?

Alright, you're bringing a lot to the table here, so I feel like focusing on what's being discussed - in no way do I wish the Mint team to lose focus on supporting Cinnamon -- matter of fact, by restyling Cinnamon means supporting it even further, but on the visual style department.
And it's not like the community wants a KDE 2.0 (gosh why did you even drag KDE into this?), No, it's not that! It's just that blatant solid color that's been there for all these years, that has to change. And BECAUSE TRANSPARENT CINNAMON THEMES are very popular - and therefore a common topic, by adding Blur effect on top of it, system elements/controls such as Menu, panel, applets, etc would benefit by looking more modern and offering a fresh redesign.
And lets not kid ourselves here, we know that Blur does impact the system if implemented poorly or with the wrong settings, which could lead to GPU meltdown (a little bit of exaggeration there, but you get the picture) - that's what Cinnamon tweak settings should be for.

So give us Blur, and let us play around with it. Those with a beefier apu from a desktop computer can make it look prettier than those with a mobile apu, so having options to suit our needs and system settings is important.
And for those who are like "Oh what's the problem looking the same after all these years?" all I can say is fine. You don't want it, that's on you. But nothing remains looking the same over time, and offering Cinnamon a more modern look shows that the team is keeping up with the time and with the community's request. (We've been trying this by ourselves after all, so why turn a blind eye on it?)

Don't get it twisted, I'm not saying "do it today! Or tomorrow! Or for the next release!" No, I'm asking the team to bring their attention to this topic and feature request, tell us how do-able it is with the current version of Cinnamon (does it allow for such a thing without compromising the Cinnamon team's agenda? Could it be done in an official way, meaning further supported for future Linux Mint releases?) - so some clarification from the team on this topic would be a nice place to start from.

I'm sorry for the long post.

@akirapink
Copy link

akirapink commented Aug 4, 2022

@rdlf4 oh! yeah
if they can't do it now, that's alright, but it feels really odd that they haven't done it with how many cinnamon themes use transparency
which got me suspecting maybe there could be mismanagement on how what resources are allocated to what stuff but that's just a gut feeling i took way too far
sorry about that,

mtwebster added a commit to mtwebster/Cinnamon that referenced this pull request May 2, 2023
mtwebster added a commit to mtwebster/Cinnamon that referenced this pull request May 2, 2023
@mtwebster
Copy link
Member

Merged via 6aeeb22

@mtwebster mtwebster closed this Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet