gallium/util: start splitting u_debug into generic and gallium specific components

In order to pull u_debug into src/util we need to break the generically
useful bits from the bits that are tightly coupled to gallium.

Tested-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Dylan Baker 2018-09-20 14:35:36 -07:00
parent 389d59c72a
commit 078b3cdb34
7 changed files with 93 additions and 16 deletions

View file

@ -228,6 +228,8 @@ C_SOURCES := \
util/u_cpu_detect.h \
util/u_debug.c \
util/u_debug.h \
util/u_debug_gallium.h \
util/u_debug_gallium.c \
util/u_debug_describe.c \
util/u_debug_describe.h \
util/u_debug_flush.c \

View file

@ -248,6 +248,8 @@ files_libgallium = files(
'util/u_cpu_detect.h',
'util/u_debug.c',
'util/u_debug.h',
'util/u_debug_gallium.h',
'util/u_debug_gallium.c',
'util/u_debug_describe.c',
'util/u_debug_describe.h',
'util/u_debug_flush.c',

View file

@ -35,7 +35,6 @@
#include "pipe/p_format.h"
#include "pipe/p_state.h"
#include "util/u_inlines.h"
#include "util/u_format.h"
#include "util/u_memory.h"
#include "util/u_string.h"
#include "util/u_math.h"
@ -403,15 +402,6 @@ debug_dump_flags(const struct debug_named_value *names, unsigned long value)
}
#ifdef DEBUG
void
debug_print_format(const char *msg, unsigned fmt )
{
debug_printf("%s: %s\n", msg, util_format_name(fmt));
}
#endif
#ifdef DEBUG
int fl_indent = 0;

View file

@ -131,13 +131,8 @@ debug_printf(const char *format, ...)
* messages.
*/
void debug_print_blob( const char *name, const void *blob, unsigned size );
/* Print a message along with a prettified format string
*/
void debug_print_format(const char *msg, unsigned fmt );
#else
#define debug_print_blob(_name, _blob, _size) ((void)0)
#define debug_print_format(_msg, _fmt) ((void)0)
#endif

View file

@ -0,0 +1,42 @@
/**************************************************************************
*
* Copyright 2008 VMware, Inc.
* Copyright (c) 2008 VMware, Inc.
* All Rights Reserved.
*
* 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, sub license, 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 NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE 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 "util/u_debug.h"
#include "u_debug_gallium.h"
#include "u_format.h"
#ifdef DEBUG
void
debug_print_format(const char *msg, unsigned fmt)
{
debug_printf("%s: %s\n", msg, util_format_name(fmt));
}
#endif

View file

@ -0,0 +1,46 @@
/**************************************************************************
*
* Copyright 2008 VMware, Inc.
* Copyright (c) 2008 VMware, Inc.
* All Rights Reserved.
*
* 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, sub license, 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 NON-INFRINGEMENT.
* IN NO EVENT SHALL VMWARE 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_GALLIUM_H_
#define _U_DEBUG_GALLIUM_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef DEBUG
void debug_print_format(const char *msg, unsigned fmt);
#else
#define debug_print_format(_msg, _fmt) ((void)0)
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -37,7 +37,7 @@
#include "pipe/p_compiler.h"
#include "pipe/p_format.h"
#include "util/u_debug.h"
#include "util/u_debug_gallium.h"
#include "util/u_format.h"
#include "util/u_math.h"