[Mesa-dev] [PATCH 2/2] intel: batch-decoder: fix parsing of BLEND_STATE

Lionel Landwerlin lionel.g.landwerlin at intel.com
Tue Aug 14 00:21:48 UTC 2018


The previous implementation seemed to imply that
3DSTATE_BLEND_STATE_POINTERS had a pointer to an array of BLEND_STATE.
This is true on Gen7.5 but not on Gen8+. The actual array is made up
of BLEND_STATE_ENTRY elements following BLEND_STATE (which is empty on
Gen7.5).

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107544
---
 src/intel/common/gen_batch_decoder.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/intel/common/gen_batch_decoder.c b/src/intel/common/gen_batch_decoder.c
index f5be0018afc..715eeaa159c 100644
--- a/src/intel/common/gen_batch_decoder.c
+++ b/src/intel/common/gen_batch_decoder.c
@@ -691,7 +691,31 @@ static void
 decode_3dstate_blend_state_pointers(struct gen_batch_decode_ctx *ctx,
                                     const uint32_t *p)
 {
-   decode_dynamic_state_pointers(ctx, "BLEND_STATE", p, 1);
+   struct gen_group *inst = gen_spec_find_instruction(ctx->spec, p);
+   struct gen_group *state = gen_spec_find_struct(ctx->spec, "BLEND_STATE");
+   struct gen_group *state_entry = gen_spec_find_struct(ctx->spec, "BLEND_STATE_ENTRY");
+   uint32_t state_offset = 0;
+
+   struct gen_field_iterator iter;
+   gen_field_iterator_init(&iter, inst, p, 0, false);
+   while (gen_field_iterator_next(&iter)) {
+      if (str_ends_with(iter.name, "Pointer")) {
+         state_offset = iter.raw_value;
+         break;
+      }
+   }
+
+   uint64_t state_addr = ctx->dynamic_base + state_offset;
+   struct gen_batch_decode_bo bo = ctx_get_bo(ctx, state_addr);
+   const void *state_map = bo.map;
+
+   ctx_print_group(ctx, state, state_offset, state_map);
+
+   state_addr += state->dw_length;
+   state_map += state->dw_length;
+
+   fprintf(ctx->fp, "%s 0\n", state_entry->name);
+   ctx_print_group(ctx, state_entry, state_offset, state_map);
 }
 
 static void
-- 
2.18.0



More information about the mesa-dev mailing list