mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 08:30:10 +01:00
v3d: introduce V3D_DBG() macro to make V3D_DEBUG checks consistent
The main issue was the inconsistent use of `unlikely()`, but the macro also simplifies the code a little bit. Signed-off-by: Eric Engestrom <eric@igalia.com> Reviewed-by: Juan A. Suarez <jasuarez@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18086>
This commit is contained in:
parent
e178ecf8a9
commit
e767f54f28
22 changed files with 76 additions and 79 deletions
|
|
@ -37,7 +37,7 @@
|
|||
#include "util/u_debug.h"
|
||||
#include "c11/threads.h"
|
||||
|
||||
uint32_t V3D_DEBUG = 0;
|
||||
uint32_t v3d_mesa_debug = 0;
|
||||
|
||||
static const struct debug_named_value debug_control[] = {
|
||||
{ "cl", V3D_DEBUG_CL,
|
||||
|
|
@ -103,7 +103,7 @@ static const struct debug_named_value debug_control[] = {
|
|||
|
||||
DEBUG_GET_ONCE_FLAGS_OPTION(v3d_debug, "V3D_DEBUG", debug_control, 0)
|
||||
|
||||
uint32_t
|
||||
bool
|
||||
v3d_debug_flag_for_shader_stage(gl_shader_stage stage)
|
||||
{
|
||||
uint32_t flags[] = {
|
||||
|
|
@ -115,11 +115,11 @@ v3d_debug_flag_for_shader_stage(gl_shader_stage stage)
|
|||
[MESA_SHADER_COMPUTE] = V3D_DEBUG_CS,
|
||||
};
|
||||
STATIC_ASSERT(MESA_SHADER_STAGES == 6);
|
||||
return flags[stage];
|
||||
return v3d_mesa_debug & flags[stage];
|
||||
}
|
||||
|
||||
void
|
||||
v3d_process_debug_variable(void)
|
||||
{
|
||||
V3D_DEBUG = debug_get_option_v3d_debug();
|
||||
v3d_mesa_debug = debug_get_option_v3d_debug();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,9 @@ extern "C" {
|
|||
* list of debugging flags, as well as some macros for handling them.
|
||||
*/
|
||||
|
||||
extern uint32_t V3D_DEBUG;
|
||||
extern uint32_t v3d_mesa_debug;
|
||||
|
||||
#define V3D_DBG(flag) unlikely(v3d_mesa_debug & V3D_DEBUG_ ## flag)
|
||||
|
||||
#define V3D_DEBUG_SHADERDB (1 << 0)
|
||||
#define V3D_DEBUG_TGSI (1 << 1)
|
||||
|
|
@ -88,7 +90,7 @@ extern uint32_t V3D_DEBUG;
|
|||
#define dbg_printf(...) fprintf(stderr, __VA_ARGS__)
|
||||
#endif /* HAVE_ANDROID_PLATFORM */
|
||||
|
||||
extern uint32_t v3d_debug_flag_for_shader_stage(gl_shader_stage stage);
|
||||
extern bool v3d_debug_flag_for_shader_stage(gl_shader_stage stage);
|
||||
|
||||
extern void v3d_process_debug_variable(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -1313,7 +1313,7 @@ f2f16_rtz(struct v3d_compile *c, struct qreg f32)
|
|||
* the default RTE conversion.
|
||||
*/
|
||||
static bool _first = true;
|
||||
if (_first && unlikely(V3D_DEBUG & V3D_DEBUG_PERF)) {
|
||||
if (_first && V3D_DBG(PERF)) {
|
||||
fprintf(stderr, "Shader uses round-toward-zero f32->f16 "
|
||||
"conversion which is not supported in hardware.\n");
|
||||
_first = false;
|
||||
|
|
@ -4568,8 +4568,8 @@ vir_check_payload_w(struct v3d_compile *c)
|
|||
void
|
||||
v3d_nir_to_vir(struct v3d_compile *c)
|
||||
{
|
||||
if (V3D_DEBUG & (V3D_DEBUG_NIR |
|
||||
v3d_debug_flag_for_shader_stage(c->s->info.stage))) {
|
||||
if (V3D_DBG(NIR) ||
|
||||
v3d_debug_flag_for_shader_stage(c->s->info.stage)) {
|
||||
fprintf(stderr, "%s prog %d/%d NIR:\n",
|
||||
vir_get_stage_name(c),
|
||||
c->program_id, c->variant_id);
|
||||
|
|
@ -4603,8 +4603,8 @@ v3d_nir_to_vir(struct v3d_compile *c)
|
|||
unreachable("bad stage");
|
||||
}
|
||||
|
||||
if (V3D_DEBUG & (V3D_DEBUG_VIR |
|
||||
v3d_debug_flag_for_shader_stage(c->s->info.stage))) {
|
||||
if (V3D_DBG(VIR) ||
|
||||
v3d_debug_flag_for_shader_stage(c->s->info.stage)) {
|
||||
fprintf(stderr, "%s prog %d/%d pre-opt VIR:\n",
|
||||
vir_get_stage_name(c),
|
||||
c->program_id, c->variant_id);
|
||||
|
|
@ -4625,8 +4625,8 @@ v3d_nir_to_vir(struct v3d_compile *c)
|
|||
* instructions until the results are needed.
|
||||
*/
|
||||
|
||||
if (V3D_DEBUG & (V3D_DEBUG_VIR |
|
||||
v3d_debug_flag_for_shader_stage(c->s->info.stage))) {
|
||||
if (V3D_DBG(VIR) ||
|
||||
v3d_debug_flag_for_shader_stage(c->s->info.stage)) {
|
||||
fprintf(stderr, "%s prog %d/%d VIR:\n",
|
||||
vir_get_stage_name(c),
|
||||
c->program_id, c->variant_id);
|
||||
|
|
@ -4647,7 +4647,7 @@ v3d_nir_to_vir(struct v3d_compile *c)
|
|||
}
|
||||
|
||||
if (c->threads == min_threads &&
|
||||
(V3D_DEBUG & V3D_DEBUG_RA)) {
|
||||
V3D_DBG(RA)) {
|
||||
fprintf(stderr,
|
||||
"Failed to register allocate using %s\n",
|
||||
c->fallback_scheduler ? "the fallback scheduler:" :
|
||||
|
|
@ -4664,7 +4664,7 @@ v3d_nir_to_vir(struct v3d_compile *c)
|
|||
}
|
||||
|
||||
if (c->threads <= MAX2(c->min_threads_for_reg_alloc, min_threads)) {
|
||||
if (V3D_DEBUG & V3D_DEBUG_PERF) {
|
||||
if (V3D_DBG(PERF)) {
|
||||
fprintf(stderr,
|
||||
"Failed to register allocate %s "
|
||||
"prog %d/%d at %d threads.\n",
|
||||
|
|
@ -4691,8 +4691,8 @@ v3d_nir_to_vir(struct v3d_compile *c)
|
|||
vir_restore_last_thrsw(c, restore_last_thrsw, restore_scoreboard_lock);
|
||||
|
||||
if (c->spills &&
|
||||
(V3D_DEBUG & (V3D_DEBUG_VIR |
|
||||
v3d_debug_flag_for_shader_stage(c->s->info.stage)))) {
|
||||
(V3D_DBG(VIR) ||
|
||||
v3d_debug_flag_for_shader_stage(c->s->info.stage))) {
|
||||
fprintf(stderr, "%s prog %d/%d spilled VIR:\n",
|
||||
vir_get_stage_name(c),
|
||||
c->program_id, c->variant_id);
|
||||
|
|
|
|||
|
|
@ -577,7 +577,7 @@ vir_compile_init(const struct v3d_compiler *compiler,
|
|||
c->disable_general_tmu_sched = disable_general_tmu_sched;
|
||||
c->disable_tmu_pipelining = disable_tmu_pipelining;
|
||||
c->disable_constant_ubo_load_sorting = disable_constant_ubo_load_sorting;
|
||||
c->disable_loop_unrolling = V3D_DEBUG & V3D_DEBUG_NO_LOOP_UNROLL
|
||||
c->disable_loop_unrolling = V3D_DBG(NO_LOOP_UNROLL)
|
||||
? true : disable_loop_unrolling;
|
||||
|
||||
s = nir_shader_clone(c, s);
|
||||
|
|
@ -1798,7 +1798,7 @@ uint64_t *v3d_compile(const struct v3d_compiler *compiler,
|
|||
c->program_id, c->variant_id);
|
||||
|
||||
if (ret >= 0) {
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_PERF))
|
||||
if (V3D_DBG(PERF))
|
||||
fprintf(stderr, "%s\n", debug_msg);
|
||||
|
||||
c->debug_output(debug_msg, c->debug_output_data);
|
||||
|
|
@ -1846,7 +1846,7 @@ uint64_t *v3d_compile(const struct v3d_compiler *compiler,
|
|||
best_spill_fill_count = c->spills + c->fills;
|
||||
}
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_PERF)) {
|
||||
if (V3D_DBG(PERF)) {
|
||||
char *debug_msg;
|
||||
int ret = asprintf(&debug_msg,
|
||||
"Compiled %s prog %d/%d with %d "
|
||||
|
|
@ -1877,7 +1877,7 @@ uint64_t *v3d_compile(const struct v3d_compiler *compiler,
|
|||
c = best_c;
|
||||
}
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_PERF) &&
|
||||
if (V3D_DBG(PERF) &&
|
||||
c->compilation_result !=
|
||||
V3D_COMPILATION_FAILED_REGISTER_ALLOCATION &&
|
||||
c->spills > 0) {
|
||||
|
|
@ -1913,7 +1913,7 @@ uint64_t *v3d_compile(const struct v3d_compiler *compiler,
|
|||
char *shaderdb;
|
||||
int ret = v3d_shaderdb_dump(c, &shaderdb);
|
||||
if (ret >= 0) {
|
||||
if (V3D_DEBUG & V3D_DEBUG_SHADERDB)
|
||||
if (V3D_DBG(SHADERDB))
|
||||
fprintf(stderr, "SHADER-DB-%s - %s\n", s->info.name, shaderdb);
|
||||
|
||||
c->debug_output(shaderdb, c->debug_output_data);
|
||||
|
|
|
|||
|
|
@ -430,8 +430,8 @@ v3d_vir_to_qpu(struct v3d_compile *c, struct qpu_reg *temp_registers)
|
|||
}
|
||||
assert(i == c->qpu_inst_count);
|
||||
|
||||
if (V3D_DEBUG & (V3D_DEBUG_QPU |
|
||||
v3d_debug_flag_for_shader_stage(c->s->info.stage))) {
|
||||
if (V3D_DBG(QPU) ||
|
||||
v3d_debug_flag_for_shader_stage(c->s->info.stage)) {
|
||||
v3d_dump_qpu(c);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -752,7 +752,7 @@ v3dv_job_init(struct v3dv_job *job,
|
|||
|
||||
v3dv_cl_init(job, &job->indirect);
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_ALWAYS_FLUSH))
|
||||
if (V3D_DBG(ALWAYS_FLUSH))
|
||||
job->always_flush = true;
|
||||
}
|
||||
|
||||
|
|
@ -1521,7 +1521,7 @@ cmd_buffer_subpass_check_double_buffer_mode(struct v3dv_cmd_buffer *cmd_buffer,
|
|||
job->can_use_double_buffer = false;
|
||||
|
||||
/* Double-buffer can only be used if requested via V3D_DEBUG */
|
||||
if (!unlikely(V3D_DEBUG & V3D_DEBUG_DOUBLE_BUFFER))
|
||||
if (!V3D_DBG(DOUBLE_BUFFER))
|
||||
return;
|
||||
|
||||
/* Double-buffer cannot be enabled for MSAA jobs */
|
||||
|
|
|
|||
|
|
@ -858,7 +858,7 @@ physical_device_init(struct v3dv_physical_device *device,
|
|||
/* Initialize sparse array for refcounting imported BOs */
|
||||
util_sparse_array_init(&device->bo_map, sizeof(struct v3dv_bo), 512);
|
||||
|
||||
device->options.merge_jobs = !(V3D_DEBUG & V3D_DEBUG_NO_MERGE_JOBS);
|
||||
device->options.merge_jobs = !V3D_DBG(NO_MERGE_JOBS);
|
||||
|
||||
device->drm_syncobj_type = vk_drm_syncobj_get_type(device->render_fd);
|
||||
|
||||
|
|
|
|||
|
|
@ -81,10 +81,10 @@ uint8_t
|
|||
v3dv_get_tex_return_size(const struct v3dv_format *vf,
|
||||
bool compare_enable)
|
||||
{
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_TMU_16BIT))
|
||||
if (V3D_DBG(TMU_16BIT))
|
||||
return 16;
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_TMU_32BIT))
|
||||
if (V3D_DBG(TMU_32BIT))
|
||||
return 32;
|
||||
|
||||
if (compare_enable)
|
||||
|
|
|
|||
|
|
@ -438,7 +438,7 @@ shader_module_compile_to_nir(struct v3dv_device *device,
|
|||
const nir_shader_compiler_options *nir_options = &v3dv_nir_options;
|
||||
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_DUMP_SPIRV) && stage->module->nir == NULL)
|
||||
if (V3D_DBG(DUMP_SPIRV) && stage->module->nir == NULL)
|
||||
v3dv_print_spirv(stage->module->data, stage->module->size, stderr);
|
||||
|
||||
/* vk_shader_module_to_nir also handles internal shaders, when module->nir
|
||||
|
|
@ -456,15 +456,14 @@ shader_module_compile_to_nir(struct v3dv_device *device,
|
|||
return NULL;
|
||||
assert(nir->info.stage == broadcom_shader_stage_to_gl(stage->stage));
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_SHADERDB) && stage->module->nir == NULL) {
|
||||
if (V3D_DBG(SHADERDB) && stage->module->nir == NULL) {
|
||||
char sha1buf[41];
|
||||
_mesa_sha1_format(sha1buf, stage->pipeline->sha1);
|
||||
nir->info.name = ralloc_strdup(nir, sha1buf);
|
||||
}
|
||||
|
||||
if (unlikely(V3D_DEBUG & (V3D_DEBUG_NIR |
|
||||
v3d_debug_flag_for_shader_stage(
|
||||
broadcom_shader_stage_to_gl(stage->stage))))) {
|
||||
if (V3D_DBG(NIR) ||
|
||||
v3d_debug_flag_for_shader_stage(broadcom_shader_stage_to_gl(stage->stage))) {
|
||||
fprintf(stderr, "NIR after vk_shader_module_to_nir: %s prog %d NIR:\n",
|
||||
broadcom_shader_stage_name(stage->stage),
|
||||
stage->program_id);
|
||||
|
|
@ -743,9 +742,9 @@ lower_tex_src_to_offset(nir_builder *b,
|
|||
base_index;
|
||||
|
||||
uint8_t return_size;
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_TMU_16BIT))
|
||||
if (V3D_DBG(TMU_16BIT))
|
||||
return_size = 16;
|
||||
else if (unlikely(V3D_DEBUG & V3D_DEBUG_TMU_32BIT))
|
||||
else if (V3D_DBG(TMU_32BIT))
|
||||
return_size = 32;
|
||||
else
|
||||
return_size = relaxed_precision || instr->is_shadow ? 16 : 32;
|
||||
|
|
@ -1649,9 +1648,8 @@ pipeline_compile_shader_variant(struct v3dv_pipeline_stage *p_stage,
|
|||
&pipeline->device->instance->physicalDevice;
|
||||
const struct v3d_compiler *compiler = physical_device->compiler;
|
||||
|
||||
if (unlikely(V3D_DEBUG & (V3D_DEBUG_NIR |
|
||||
v3d_debug_flag_for_shader_stage
|
||||
(broadcom_shader_stage_to_gl(p_stage->stage))))) {
|
||||
if (V3D_DBG(NIR) ||
|
||||
v3d_debug_flag_for_shader_stage(broadcom_shader_stage_to_gl(p_stage->stage))) {
|
||||
fprintf(stderr, "Just before v3d_compile: %s prog %d NIR:\n",
|
||||
broadcom_shader_stage_name(p_stage->stage),
|
||||
p_stage->program_id);
|
||||
|
|
@ -3080,7 +3078,7 @@ v3dv_CreateGraphicsPipelines(VkDevice _device,
|
|||
V3DV_FROM_HANDLE(v3dv_device, device, _device);
|
||||
VkResult result = VK_SUCCESS;
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_SHADERS))
|
||||
if (V3D_DBG(SHADERS))
|
||||
mtx_lock(&device->pdevice->mutex);
|
||||
|
||||
uint32_t i = 0;
|
||||
|
|
@ -3106,7 +3104,7 @@ v3dv_CreateGraphicsPipelines(VkDevice _device,
|
|||
for (; i < count; i++)
|
||||
pPipelines[i] = VK_NULL_HANDLE;
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_SHADERS))
|
||||
if (V3D_DBG(SHADERS))
|
||||
mtx_unlock(&device->pdevice->mutex);
|
||||
|
||||
return result;
|
||||
|
|
@ -3318,7 +3316,7 @@ v3dv_CreateComputePipelines(VkDevice _device,
|
|||
V3DV_FROM_HANDLE(v3dv_device, device, _device);
|
||||
VkResult result = VK_SUCCESS;
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_SHADERS))
|
||||
if (V3D_DBG(SHADERS))
|
||||
mtx_lock(&device->pdevice->mutex);
|
||||
|
||||
uint32_t i = 0;
|
||||
|
|
@ -3343,7 +3341,7 @@ v3dv_CreateComputePipelines(VkDevice _device,
|
|||
for (; i < createInfoCount; i++)
|
||||
pPipelines[i] = VK_NULL_HANDLE;
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_SHADERS))
|
||||
if (V3D_DBG(SHADERS))
|
||||
mtx_unlock(&device->pdevice->mutex);
|
||||
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ v3dv_pipeline_cache_search_for_pipeline(struct v3dv_pipeline_cache *cache,
|
|||
|
||||
size_t buffer_size;
|
||||
uint8_t *buffer = disk_cache_get(disk_cache, cache_key, &buffer_size);
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_CACHE)) {
|
||||
if (V3D_DBG(CACHE)) {
|
||||
char sha1buf[41];
|
||||
_mesa_sha1_format(sha1buf, cache_key);
|
||||
fprintf(stderr, "[v3dv on-disk cache] %s %s\n",
|
||||
|
|
@ -478,7 +478,7 @@ pipeline_cache_upload_shared_data(struct v3dv_pipeline_cache *cache,
|
|||
cache_key cache_key;
|
||||
disk_cache_compute_key(disk_cache, shared_data->sha1_key, 20, cache_key);
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_CACHE)) {
|
||||
if (V3D_DBG(CACHE)) {
|
||||
char sha1buf[41];
|
||||
_mesa_sha1_format(sha1buf, shared_data->sha1_key);
|
||||
fprintf(stderr, "[v3dv on-disk cache] storing %s\n", sha1buf);
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@
|
|||
#endif
|
||||
|
||||
#define perf_debug(...) do { \
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_PERF)) \
|
||||
if (V3D_DBG(PERF)) \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
|
|
|
|||
|
|
@ -37,16 +37,16 @@ v3dv_clif_dump(struct v3dv_device *device,
|
|||
struct v3dv_job *job,
|
||||
struct drm_v3d_submit_cl *submit)
|
||||
{
|
||||
if (!(unlikely(V3D_DEBUG & (V3D_DEBUG_CL |
|
||||
V3D_DEBUG_CL_NO_BIN |
|
||||
V3D_DEBUG_CLIF))))
|
||||
if (!(V3D_DBG(CL) ||
|
||||
V3D_DBG(CL_NO_BIN) ||
|
||||
V3D_DBG(CLIF)))
|
||||
return;
|
||||
|
||||
struct clif_dump *clif = clif_dump_init(&device->devinfo,
|
||||
stderr,
|
||||
V3D_DEBUG & (V3D_DEBUG_CL |
|
||||
V3D_DEBUG_CL_NO_BIN),
|
||||
V3D_DEBUG & V3D_DEBUG_CL_NO_BIN);
|
||||
V3D_DBG(CL) ||
|
||||
V3D_DBG(CL_NO_BIN),
|
||||
V3D_DBG(CL_NO_BIN));
|
||||
|
||||
set_foreach(job->bos, entry) {
|
||||
struct v3dv_bo *bo = (void *)entry->key;
|
||||
|
|
|
|||
|
|
@ -479,8 +479,7 @@ v3d_tlb_blit(struct pipe_context *pctx, struct pipe_blit_info *info)
|
|||
if (is_color_blit)
|
||||
surfaces[0] = dst_surf;
|
||||
|
||||
bool double_buffer =
|
||||
unlikely(V3D_DEBUG & V3D_DEBUG_DOUBLE_BUFFER) && !msaa;
|
||||
bool double_buffer = V3D_DBG(DOUBLE_BUFFER) && !msaa;
|
||||
|
||||
uint32_t tile_width, tile_height, max_bpp;
|
||||
v3d_get_tile_buffer_size(msaa, double_buffer,
|
||||
|
|
|
|||
|
|
@ -471,7 +471,7 @@ v3d_bo_wait(struct v3d_bo *bo, uint64_t timeout_ns, const char *reason)
|
|||
{
|
||||
struct v3d_screen *screen = bo->screen;
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_PERF) && timeout_ns && reason) {
|
||||
if (V3D_DBG(PERF) && timeout_ns && reason) {
|
||||
if (v3d_wait_bo_ioctl(screen->fd, bo->handle, 0) == -ETIME) {
|
||||
fprintf(stderr, "Blocking on %s BO for %s\n",
|
||||
bo->name, reason);
|
||||
|
|
|
|||
|
|
@ -338,8 +338,8 @@ v3d_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
|
|||
struct v3d_context *v3d;
|
||||
|
||||
/* Prevent dumping of the shaders built during context setup. */
|
||||
uint32_t saved_shaderdb_flag = V3D_DEBUG & V3D_DEBUG_SHADERDB;
|
||||
V3D_DEBUG &= ~V3D_DEBUG_SHADERDB;
|
||||
uint32_t saved_shaderdb_flag = v3d_mesa_debug & V3D_DEBUG_SHADERDB;
|
||||
v3d_mesa_debug &= ~V3D_DEBUG_SHADERDB;
|
||||
|
||||
v3d = rzalloc(NULL, struct v3d_context);
|
||||
if (!v3d)
|
||||
|
|
@ -394,7 +394,7 @@ v3d_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
|
|||
goto fail;
|
||||
v3d->blitter->use_index_buffer = true;
|
||||
|
||||
V3D_DEBUG |= saved_shaderdb_flag;
|
||||
v3d_mesa_debug |= saved_shaderdb_flag;
|
||||
|
||||
v3d->sample_mask = (1 << V3D_MAX_SAMPLES) - 1;
|
||||
v3d->active_queries = true;
|
||||
|
|
|
|||
|
|
@ -645,7 +645,7 @@ struct v3d_blend_state {
|
|||
};
|
||||
|
||||
#define perf_debug(...) do { \
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_PERF)) \
|
||||
if (V3D_DBG(PERF)) \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
if (unlikely(v3d->debug.debug_message)) \
|
||||
util_debug_message(&v3d->debug, PERF_INFO, __VA_ARGS__); \
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ v3d_disk_cache_retrieve(struct v3d_context *v3d,
|
|||
size_t buffer_size;
|
||||
void *buffer = disk_cache_get(cache, cache_key, &buffer_size);
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_CACHE)) {
|
||||
if (V3D_DBG(CACHE)) {
|
||||
char sha1[41];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[v3d on-disk cache] %s %s\n",
|
||||
|
|
@ -205,7 +205,7 @@ v3d_disk_cache_store(struct v3d_context *v3d,
|
|||
cache_key cache_key;
|
||||
v3d_disk_cache_compute_key(cache, key, cache_key);
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_CACHE)) {
|
||||
if (V3D_DBG(CACHE)) {
|
||||
char sha1[41];
|
||||
_mesa_sha1_format(sha1, cache_key);
|
||||
fprintf(stderr, "[v3d on-disk cache] storing %s\n", sha1);
|
||||
|
|
|
|||
|
|
@ -102,10 +102,10 @@ v3d_get_tex_return_size(const struct v3d_device_info *devinfo,
|
|||
if (!vf)
|
||||
return 0;
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_TMU_16BIT))
|
||||
if (V3D_DBG(TMU_16BIT))
|
||||
return 16;
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_TMU_32BIT))
|
||||
if (V3D_DBG(TMU_32BIT))
|
||||
return 32;
|
||||
|
||||
if (compare == PIPE_TEX_COMPARE_R_TO_TEXTURE)
|
||||
|
|
|
|||
|
|
@ -358,8 +358,7 @@ v3d_get_job(struct v3d_context *v3d,
|
|||
}
|
||||
}
|
||||
|
||||
job->double_buffer =
|
||||
unlikely(V3D_DEBUG & V3D_DEBUG_DOUBLE_BUFFER) && !job->msaa;
|
||||
job->double_buffer = V3D_DBG(DOUBLE_BUFFER) && !job->msaa;
|
||||
|
||||
memcpy(&job->key, &local_key, sizeof(local_key));
|
||||
_mesa_hash_table_insert(v3d->jobs, &job->key, job);
|
||||
|
|
@ -430,16 +429,16 @@ v3d_get_job_for_fbo(struct v3d_context *v3d)
|
|||
static void
|
||||
v3d_clif_dump(struct v3d_context *v3d, struct v3d_job *job)
|
||||
{
|
||||
if (!(unlikely(V3D_DEBUG & (V3D_DEBUG_CL |
|
||||
V3D_DEBUG_CL_NO_BIN |
|
||||
V3D_DEBUG_CLIF))))
|
||||
if (!(V3D_DBG(CL) ||
|
||||
V3D_DBG(CL_NO_BIN) ||
|
||||
V3D_DBG(CLIF)))
|
||||
return;
|
||||
|
||||
struct clif_dump *clif = clif_dump_init(&v3d->screen->devinfo,
|
||||
stderr,
|
||||
V3D_DEBUG & (V3D_DEBUG_CL |
|
||||
V3D_DEBUG_CL_NO_BIN),
|
||||
V3D_DEBUG & V3D_DEBUG_CL_NO_BIN);
|
||||
V3D_DBG(CL) ||
|
||||
V3D_DBG(CL_NO_BIN),
|
||||
V3D_DBG(CL_NO_BIN));
|
||||
|
||||
set_foreach(job->bos, entry) {
|
||||
struct v3d_bo *bo = (void *)entry->key;
|
||||
|
|
@ -552,7 +551,7 @@ v3d_job_submit(struct v3d_context *v3d, struct v3d_job *job)
|
|||
|
||||
v3d_clif_dump(v3d, job);
|
||||
|
||||
if (!(unlikely(V3D_DEBUG & V3D_DEBUG_NORAST))) {
|
||||
if (!V3D_DBG(NORAST)) {
|
||||
int ret;
|
||||
|
||||
ret = v3d_ioctl(v3d->fd, DRM_IOCTL_V3D_SUBMIT_CL, &job->submit);
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ v3d_uncompiled_shader_create(struct pipe_context *pctx,
|
|||
} else {
|
||||
assert(type == PIPE_SHADER_IR_TGSI);
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_TGSI)) {
|
||||
if (V3D_DBG(TGSI)) {
|
||||
fprintf(stderr, "prog %d TGSI:\n",
|
||||
so->program_id);
|
||||
tgsi_dump(ir, 0);
|
||||
|
|
@ -328,8 +328,7 @@ v3d_uncompiled_shader_create(struct pipe_context *pctx,
|
|||
so->base.type = PIPE_SHADER_IR_NIR;
|
||||
so->base.ir.nir = s;
|
||||
|
||||
if (unlikely(V3D_DEBUG & (V3D_DEBUG_NIR |
|
||||
v3d_debug_flag_for_shader_stage(s->info.stage)))) {
|
||||
if (V3D_DBG(NIR) || v3d_debug_flag_for_shader_stage(s->info.stage)) {
|
||||
fprintf(stderr, "%s prog %d NIR:\n",
|
||||
gl_shader_stage_name(s->info.stage),
|
||||
so->program_id);
|
||||
|
|
@ -337,7 +336,7 @@ v3d_uncompiled_shader_create(struct pipe_context *pctx,
|
|||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_PRECOMPILE))
|
||||
if (V3D_DBG(PRECOMPILE))
|
||||
v3d_shader_precompile(v3d, so);
|
||||
|
||||
return so;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
static void
|
||||
v3d_debug_resource_layout(struct v3d_resource *rsc, const char *caller)
|
||||
{
|
||||
if (!(unlikely(V3D_DEBUG & V3D_DEBUG_SURFACE)))
|
||||
if (!V3D_DBG(SURFACE))
|
||||
return;
|
||||
|
||||
struct pipe_resource *prsc = &rsc->base;
|
||||
|
|
|
|||
|
|
@ -1308,7 +1308,7 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
|
|||
v3d_flush(pctx);
|
||||
}
|
||||
|
||||
if (unlikely(V3D_DEBUG & V3D_DEBUG_ALWAYS_FLUSH))
|
||||
if (V3D_DBG(ALWAYS_FLUSH))
|
||||
v3d_flush(pctx);
|
||||
}
|
||||
|
||||
|
|
@ -1470,7 +1470,7 @@ v3d_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
|
|||
|
||||
v3d->last_perfmon = v3d->active_perfmon;
|
||||
|
||||
if (!(unlikely(V3D_DEBUG & V3D_DEBUG_NORAST))) {
|
||||
if (!V3D_DBG(NORAST)) {
|
||||
int ret = v3d_ioctl(screen->fd, DRM_IOCTL_V3D_SUBMIT_CSD,
|
||||
&submit);
|
||||
static bool warned = false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue