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

Fix mesa rendering outside window borders on wayland #1518

Merged
merged 5 commits into from
Sep 23, 2018

Conversation

trimental
Copy link
Contributor

@trimental trimental commented Aug 20, 2018

This PR essentially reverts 62eb1e2 but fixes issue #1517.

Fixes #1536
Fixes #1517
Fixes #1282
Fixes #1227

@chrisduerr
Copy link
Member

Benchmarking this change it introduces a 3000% performance penalty on my X11/mesa system.

Running the alt-screen-random-write benchmark in vtebench the benchmark finishes in 4 seconds on the latest master and takes 2:03 minutes with this PR.

@jedahan
Copy link
Contributor

jedahan commented Aug 20, 2018

Is there a link to the relevant mesa bug?

@trimental
Copy link
Contributor Author

@chrisduerr I would be grateful if you could re-benchmark this PR with the latest commit 5e5e3ad to see if the performance issue still persists

Copy link
Member

@chrisduerr chrisduerr left a comment

Choose a reason for hiding this comment

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

The latest iteration on this PR solves the performance issues I've mentioned.

However there are still some minor issues I've noticed.

src/main.rs Outdated

// Draw the current state of the terminal
display.draw(terminal, &config, processor.selection.as_ref());
let terminal_clone = terminal.clone();
display.draw(terminal_clone, &config, processor.selection.as_ref());
Copy link
Member

Choose a reason for hiding this comment

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

I don't think cloning the terminal is necessary here. And it could cause issues when display.drawa ever wants to mutate the terminal. It should be possible to make use of the terminal without having to clone it.

Cloning the terminal is also very expensive, since there's a lot of state attached to it.

Also a small nitpick: I'd expect terminal_locked to be a bool, the name terminal_lock would be more appropriate here.

src/display.rs Show resolved Hide resolved
src/display.rs Outdated
let visual_bell_intensity = terminal_locked.visual_bell.intensity();

let background_color = terminal_locked.background_color();
self.last_background_color = background_color;
Copy link
Member

Choose a reason for hiding this comment

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

I think self.last_background_color is assigned here but never actually read, it should be removed if it's not required anymore.

src/display.rs Outdated
api.clear(background_color);
});

let mut terminal = terminal.lock();
// Clear dirty flag
Copy link
Member

Choose a reason for hiding this comment

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

An empty line before this comment would be nice to improve the visual clarity a bit.

src/display.rs Outdated
if background_color_changed {
api.clear(background_color);
}
api.clear(background_color);
Copy link
Member

Choose a reason for hiding this comment

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

Since the background is cleared previously, it should not be required to have this api.clear call anymore.

@chrisduerr
Copy link
Member

@jedahan According to the discussion in #410, the performance issue was never reported to mesa. I'm not 100% familiar with what's going on since I've never investigated it myself, but potentially it makes sense to report this upstream.

I probably makes sense either way for @jwilm to review this since iirc he's the only one who ever looked into this. Maybe it makes sense to report this upstream at this point? Even though this patch seems to 'do the job' at first glance.

Copy link
Member

@chrisduerr chrisduerr left a comment

Choose a reason for hiding this comment

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

Looks good to me. Blocked on @jwilm giving it a second review just to make sure that this doesn't introduce any issues that aren't immediately obvious.

@chrisduerr
Copy link
Member

So I just looked into my TODO and noticed that the issue #1227 seems like it might be affected by it.

So I tested things out and noticed that this PR also fixes a few other issues I've been struggling with for a long time.

In i3 when a new window is spawned, sometimes the old window is cleared without being properly redrawn. Another issue is that when closing a window (which grows the other tiled alacritty windows), the window would not visually resize itself until an event is received. Both these issues are solved with this PR.

@trimental
Copy link
Contributor Author

@chrisduerr wow that’s great, would you like me to change the PR naming to something more generic like ‘Fix clearing of display’ if this doesn’t just effect wayland?

@chrisduerr
Copy link
Member

I think it's fine the way it is right now. You can change it if you have an idea for a better title though. It can still be changed when merging though, so it's not a huge deal.

@ddevault
Copy link

Nice work. I tested a combined branch with #1403 and this on sway master (with wlroots) and it fixes the issue.

@ddevault ddevault mentioned this pull request Sep 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants