freedreno: Convert to mesa_log*()

debug_printf() isn't terribly great in multi-threaded situations.. but
since we now have a simple util/log.h, which even plays nicely with
logcat on android, lets use that instead.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7342>
This commit is contained in:
Rob Clark 2020-11-08 11:14:22 -08:00 committed by Marge Bot
parent a8b9860a97
commit 156d7e45f7
12 changed files with 32 additions and 29 deletions

View file

@ -41,6 +41,7 @@
#include "util/hash_table.h"
#include "util/list.h"
#include "util/log.h"
#include "util/simple_mtx.h"
#include "util/u_debug.h"
#include "util/u_atomic.h"
@ -176,17 +177,17 @@ struct fd_bo *fd_bo_new_ring(struct fd_device *dev, uint32_t size);
bool fd_dbg(void);
#define INFO_MSG(fmt, ...) \
do { if (fd_dbg()) debug_printf("[I] "fmt " (%s:%d)\n", \
##__VA_ARGS__, __FUNCTION__, __LINE__); } while (0)
do { if (fd_dbg()) mesa_logi("%s:%d: "fmt, \
__FUNCTION__, __LINE__, ##__VA_ARGS__); } while (0)
#define DEBUG_MSG(fmt, ...) \
do if (enable_debug) { debug_printf("[D] "fmt " (%s:%d)\n", \
##__VA_ARGS__, __FUNCTION__, __LINE__); } while (0)
do if (enable_debug) { mesa_logd("%s:%d: "fmt, \
__FUNCTION__, __LINE__, ##__VA_ARGS__); } while (0)
#define WARN_MSG(fmt, ...) \
do { debug_printf("[W] "fmt " (%s:%d)\n", \
##__VA_ARGS__, __FUNCTION__, __LINE__); } while (0)
do { mesa_logw("%s:%d: "fmt, \
__FUNCTION__, __LINE__, ##__VA_ARGS__); } while (0)
#define ERROR_MSG(fmt, ...) \
do { debug_printf("[E] " fmt " (%s:%d)\n", \
##__VA_ARGS__, __FUNCTION__, __LINE__); } while (0)
do { mesa_loge("%s:%d: " fmt, \
__FUNCTION__, __LINE__, ##__VA_ARGS__); } while (0)
#define U642VOID(x) ((void *)(unsigned long)(x))
#define VOID2U64(x) ((uint64_t)(unsigned long)(x))

View file

@ -84,7 +84,7 @@ static uint32_t reg(struct ir3_register *reg, struct ir3_info *info,
reg_t val = { .dummy32 = 0 };
if (reg->flags & ~valid_flags) {
debug_printf("INVALID FLAGS: %x vs %x\n",
mesa_logd("INVALID FLAGS: %x vs %x",
reg->flags, valid_flags);
}

View file

@ -28,6 +28,7 @@
#define IR3_COMPILER_H_
#include "util/disk_cache.h"
#include "util/log.h"
#include "ir3.h"

View file

@ -35,7 +35,7 @@
#define COND(bool, val) ((bool) ? (val) : 0)
#define DBG(fmt, ...) \
do { debug_printf("%s:%d: "fmt "\n", \
do { mesa_logd("%s:%d: "fmt, \
__FUNCTION__, __LINE__, ##__VA_ARGS__); } while (0)
/**

View file

@ -172,14 +172,14 @@ compile_variant(struct ir3_shader_variant *v)
{
int ret = ir3_compile_shader_nir(v->shader->compiler, v);
if (ret) {
_debug_printf("compile failed! (%s:%s)", v->shader->nir->info.name,
mesa_loge("compile failed! (%s:%s)", v->shader->nir->info.name,
v->shader->nir->info.label);
return false;
}
assemble_variant(v);
if (!v->bin) {
_debug_printf("assemble failed! (%s:%s)", v->shader->nir->info.name,
mesa_loge("assemble failed! (%s:%s)", v->shader->nir->info.name,
v->shader->nir->info.label);
return false;
}

View file

@ -186,7 +186,7 @@ fd2_create_batch_query(struct pipe_context *pctx,
/* verify valid query_type, ie. is it actually a perfcntr? */
if ((query_types[i] < FD_QUERY_FIRST_PERFCNTR) ||
(idx >= screen->num_perfcntr_queries)) {
debug_printf("invalid batch query query_type: %u\n", query_types[i]);
mesa_loge("invalid batch query query_type: %u", query_types[i]);
goto error;
}
@ -211,7 +211,7 @@ fd2_create_batch_query(struct pipe_context *pctx,
if (counters_per_group[entry->gid] >=
screen->perfcntr_groups[entry->gid].num_counters) {
debug_printf("too many counters for group %u\n", entry->gid);
mesa_loge("too many counters for group %u", entry->gid);
goto error;
}

View file

@ -398,7 +398,7 @@ fd5_create_batch_query(struct pipe_context *pctx,
/* verify valid query_type, ie. is it actually a perfcntr? */
if ((query_types[i] < FD_QUERY_FIRST_PERFCNTR) ||
(idx >= screen->num_perfcntr_queries)) {
debug_printf("invalid batch query query_type: %u\n", query_types[i]);
mesa_loge("invalid batch query query_type: %u", query_types[i]);
goto error;
}
@ -423,7 +423,7 @@ fd5_create_batch_query(struct pipe_context *pctx,
if (counters_per_group[entry->gid] >=
screen->perfcntr_groups[entry->gid].num_counters) {
debug_printf("too many counters for group %u\n", entry->gid);
mesa_loge("too many counters for group %u\n", entry->gid);
goto error;
}

View file

@ -334,7 +334,7 @@ update_vsc_pipe(struct fd_batch *batch)
* frame:
*/
fd6_ctx->vsc_draw_strm_pitch = align(batch->draw_strm_bits/8, 0x4000);
debug_printf("pre-resize VSC_DRAW_STRM_PITCH to: 0x%x\n",
mesa_logd("pre-resize VSC_DRAW_STRM_PITCH to: 0x%x",
fd6_ctx->vsc_draw_strm_pitch);
}
@ -343,7 +343,7 @@ update_vsc_pipe(struct fd_batch *batch)
fd_bo_del(fd6_ctx->vsc_prim_strm);
fd6_ctx->vsc_prim_strm = NULL;
fd6_ctx->vsc_prim_strm_pitch = align(batch->prim_strm_bits/8, 0x4000);
debug_printf("pre-resize VSC_PRIM_STRM_PITCH to: 0x%x\n",
mesa_logd("pre-resize VSC_PRIM_STRM_PITCH to: 0x%x",
fd6_ctx->vsc_prim_strm_pitch);
}
@ -464,7 +464,7 @@ check_vsc_overflow(struct fd_context *ctx)
fd6_ctx->vsc_draw_strm = NULL;
fd6_ctx->vsc_draw_strm_pitch *= 2;
debug_printf("resized VSC_DRAW_STRM_PITCH to: 0x%x\n",
mesa_logd("resized VSC_DRAW_STRM_PITCH to: 0x%x",
fd6_ctx->vsc_draw_strm_pitch);
} else if (buffer == 0x3) {
@ -479,7 +479,7 @@ check_vsc_overflow(struct fd_context *ctx)
fd6_ctx->vsc_prim_strm = NULL;
fd6_ctx->vsc_prim_strm_pitch *= 2;
debug_printf("resized VSC_PRIM_STRM_PITCH to: 0x%x\n",
mesa_logd("resized VSC_PRIM_STRM_PITCH to: 0x%x",
fd6_ctx->vsc_prim_strm_pitch);
} else {
@ -489,7 +489,7 @@ check_vsc_overflow(struct fd_context *ctx)
* but maybe we should pre-emptively realloc vsc_data/vsc_data2
* and hope for different memory placement?
*/
DBG("invalid vsc_overflow value: 0x%08x", vsc_overflow);
mesa_loge("invalid vsc_overflow value: 0x%08x", vsc_overflow);
}
}

View file

@ -591,7 +591,7 @@ fd6_create_batch_query(struct pipe_context *pctx,
/* verify valid query_type, ie. is it actually a perfcntr? */
if ((query_types[i] < FD_QUERY_FIRST_PERFCNTR) ||
(idx >= screen->num_perfcntr_queries)) {
debug_printf("invalid batch query query_type: %u\n", query_types[i]);
mesa_loge("invalid batch query query_type: %u", query_types[i]);
goto error;
}
@ -616,7 +616,7 @@ fd6_create_batch_query(struct pipe_context *pctx,
if (counters_per_group[entry->gid] >=
screen->perfcntr_groups[entry->gid].num_counters) {
debug_printf("too many counters for group %u\n", entry->gid);
mesa_loge("too many counters for group %u", entry->gid);
goto error;
}

View file

@ -236,7 +236,7 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
/* emulate unsupported primitives: */
if (!fd_supported_prim(ctx, info->mode)) {
if (ctx->streamout.num_targets > 0)
debug_error("stream-out with emulated prims");
mesa_loge("stream-out with emulated prims");
util_primconvert_save_rasterizer_state(ctx->primconvert, ctx->rasterizer);
util_primconvert_draw_vbo(ctx->primconvert, info);
return;

View file

@ -496,7 +496,7 @@ fd_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_capf param)
case PIPE_CAPF_CONSERVATIVE_RASTER_DILATE_GRANULARITY:
return 0.0f;
}
debug_printf("unknown paramf %d\n", param);
mesa_loge("unknown paramf %d", param);
return 0;
}
@ -523,7 +523,7 @@ fd_screen_get_shader_param(struct pipe_screen *pscreen,
break;
return 0;
default:
DBG("unknown shader type %d", shader);
mesa_loge("unknown shader type %d", shader);
return 0;
}
@ -636,7 +636,7 @@ fd_screen_get_shader_param(struct pipe_screen *pscreen,
}
return 0;
}
debug_printf("unknown shader param %d\n", param);
mesa_loge("unknown shader param %d", param);
return 0;
}
@ -988,7 +988,7 @@ fd_screen_create(struct fd_device *dev, struct renderonly *ro)
fd6_screen_init(pscreen);
break;
default:
debug_printf("unsupported GPU: a%03d\n", screen->gpu_id);
mesa_loge("unsupported GPU: a%03d", screen->gpu_id);
goto fail;
}

View file

@ -32,6 +32,7 @@
#include "pipe/p_format.h"
#include "pipe/p_state.h"
#include "util/log.h"
#include "util/u_debug.h"
#include "util/u_math.h"
#include "util/half_float.h"
@ -96,7 +97,7 @@ extern bool fd_binning_enabled;
#define DBG(fmt, ...) \
do { if (fd_mesa_debug & FD_DBG_MSGS) \
debug_printf("%s:%d: "fmt "\n", \
mesa_logd("%s:%d: "fmt, \
__FUNCTION__, __LINE__, ##__VA_ARGS__); } while (0)
/* for conditionally setting boolean flag(s): */