mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 00:32:57 -04:00
glxdisplay: grab X11 lock around various GLX calls
This commit is contained in:
parent
254cea63bb
commit
0a1b6df648
@ -71,7 +71,10 @@ begin_frame(FrameMode mode, Thread *current_thread) {
|
|||||||
|
|
||||||
glxGraphicsStateGuardian *glxgsg;
|
glxGraphicsStateGuardian *glxgsg;
|
||||||
DCAST_INTO_R(glxgsg, _gsg, false);
|
DCAST_INTO_R(glxgsg, _gsg, false);
|
||||||
glXMakeCurrent(_display, _pbuffer, glxgsg->_context);
|
{
|
||||||
|
LightReMutexHolder holder(glxGraphicsPipe::_x_mutex);
|
||||||
|
glXMakeCurrent(_display, _pbuffer, glxgsg->_context);
|
||||||
|
}
|
||||||
|
|
||||||
// Now that we have made the context current to a window, we can reset the
|
// Now that we have made the context current to a window, we can reset the
|
||||||
// GSG state if this is the first time it has been used. (We can't just
|
// GSG state if this is the first time it has been used. (We can't just
|
||||||
@ -125,6 +128,7 @@ end_frame(FrameMode mode, Thread *current_thread) {
|
|||||||
void glxGraphicsBuffer::
|
void glxGraphicsBuffer::
|
||||||
close_buffer() {
|
close_buffer() {
|
||||||
if (_gsg != nullptr) {
|
if (_gsg != nullptr) {
|
||||||
|
LightReMutexHolder holder(glxGraphicsPipe::_x_mutex);
|
||||||
glXMakeCurrent(_display, None, nullptr);
|
glXMakeCurrent(_display, None, nullptr);
|
||||||
|
|
||||||
if (_pbuffer != None) {
|
if (_pbuffer != None) {
|
||||||
@ -179,6 +183,8 @@ open_buffer() {
|
|||||||
|
|
||||||
nassertr(glxgsg->_supports_pbuffer, false);
|
nassertr(glxgsg->_supports_pbuffer, false);
|
||||||
|
|
||||||
|
LightReMutexHolder holder(glxGraphicsPipe::_x_mutex);
|
||||||
|
|
||||||
static const int max_attrib_list = 32;
|
static const int max_attrib_list = 32;
|
||||||
int attrib_list[max_attrib_list];
|
int attrib_list[max_attrib_list];
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
@ -74,7 +74,10 @@ begin_frame(FrameMode mode, Thread *current_thread) {
|
|||||||
|
|
||||||
glxGraphicsStateGuardian *glxgsg;
|
glxGraphicsStateGuardian *glxgsg;
|
||||||
DCAST_INTO_R(glxgsg, _gsg, false);
|
DCAST_INTO_R(glxgsg, _gsg, false);
|
||||||
glXMakeCurrent(_display, _glx_pixmap, glxgsg->_context);
|
{
|
||||||
|
LightReMutexHolder holder(glxGraphicsPipe::_x_mutex);
|
||||||
|
glXMakeCurrent(_display, _glx_pixmap, glxgsg->_context);
|
||||||
|
}
|
||||||
|
|
||||||
// Now that we have made the context current to a window, we can reset the
|
// Now that we have made the context current to a window, we can reset the
|
||||||
// GSG state if this is the first time it has been used. (We can't just
|
// GSG state if this is the first time it has been used. (We can't just
|
||||||
@ -127,6 +130,7 @@ end_frame(FrameMode mode, Thread *current_thread) {
|
|||||||
*/
|
*/
|
||||||
void glxGraphicsPixmap::
|
void glxGraphicsPixmap::
|
||||||
close_buffer() {
|
close_buffer() {
|
||||||
|
LightReMutexHolder holder(glxGraphicsPipe::_x_mutex);
|
||||||
if (_gsg != nullptr) {
|
if (_gsg != nullptr) {
|
||||||
glXMakeCurrent(_display, None, nullptr);
|
glXMakeCurrent(_display, None, nullptr);
|
||||||
_gsg.clear();
|
_gsg.clear();
|
||||||
@ -197,6 +201,7 @@ open_buffer() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LightReMutexHolder holder(glxGraphicsPipe::_x_mutex);
|
||||||
_x_pixmap = XCreatePixmap(_display, _drawable,
|
_x_pixmap = XCreatePixmap(_display, _drawable,
|
||||||
get_x_size(), get_y_size(), visual_info->depth);
|
get_x_size(), get_y_size(), visual_info->depth);
|
||||||
if (_x_pixmap == None) {
|
if (_x_pixmap == None) {
|
||||||
|
@ -64,6 +64,7 @@ glxGraphicsStateGuardian(GraphicsEngine *engine, GraphicsPipe *pipe,
|
|||||||
*/
|
*/
|
||||||
glxGraphicsStateGuardian::
|
glxGraphicsStateGuardian::
|
||||||
~glxGraphicsStateGuardian() {
|
~glxGraphicsStateGuardian() {
|
||||||
|
LightReMutexHolder holder(glxGraphicsPipe::_x_mutex);
|
||||||
destroy_temp_xwindow();
|
destroy_temp_xwindow();
|
||||||
if (_visuals != nullptr) {
|
if (_visuals != nullptr) {
|
||||||
XFree(_visuals);
|
XFree(_visuals);
|
||||||
@ -224,6 +225,7 @@ choose_pixel_format(const FrameBufferProperties &properties,
|
|||||||
X11_Display *display,
|
X11_Display *display,
|
||||||
int screen, bool need_pbuffer, bool need_pixmap) {
|
int screen, bool need_pbuffer, bool need_pixmap) {
|
||||||
|
|
||||||
|
LightReMutexHolder holder(glxGraphicsPipe::_x_mutex);
|
||||||
_display = display;
|
_display = display;
|
||||||
_screen = screen;
|
_screen = screen;
|
||||||
_context = nullptr;
|
_context = nullptr;
|
||||||
@ -457,6 +459,7 @@ gl_get_error() const {
|
|||||||
*/
|
*/
|
||||||
void glxGraphicsStateGuardian::
|
void glxGraphicsStateGuardian::
|
||||||
query_gl_version() {
|
query_gl_version() {
|
||||||
|
LightReMutexHolder holder(glxGraphicsPipe::_x_mutex);
|
||||||
PosixGraphicsStateGuardian::query_gl_version();
|
PosixGraphicsStateGuardian::query_gl_version();
|
||||||
|
|
||||||
show_glx_client_string("GLX_VENDOR", GLX_VENDOR);
|
show_glx_client_string("GLX_VENDOR", GLX_VENDOR);
|
||||||
@ -483,6 +486,7 @@ query_gl_version() {
|
|||||||
*/
|
*/
|
||||||
void glxGraphicsStateGuardian::
|
void glxGraphicsStateGuardian::
|
||||||
get_extra_extensions() {
|
get_extra_extensions() {
|
||||||
|
LightReMutexHolder holder(glxGraphicsPipe::_x_mutex);
|
||||||
save_extensions(glXQueryExtensionsString(_display, _screen));
|
save_extensions(glXQueryExtensionsString(_display, _screen));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -497,6 +501,8 @@ do_get_extension_func(const char *name) {
|
|||||||
nassertr(name != nullptr, nullptr);
|
nassertr(name != nullptr, nullptr);
|
||||||
|
|
||||||
if (glx_get_proc_address) {
|
if (glx_get_proc_address) {
|
||||||
|
LightReMutexHolder holder(glxGraphicsPipe::_x_mutex);
|
||||||
|
|
||||||
// First, check if we have glXGetProcAddress available. This will be
|
// First, check if we have glXGetProcAddress available. This will be
|
||||||
// superior if we can get it.
|
// superior if we can get it.
|
||||||
|
|
||||||
|
@ -154,6 +154,8 @@ end_flip() {
|
|||||||
*/
|
*/
|
||||||
void glxGraphicsWindow::
|
void glxGraphicsWindow::
|
||||||
close_window() {
|
close_window() {
|
||||||
|
LightReMutexHolder holder(glxGraphicsPipe::_x_mutex);
|
||||||
|
|
||||||
if (_gsg != nullptr) {
|
if (_gsg != nullptr) {
|
||||||
glXMakeCurrent(_display, None, nullptr);
|
glXMakeCurrent(_display, None, nullptr);
|
||||||
_gsg.clear();
|
_gsg.clear();
|
||||||
@ -204,6 +206,8 @@ open_window() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LightReMutexHolder holder(glxGraphicsPipe::_x_mutex);
|
||||||
|
|
||||||
if (glxgsg->_fbconfig != None) {
|
if (glxgsg->_fbconfig != None) {
|
||||||
setup_colormap(glxgsg->_fbconfig);
|
setup_colormap(glxgsg->_fbconfig);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user