From: Ilia Mirkin Date: Fri, 26 Jul 2019 03:23:08 +0000 (-0400) Subject: nouveau: flip DEBUG -> !NDEBUG X-Git-Tag: upstream/19.3.0~3687 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=23dfff0669ef351372379b517b455cee2f9bb9c7;p=platform%2Fupstream%2Fmesa.git nouveau: flip DEBUG -> !NDEBUG The meson conversion chose to change the meaning of DEBUG to "used for debugging" to be "used for expensive things for debugging", primarily for nir_validate. Flip things over so that we get nice things with optimizations enabled. While we're at it, also kill off nouveau_statebuf.h which is unused (and has a mention of DEBUG which is how I found it). Signed-off-by: Ilia Mirkin Reviewed-by: Karol Herbst --- diff --git a/src/gallium/drivers/nouveau/Makefile.sources b/src/gallium/drivers/nouveau/Makefile.sources index c6a1aff..6c36099 100644 --- a/src/gallium/drivers/nouveau/Makefile.sources +++ b/src/gallium/drivers/nouveau/Makefile.sources @@ -12,7 +12,6 @@ C_SOURCES := \ nouveau_mm.h \ nouveau_screen.c \ nouveau_screen.h \ - nouveau_statebuf.h \ nouveau_video.c \ nouveau_video.h \ nouveau_vp3_video_bsp.c \ diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h index 95b3d63..322bdd0 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h @@ -54,7 +54,7 @@ struct nv50_ir_varying ubyte si; /* TGSI semantic index */ }; -#ifdef DEBUG +#ifndef NDEBUG # define NV50_IR_DEBUG_BASIC (1 << 0) # define NV50_IR_DEBUG_VERBOSE (2 << 0) # define NV50_IR_DEBUG_REG_ALLOC (1 << 2) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_inlines.h b/src/gallium/drivers/nouveau/codegen/nv50_ir_inlines.h index 4cb53ab..b4ca5ed 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_inlines.h +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_inlines.h @@ -222,7 +222,7 @@ Instruction *Value::getUniqueInsn() const return (*it)->getInsn(); // should be unreachable and trigger assertion at the end } -#ifdef DEBUG +#ifndef NDEBUG if (reg.data.id < 0) { int n = 0; for (DefCIterator it = defs.begin(); n < 2 && it != defs.end(); ++it) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_util.h b/src/gallium/drivers/nouveau/codegen/nv50_ir_util.h index affe04a..307c23d 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_util.h +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_util.h @@ -36,14 +36,14 @@ #include "util/u_inlines.h" #include "util/u_memory.h" -#define ERROR(args...) debug_printf("ERROR: " args) -#define WARN(args...) debug_printf("WARNING: " args) -#define INFO(args...) debug_printf(args) +#define ERROR(args...) _debug_printf("ERROR: " args) +#define WARN(args...) _debug_printf("WARNING: " args) +#define INFO(args...) _debug_printf(args) #define INFO_DBG(m, f, args...) \ do { \ if (m & NV50_IR_DEBUG_##f) \ - debug_printf(args); \ + _debug_printf(args); \ } while(0) #define FATAL(args...) \ diff --git a/src/gallium/drivers/nouveau/meson.build b/src/gallium/drivers/nouveau/meson.build index 6413821..b3e79bf 100644 --- a/src/gallium/drivers/nouveau/meson.build +++ b/src/gallium/drivers/nouveau/meson.build @@ -32,7 +32,6 @@ files_libnouveau = files( 'nouveau_mm.h', 'nouveau_screen.c', 'nouveau_screen.h', - 'nouveau_statebuf.h', 'nouveau_video.c', 'nouveau_video.h', 'nouveau_vp3_video_bsp.c', diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h index 1302c60..450c7c4 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.h +++ b/src/gallium/drivers/nouveau/nouveau_screen.h @@ -6,7 +6,7 @@ #include "util/u_atomic.h" #include "util/u_memory.h" -#ifdef DEBUG +#ifndef NDEBUG # define NOUVEAU_ENABLE_DRIVER_STATISTICS #endif diff --git a/src/gallium/drivers/nouveau/nouveau_statebuf.h b/src/gallium/drivers/nouveau/nouveau_statebuf.h deleted file mode 100644 index da5d797..0000000 --- a/src/gallium/drivers/nouveau/nouveau_statebuf.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __NOUVEAU_STATEBUF_H__ -#define __NOUVEAU_STATEBUF_H__ - -/* state buffers: lightweight state objects interface */ -/* relocations are not supported, but Gallium CSOs don't require them */ - -struct nouveau_statebuf_builder -{ - uint32_t* p; -#ifdef DEBUG - uint32_t* pend; -#endif -}; - -#ifdef DEBUG -#define sb_init(var) {var, var + sizeof(var) / sizeof((var)[0])} -#define sb_data(sb, v) do {assert((sb).p != (sb).pend); *(sb).p++ = (v);} while(0) -#else -#define sb_init(var) {var} -#define sb_data(sb, v) *(sb).p++ = (v) -#endif - -static inline uint32_t sb_header(unsigned subc, unsigned mthd, unsigned size) -{ - return (size << 18) | (subc << 13) | mthd; -} - -#define sb_method(sb, v, n) sb_data(sb, sb_header(SUBC_3D(v), n)); - -#define sb_len(sb, var) ((sb).p - (var)) -#define sb_emit(push, sb_buf, sb_len) do {PUSH_SPACE((push), (sb_len)); PUSH_DATAp((push), (sb_buf), (sb_len)); } while(0) -#endif diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c b/src/gallium/drivers/nouveau/nv50/nv50_program.c index a725aed..c9d01e8 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_program.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c @@ -378,7 +378,7 @@ nv50_program_translate(struct nv50_program *prog, uint16_t chipset, info->driverPriv = prog; -#ifdef DEBUG +#ifndef NDEBUG info->optLevel = debug_get_num_option("NV50_PROG_OPTIMIZE", 3); info->dbgFlags = debug_get_num_option("NV50_PROG_DEBUG", 0); info->omitLineNum = debug_get_num_option("NV50_PROG_DEBUG_OMIT_LINENUM", 0); diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c index 180b31e..3248724 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c @@ -544,7 +544,7 @@ nvc0_program_create_tfb_state(const struct nv50_ir_prog_info *info, return tfb; } -#ifdef DEBUG +#ifndef NDEBUG static void nvc0_program_dump(struct nvc0_program *prog) { @@ -594,7 +594,7 @@ nvc0_program_translate(struct nvc0_program *prog, uint16_t chipset, return false; } -#ifdef DEBUG +#ifndef NDEBUG info->target = debug_get_num_option("NV50_PROG_CHIPSET", chipset); info->optLevel = debug_get_num_option("NV50_PROG_OPTIMIZE", 3); info->dbgFlags = debug_get_num_option("NV50_PROG_DEBUG", 0); @@ -714,7 +714,7 @@ nvc0_program_translate(struct nvc0_program *prog, uint16_t chipset, prog->num_gprs, info->bin.instructions, info->bin.codeSize); -#ifdef DEBUG +#ifndef NDEBUG if (debug_get_option("NV50_PROG_CHIPSET", NULL) && info->dbgFlags) nvc0_program_dump(prog); #endif @@ -880,7 +880,7 @@ nvc0_program_upload(struct nvc0_context *nvc0, struct nvc0_program *prog) nvc0_program_upload_code(nvc0, prog); -#ifdef DEBUG +#ifndef NDEBUG if (debug_get_bool_option("NV50_PROG_DEBUG", false)) nvc0_program_dump(prog); #endif diff --git a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c index 022aace..91c2671 100644 --- a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c +++ b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c @@ -27,7 +27,7 @@ #include "codegen/nv50_ir_driver.h" -#ifdef DEBUG +#ifndef NDEBUG static void nve4_compute_dump_launch_desc(const struct nve4_cp_launch_desc *); static void gp100_compute_dump_launch_desc(const struct gp100_cp_launch_desc *); #endif @@ -741,7 +741,7 @@ nve4_launch_grid(struct pipe_context *pipe, const struct pipe_grid_info *info) nve4_compute_upload_input(nvc0, info); -#ifdef DEBUG +#ifndef NDEBUG if (debug_get_num_option("NV50_PROG_DEBUG", 0)) { if (nvc0->screen->compute->oclass >= GP100_COMPUTE_CLASS) gp100_compute_dump_launch_desc(desc); @@ -878,7 +878,7 @@ nve4_compute_validate_textures(struct nvc0_context *nvc0) } -#ifdef DEBUG +#ifndef NDEBUG static const char *nve4_cache_split_name(unsigned value) { switch (value) {