summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/debug_output.c
Commit message (Collapse)AuthorAgeFilesLines
* mesa: don't attempt to unlock an unlocked debug state mutexJonathan Gray2016-12-201-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 929fcee47e46781c57f2a354ce0a013915c033d1 introduced code that attempts to unlock an unlocked mutex which is undefined behaviour. On OpenBSD this leads to an abort: 0 0x0000124dadfa96ba in thrkill () at <stdin>:2 1 0x0000124dadf3da39 in *_libc_abort () at /usr/src/lib/libc/stdlib/abort.c:52 2 0x0000124d2c1165b5 in *_libpthread_pthread_mutex_unlock (mutexp=<optimized out>) at /usr/src/lib/librthread/rthread_sync.c:221 3 0x0000124d279c02e4 in init_attrib_groups (ctx=0x124df0fda000) at main/context.c:825 4 _mesa_initialize_context (ctx=ctx@entry=0x124df0fda000, api=api@entry=API_OPENGL_CORE, visual=visual@entry=0x7f7ffffbdfd0, share_list=share_list@entry=0x0, driverFunctions=driverFunctions@entry=0x7f7ffffbda60) at main/context.c:1204 5 0x0000124d27b507ec in st_create_context (api=api@entry=API_OPENGL_CORE, pipe=pipe@entry=0x124dc4910000, visual=visual@entry=0x7f7ffffbdfd0, share=share@entry=0x0, options=options@entry=0x7f7ffffbe128) at state_tracker/st_context.c:545 6 0x0000124d27b8639f in st_api_create_context (stapi=<optimized out>, smapi=0x124d1b608800, attribs=0x7f7ffffbe100, error=0x7f7ffffbe0fc, shared_stctxi=0x0) at state_tracker/st_manager.c:669 7 0x0000124d27cc5b9c in dri_create_context (api=<optimized out>, visual=0x124d8a0f8a00, cPriv=0x124de473f240, major_version=<optimized out>, minor_version=<optimized out>, flags=<optimized out>, notify_reset=false, error=0x7f7ffffbe2b4, sharedContextPrivate=0x0) at dri_context.c:123 8 0x0000124d27cc5029 in driCreateContextAttribs (screen=0x124d8a0f8400, api=<optimized out>, config=0x124d8a0f8a00, shared=<optimized out>, num_attribs=<optimized out>, attribs=<optimized out>, error=0x7f7ffffbe2b4, data=0x124d77814a00) at dri_util.c:448 9 0x0000124d8e109b00 in drisw_create_context_attribs (base=0x124df3e08700, config_base=0x124d7a0e7300, shareList=<optimized out>, num_attribs=<optimized out>, attribs=<optimized out>, error=0x7f7ffffbe2b4) at drisw_glx.c:476 10 0x0000124d8e104b4a in glXCreateContextAttribsARB (dpy=0x124d533f0000, config=0x124d7a0e7300, share_context=0x0, direct=1, attrib_list=0x7f7ffffbe300) at create_context.c:78 Signed-off-by: Jonathan Gray <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* mesa: Add missing call to _mesa_unlock_debug_state(ctx); v2Tom Stellard2016-11-171-1/+3
| | | | | | | | | | | | cd724208d3e1e3307f84a794f2c1fc83b69ccf8a added a call to _mesa_lock_debug_state(ctx) but wasn't unlocking the debug state. This fixes a hang in glsl-fs-loop piglit test with MESA_DEBUG=context. v2: - Remove unrelated changes. Reviewed-by: Brian Paul <[email protected]>
* mesa: if MESA_DEBUG=context, create a debug contextBrian Paul2016-11-161-0/+21
| | | | | | | | | | | | | | | | | | | A number of drivers report useful debug/perf information accessible through GL_ARB_debug_output and with debug contexts (i.e. setting the GLX_CONTEXT_DEBUG_BIT_ARB flag). But few applications actually use the GL_ARB_debug_output extension. This change lets one set the MESA_DEBUG env var to "context" to force-set a debug context and report debug/perf messages to stderr (or whatever file MESA_LOG_FILE is set to). This is a useful debugging tool. The small change in st_api_create_context() is needed so that st_update_debug_callback() gets called to hook up the driver debug callbacks when ST_CONTEXT_FLAG_DEBUG was not set, but MESA_DEBUG=context. v2: use %.*s format string instead of allocating temporary buffer. Reviewed-by: Nicolai Hähnle <[email protected]>
* mesa: Handle negative length in glPushDebugGroup().Kenneth Graunke2016-03-241-0/+3
| | | | | | | | | | | | | The KHR_debug spec doesn't actually say we should handle this, but that is most likely an oversight - it says to check against strlen and generate errors if length is negative. It appears they just forgot to explicitly spell out that we should then proceed to actually handle it. Fixes crashes from uncaught std::string exceptions in many dEQP-GLES31.functional.debug.error_filters.* tests. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* mesa: Make glDebugMessageInsert deal with negative length for all types.Kenneth Graunke2016-03-241-3/+4
| | | | | | | | | | | | | | | | | | | | From the KHR_debug spec, section 5.5.5 (Externally Generated Messages): "If <length> is negative, it is implied that <buf> contains a null terminated string. The error INVALID_VALUE will be generated if the number of characters in <buf>, excluding the null terminator when <length> is negative, is not less than the value of MAX_DEBUG_MESSAGE_LENGTH." This indicates that length should be set to strlen for all types, not just GL_DEBUG_TYPE_MARKER. We want it to be after validate_length() so we still generate appropriate errors. Fixes crashes from uncaught std::string exceptions in many dEQP-GLES31.functional.debug.error_filters.* tests. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* mesa: Include null terminator in GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH.Kenneth Graunke2016-03-241-1/+1
| | | | | | | | | | | | | | | | | | | From the KHR_debug spec: "Applications can query the number of messages currently in the log by obtaining the value of DEBUG_LOGGED_MESSAGES, and the string length (including its null terminator) of the oldest message in the log through the value of DEBUG_NEXT_LOGGED_MESSAGE_LENGTH." Because we weren't including the null terminator, many dEQP tests called glGetDebugMessageLog with a bufSize parameter that was 1 too small, and unable to contain the message, so we skipped returning it, failing many cases. Fixes 298 dEQP-GLES31.functional.debug.* tests. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Stephane Marchesin <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* mesa: Make glGet queries initialize ctx->Debug when necessary.Kenneth Graunke2016-03-031-14/+6
| | | | | | | | | | | | | | | | | | | | | | | dEQP-GLES31.functional.debug.state_query.debug_group_stack_depth_* tries to call glGet on GL_DEBUG_GROUP_STACK_DEPTH right away, before doing any other debug setup. This should return 1. However, because ctx->Debug wasn't allocated, we bailed and returned 0. This patch removes the open-coded locking and switches the two glGet functions to use _mesa_lock_debug_state(), which takes care of allocating and initializing that state on the first time. It also conveniently takes care of unlocking on failure for us, so we don't need to handle that in every caller. Fixes dEQP-GLES31.functional.debug.state_query.debug_group_stack_depth_ {getboolean,getfloat,getinteger,getinteger64}. Cc: [email protected] Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* mesa: move GL_ARB_debug_output code into new debug_output.c fileBrian Paul2016-02-081-0/+1301
The errors.c file had grown quite large so split off this extension code into its own file. This involved making a handful of functions non-static. Acked-by: Timothy Arceri <[email protected]>