Implement workaround for Mesa issue
This addresses the issue where systems running Mesa drivers would be an order of magnitude slower than other terminals. With this patch, performance is nearly as good as with proprietary drivers. There is one caveat where, since the cause of slowness hasn't been removed, there is less time available for rendering on Mesa systems. I've benchmarked this on my system (i5-3570 @ 3.4GHz, GTX 680) using `time find /usr` with the following results: * ~2.0 seconds average with proprietary driver * ~2.3 seconds average with Mesa driver cc #125
This commit is contained in:
parent
c49d4a9365
commit
62eb1e2938
|
@ -202,6 +202,9 @@ impl Display {
|
|||
// need to be in the callback.
|
||||
let (tx, rx) = mpsc::channel();
|
||||
|
||||
// Clear screen
|
||||
renderer.with_api(config, &size_info, 0. /* visual bell intensity */, |api| api.clear());
|
||||
|
||||
let mut display = Display {
|
||||
window: window,
|
||||
renderer: renderer,
|
||||
|
@ -276,10 +279,11 @@ impl Display {
|
|||
self.window.set_title(&title);
|
||||
}
|
||||
|
||||
let size_info = *terminal.size_info();
|
||||
let visual_bell_intensity = terminal.visual_bell.intensity();
|
||||
|
||||
{
|
||||
let glyph_cache = &mut self.glyph_cache;
|
||||
let size_info = *terminal.size_info();
|
||||
let visual_bell_intensity = terminal.visual_bell.intensity();
|
||||
|
||||
// Draw grid
|
||||
{
|
||||
|
@ -291,8 +295,6 @@ impl Display {
|
|||
// TODO I wonder if the renderable cells iter could avoid the
|
||||
// mutable borrow
|
||||
self.renderer.with_api(config, &size_info, visual_bell_intensity, |mut api| {
|
||||
api.clear();
|
||||
|
||||
// Draw the grid
|
||||
api.render_cells(terminal.renderable_cells(config, selection), glyph_cache);
|
||||
});
|
||||
|
@ -313,5 +315,18 @@ impl Display {
|
|||
self.window
|
||||
.swap_buffers()
|
||||
.expect("swap buffers");
|
||||
|
||||
// Clear after swap_buffers when terminal mutex isn't held. Mesa for
|
||||
// some reason takes a long time to call glClear(). The driver descends
|
||||
// into xcb_connect_to_fd() which ends up calling __poll_nocancel()
|
||||
// which blocks for a while.
|
||||
//
|
||||
// By keeping this outside of the critical region, the Mesa bug is
|
||||
// worked around to some extent. Since this doesn't actually address the
|
||||
// issue of glClear being slow, less time is available for input
|
||||
// handling and rendering.
|
||||
self.renderer.with_api(config, &size_info, visual_bell_intensity, |api| {
|
||||
api.clear();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue