v3d/v3dv: add unlikely for any V3D_DEBUG check

We had some with unlikely, some without it. Let's just put unlikely to
all of them.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13071>
This commit is contained in:
Alejandro Piñeiro 2021-09-28 00:37:49 +02:00 committed by Marge Bot
parent 0e5601e6f3
commit 1898ee5493
7 changed files with 22 additions and 22 deletions

View file

@ -797,7 +797,7 @@ v3dv_job_init(struct v3dv_job *job,
v3dv_cl_init(job, &job->indirect);
if (V3D_DEBUG & V3D_DEBUG_ALWAYS_FLUSH)
if (unlikely(V3D_DEBUG & V3D_DEBUG_ALWAYS_FLUSH))
job->always_flush = true;
}

View file

@ -440,7 +440,7 @@ shader_module_compile_to_nir(struct v3dv_device *device,
uint32_t *spirv = (uint32_t *) stage->module->data;
assert(stage->module->size % 4 == 0);
if (V3D_DEBUG & V3D_DEBUG_DUMP_SPIRV)
if (unlikely(V3D_DEBUG & V3D_DEBUG_DUMP_SPIRV))
v3dv_print_spirv(stage->module->data, stage->module->size, stderr);
uint32_t num_spec_entries = 0;
@ -467,9 +467,9 @@ shader_module_compile_to_nir(struct v3dv_device *device,
}
assert(nir->info.stage == broadcom_shader_stage_to_gl(stage->stage));
if (V3D_DEBUG & (V3D_DEBUG_NIR |
v3d_debug_flag_for_shader_stage(
broadcom_shader_stage_to_gl(stage->stage)))) {
if (unlikely(V3D_DEBUG & (V3D_DEBUG_NIR |
v3d_debug_flag_for_shader_stage(
broadcom_shader_stage_to_gl(stage->stage))))) {
fprintf(stderr, "Initial form: %s prog %d NIR:\n",
broadcom_shader_stage_name(stage->stage),
stage->program_id);
@ -1619,9 +1619,9 @@ pipeline_compile_shader_variant(struct v3dv_pipeline_stage *p_stage,
&pipeline->device->instance->physicalDevice;
const struct v3d_compiler *compiler = physical_device->compiler;
if (V3D_DEBUG & (V3D_DEBUG_NIR |
v3d_debug_flag_for_shader_stage
(broadcom_shader_stage_to_gl(p_stage->stage)))) {
if (unlikely(V3D_DEBUG & (V3D_DEBUG_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);

View file

@ -34,9 +34,9 @@ v3dv_clif_dump(struct v3dv_device *device,
struct v3dv_job *job,
struct drm_v3d_submit_cl *submit)
{
if (!(V3D_DEBUG & (V3D_DEBUG_CL |
V3D_DEBUG_CL_NO_BIN |
V3D_DEBUG_CLIF)))
if (!(unlikely(V3D_DEBUG & (V3D_DEBUG_CL |
V3D_DEBUG_CL_NO_BIN |
V3D_DEBUG_CLIF))))
return;
struct clif_dump *clif = clif_dump_init(&device->devinfo,

View file

@ -426,9 +426,9 @@ v3d_get_job_for_fbo(struct v3d_context *v3d)
static void
v3d_clif_dump(struct v3d_context *v3d, struct v3d_job *job)
{
if (!(V3D_DEBUG & (V3D_DEBUG_CL |
V3D_DEBUG_CL_NO_BIN |
V3D_DEBUG_CLIF)))
if (!(unlikely(V3D_DEBUG & (V3D_DEBUG_CL |
V3D_DEBUG_CL_NO_BIN |
V3D_DEBUG_CLIF))))
return;
struct clif_dump *clif = clif_dump_init(&v3d->screen->devinfo,
@ -538,7 +538,7 @@ v3d_job_submit(struct v3d_context *v3d, struct v3d_job *job)
v3d_clif_dump(v3d, job);
if (!(V3D_DEBUG & V3D_DEBUG_NORAST)) {
if (!(unlikely(V3D_DEBUG & V3D_DEBUG_NORAST))) {
int ret;
ret = v3d_ioctl(v3d->fd, DRM_IOCTL_V3D_SUBMIT_CL, &job->submit);

View file

@ -297,7 +297,7 @@ v3d_uncompiled_shader_create(struct pipe_context *pctx,
} else {
assert(type == PIPE_SHADER_IR_TGSI);
if (V3D_DEBUG & V3D_DEBUG_TGSI) {
if (unlikely(V3D_DEBUG & V3D_DEBUG_TGSI)) {
fprintf(stderr, "prog %d TGSI:\n",
so->program_id);
tgsi_dump(ir, 0);
@ -328,8 +328,8 @@ v3d_uncompiled_shader_create(struct pipe_context *pctx,
so->base.type = PIPE_SHADER_IR_NIR;
so->base.ir.nir = s;
if (V3D_DEBUG & (V3D_DEBUG_NIR |
v3d_debug_flag_for_shader_stage(s->info.stage))) {
if (unlikely(V3D_DEBUG & (V3D_DEBUG_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 +337,7 @@ v3d_uncompiled_shader_create(struct pipe_context *pctx,
fprintf(stderr, "\n");
}
if (V3D_DEBUG & V3D_DEBUG_PRECOMPILE)
if (unlikely(V3D_DEBUG & V3D_DEBUG_PRECOMPILE))
v3d_shader_precompile(v3d, so);
return so;

View file

@ -41,7 +41,7 @@
static void
v3d_debug_resource_layout(struct v3d_resource *rsc, const char *caller)
{
if (!(V3D_DEBUG & V3D_DEBUG_SURFACE))
if (!(unlikely(V3D_DEBUG & V3D_DEBUG_SURFACE)))
return;
struct pipe_resource *prsc = &rsc->base;

View file

@ -1284,7 +1284,7 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
v3d_flush(pctx);
}
if (V3D_DEBUG & V3D_DEBUG_ALWAYS_FLUSH)
if (unlikely(V3D_DEBUG & V3D_DEBUG_ALWAYS_FLUSH))
v3d_flush(pctx);
}
@ -1446,7 +1446,7 @@ v3d_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
v3d->last_perfmon = v3d->active_perfmon;
if (!(V3D_DEBUG & V3D_DEBUG_NORAST)) {
if (!(unlikely(V3D_DEBUG & V3D_DEBUG_NORAST))) {
int ret = v3d_ioctl(screen->fd, DRM_IOCTL_V3D_SUBMIT_CSD,
&submit);
static bool warned = false;