summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/errors.c
Commit message (Collapse)AuthorAgeFilesLines
* android: print debug info to logcatWuZhen2016-11-011-0/+8
| | | | | | | | | | Redirect logs printed to stderr to logcat. NO_REF_TASK Tested: local run Change-Id: I58e3966a608af361b86c54b4c95a92561b711968 Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
* mesa: move GL_ARB_debug_output code into new debug_output.c fileBrian Paul2016-02-081-1273/+13
| | | | | | | | 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 <timothy.arceri@collabora.com>
* mesa: wire up EmitStringMarker for KHR_debugRob Clark2016-01-211-0/+7
| | | | | | | | | | | | The extension spec[1] describes DEBUG_TYPE_MARKER as "Annotation of the command stream". So for DEBUG_TYPE_MARKER, also pass the buf to the driver's EmitStringMarker() to be inserted in the command stream. [1] https://www.opengl.org/registry/specs/KHR/debug.txt Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* mesa: add GREMEDY_string_markerRob Clark2016-01-211-0/+13
| | | | | Signed-off-by: Rob Clark <robclark@freedesktop.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* mesa: rework the meaning of gl_debug_message::lengthEmil Velikov2015-12-031-16/+24
| | | | | | | | | | | | | | | | | | | Currently it stores strlen(buf) whenever the user originally provided a negative value for length. Although I've not seen any explicit text in the spec, CTS requires that the very same length (be that negative value or not) is returned back on Pop. So let's push down the length < 0 checks, tweak the meaning of gl_debug_message::length and fix GetDebugMessageLog to add and count the null terminators, as required by the spec. v2: return correct total length in GetDebugMessageLog v3: rebase (drop _mesa_shader_debug hunk). Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
* mesa: errors: validate the length of null terminated stringEmil Velikov2015-12-031-3/+17
| | | | | | | | | We're about to rework the meaning of gl_debug_message::length to only store the user provided data. Thus we should add an explicit validation for null terminated strings. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
* mesa: accept TYPE_PUSH/POP_GROUP with glDebugMessageInsertEmil Velikov2015-12-031-1/+1
| | | | | | | | | | | | | | | | | | These new (relative to ARB_debug_output) tokens, have been explicitly separated from the existing ones in the spec text. With the reference to glDebugMessageInsert was dropped. At the same time, further down the spec says: "The value of <type> must be one of the values from Table 5.4" ... and these two are listed in Table 5.4. The GL 4.3 and GLES 3.2 do not give any hints on the former 'definition', plus CTS requires that the tokens are valid values for glDebugMessageInsert. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
* mesa: add SEVERITY_NOTIFICATION to default stateEmil Velikov2015-12-031-2/+3
| | | | | | | | | | | | As per the spec quote: "All messages are initially enabled unless their assigned severity is DEBUG_SEVERITY_LOW" We already had MEDIUM and HIGH set, let's toggle NOTIFICATION as well. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
* mesa: return the correct value for GroupStackDepthEmil Velikov2015-12-031-1/+1
| | | | | | | | We already have one group (the default) as specified in the spec. So lets return its size, rather than the index of the current group. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
* mesa: rename GroupStackDepth to CurrentGroupEmil Velikov2015-12-031-16/+16
| | | | | | | | | The variable is used as the actual index, rather than the size of the group stack - rename it to reflect that. Suggested-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
* mesa: remove len argument from _mesa_shader_debug()Emil Velikov2015-11-291-6/+5
| | | | | | | | | | There was only a single user which was using strlen(buf). As this function is not user facing (i.e. we don't need to feed back original length via a callback), we can simplify things. Suggested-by: Timothy Arceri <timothy.arceri@collabora.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
* mesa: remove unused var in _mesa_PushDebugGroup()Brian Paul2015-11-201-1/+0
| | | | Trivial.
* mesa: use the correct string for the ES GL_KHR_debug functionsEmil Velikov2015-11-201-7/+33
| | | | | | | | | As defined in the spec when implemented in an OpenGL ES context, all entry points defined by this extension must have a "KHR" suffix. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
* mesa: Rename _mesa_lookup_enum_by_nr() to _mesa_enum_to_string().Kenneth Graunke2015-07-201-2/+2
| | | | | | | Generated by sed; no manual changes. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: Add a va_args variant of _mesa_gl_debug().Kenneth Graunke2015-06-231-8/+21
| | | | | | | | This will be useful for wrapper functions. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
* mesa: Include simple_list.h explicitly in errors.c.Francisco Jerez2015-06-091-0/+1
| | | | | | | This seems to be the only user of simple_list in core mesa not including the header explicitly. Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: add _mesa_log(), _mesa_get_log_file() functionsBrian Paul2015-04-151-7/+36
| | | | | | | | | | _mesa_log() simply writes log information to stderr or MESA_LOG_FILE. _mesa_get_log_file() returns the file handle to use for logging. This will be used for shader dumping/logging instead of always printing to stderr. Reviewed-by: José Fonseca <jfonseca@vmware.com>
* mesa: include stdio.h where neededBrian Paul2015-03-051-0/+1
| | | | | | | Instead of relying on glapi.h or some other header to provide it. Acked-by: Matt Turner <mattst88@gmail.com> Reviewed-by: José Fonseca <jfonseca@vmware.com>
* mesa/main: replace Elements() with ARRAY_SIZE()Brian Paul2015-03-021-3/+3
| | | | | | | | We've been using a mix of these two macros for a while now. Let's just use the later everywhere. It seems to be the convention used by other open-source projects. Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
* mesa: include stdarg.h only where it's usedBrian Paul2015-02-261-0/+1
| | | | | Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
* mesa: Use assert() instead of ASSERT wrapper.Matt Turner2015-02-231-2/+2
| | | | Acked-by: Eric Anholt <eric@anholt.net>
* mesa: Fix some signed-unsigned comparison warningsJan Vesely2015-01-211-4/+4
| | | | | | | | v2: s/unsigned int/unsigned/ in prog_optimize.c Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> Reviewed-by: David Heidelberg <david@ixit.cz> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
* mesa: Add a source parameter to _mesa_gl_debug.Matt Turner2014-12-051-1/+2
| | | | | Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* mesa: protect the debug state with a mutexChia-I Wu2014-10-301-47/+125
| | | | | | | | | | We are about to change mesa to spawn threads for deferred glCompileShader and glLinkProgram, and we need to make sure those threads can send compiler warnings/errors to the debug output safely. Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* mesa: Drop _mesa_getenv() wrapper.Matt Turner2014-09-241-3/+3
| | | | | | Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* mesa: Unifdef _WIN32_WCE.Matt Turner2014-09-241-1/+1
| | | | | | Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* util: Move the open-addressing linear-probing hash_table to src/util.Kenneth Graunke2014-08-041-1/+1
| | | | | | | | | | | | | | | | | This hash table is used in core Mesa, the GLSL compiler, and the i965 driver, which makes it a good candidate for the new src/util module. It's much faster than program/hash_table.[ch] (see commit 6991c2922f5 for data), and José's u_hash_table.c has a comment saying Gallium should probably consider switching to a linear probing hash table at some point. So this seems like the best candidate for a shared data structure. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> v2 (Jason Ekstrand): Pick up another hash_table use and patch up scons Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
* mesa: Add _mesa_error_no_memory for logging out-of-memory messagesIan Romanick2014-05-021-0/+6
| | | | | | | | | | This can be called from locations that don't have a context pointer handy. This patch also adds enough infrastructure so that the unit tests for the GLSL compiler and the stand-alone compiler will build and function. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
* mesa: overhaul debug namespace supportChia-I Wu2014-04-271-178/+88
| | | | | | | | | | | | | | | | | | _mesa_HashTable is not well-suited for us: it locks a mutex unnecessarily and it does not accept 0 as the key (and have branches to handle 1 specially). What we really need is a sparse array. Whether it should be implemented as a hash table, a list, or a bsearch()-able array requires investigations of the use models. We choose to implement it as a list for now, assuming it is common to have a short list of IDs in each (source, type) namespace. The code is simpler, and the memory footprint is lower. This also fixes several corner cases such as making messages to have different states at different severities. v2: use GLbitfield for State/DefaultState, and add a comment Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: delay copying of debug groupsChia-I Wu2014-04-271-41/+89
| | | | | | | | | | | | Do not copy the debug group until it is about to be written. One likely scenario of using glPushDebugGroup/glPopDebugGroup is to enclose a sequence of GL commands and give them a human-readable description. There is no message control change in this scenario, and thus no need to copy. This also reduces the initial size of gl_debug_state from 306KB to 7KB. Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: clean up debug output namespace handlingChia-I Wu2014-04-271-139/+211
| | | | | | | | | | | | | | | | | | Add functions to provide these operations on a struct gl_debug_namespace: init(): initialize the namespace copy(): copy all elements from one namespace to another clear(): clear all elements (to free the memories) set(): set the value of an element set_all(): set the value of all elements get(): get the value of an element A debug namespace is like a sparse array. The length of the array is huge, 2^sizeof(GLuint), but most of the elements assume the same value sepcified by set_all(). Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: clean up debug groupsChia-I Wu2014-04-271-42/+48
| | | | | | | | | | | | Add struct gl_debug_group to hold all namespaces of a debug group. Replace the 3-dimensional array, Namespaces, in struct gl_debug_state by a 1-dimensional array of type struct gl_debug_groups. Turn the 4-dimensional array, Defaults, in struct gl_debug_state to a 1-dimensional array in struct gl_debug_namespace. Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: clean up debug message logChia-I Wu2014-04-271-36/+42
| | | | | | | | | Remove NextMsgLength, and move members of struct gl_debug_state that belong to the message log to a new struct, gl_debug_log. Rename gl_debug_msg to gl_debug_message. Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: use accessors for struct gl_debug_stateChia-I Wu2014-04-271-1/+136
| | | | | | | | | | | | | | | | When GL_DEBUG_OUTPUT_SYNCHRONOUS is GL_TRUE, drivers are allowed to log debug messages from other threads. That requires gl_debug_state to be protected by a mutex, even when it is a context state. While we do not spawn threads in Mesa yet, this commit makes it easier to do when we want to. Since the definition of struct gl_debug_state is no longer needed by the rest of the driver, move it to main/errors.c. This should make it even harder to use the struct incorrectly. v2: add comments for the accessors Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: eliminate debug output message_insertChia-I Wu2014-04-271-26/+19
| | | | | | | | | | | Add validate_length, and call it together with log_msg directly instead of message_insert. No functional change. v2: make sure length is non-negative (i.e., known) before calling validate_length, noted by Timothy Arceri Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: eliminate debug output should_logChia-I Wu2014-04-271-29/+11
| | | | | | | | In both call sites, it could be easily replaced by direct debug_is_message_enabled calls. No functional change. Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: eliminate debug output control_app_messagesChia-I Wu2014-04-271-66/+17
| | | | | | | | Merge control_app_messages with the only caller. Eliminate set_message_state and control_messages too as they are unused. No functional change. Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: eliminate debug output get_msgChia-I Wu2014-04-271-73/+26
| | | | | | | Merge get_msg with the only caller. No functional change. Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: refactor _mesa_PopDebugGroup and _mesa_free_errors_dataChia-I Wu2014-04-271-62/+63
| | | | | | | | | Replace free_errors_data by debug_clear_group. Add debug_pop_group and debug_destroy for use in _mesa_PopDebugGroup and _mesa_free_errors_data respectively. No funcitonal change. Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: refactor _mesa_PushDebugGroupChia-I Wu2014-04-271-42/+60
| | | | | | | | | Move group copying to debug_push_group. Save the group message before pushing instead of after, since we will need it after popping. No functional change otherwise. Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: refactor debug output control_messagesChia-I Wu2014-04-271-51/+62
| | | | | | | Move most of the code to debug_set_message_enable_all. No functional change. Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: refactor debug output get_msgChia-I Wu2014-04-271-11/+47
| | | | | | | | Move message fetching to debug_fetch_message and message deletion to debug_delete_messages. No functional change. Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: refactor debug out log_msgChia-I Wu2014-04-271-59/+75
| | | | | | | | Move message logging to debug_log_message. Replace store_message_details by debug_message_store. No functional change. Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: refactor debug output set_message_stateChia-I Wu2014-04-271-31/+39
| | | | | | | Move message state update to debug_set_message_enable. No functional change. Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: refactor debug output should_logChia-I Wu2014-04-271-50/+61
| | | | | | | | Move the message filtering logic to debug_is_message_enabled. No functional change. Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: refactor _mesa_get_debug_stateChia-I Wu2014-04-271-25/+37
| | | | | | | | Move gl_debug_state allocation to a new function, debug_create. No functional change. Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: s/FREE/free/ in _mesa_free_errors_data()Brian Paul2014-04-101-1/+1
| | | | | Reviewed-by: Jakob Bornecrantz <jakob@vmware.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* mesa: Release gl_debug_state when destroying context.Mike Stroyan2014-03-121-1/+4
| | | | | | | | Commit 6e8d04a caused a leak by allocating ctx->Debug but never freeing it. Release the memory in _mesa_free_errors_data when destroying a context. Use FREE to match CALLOC_STRUCT from _mesa_get_debug_state. Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: add missing DebugMessageControl typesTimothy Arceri2014-03-081-0/+2
| | | | | Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au> Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: make ARB_debug_output functions an alias ofTimothy Arceri2014-03-081-219/+82
| | | | | | | | | | | | | KHR_debug Also update dispatch sanity removing ARB_debug_output checks and removing KHR_debug placeholders as the checks have already been added V2: Make sure we exit case statements with conditional breaks rather than just dropping through. Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au> Reviewed-by: Brian Paul <brianp@vmware.com>