i965/tex_image: Use meta for instead of the blitter PBO TexImage and GetTexImage
[mesa.git] / src / mesa / drivers / dri / i965 / brw_state_dump.c
index 48903965dd9408ddffc9984e655133710d590595..8b32810afe935bc013fc618e5024adae86033f44 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "brw_context.h"
 #include "brw_defines.h"
+#include "brw_eu.h"
 
 static void
 batch_out(struct brw_context *brw, const char *name, uint32_t offset,
@@ -197,22 +198,28 @@ static void dump_gen7_surface_state(struct brw_context *brw, uint32_t offset)
    const char *name = "SURF";
    uint32_t *surf = brw->batch.bo->virtual + offset;
 
-   batch_out(brw, name, offset, 0, "%s %s\n",
+   batch_out(brw, name, offset, 0, "%s %s %s\n",
              get_965_surfacetype(GET_FIELD(surf[0], BRW_SURFACE_TYPE)),
-             get_965_surface_format(GET_FIELD(surf[0], BRW_SURFACE_FORMAT)));
+             get_965_surface_format(GET_FIELD(surf[0], BRW_SURFACE_FORMAT)),
+             (surf[0] & GEN7_SURFACE_IS_ARRAY) ? "array" : "");
    batch_out(brw, name, offset, 1, "offset\n");
-   batch_out(brw, name, offset, 2, "%dx%d size, %d mips\n",
+   batch_out(brw, name, offset, 2, "%dx%d size, %d mips, %d slices\n",
              GET_FIELD(surf[2], GEN7_SURFACE_WIDTH) + 1,
              GET_FIELD(surf[2], GEN7_SURFACE_HEIGHT) + 1,
-             surf[5] & INTEL_MASK(3, 0));
+             surf[5] & INTEL_MASK(3, 0),
+             GET_FIELD(surf[3], BRW_SURFACE_DEPTH) + 1);
    batch_out(brw, name, offset, 3, "pitch %d, %stiled\n",
             (surf[3] & INTEL_MASK(17, 0)) + 1,
              (surf[0] & (1 << 14)) ? "" : "not ");
-   batch_out(brw, name, offset, 4, "mip base %d\n",
+   batch_out(brw, name, offset, 4, "min array element %d, array extent %d\n",
+             GET_FIELD(surf[4], GEN7_SURFACE_MIN_ARRAY_ELEMENT),
+             GET_FIELD(surf[4], GEN7_SURFACE_RENDER_TARGET_VIEW_EXTENT) + 1);
+   batch_out(brw, name, offset, 5, "mip base %d\n",
              GET_FIELD(surf[5], GEN7_SURFACE_MIN_LOD));
-   batch_out(brw, name, offset, 5, "x,y offset: %d,%d\n",
+   batch_out(brw, name, offset, 6, "x,y offset: %d,%d\n",
              GET_FIELD(surf[5], BRW_SURFACE_X_OFFSET),
              GET_FIELD(surf[5], BRW_SURFACE_Y_OFFSET));
+   batch_out(brw, name, offset, 7, "\n");
 }
 
 static void
@@ -236,12 +243,11 @@ dump_sdc(struct brw_context *brw, uint32_t offset)
       batch_out(brw, name, offset, 10, "s16 ba\n");
       batch_out(brw, name, offset, 11, "s8 rgba\n");
    } else {
-      struct brw_sampler_default_color *sdc = (brw->batch.bo->virtual +
-                                              offset);
-      batch_out(brw, name, offset, 0, "r %f\n", sdc->color[0]);
-      batch_out(brw, name, offset, 1, "g %f\n", sdc->color[1]);
-      batch_out(brw, name, offset, 2, "b %f\n", sdc->color[2]);
-      batch_out(brw, name, offset, 3, "a %f\n", sdc->color[3]);
+      float *sdc = brw->batch.bo->virtual + offset;
+      batch_out(brw, name, offset, 0, "r %f\n", sdc[0]);
+      batch_out(brw, name, offset, 1, "g %f\n", sdc[1]);
+      batch_out(brw, name, offset, 2, "b %f\n", sdc[2]);
+      batch_out(brw, name, offset, 3, "a %f\n", sdc[3]);
    }
 }
 
@@ -249,11 +255,9 @@ static void dump_sampler_state(struct brw_context *brw,
                               uint32_t offset, uint32_t size)
 {
    int i;
-   struct brw_sampler_state *samp = brw->batch.bo->virtual + offset;
+   uint32_t *samp = brw->batch.bo->virtual + offset;
 
-   assert(brw->gen < 7);
-
-   for (i = 0; i < size / sizeof(*samp); i++) {
+   for (i = 0; i < size / 16; i++) {
       char name[20];
 
       sprintf(name, "WM SAMP%d", i);
@@ -262,34 +266,11 @@ static void dump_sampler_state(struct brw_context *brw,
       batch_out(brw, name, offset, 2, "default color pointer\n");
       batch_out(brw, name, offset, 3, "chroma key, aniso\n");
 
-      samp++;
-      offset += sizeof(*samp);
+      samp += 4;
+      offset += 4 * sizeof(uint32_t);
    }
 }
 
-static void dump_gen7_sampler_state(struct brw_context *brw,
-                                   uint32_t offset, uint32_t size)
-{
-   struct gen7_sampler_state *samp = brw->batch.bo->virtual + offset;
-   int i;
-
-   assert(brw->gen >= 7);
-
-   for (i = 0; i < size / sizeof(*samp); i++) {
-      char name[20];
-
-      sprintf(name, "WM SAMP%d", i);
-      batch_out(brw, name, offset, 0, "filtering\n");
-      batch_out(brw, name, offset, 1, "wrapping, lod\n");
-      batch_out(brw, name, offset, 2, "default color pointer\n");
-      batch_out(brw, name, offset, 3, "chroma key, aniso\n");
-
-      samp++;
-      offset += sizeof(*samp);
-   }
-}
-
-
 static void dump_sf_viewport_state(struct brw_context *brw,
                                   uint32_t offset)
 {
@@ -480,8 +461,7 @@ static void
 dump_prog_cache(struct brw_context *brw)
 {
    struct brw_cache *cache = &brw->cache;
-   unsigned int b, i;
-   uint32_t *data;
+   unsigned int b;
 
    drm_intel_bo_map(brw->cache.bo, false);
 
@@ -490,42 +470,34 @@ dump_prog_cache(struct brw_context *brw)
 
       for (item = cache->items[b]; item; item = item->next) {
         const char *name;
-        uint32_t offset = item->offset;
-
-        data = brw->cache.bo->virtual + item->offset;
 
         switch (item->cache_id) {
-        case BRW_VS_PROG:
+        case BRW_CACHE_VS_PROG:
            name = "VS kernel";
            break;
-        case BRW_FF_GS_PROG:
+        case BRW_CACHE_FF_GS_PROG:
            name = "Fixed-function GS kernel";
            break;
-         case BRW_GS_PROG:
+         case BRW_CACHE_GS_PROG:
             name = "GS kernel";
             break;
-        case BRW_CLIP_PROG:
+        case BRW_CACHE_CLIP_PROG:
            name = "CLIP kernel";
            break;
-        case BRW_SF_PROG:
+        case BRW_CACHE_SF_PROG:
            name = "SF kernel";
            break;
-        case BRW_WM_PROG:
-           name = "WM kernel";
+        case BRW_CACHE_FS_PROG:
+           name = "FS kernel";
            break;
         default:
            name = "unknown";
            break;
         }
 
-        for (i = 0; i < item->size / 4 / 4; i++) {
-           fprintf(stderr, "0x%08x: %8s: 0x%08x 0x%08x 0x%08x 0x%08x ",
-                   offset + i * 4 * 4,
-                   name,
-                   data[i * 4], data[i * 4 + 1], data[i * 4 + 2], data[i * 4 + 3]);
-
-           brw_disasm(stderr, (void *)(data + i * 4), brw->gen);
-        }
+         fprintf(stderr, "%s:\n", name);
+         brw_disassemble(brw, brw->cache.bo->virtual, item->offset, item->size,
+                         stderr);
       }
    }
 
@@ -593,11 +565,7 @@ dump_state_batch(struct brw_context *brw)
         }
         break;
       case AUB_TRACE_SAMPLER_STATE:
-        if (brw->gen < 7) {
-           dump_sampler_state(brw, offset, size);
-        } else {
-           dump_gen7_sampler_state(brw, offset, size);
-        }
+         dump_sampler_state(brw, offset, size);
         break;
       case AUB_TRACE_SAMPLER_DEFAULT_COLOR:
         dump_sdc(brw, offset);