Skip to content

Commit

Permalink
Fix state tracker crash when encountering unknown register (#12)
Browse files Browse the repository at this point in the history
This can happen for production driver captures which use registers
that mesa may not know about

Co-authored-by: Shan-Min Chao <shanminchao@google.com>
  • Loading branch information
shanminchao and Shan-Min Chao authored Oct 4, 2023
1 parent e177af5 commit d7ecdb2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions dive_core/common/emulate_pm4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,14 @@ bool EmulateStateTracker::OnPacket(const IMemoryManager &mem_manager,
uint32_t reg_offset = type4_header->offset + dword;
DIVE_ASSERT(reg_offset < kNumRegs);
const RegInfo *reg_info_ptr = GetRegInfo(reg_offset);
DIVE_ASSERT(reg_info_ptr != nullptr);

constexpr size_t dword_in_bytes = sizeof(uint32_t);
uint32_t size_in_dwords = 1;
if (reg_info_ptr->m_is_64_bit)
size_in_dwords = 2;
if (reg_info_ptr != nullptr)
{
if (reg_info_ptr->m_is_64_bit)
size_in_dwords = 2;
}
offset_in_bytes += size_in_dwords * dword_in_bytes;
for (uint32_t i = 0; i < size_in_dwords; ++i)
{
Expand Down

0 comments on commit d7ecdb2

Please sign in to comment.