nouveau: flip DEBUG -> !NDEBUG
authorIlia Mirkin <imirkin@alum.mit.edu>
Fri, 26 Jul 2019 03:23:08 +0000 (23:23 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sat, 27 Jul 2019 22:24:11 +0000 (18:24 -0400)
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 <imirkin@alum.mit.edu>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
src/gallium/drivers/nouveau/Makefile.sources
src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
src/gallium/drivers/nouveau/codegen/nv50_ir_inlines.h
src/gallium/drivers/nouveau/codegen/nv50_ir_util.h
src/gallium/drivers/nouveau/meson.build
src/gallium/drivers/nouveau/nouveau_screen.h
src/gallium/drivers/nouveau/nouveau_statebuf.h [deleted file]
src/gallium/drivers/nouveau/nv50/nv50_program.c
src/gallium/drivers/nouveau/nvc0/nvc0_program.c
src/gallium/drivers/nouveau/nvc0/nve4_compute.c

index c6a1aff..6c36099 100644 (file)
@@ -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 \
index 95b3d63..322bdd0 100644 (file)
@@ -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)
index 4cb53ab..b4ca5ed 100644 (file)
@@ -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)
index affe04a..307c23d 100644 (file)
 #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...)          \
index 6413821..b3e79bf 100644 (file)
@@ -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',
index 1302c60..450c7c4 100644 (file)
@@ -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 (file)
index da5d797..0000000
+++ /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
index a725aed..c9d01e8 100644 (file)
@@ -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);
index 180b31e..3248724 100644 (file)
@@ -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
index 022aace..91c2671 100644 (file)
@@ -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) {