Merge branch '7.8'
[mesa.git] / src / mesa / drivers / dri / i965 / brw_state_dump.c
index 3a93f9f732ea3766482b89172903ba9b7994bd3d..020ac523b68f9e10c7c36531d53b9ad20b9ad583 100644 (file)
  *
  */
 
-#include "mtypes.h"
+#include "main/mtypes.h"
 
 #include "brw_context.h"
-#include "brw_state.h"
 #include "brw_defines.h"
 
 /**
@@ -84,6 +83,19 @@ get_965_surfacetype(unsigned int surfacetype)
     }
 }
 
+static const char *
+get_965_surface_format(unsigned int surface_format)
+{
+    switch (surface_format) {
+    case 0x000: return "r32g32b32a32_float";
+    case 0x0c1: return "b8g8r8a8_unorm";
+    case 0x100: return "b5g6r5_unorm";
+    case 0x102: return "b5g5r5a1_unorm";
+    case 0x104: return "b4g4r4a4_unorm";
+    default: return "unknown";
+    }
+}
+
 static void dump_wm_surface_state(struct brw_context *brw)
 {
    int i;
@@ -95,7 +107,7 @@ static void dump_wm_surface_state(struct brw_context *brw)
       char name[20];
 
       if (surf_bo == NULL) {
-        fprintf(stderr, "WM SS%d: NULL\n", i);
+        fprintf(stderr, "  WM SS%d: NULL\n", i);
         continue;
       }
       dri_bo_map(surf_bo, GL_FALSE);
@@ -103,8 +115,9 @@ static void dump_wm_surface_state(struct brw_context *brw)
       surf = (struct brw_surface_state *)(surf_bo->virtual);
 
       sprintf(name, "WM SS%d", i);
-      state_out(name, surf, surfoff, 0, "%s\n",
-               get_965_surfacetype(surf->ss0.surface_type));
+      state_out(name, surf, surfoff, 0, "%s %s\n",
+               get_965_surfacetype(surf->ss0.surface_type),
+               get_965_surface_format(surf->ss0.surface_format));
       state_out(name, surf, surfoff, 1, "offset\n");
       state_out(name, surf, surfoff, 2, "%dx%d size, %d mips\n",
                surf->ss2.width + 1, surf->ss2.height + 1, surf->ss2.mip_count);
@@ -112,6 +125,8 @@ static void dump_wm_surface_state(struct brw_context *brw)
                surf->ss3.pitch + 1, surf->ss3.tiled_surface ? "" : "not ");
       state_out(name, surf, surfoff, 4, "mip base %d\n",
                surf->ss4.min_lod);
+      state_out(name, surf, surfoff, 5, "x,y offset: %d,%d\n",
+               surf->ss5.x_offset, surf->ss5.y_offset);
 
       dri_bo_unmap(surf_bo);
    }
@@ -162,6 +177,14 @@ static void brw_debug_prog(const char *name, dri_bo *prog)
       fprintf(stderr, "%8s: 0x%08x: 0x%08x 0x%08x 0x%08x 0x%08x\n",
              name, (unsigned int)prog->offset + i * 4 * 4,
              data[i * 4], data[i * 4 + 1], data[i * 4 + 2], data[i * 4 + 3]);
+      /* Stop at the end of the program.  It'd be nice to keep track of the actual
+       * intended program size instead of guessing like this.
+       */
+      if (data[i * 4 + 0] == 0 &&
+         data[i * 4 + 1] == 0 &&
+         data[i * 4 + 2] == 0 &&
+         data[i * 4 + 3] == 0)
+        break;
    }
 
    dri_bo_unmap(prog);