diff options
author | marha <marha@users.sourceforge.net> | 2011-08-30 08:04:44 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-08-30 08:08:15 +0200 |
commit | 82ce0534a7bc89f1ed93b4b952b30ceb3d94210d (patch) | |
tree | a2b73894a436b1158cf0e8e2f2ea946478529d12 /mesalib/src/gallium/auxiliary | |
parent | 01df5d59e56a1b060568f8cad2e89f7eea22fc70 (diff) | |
download | vcxsrv-82ce0534a7bc89f1ed93b4b952b30ceb3d94210d.tar.gz vcxsrv-82ce0534a7bc89f1ed93b4b952b30ceb3d94210d.tar.bz2 vcxsrv-82ce0534a7bc89f1ed93b4b952b30ceb3d94210d.zip |
mesa git update 30 aug 2011
Diffstat (limited to 'mesalib/src/gallium/auxiliary')
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_debug_describe.c | 162 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_debug_refcnt.c | 382 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_debug_refcnt.h | 126 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_video.h | 8 |
4 files changed, 339 insertions, 339 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_debug_describe.c b/mesalib/src/gallium/auxiliary/util/u_debug_describe.c index f84f942d6..3574accc0 100644 --- a/mesalib/src/gallium/auxiliary/util/u_debug_describe.c +++ b/mesalib/src/gallium/auxiliary/util/u_debug_describe.c @@ -1,81 +1,81 @@ -/**************************************************************************
- *
- * Copyright 2010 Luca Barbieri
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#include <pipe/p_state.h>
-#include <util/u_format.h>
-#include <util/u_debug_describe.h>
-#include <util/u_string.h>
-
-void
-debug_describe_reference(char* buf, const struct pipe_reference*ptr)
-{
- strcpy(buf, "pipe_object");
-}
-
-void
-debug_describe_resource(char* buf, const struct pipe_resource *ptr)
-{
- switch(ptr->target)
- {
- case PIPE_BUFFER:
- util_sprintf(buf, "pipe_buffer<%u>", (unsigned)util_format_get_stride(ptr->format, ptr->width0));
- break;
- case PIPE_TEXTURE_1D:
- util_sprintf(buf, "pipe_texture1d<%u,%s,%u>", ptr->width0, util_format_short_name(ptr->format), ptr->last_level);
- break;
- case PIPE_TEXTURE_2D:
- util_sprintf(buf, "pipe_texture2d<%u,%u,%s,%u>", ptr->width0, ptr->height0, util_format_short_name(ptr->format), ptr->last_level);
- break;
- case PIPE_TEXTURE_RECT:
- util_sprintf(buf, "pipe_texture_rect<%u,%u,%s>", ptr->width0, ptr->height0, util_format_short_name(ptr->format));
- break;
- case PIPE_TEXTURE_CUBE:
- util_sprintf(buf, "pipe_texture_cube<%u,%u,%s,%u>", ptr->width0, ptr->height0, util_format_short_name(ptr->format), ptr->last_level);
- break;
- case PIPE_TEXTURE_3D:
- util_sprintf(buf, "pipe_texture3d<%u,%u,%u,%s,%u>", ptr->width0, ptr->height0, ptr->depth0, util_format_short_name(ptr->format), ptr->last_level);
- break;
- default:
- util_sprintf(buf, "pipe_martian_resource<%u>", ptr->target);
- break;
- }
-}
-
-void
-debug_describe_surface(char* buf, const struct pipe_surface *ptr)
-{
- char res[128];
- debug_describe_resource(res, ptr->texture);
- util_sprintf(buf, "pipe_surface<%s,%u,%u,%u>", res, ptr->u.tex.level, ptr->u.tex.first_layer, ptr->u.tex.last_layer);
-}
-
-void
-debug_describe_sampler_view(char* buf, const struct pipe_sampler_view *ptr)
-{
- char res[128];
- debug_describe_resource(res, ptr->texture);
- util_sprintf(buf, "pipe_sampler_view<%s,%s>", res, util_format_short_name(ptr->format));
-}
+/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include "pipe/p_state.h" +#include "util/u_format.h" +#include "util/u_debug_describe.h" +#include "util/u_string.h" + +void +debug_describe_reference(char* buf, const struct pipe_reference*ptr) +{ + strcpy(buf, "pipe_object"); +} + +void +debug_describe_resource(char* buf, const struct pipe_resource *ptr) +{ + switch(ptr->target) + { + case PIPE_BUFFER: + util_sprintf(buf, "pipe_buffer<%u>", (unsigned)util_format_get_stride(ptr->format, ptr->width0)); + break; + case PIPE_TEXTURE_1D: + util_sprintf(buf, "pipe_texture1d<%u,%s,%u>", ptr->width0, util_format_short_name(ptr->format), ptr->last_level); + break; + case PIPE_TEXTURE_2D: + util_sprintf(buf, "pipe_texture2d<%u,%u,%s,%u>", ptr->width0, ptr->height0, util_format_short_name(ptr->format), ptr->last_level); + break; + case PIPE_TEXTURE_RECT: + util_sprintf(buf, "pipe_texture_rect<%u,%u,%s>", ptr->width0, ptr->height0, util_format_short_name(ptr->format)); + break; + case PIPE_TEXTURE_CUBE: + util_sprintf(buf, "pipe_texture_cube<%u,%u,%s,%u>", ptr->width0, ptr->height0, util_format_short_name(ptr->format), ptr->last_level); + break; + case PIPE_TEXTURE_3D: + util_sprintf(buf, "pipe_texture3d<%u,%u,%u,%s,%u>", ptr->width0, ptr->height0, ptr->depth0, util_format_short_name(ptr->format), ptr->last_level); + break; + default: + util_sprintf(buf, "pipe_martian_resource<%u>", ptr->target); + break; + } +} + +void +debug_describe_surface(char* buf, const struct pipe_surface *ptr) +{ + char res[128]; + debug_describe_resource(res, ptr->texture); + util_sprintf(buf, "pipe_surface<%s,%u,%u,%u>", res, ptr->u.tex.level, ptr->u.tex.first_layer, ptr->u.tex.last_layer); +} + +void +debug_describe_sampler_view(char* buf, const struct pipe_sampler_view *ptr) +{ + char res[128]; + debug_describe_resource(res, ptr->texture); + util_sprintf(buf, "pipe_sampler_view<%s,%s>", res, util_format_short_name(ptr->format)); +} diff --git a/mesalib/src/gallium/auxiliary/util/u_debug_refcnt.c b/mesalib/src/gallium/auxiliary/util/u_debug_refcnt.c index 0a242e124..b3e389408 100644 --- a/mesalib/src/gallium/auxiliary/util/u_debug_refcnt.c +++ b/mesalib/src/gallium/auxiliary/util/u_debug_refcnt.c @@ -1,191 +1,191 @@ -/**************************************************************************
- *
- * Copyright 2010 Luca Barbieri
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#if defined(DEBUG) && (!defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_WINDOWS_USER))
-
-/* see http://www.mozilla.org/performance/refcnt-balancer.html for what do with the output
- * on Linux, use tools/addr2line.sh to postprocess it before anything else
- **/
-#include <util/u_debug.h>
-#include <util/u_debug_refcnt.h>
-#include <util/u_debug_stack.h>
-#include <util/u_debug_symbol.h>
-#include <util/u_string.h>
-#include <util/u_hash_table.h>
-#include <os/os_thread.h>
-#include <os/os_stream.h>
-
-int debug_refcnt_state;
-
-struct os_stream* stream;
-
-/* TODO: maybe move this serial machinery to a stand-alone module and expose it? */
-pipe_static_mutex(serials_mutex);
-
-static struct util_hash_table* serials_hash;
-static unsigned serials_last;
-
-static unsigned hash_ptr(void* p)
-{
- return (unsigned)(uintptr_t)p;
-}
-
-static int compare_ptr(void* a, void* b)
-{
- if(a == b)
- return 0;
- else if(a < b)
- return -1;
- else
- return 1;
-}
-
-static boolean debug_serial(void* p, unsigned* pserial)
-{
- unsigned serial;
- boolean found = TRUE;
-#ifdef PIPE_SUBSYSTEM_WINDOWS_USER
- static boolean first = TRUE;
-
- if (first) {
- pipe_mutex_init(serials_mutex);
- first = FALSE;
- }
-#endif
-
- pipe_mutex_lock(serials_mutex);
- if(!serials_hash)
- serials_hash = util_hash_table_create(hash_ptr, compare_ptr);
- serial = (unsigned)(uintptr_t)util_hash_table_get(serials_hash, p);
- if(!serial)
- {
- /* time to stop logging... (you'll have a 100 GB logfile at least at this point)
- * TODO: avoid this
- */
- serial = ++serials_last;
- if(!serial)
- {
- debug_error("More than 2^32 objects detected, aborting.\n");
- os_abort();
- }
-
- util_hash_table_set(serials_hash, p, (void*)(uintptr_t)serial);
- found = FALSE;
- }
- pipe_mutex_unlock(serials_mutex);
- *pserial = serial;
- return found;
-}
-
-static void debug_serial_delete(void* p)
-{
- pipe_mutex_lock(serials_mutex);
- util_hash_table_remove(serials_hash, p);
- pipe_mutex_unlock(serials_mutex);
-}
-
-#define STACK_LEN 64
-
-static void dump_stack(const char* symbols[STACK_LEN])
-{
- unsigned i;
- for(i = 0; i < STACK_LEN; ++i)
- {
- if(symbols[i])
- os_stream_printf(stream, "%s\n", symbols[i]);
- }
- os_stream_write(stream, "\n", 1);
-}
-
-void debug_reference_slowpath(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change)
-{
- if(debug_refcnt_state < 0)
- return;
-
- if(!debug_refcnt_state)
- {
- const char* filename = debug_get_option("GALLIUM_REFCNT_LOG", NULL);
- if(filename && filename[0])
- stream = os_file_stream_create(filename);
-
- if(stream)
- debug_refcnt_state = 1;
- else
- debug_refcnt_state = -1;
- }
-
- if(debug_refcnt_state > 0)
- {
- struct debug_stack_frame frames[STACK_LEN];
- const char* symbols[STACK_LEN];
- char buf[1024];
-
- unsigned i;
- unsigned refcnt = p->count;
- unsigned serial;
- boolean existing = debug_serial((void*)p, &serial);
-
- debug_backtrace_capture(frames, 1, STACK_LEN);
- for(i = 0; i < STACK_LEN; ++i)
- {
- if(frames[i].function)
- symbols[i] = debug_symbol_name_cached(frames[i].function);
- else
- symbols[i] = 0;
- }
-
- get_desc(buf, p);
-
- if(!existing)
- {
- os_stream_printf(stream, "<%s> %p %u Create\n", buf, p, serial);
- dump_stack(symbols);
-
- /* this is there to provide a gradual change even if we don't see the initialization */
- for(i = 1; i <= refcnt - change; ++i)
- {
- os_stream_printf(stream, "<%s> %p %u AddRef %u\n", buf, p, serial, i);
- dump_stack(symbols);
- }
- }
-
- if(change)
- {
- os_stream_printf(stream, "<%s> %p %u %s %u\n", buf, p, serial, change > 0 ? "AddRef" : "Release", refcnt);
- dump_stack(symbols);
- }
-
- if(!refcnt)
- {
- debug_serial_delete((void*)p);
- os_stream_printf(stream, "<%s> %p %u Destroy\n", buf, p, serial);
- dump_stack(symbols);
- }
-
- os_stream_flush(stream);
- }
-}
-#endif
+/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#if defined(DEBUG) && (!defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_WINDOWS_USER)) + +/* see http://www.mozilla.org/performance/refcnt-balancer.html for what do with the output + * on Linux, use tools/addr2line.sh to postprocess it before anything else + **/ +#include "util/u_debug.h" +#include "util/u_debug_refcnt.h" +#include "util/u_debug_stack.h" +#include "util/u_debug_symbol.h" +#include "util/u_string.h" +#include "util/u_hash_table.h" +#include "os/os_thread.h" +#include "os/os_stream.h" + +int debug_refcnt_state; + +struct os_stream* stream; + +/* TODO: maybe move this serial machinery to a stand-alone module and expose it? */ +pipe_static_mutex(serials_mutex); + +static struct util_hash_table* serials_hash; +static unsigned serials_last; + +static unsigned hash_ptr(void* p) +{ + return (unsigned)(uintptr_t)p; +} + +static int compare_ptr(void* a, void* b) +{ + if(a == b) + return 0; + else if(a < b) + return -1; + else + return 1; +} + +static boolean debug_serial(void* p, unsigned* pserial) +{ + unsigned serial; + boolean found = TRUE; +#ifdef PIPE_SUBSYSTEM_WINDOWS_USER + static boolean first = TRUE; + + if (first) { + pipe_mutex_init(serials_mutex); + first = FALSE; + } +#endif + + pipe_mutex_lock(serials_mutex); + if(!serials_hash) + serials_hash = util_hash_table_create(hash_ptr, compare_ptr); + serial = (unsigned)(uintptr_t)util_hash_table_get(serials_hash, p); + if(!serial) + { + /* time to stop logging... (you'll have a 100 GB logfile at least at this point) + * TODO: avoid this + */ + serial = ++serials_last; + if(!serial) + { + debug_error("More than 2^32 objects detected, aborting.\n"); + os_abort(); + } + + util_hash_table_set(serials_hash, p, (void*)(uintptr_t)serial); + found = FALSE; + } + pipe_mutex_unlock(serials_mutex); + *pserial = serial; + return found; +} + +static void debug_serial_delete(void* p) +{ + pipe_mutex_lock(serials_mutex); + util_hash_table_remove(serials_hash, p); + pipe_mutex_unlock(serials_mutex); +} + +#define STACK_LEN 64 + +static void dump_stack(const char* symbols[STACK_LEN]) +{ + unsigned i; + for(i = 0; i < STACK_LEN; ++i) + { + if(symbols[i]) + os_stream_printf(stream, "%s\n", symbols[i]); + } + os_stream_write(stream, "\n", 1); +} + +void debug_reference_slowpath(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change) +{ + if(debug_refcnt_state < 0) + return; + + if(!debug_refcnt_state) + { + const char* filename = debug_get_option("GALLIUM_REFCNT_LOG", NULL); + if(filename && filename[0]) + stream = os_file_stream_create(filename); + + if(stream) + debug_refcnt_state = 1; + else + debug_refcnt_state = -1; + } + + if(debug_refcnt_state > 0) + { + struct debug_stack_frame frames[STACK_LEN]; + const char* symbols[STACK_LEN]; + char buf[1024]; + + unsigned i; + unsigned refcnt = p->count; + unsigned serial; + boolean existing = debug_serial((void*)p, &serial); + + debug_backtrace_capture(frames, 1, STACK_LEN); + for(i = 0; i < STACK_LEN; ++i) + { + if(frames[i].function) + symbols[i] = debug_symbol_name_cached(frames[i].function); + else + symbols[i] = 0; + } + + get_desc(buf, p); + + if(!existing) + { + os_stream_printf(stream, "<%s> %p %u Create\n", buf, p, serial); + dump_stack(symbols); + + /* this is there to provide a gradual change even if we don't see the initialization */ + for(i = 1; i <= refcnt - change; ++i) + { + os_stream_printf(stream, "<%s> %p %u AddRef %u\n", buf, p, serial, i); + dump_stack(symbols); + } + } + + if(change) + { + os_stream_printf(stream, "<%s> %p %u %s %u\n", buf, p, serial, change > 0 ? "AddRef" : "Release", refcnt); + dump_stack(symbols); + } + + if(!refcnt) + { + debug_serial_delete((void*)p); + os_stream_printf(stream, "<%s> %p %u Destroy\n", buf, p, serial); + dump_stack(symbols); + } + + os_stream_flush(stream); + } +} +#endif diff --git a/mesalib/src/gallium/auxiliary/util/u_debug_refcnt.h b/mesalib/src/gallium/auxiliary/util/u_debug_refcnt.h index 61cc7122c..c02fba27d 100644 --- a/mesalib/src/gallium/auxiliary/util/u_debug_refcnt.h +++ b/mesalib/src/gallium/auxiliary/util/u_debug_refcnt.h @@ -1,63 +1,63 @@ -/**************************************************************************
- *
- * Copyright 2010 Luca Barbieri
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial
- * portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-#ifndef U_DEBUG_REFCNT_H_
-#define U_DEBUG_REFCNT_H_
-
-#include <pipe/p_config.h>
-#include <pipe/p_state.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void (*debug_reference_descriptor)(char*, const struct pipe_reference*);
-
-#if defined(DEBUG) && (!defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_WINDOWS_USER))
-
-extern int debug_refcnt_state;
-
-void debug_reference_slowpath(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change);
-
-static INLINE void debug_reference(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change)
-{
- if (debug_refcnt_state >= 0)
- debug_reference_slowpath(p, get_desc, change);
-}
-
-#else
-
-static INLINE void debug_reference(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change)
-{
-}
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* U_DEBUG_REFCNT_H_ */
+/************************************************************************** + * + * Copyright 2010 Luca Barbieri + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef U_DEBUG_REFCNT_H_ +#define U_DEBUG_REFCNT_H_ + +#include "pipe/p_config.h" +#include "pipe/p_state.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*debug_reference_descriptor)(char*, const struct pipe_reference*); + +#if defined(DEBUG) && (!defined(PIPE_OS_WINDOWS) || defined(PIPE_SUBSYSTEM_WINDOWS_USER)) + +extern int debug_refcnt_state; + +void debug_reference_slowpath(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change); + +static INLINE void debug_reference(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change) +{ + if (debug_refcnt_state >= 0) + debug_reference_slowpath(p, get_desc, change); +} + +#else + +static INLINE void debug_reference(const struct pipe_reference* p, debug_reference_descriptor get_desc, int change) +{ +} + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* U_DEBUG_REFCNT_H_ */ diff --git a/mesalib/src/gallium/auxiliary/util/u_video.h b/mesalib/src/gallium/auxiliary/util/u_video.h index 6b67881e6..be3fac2d0 100644 --- a/mesalib/src/gallium/auxiliary/util/u_video.h +++ b/mesalib/src/gallium/auxiliary/util/u_video.h @@ -32,12 +32,12 @@ extern "C" { #endif -#include <pipe/p_defines.h> -#include <pipe/p_video_enums.h> +#include "pipe/p_defines.h" +#include "pipe/p_video_enums.h" /* u_reduce_video_profile() needs these */ -#include <pipe/p_compiler.h> -#include <util/u_debug.h> +#include "pipe/p_compiler.h" +#include "util/u_debug.h" static INLINE enum pipe_video_codec u_reduce_video_profile(enum pipe_video_profile profile) |