Skip to content

Commit 544ef13

Browse files
committed
x11display: fix crash with multithreading and NVIDIA driver
1 parent e32388c commit 544ef13

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

panda/src/x11display/x11GraphicsWindow.cxx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,23 @@ move_pointer(int device, int x, int y) {
218218
}
219219
}
220220

221+
/**
222+
* Clears the entire framebuffer before rendering, according to the settings
223+
* of get_color_clear_active() and get_depth_clear_active() (inherited from
224+
* DrawableRegion).
225+
*
226+
* This function is called only within the draw thread.
227+
*/
228+
void x11GraphicsWindow::
229+
clear(Thread *current_thread) {
230+
if (is_any_clear_active()) {
231+
// Evidently the NVIDIA driver may call glXCreateNewContext inside
232+
// prepare_display_region, so we need to hold the X11 lock.
233+
LightReMutexHolder holder(x11GraphicsPipe::_x_mutex);
234+
GraphicsOutput::clear(current_thread);
235+
}
236+
}
237+
221238
/**
222239
* This function will be called within the draw thread before beginning
223240
* rendering for a given frame. It should do whatever setup is required, and

panda/src/x11display/x11GraphicsWindow.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class x11GraphicsWindow : public GraphicsWindow {
3636

3737
virtual MouseData get_pointer(int device) const;
3838
virtual bool move_pointer(int device, int x, int y);
39+
40+
virtual void clear(Thread *current_thread);
3941
virtual bool begin_frame(FrameMode mode, Thread *current_thread);
4042
virtual void end_frame(FrameMode mode, Thread *current_thread);
4143

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy