From 6d5d803c5a27062dd9e031d72cc8185616e18666 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Fri, 20 Dec 2013 02:37:35 +0000 Subject: [PATCH] make all KHR and GREMEDY debugging code optional (but still enabled by default) git-svn-id: https://xpra.org/svn/Xpra/trunk@5010 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/xpra/client/gl/gl_window_backing.py | 65 +++++++++++++------------ 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/src/xpra/client/gl/gl_window_backing.py b/src/xpra/client/gl/gl_window_backing.py index f2067c32be..5984c03bed 100644 --- a/src/xpra/client/gl/gl_window_backing.py +++ b/src/xpra/client/gl/gl_window_backing.py @@ -5,6 +5,7 @@ # later version. See the file COPYING for details. #only works with gtk2: +import os from gtk import gdk assert gdk import gtk.gdkgl, gtk.gtkgl #@UnresolvedImport @@ -14,6 +15,7 @@ from xpra.log import Logger, debug_if_env log = Logger() debug = debug_if_env(log, "XPRA_OPENGL_DEBUG") +OPENGL_DEBUG = os.environ.get("XPRA_OPENGL_DEBUG", "1")=="1" from xpra.codecs.codec_constants import get_subsampling_divs @@ -44,37 +46,38 @@ glBindProgramARB, glProgramStringARB, GL_PROGRAM_ERROR_STRING_ARB, GL_PROGRAM_FORMAT_ASCII_ARB from OpenGL.GL.ARB.fragment_program import GL_FRAGMENT_PROGRAM_ARB from OpenGL.GL.ARB.framebuffer_object import GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, glGenFramebuffers, glBindFramebuffer, glFramebufferTexture2D -try: - from OpenGL.GL.KHR.debug import GL_DEBUG_OUTPUT, GL_DEBUG_OUTPUT_SYNCHRONOUS, glDebugMessageControl, glDebugMessageCallback, glInitDebugKHR -except ImportError: - debug("Unable to import GL_KHR_debug OpenGL extension. Debug output will be more limited.") - GL_DEBUG_OUTPUT = None - GL_DEBUG_OUTPUT_SYNCHRONOUS = None -try: - from OpenGL.GL.GREMEDY.string_marker import glInitStringMarkerGREMEDY, glStringMarkerGREMEDY - from OpenGL.GL.GREMEDY.frame_terminator import glInitFrameTerminatorGREMEDY, glFrameTerminatorGREMEDY - from OpenGL.GL import GLDEBUGPROC #@UnresolvedImport - def py_gl_debug_callback(source, error_type, error_id, severity, length, message, param): - log.error("src %x type %x id %x severity %x length %d message %s", source, error_type, error_id, severity, length, message) - gl_debug_callback = GLDEBUGPROC(py_gl_debug_callback) -except ImportError: - # This is normal- GREMEDY_string_marker is only available with OpenGL debuggers - gl_debug_callback = None - glInitStringMarkerGREMEDY = None - glStringMarkerGREMEDY = None - glInitFrameTerminatorGREMEDY = None - glFrameTerminatorGREMEDY = None -debug("OpenGL debugging settings: "+ - "GL_DEBUG_OUTPUT=%s, GL_DEBUG_OUTPUT_SYNCHRONOUS=%s"+ - "gl_debug_callback=%s, "+ - "glInitStringMarkerGREMEDY=%s, glStringMarkerGREMEDY=%s, glInitFrameTerminatorGREMEDY=%s, glFrameTerminatorGREMEDY=%s", - GL_DEBUG_OUTPUT, - GL_DEBUG_OUTPUT_SYNCHRONOUS, - gl_debug_callback, - glInitStringMarkerGREMEDY, - glStringMarkerGREMEDY, - glInitFrameTerminatorGREMEDY, - glFrameTerminatorGREMEDY) + + +#debugging variables: +GL_DEBUG_OUTPUT = None +GL_DEBUG_OUTPUT_SYNCHRONOUS = None +gl_debug_callback = None +glInitStringMarkerGREMEDY = None +glStringMarkerGREMEDY = None +glInitFrameTerminatorGREMEDY = None +glFrameTerminatorGREMEDY = None +if OPENGL_DEBUG: + try: + from OpenGL.GL.KHR.debug import GL_DEBUG_OUTPUT, GL_DEBUG_OUTPUT_SYNCHRONOUS, glDebugMessageControl, glDebugMessageCallback, glInitDebugKHR + except ImportError: + debug("Unable to import GL_KHR_debug OpenGL extension. Debug output will be more limited.") + try: + from OpenGL.GL.GREMEDY.string_marker import glInitStringMarkerGREMEDY, glStringMarkerGREMEDY + from OpenGL.GL.GREMEDY.frame_terminator import glInitFrameTerminatorGREMEDY, glFrameTerminatorGREMEDY + from OpenGL.GL import GLDEBUGPROC #@UnresolvedImport + def py_gl_debug_callback(source, error_type, error_id, severity, length, message, param): + log.error("src %x type %x id %x severity %x length %d message %s", source, error_type, error_id, severity, length, message) + gl_debug_callback = GLDEBUGPROC(py_gl_debug_callback) + except ImportError: + # This is normal- GREMEDY_string_marker is only available with OpenGL debuggers + debug("Unable to import GREMEDY OpenGL extension. Debug output will be more limited.") + debug("OpenGL debugging settings: "+ + "GL_DEBUG_OUTPUT=%s, GL_DEBUG_OUTPUT_SYNCHRONOUS=%s"+ + "gl_debug_callback=%s, "+ + "glInitStringMarkerGREMEDY=%s, glStringMarkerGREMEDY=%s, glInitFrameTerminatorGREMEDY=%s, glFrameTerminatorGREMEDY=%s", + GL_DEBUG_OUTPUT, GL_DEBUG_OUTPUT_SYNCHRONOUS, + gl_debug_callback, glInitStringMarkerGREMEDY, glStringMarkerGREMEDY, + glInitFrameTerminatorGREMEDY, glFrameTerminatorGREMEDY) from ctypes import c_char_p