i915: Remove most of the code under gen >= 4 checks.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_state_dump.c
index b9e5cc1a534f1b2833682feecd0b0014065986b8..6fc883753cc069d27e38cd7799f4895ada2cde49 100644 (file)
@@ -201,20 +201,24 @@ static void dump_surface_state(struct brw_context *brw, uint32_t offset)
 static void dump_gen7_surface_state(struct brw_context *brw, uint32_t offset)
 {
    const char *name = "SURF";
-   struct gen7_surface_state *surf = brw->intel.batch.bo->virtual + offset;
+   uint32_t *surf = brw->intel.batch.bo->virtual + offset;
 
    batch_out(brw, name, offset, 0, "%s %s\n",
-            get_965_surfacetype(surf->ss0.surface_type),
-            get_965_surface_format(surf->ss0.surface_format));
+             get_965_surfacetype(GET_FIELD(surf[0], BRW_SURFACE_TYPE)),
+             get_965_surface_format(GET_FIELD(surf[0], BRW_SURFACE_FORMAT)));
    batch_out(brw, name, offset, 1, "offset\n");
    batch_out(brw, name, offset, 2, "%dx%d size, %d mips\n",
-            surf->ss2.width + 1, surf->ss2.height + 1, surf->ss5.mip_count);
+             GET_FIELD(surf[2], GEN7_SURFACE_WIDTH) + 1,
+             GET_FIELD(surf[2], GEN7_SURFACE_HEIGHT) + 1,
+             surf[5] & INTEL_MASK(3, 0));
    batch_out(brw, name, offset, 3, "pitch %d, %stiled\n",
-            surf->ss3.pitch + 1, surf->ss0.tiled_surface ? "" : "not ");
+            (surf[3] & INTEL_MASK(17, 0)) + 1,
+             (surf[0] & (1 << 14)) ? "" : "not ");
    batch_out(brw, name, offset, 4, "mip base %d\n",
-            surf->ss5.min_lod);
+             GET_FIELD(surf[5], GEN7_SURFACE_MIN_LOD));
    batch_out(brw, name, offset, 5, "x,y offset: %d,%d\n",
-            surf->ss5.x_offset, surf->ss5.y_offset);
+             GET_FIELD(surf[5], BRW_SURFACE_X_OFFSET),
+             GET_FIELD(surf[5], BRW_SURFACE_Y_OFFSET));
 }
 
 static void
@@ -292,7 +296,6 @@ static void dump_gen7_sampler_state(struct brw_context *brw,
       samp++;
       offset += sizeof(*samp);
    }
-   drm_intel_bo_unmap(intel->batch.bo);
 }
 
 
@@ -455,6 +458,23 @@ dump_vs_constants(struct brw_context *brw, uint32_t offset, uint32_t size)
    }
 }
 
+static void
+dump_wm_constants(struct brw_context *brw, uint32_t offset, uint32_t size)
+{
+   const char *name = "WM_CONST";
+   struct intel_context *intel = &brw->intel;
+   uint32_t *as_uint = intel->batch.bo->virtual + offset;
+   float *as_float = intel->batch.bo->virtual + offset;
+   int i;
+
+   for (i = 0; i < size / 4; i += 4) {
+      batch_out(brw, name, offset, i, "%3d: (% f % f % f % f) (0x%08x 0x%08x 0x%08x 0x%08x)\n",
+               i / 4,
+               as_float[i], as_float[i + 1], as_float[i + 2], as_float[i + 3],
+               as_uint[i], as_uint[i + 1], as_uint[i + 2], as_uint[i + 3]);
+   }
+}
+
 static void dump_binding_table(struct brw_context *brw, uint32_t offset,
                               uint32_t size)
 {
@@ -602,6 +622,9 @@ dump_state_batch(struct brw_context *brw)
       case AUB_TRACE_VS_CONSTANTS:
         dump_vs_constants(brw, offset, size);
         break;
+      case AUB_TRACE_WM_CONSTANTS:
+        dump_wm_constants(brw, offset, size);
+        break;
       default:
         break;
       }