x11display: fix crash with multithreading and NVIDIA driver

This commit is contained in:
rdb 2018-11-24 22:44:55 +01:00
parent e32388c2f8
commit 544ef137ee
2 changed files with 19 additions and 0 deletions

View File

@ -218,6 +218,23 @@ move_pointer(int device, int x, int y) {
}
}
/**
* Clears the entire framebuffer before rendering, according to the settings
* of get_color_clear_active() and get_depth_clear_active() (inherited from
* DrawableRegion).
*
* This function is called only within the draw thread.
*/
void x11GraphicsWindow::
clear(Thread *current_thread) {
if (is_any_clear_active()) {
// Evidently the NVIDIA driver may call glXCreateNewContext inside
// prepare_display_region, so we need to hold the X11 lock.
LightReMutexHolder holder(x11GraphicsPipe::_x_mutex);
GraphicsOutput::clear(current_thread);
}
}
/**
* This function will be called within the draw thread before beginning
* rendering for a given frame. It should do whatever setup is required, and

View File

@ -36,6 +36,8 @@ public:
virtual MouseData get_pointer(int device) const;
virtual bool move_pointer(int device, int x, int y);
virtual void clear(Thread *current_thread);
virtual bool begin_frame(FrameMode mode, Thread *current_thread);
virtual void end_frame(FrameMode mode, Thread *current_thread);