brw: add dumping to gem winsys
authorKeith Whitwell <keithw@vmware.com>
Mon, 30 Nov 2009 13:39:21 +0000 (13:39 +0000)
committerKeith Whitwell <keithw@vmware.com>
Mon, 30 Nov 2009 15:37:27 +0000 (15:37 +0000)
16 files changed:
progs/demos/gears.c
src/gallium/drivers/i965/Makefile
src/gallium/drivers/i965/brw_batchbuffer.c
src/gallium/drivers/i965/brw_context.h
src/gallium/drivers/i965/brw_debug.h
src/gallium/drivers/i965/brw_disasm.c
src/gallium/drivers/i965/brw_eu_emit.c
src/gallium/drivers/i965/brw_screen.c
src/gallium/drivers/i965/brw_vs_emit.c
src/gallium/drivers/i965/brw_winsys.h
src/gallium/drivers/i965/brw_winsys_debug.c [new file with mode: 0644]
src/gallium/drivers/i965/brw_wm_emit.c
src/gallium/winsys/drm/i965/gem/i965_drm_api.c
src/gallium/winsys/drm/i965/gem/i965_drm_buffer.c
src/gallium/winsys/drm/i965/gem/i965_drm_winsys.h
src/gallium/winsys/drm/i965/xlib/xlib_i965.c

index 6016162d6f74c6973bf80113269a7af87c587c4e..cf2c0a5443cc49f94aae73bfad1706e63a3fbcca 100644 (file)
@@ -92,6 +92,7 @@ gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
 
   glNormal3f(0.0, 0.0, -1.0);
 
+#if 0
   /* draw back face */
   glBegin(GL_QUAD_STRIP);
   for (i = 0; i <= teeth; i++) {
@@ -160,6 +161,7 @@ gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
     glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
   }
   glEnd();
+#endif
 
 }
 
@@ -195,6 +197,7 @@ draw(void)
       glCallList(gear1);
     glPopMatrix();
 
+#if 0
     glPushMatrix();
       glTranslatef(3.1, -2.0, 0.0);
       glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
@@ -206,6 +209,7 @@ draw(void)
       glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
       glCallList(gear3);
     glPopMatrix();
+#endif
 
   glPopMatrix();
 
@@ -213,6 +217,9 @@ draw(void)
 
   Frames++;
 
+  if (Frames == 2)
+     exit(0);
+
   {
     GLint t = glutGet(GLUT_ELAPSED_TIME);
     if (t - T0 >= 5000) {
index 8df07d1c10e0aae2048c46f8ac5c717ff0edcdd3..95fd3cd69bd5b662db09df6f0696e2433976ff1d 100644 (file)
@@ -68,6 +68,7 @@ C_SOURCES = \
        brw_screen_texture.c \
        brw_screen_surface.c \
        brw_batchbuffer.c \
+       brw_winsys_debug.c \
        intel_decode.c
 
 include ../../Makefile.template
index d725e8b27e054a93ba6748eb5aa92b54d04e38a3..22607dc6083def488039cf4748a430fda6865762 100644 (file)
 #include "util/u_memory.h"
 
 #include "brw_batchbuffer.h"
-//#include "brw_decode.h"
 #include "brw_reg.h"
 #include "brw_winsys.h"
 #include "brw_debug.h"
 #include "brw_structs.h"
-#include "intel_decode.h"
 
 #define ALWAYS_EMIT_MI_FLUSH 1
 
index 598e747fe0891d4cdb62c771bc66afa290accb15..b7330f00f49e07e41ba77784daf7f37ccd1b0aa3 100644 (file)
@@ -832,11 +832,6 @@ int brw_upload_urb_fence(struct brw_context *brw);
  */
 int brw_upload_cs_urb_state(struct brw_context *brw);
 
-/* brw_disasm.c */
-int brw_disasm_insn (FILE *file, const struct brw_instruction *inst);
-int brw_disasm (FILE *file, 
-                const struct brw_instruction *inst,
-                unsigned count);
 
 /*======================================================================
  * Inline conversion functions.  These are better-typed than the
index 0deddbf977076565f76b167cd0a3c32691f9bf5c..98407a06edaf293a7a4795afd3baef4d143505bf 100644 (file)
@@ -39,4 +39,5 @@ extern int BRW_DEBUG;
 #endif
 
 
+
 #endif
index 4100f11d48f135bb48515cd896db1751b5ca059c..65db27248b1308997d1ccc325320d1e346e104cd 100644 (file)
@@ -27,7 +27,9 @@
 #include <unistd.h>
 #include <stdarg.h>
 
-#include "brw_context.h"
+#include "brw_disasm.h"
+#include "brw_structs.h"
+#include "brw_reg.h"
 #include "brw_defines.h"
 
 struct {
index 7776b4f9655d951833533c1a91799fdf2fce22f7..3ee50899fba39febb529db9cf0b7b2b3b3998e24 100644 (file)
@@ -34,6 +34,7 @@
 #include "brw_defines.h"
 #include "brw_eu.h"
 #include "brw_debug.h"
+#include "brw_disasm.h"
 
 
 
index 05da72ebb2b425a5fc331db91ca68b10f98a2bb2..70e2d9c47a371e60cff5f73cec6e1f3023f5288a 100644 (file)
@@ -65,7 +65,16 @@ static const struct debug_named_value debug_names[] = {
    { NULL,    0 }
 };
 
+static const struct debug_named_value dump_names[] = {
+   { "asm",   DUMP_ASM},
+   { "state", DUMP_STATE},
+   { "batch", DUMP_BATCH},
+   { NULL, 0 }
+};
+
 int BRW_DEBUG = 0;
+int BRW_DUMP = 0;
+
 #endif
 
 
@@ -327,6 +336,8 @@ brw_create_screen(struct brw_winsys_screen *sws, uint pci_id)
    BRW_DEBUG = debug_get_flags_option("BRW_DEBUG", debug_names, 0);
    BRW_DEBUG |= debug_get_flags_option("INTEL_DEBUG", debug_names, 0);
    BRW_DEBUG |= DEBUG_STATS | DEBUG_MIN_URB | DEBUG_WM;
+
+   BRW_DUMP = debug_get_flags_option("BRW_DUMP", dump_names, 0);
 #endif
 
    memset(&chipset, 0, sizeof chipset);
index 00f0af2d07f1c0c0c138c07b9045ec96402aee51..20cec0f59b47fcbd6414d14acf0e1d3c1124cee4 100644 (file)
@@ -41,6 +41,7 @@
 #include "brw_context.h"
 #include "brw_vs.h"
 #include "brw_debug.h"
+#include "brw_disasm.h"
 
 /* Choose one of the 4 vec4's which can be packed into each 16-wide reg.
  */
index a723244960a4196331d33f7ed5aaaac4de851195..9e86a1256e1726166015f13b38b55dfd8634b81d 100644 (file)
@@ -111,6 +111,7 @@ enum brw_buffer_data_type {
 };
 
 
+
 /* Relocations to be applied with subdata in a call to sws->bo_subdata, below.
  *
  * Effectively this encodes:
@@ -274,6 +275,26 @@ brw_texture_blanket_winsys_buffer(struct pipe_screen *screen,
                                   struct brw_winsys_buffer *buffer);
 
 
+/*************************************************************************
+ * Cooperative dumping between winsys and driver.  TODO: make this
+ * driver-only by wrapping calls to winsys->bo_subdata().
+ */
+
+#ifdef DEBUG
+extern int BRW_DUMP;
+#else
+#define BRW_DUMP 0
+#endif 
+
+#define DUMP_ASM               0x1
+#define DUMP_STATE             0x2
+#define DUMP_BATCH             0x4
+
+void brw_dump_data( unsigned pci_id,
+                   enum brw_buffer_data_type data_type,
+                   unsigned offset,
+                   const void *data,
+                   size_t size );
 
 
 #endif
diff --git a/src/gallium/drivers/i965/brw_winsys_debug.c b/src/gallium/drivers/i965/brw_winsys_debug.c
new file mode 100644 (file)
index 0000000..f8f6a53
--- /dev/null
@@ -0,0 +1,87 @@
+#include "brw_winsys.h"
+#include "brw_disasm.h"
+#include "brw_structs_dump.h"
+#include "brw_structs.h"
+#include "intel_decode.h"
+
+
+void brw_dump_data( unsigned pci_id,
+                   enum brw_buffer_data_type data_type,
+                   unsigned offset,
+                   const void *data,
+                   size_t size )
+{
+   if (BRW_DUMP & DUMP_ASM) {
+      switch (data_type) {
+      case BRW_DATA_GS_WM_PROG:
+      case BRW_DATA_GS_SF_PROG:
+      case BRW_DATA_GS_VS_PROG:
+      case BRW_DATA_GS_GS_PROG:
+      case BRW_DATA_GS_CLIP_PROG:
+         brw_disasm( stderr, data, size / sizeof(struct brw_instruction) );
+         break;
+      default:
+         break;
+      }
+   }
+
+   if (BRW_DUMP & DUMP_STATE) {
+      switch (data_type) {
+      case BRW_DATA_GS_CC_VP:
+         brw_dump_cc_viewport( data );
+         break;
+      case BRW_DATA_GS_CC_UNIT:
+         brw_dump_cc_unit_state( data );
+         break;
+      case BRW_DATA_GS_SAMPLER_DEFAULT_COLOR:
+         brw_dump_sampler_default_color( data );
+         break;
+      case BRW_DATA_GS_SAMPLER:
+         brw_dump_sampler_state( data );
+         break;
+      case BRW_DATA_GS_WM_UNIT:
+         brw_dump_wm_unit_state( data );
+         break;
+      case BRW_DATA_GS_SF_VP:
+         brw_dump_sf_viewport( data );
+         break;
+      case BRW_DATA_GS_SF_UNIT:
+         brw_dump_sf_unit_state( data );
+         break;
+      case BRW_DATA_GS_VS_UNIT:
+         brw_dump_vs_unit_state( data );
+         break;
+      case BRW_DATA_GS_GS_UNIT:
+         brw_dump_gs_unit_state( data );
+         break;
+      case BRW_DATA_GS_CLIP_VP:
+         brw_dump_clipper_viewport( data );
+         break;
+      case BRW_DATA_GS_CLIP_UNIT:
+         brw_dump_clip_unit_state( data );
+         break;
+      case BRW_DATA_SS_SURFACE:
+         brw_dump_surface_state( data );
+         break;
+      case BRW_DATA_SS_SURF_BIND:
+         break;
+      case BRW_DATA_OTHER:
+         break;
+      case BRW_DATA_CONSTANT_BUFFER:
+         break;
+      default:
+         break;
+      }
+   }
+
+   if (BRW_DUMP & DUMP_BATCH) {
+      switch (data_type) {
+      case BRW_DATA_BATCH_BUFFER:
+         intel_decode(data, size / 4, offset, pci_id);
+         break;
+      default:
+         break;
+      }
+   }
+}
+
index 3250db18486c59e2ea85748c8e9c0bd13954e108..0b82f4e1562fe85d291b09b5f7634539cdc21acb 100644 (file)
@@ -35,6 +35,7 @@
 #include "brw_context.h"
 #include "brw_wm.h"
 #include "brw_debug.h"
+#include "brw_disasm.h"
 
 /* Not quite sure how correct this is - need to understand horiz
  * vs. vertical strides a little better.
index 191a733c3682a208179ed0cc6daf617d4b93f550..5d5dfdae464dbee8c64fd10173a0de37c14d4a62 100644 (file)
@@ -44,6 +44,9 @@ i965_libdrm_buffer_from_handle(struct i965_libdrm_winsys *idws,
    struct i965_libdrm_buffer *buf = CALLOC_STRUCT(i965_libdrm_buffer);
    uint32_t tile = 0, swizzle = 0;
 
+   if (BRW_DUMP)
+      debug_printf("%s\n", __FUNCTION__);
+
    if (!buf)
       return NULL;
    pipe_reference_init(&buf->base.reference, 1);
@@ -89,6 +92,9 @@ i965_libdrm_texture_from_shared_handle(struct drm_api *api,
    struct i965_libdrm_winsys *idws = i965_libdrm_winsys(brw_screen(screen)->sws);
    struct i965_libdrm_buffer *buffer;
 
+   if (BRW_DUMP)
+      debug_printf("%s\n", __FUNCTION__);
+
    buffer = i965_libdrm_buffer_from_handle(idws, name, handle);
    if (!buffer)
       return NULL;
@@ -106,6 +112,10 @@ i965_libdrm_shared_handle_from_texture(struct drm_api *api,
 {
    struct i965_libdrm_buffer *buf = NULL;
    struct brw_winsys_buffer *buffer = NULL;
+
+   if (BRW_DUMP)
+      debug_printf("%s\n", __FUNCTION__);
+
    if (!brw_texture_get_winsys_buffer(texture, &buffer, pitch))
       return FALSE;
 
@@ -129,6 +139,10 @@ i965_libdrm_local_handle_from_texture(struct drm_api *api,
                                       unsigned *handle)
 {
    struct brw_winsys_buffer *buffer = NULL;
+
+   if (BRW_DUMP)
+      debug_printf("%s\n", __FUNCTION__);
+
    if (!brw_texture_get_winsys_buffer(texture, &buffer, pitch))
       return FALSE;
 
@@ -142,6 +156,9 @@ i965_libdrm_winsys_destroy(struct brw_winsys_screen *iws)
 {
    struct i965_libdrm_winsys *idws = i965_libdrm_winsys(iws);
 
+   if (BRW_DUMP)
+      debug_printf("%s\n", __FUNCTION__);
+
    drm_intel_bufmgr_destroy(idws->gem);
 
    FREE(idws);
@@ -154,6 +171,8 @@ i965_libdrm_create_screen(struct drm_api *api, int drmFD,
    struct i965_libdrm_winsys *idws;
    unsigned int deviceID;
 
+   debug_printf("%s\n", __FUNCTION__);
+
    if (arg != NULL) {
       switch(arg->mode) {
       case DRM_CREATE_NORMAL:
@@ -194,6 +213,8 @@ i965_libdrm_create_context(struct drm_api *api, struct pipe_screen *screen)
 static void
 destroy(struct drm_api *api)
 {
+   if (BRW_DUMP)
+      debug_printf("%s\n", __FUNCTION__);
 
 }
 
index 1f3f19ab725bec67e9cbe8b09bd7a306a11f337f..d4a0c97262a2a18bc3668acac4f6c295e6b39e2a 100644 (file)
@@ -5,16 +5,59 @@
 #include "i915_drm.h"
 #include "intel_bufmgr.h"
 
+
+
 const char *names[BRW_BUFFER_TYPE_MAX] = {
-   "texture",
-   "scanout",
-   "vertex",
-   "curbe",
-   "query",
-   "shader_constants",
-   "wm_scratch",
-   "batch",
-   "state_cache",
+   "TEXTURE",
+   "SCANOUT",
+   "VERTEX",
+   "CURBE",
+   "QUERY",
+   "SHADER_CONSTANTS",
+   "WM_SCRATCH",
+   "BATCH",
+   "GENERAL_STATE",
+   "SURFACE_STATE",
+   "PIXEL",
+   "GENERIC",
+};
+
+const char *usages[BRW_USAGE_MAX] = {
+   "STATE",
+   "QUERY_RESULT",
+   "RENDER_TARGET",
+   "DEPTH_BUFFER",
+   "BLIT_SOURCE",
+   "BLIT_DEST",
+   "SAMPLER",
+   "VERTEX",
+   "SCRATCH"
+};
+
+
+const char *data_types[BRW_DATA_MAX] =
+{
+   "GS: CC_VP",
+   "GS: CC_UNIT",
+   "GS: WM_PROG",
+   "GS: SAMPLER_DEFAULT_COLOR",
+   "GS: SAMPLER",
+   "GS: WM_UNIT",
+   "GS: SF_PROG",
+   "GS: SF_VP",
+   "GS: SF_UNIT",
+   "GS: VS_UNIT",
+   "GS: VS_PROG",
+   "GS: GS_UNIT",
+   "GS: GS_PROG",
+   "GS: CLIP_VP",
+   "GS: CLIP_UNIT",
+   "GS: CLIP_PROG",
+   "SS: SURFACE",
+   "SS: SURF_BIND",
+   "CONSTANT DATA",
+   "BATCH DATA",
+   "(untyped)"
 };
 
 static enum pipe_error 
@@ -27,6 +70,9 @@ i965_libdrm_bo_alloc(struct brw_winsys_screen *sws,
    struct i965_libdrm_winsys *idws = i965_libdrm_winsys(sws);
    struct i965_libdrm_buffer *buf;
 
+   if (BRW_DUMP)
+      debug_printf("%s\n", __FUNCTION__);
+
    buf = CALLOC_STRUCT(i965_libdrm_buffer);
    if (!buf)
       return PIPE_ERROR_OUT_OF_MEMORY;
@@ -79,6 +125,9 @@ i965_libdrm_bo_destroy(struct brw_winsys_buffer *buffer)
 {
    struct i965_libdrm_buffer *buf = i965_libdrm_buffer(buffer);
 
+   if (BRW_DUMP)
+      debug_printf("%s\n", __FUNCTION__);
+
    drm_intel_bo_unreference(buf->bo);
    FREE(buffer);
 }
@@ -95,6 +144,12 @@ i965_libdrm_bo_emit_reloc(struct brw_winsys_buffer *buffer,
    int read, write;
    int ret;
 
+   if (BRW_DUMP)
+      debug_printf("%s buf %p offset %x delta %x buf2 %p/%s/%s\n",
+                  __FUNCTION__, (void *)buffer, 
+                  offset, delta,
+                  (void *)buffer2, names[buf2->data_type], usages[usage]);
+
    switch (usage) {
    case BRW_USAGE_STATE:
       read = I915_GEM_DOMAIN_INSTRUCTION;
@@ -104,7 +159,11 @@ i965_libdrm_bo_emit_reloc(struct brw_winsys_buffer *buffer,
       read = I915_GEM_DOMAIN_INSTRUCTION;
       write = I915_GEM_DOMAIN_INSTRUCTION;
       break;
-   case BRW_USAGE_BLIT_DEST:
+   case BRW_USAGE_RENDER_TARGET:
+      read = I915_GEM_DOMAIN_RENDER;
+      write = 0;
+      break;
+   case BRW_USAGE_DEPTH_BUFFER:
       read = I915_GEM_DOMAIN_RENDER;
       write = I915_GEM_DOMAIN_RENDER;
       break;
@@ -112,11 +171,7 @@ i965_libdrm_bo_emit_reloc(struct brw_winsys_buffer *buffer,
       read = 0;
       write = I915_GEM_DOMAIN_RENDER;
       break;
-   case BRW_USAGE_RENDER_TARGET:
-      read = I915_GEM_DOMAIN_RENDER;
-      write = 0;
-      break;
-   case BRW_USAGE_DEPTH_BUFFER:
+   case BRW_USAGE_BLIT_DEST:
       read = I915_GEM_DOMAIN_RENDER;
       write = I915_GEM_DOMAIN_RENDER;
       break;
@@ -137,6 +192,11 @@ i965_libdrm_bo_emit_reloc(struct brw_winsys_buffer *buffer,
       return -1;
    }
 
+   /* Needed??
+   ((uint32_t *)buf->bo->virtual)[offset/4] = (delta +
+                                              buf2->bo->offset);
+    */
+
    ret = dri_bo_emit_reloc( buf->bo, read, write, delta, offset, buf2->bo );
    if (ret)
       return -1;
@@ -152,6 +212,9 @@ i965_libdrm_bo_exec(struct brw_winsys_buffer *buffer,
    struct i965_libdrm_winsys *idws = i965_libdrm_winsys(buffer->sws);
    int ret;
 
+   if (BRW_DUMP)
+      debug_printf("%s\n", __FUNCTION__);
+
    if (idws->send_cmd) {
       ret = dri_bo_exec(buf->bo, bytes_used, NULL, 0, 0);
       if (ret)
@@ -171,10 +234,20 @@ i965_libdrm_bo_subdata(struct brw_winsys_buffer *buffer,
                        unsigned nr_reloc)
 {
    struct i965_libdrm_buffer *buf = i965_libdrm_buffer(buffer);
+   struct i965_libdrm_winsys *idws = i965_libdrm_winsys(buffer->sws);
    int ret, i;
 
    (void)data_type;
 
+   if (BRW_DUMP)
+      debug_printf("%s\n", __FUNCTION__);
+
+   if (BRW_DUMP)
+      brw_dump_data( idws->id,
+                    data_type,
+                    buf->bo->offset + offset, 
+                    data, size );
+
    /* XXX: use bo_map_gtt/memcpy/unmap_gtt under some circumstances???
     */
    ret = drm_intel_bo_subdata(buf->bo, offset, size, (void*)data);
@@ -194,6 +267,9 @@ i965_libdrm_bo_is_busy(struct brw_winsys_buffer *buffer)
 {
    struct i965_libdrm_buffer *buf = i965_libdrm_buffer(buffer);
 
+   if (BRW_DUMP)
+      debug_printf("%s\n", __FUNCTION__);
+
    return drm_intel_bo_busy(buf->bo);
 }
 
@@ -204,6 +280,9 @@ i965_libdrm_bo_references(struct brw_winsys_buffer *a,
    struct i965_libdrm_buffer *bufa = i965_libdrm_buffer(a);
    struct i965_libdrm_buffer *bufb = i965_libdrm_buffer(b);
 
+   if (BRW_DUMP)
+      debug_printf("%s\n", __FUNCTION__);
+
    /* XXX: can't find this func:
     */
    return drm_intel_bo_references(bufa->bo, bufb->bo);
@@ -220,6 +299,9 @@ i965_libdrm_check_aperture_space(struct brw_winsys_screen *iws,
    static drm_intel_bo *bos[128];
    int i;
 
+   if (BRW_DUMP)
+      debug_printf("%s\n", __FUNCTION__);
+
    if (count > Elements(bos)) {
       assert(0);
       return FALSE;
@@ -243,6 +325,12 @@ i965_libdrm_bo_map(struct brw_winsys_buffer *buffer,
    struct i965_libdrm_buffer *buf = i965_libdrm_buffer(buffer);
    int ret;
 
+
+   if (BRW_DUMP)
+      debug_printf("%s %p %s %s\n", __FUNCTION__, (void *)buffer, 
+                  write ? "read/write" : "read",
+                  write ? data_types[data_type] : "");
+
    if (!buf->map_count) {
       if (buf->map_gtt) {
          ret = drm_intel_gem_bo_map_gtt(buf->bo);
@@ -256,6 +344,7 @@ i965_libdrm_bo_map(struct brw_winsys_buffer *buffer,
       }
    }
 
+   buf->data_type = data_type;
    buf->map_count++;
    return buf->bo->virtual;
 }
@@ -265,7 +354,18 @@ i965_libdrm_bo_flush_range(struct brw_winsys_buffer *buffer,
                            unsigned offset,
                            unsigned length)
 {
+   struct i965_libdrm_buffer *buf = i965_libdrm_buffer(buffer);
+   struct i965_libdrm_winsys *idws = i965_libdrm_winsys(buffer->sws);
 
+   if (BRW_DUMP)
+      debug_printf("%s offset %d len %d\n", __FUNCTION__, offset, length);
+
+   if (BRW_DUMP)
+      brw_dump_data( idws->id,
+                    buf->data_type,
+                    buf->bo->offset + offset, 
+                    buf->bo->virtual + offset, 
+                    length );
 }
 
 static void 
@@ -273,6 +373,9 @@ i965_libdrm_bo_unmap(struct brw_winsys_buffer *buffer)
 {
    struct i965_libdrm_buffer *buf = i965_libdrm_buffer(buffer);
 
+   if (BRW_DUMP)
+      debug_printf("%s\n", __FUNCTION__);
+
    if (--buf->map_count > 0)
       return;
 
index 79457112636bcc859fd33742ed75425a81e11650..5b556b18f0ffbce812f50b204c3ea50430fc8846 100644 (file)
@@ -52,6 +52,8 @@ struct i965_libdrm_buffer {
    boolean flinked;
    unsigned flink;
 
+   unsigned data_type;         /* valid while mapped */
+
    unsigned cheesy_refcount;
 };
 
index 9d2bfae090df706ce79833a4dde4a8d50edb500f..e712de6307e842ab003f4d334ad9834dc14ce761 100644 (file)
@@ -228,89 +228,7 @@ xlib_brw_bo_exec( struct brw_winsys_buffer *buffer,
    return 0;
 }
 
-static void dump_data( struct xlib_brw_winsys *xbw,
-                       enum brw_buffer_data_type data_type,
-                       unsigned offset,
-                       const void *data,
-                       size_t size )
-{
-   static int DUMP_ASM = 0;
-   static int DUMP_STATE = 0;
-   static int DUMP_BATCH = 1;
-
-   if (DUMP_ASM) {
-      switch (data_type) {
-      case BRW_DATA_GS_WM_PROG:
-      case BRW_DATA_GS_SF_PROG:
-      case BRW_DATA_GS_VS_PROG:
-      case BRW_DATA_GS_GS_PROG:
-      case BRW_DATA_GS_CLIP_PROG:
-         brw_disasm( stderr, data, size / sizeof(struct brw_instruction) );
-         break;
-      default:
-         break;
-      }
-   }
-
-   if (DUMP_STATE) {
-      switch (data_type) {
-      case BRW_DATA_GS_CC_VP:
-         brw_dump_cc_viewport( data );
-         break;
-      case BRW_DATA_GS_CC_UNIT:
-         brw_dump_cc_unit_state( data );
-         break;
-      case BRW_DATA_GS_SAMPLER_DEFAULT_COLOR:
-         brw_dump_sampler_default_color( data );
-         break;
-      case BRW_DATA_GS_SAMPLER:
-         brw_dump_sampler_state( data );
-         break;
-      case BRW_DATA_GS_WM_UNIT:
-         brw_dump_wm_unit_state( data );
-         break;
-      case BRW_DATA_GS_SF_VP:
-         brw_dump_sf_viewport( data );
-         break;
-      case BRW_DATA_GS_SF_UNIT:
-         brw_dump_sf_unit_state( data );
-         break;
-      case BRW_DATA_GS_VS_UNIT:
-         brw_dump_vs_unit_state( data );
-         break;
-      case BRW_DATA_GS_GS_UNIT:
-         brw_dump_gs_unit_state( data );
-         break;
-      case BRW_DATA_GS_CLIP_VP:
-         brw_dump_clipper_viewport( data );
-         break;
-      case BRW_DATA_GS_CLIP_UNIT:
-         brw_dump_clip_unit_state( data );
-         break;
-      case BRW_DATA_SS_SURFACE:
-         brw_dump_surface_state( data );
-         break;
-      case BRW_DATA_SS_SURF_BIND:
-         break;
-      case BRW_DATA_OTHER:
-         break;
-      case BRW_DATA_CONSTANT_BUFFER:
-         break;
-      default:
-         break;
-      }
-   }
 
-   if (DUMP_BATCH) {
-      switch (data_type) {
-      case BRW_DATA_BATCH_BUFFER:
-         intel_decode(data, size / 4, offset, xbw->chipset.pci_id);
-         break;
-      default:
-         break;
-      }
-   }
-}
 
 
 static int
@@ -346,10 +264,11 @@ xlib_brw_bo_subdata(struct brw_winsys_buffer *buffer,
          xlib_brw_buffer(reloc[i].bo)->offset + reloc[i].delta;
    }
 
-   if (1)
-      dump_data( xbw, data_type,
-                 buf->offset + offset, 
-                 buf->virtual + offset, size );
+   if (BRW_DUMP)
+      brw_dump_data( xbw->chipset.pci_id,
+                    data_type,
+                    buf->offset + offset, 
+                    buf->virtual + offset, size );
 
 
    return 0;