Add debug window for MDEC
This commit is contained in:
parent
0f68c8c5d3
commit
2d9d999713
|
@ -20,6 +20,7 @@ public:
|
|||
T* GetFrontPointer() { return &m_ptr[m_head]; }
|
||||
constexpr u32 GetCapacity() const { return CAPACITY; }
|
||||
u32 GetSize() const { return m_size; }
|
||||
u32 GetSpace() const { return CAPACITY - m_size; }
|
||||
bool IsEmpty() const { return m_size == 0; }
|
||||
bool IsFull() const { return m_size == CAPACITY; }
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "dma.h"
|
||||
#include "interrupt_controller.h"
|
||||
#include "system.h"
|
||||
#include <imgui.h>
|
||||
Log_SetChannel(MDEC);
|
||||
|
||||
MDEC::MDEC() = default;
|
||||
|
@ -165,6 +166,7 @@ void MDEC::WriteCommandRegister(u32 value)
|
|||
m_status.data_output_depth = cw.data_output_depth;
|
||||
m_status.data_output_signed = cw.data_output_signed;
|
||||
m_status.data_output_bit15 = cw.data_output_bit15;
|
||||
m_data_out_fifo.Clear();
|
||||
|
||||
switch (cw.command)
|
||||
{
|
||||
|
@ -302,6 +304,7 @@ bool MDEC::DecodeMonoMacroblock()
|
|||
break;
|
||||
}
|
||||
|
||||
m_debug_blocks_decoded++;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -392,6 +395,7 @@ bool MDEC::DecodeColoredMacroblock()
|
|||
break;
|
||||
}
|
||||
|
||||
m_debug_blocks_decoded++;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -568,3 +572,56 @@ bool MDEC::HandleSetScaleCommand()
|
|||
std::memcpy(m_scale_table.data(), packed_data.data(), m_scale_table.size() * sizeof(s16));
|
||||
return true;
|
||||
}
|
||||
|
||||
void MDEC::DrawDebugMenu()
|
||||
{
|
||||
ImGui::MenuItem("MDEC", nullptr, &m_debug_show_state);
|
||||
}
|
||||
|
||||
void MDEC::DrawDebugWindow()
|
||||
{
|
||||
if (!m_debug_show_state)
|
||||
return;
|
||||
|
||||
ImGui::SetNextWindowSize(ImVec2(300, 350), ImGuiCond_FirstUseEver);
|
||||
if (!ImGui::Begin("MDEC State", &m_debug_show_state))
|
||||
{
|
||||
ImGui::End();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_debug_blocks_decoded > 0)
|
||||
{
|
||||
m_debug_last_blocks_decoded = m_debug_blocks_decoded;
|
||||
m_debug_blocks_decoded = 0;
|
||||
}
|
||||
|
||||
static constexpr std::array<const char*, 4> command_names = {{"None", "Decode Macroblock", "SetIqTab", "SetScale"}};
|
||||
static constexpr std::array<const char*, 4> output_depths = {{"4-bit", "8-bit", "24-bit", "15-bit"}};
|
||||
static constexpr std::array<const char*, 6> block_names = {{"Crblk", "Cbblk", "Y1", "Y2", "Y3", "Y4"}};
|
||||
|
||||
ImGui::Text("Blocks Decoded: %u (%ux8, 320x%u)", m_debug_last_blocks_decoded, m_debug_last_blocks_decoded * 8,
|
||||
m_debug_last_blocks_decoded * 8 / (320 / 8) * 8);
|
||||
ImGui::Text("Data-In FIFO Size: %u (%u bytes)", m_data_in_fifo.GetSize(), m_data_in_fifo.GetSize() * 4);
|
||||
ImGui::Text("Data-Out FIFO Size: %u (%u bytes)", m_data_out_fifo.GetSize(), m_data_out_fifo.GetSize() * 4);
|
||||
ImGui::Text("DMA Enable: %s%s", m_enable_dma_in ? "In " : "", m_enable_dma_out ? "Out" : "");
|
||||
ImGui::Text("Current Command: %s", command_names[static_cast<u8>(m_command)]);
|
||||
ImGui::Text("Current Block: %s", block_names[m_current_block]);
|
||||
ImGui::Text("Current Coefficient: %u", m_current_coefficient);
|
||||
|
||||
if (ImGui::CollapsingHeader("Status", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::Text("Data-Out FIFO Empty: %s", m_status.data_out_fifo_empty ? "Yes" : "No");
|
||||
ImGui::Text("Data-In FIFO Empty: %s", m_status.data_in_fifo_full ? "Yes" : "No");
|
||||
ImGui::Text("Command Busy FIFO Empty: %s", m_status.command_busy ? "Yes" : "No");
|
||||
ImGui::Text("Data-In Request: %s", m_status.data_in_request ? "Yes" : "No");
|
||||
ImGui::Text("Output Depth: %s", output_depths[static_cast<u8>(m_status.data_output_depth.GetValue())]);
|
||||
ImGui::Text("Output Signed: %s", m_status.data_output_signed ? "Yes" : "No");
|
||||
ImGui::Text("Output Bit 15: %u", ZeroExtend32(m_status.data_output_bit15.GetValue()));
|
||||
ImGui::Text("Current Block: %u", ZeroExtend32(m_status.current_block.GetValue()));
|
||||
ImGui::Text("Parameter Words Remaining: %d",
|
||||
static_cast<s32>(SignExtend32(m_status.parameter_words_remaining.GetValue())));
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
|
@ -26,9 +26,12 @@ public:
|
|||
u32 DMARead();
|
||||
void DMAWrite(u32 value);
|
||||
|
||||
void DrawDebugMenu();
|
||||
void DrawDebugWindow();
|
||||
|
||||
private:
|
||||
static constexpr u32 DATA_IN_FIFO_SIZE = 1048576;
|
||||
static constexpr u32 DATA_OUT_FIFO_SIZE = 1048576;
|
||||
static constexpr u32 DATA_IN_FIFO_SIZE = 512 * 1024;
|
||||
static constexpr u32 DATA_OUT_FIFO_SIZE = 512 * 1024;
|
||||
static constexpr u32 NUM_BLOCKS = 6;
|
||||
|
||||
enum DataOutputDepth : u8
|
||||
|
@ -126,4 +129,8 @@ private:
|
|||
u32 m_current_block = 0; // block (0-5)
|
||||
u32 m_current_coefficient = 64; // k (in block)
|
||||
u16 m_current_q_scale = 0;
|
||||
};
|
||||
|
||||
bool m_debug_show_state = false;
|
||||
u32 m_debug_blocks_decoded = 0;
|
||||
u32 m_debug_last_blocks_decoded = 0;
|
||||
};
|
||||
|
|
|
@ -327,6 +327,7 @@ void System::DrawDebugMenus()
|
|||
m_gpu->DrawDebugMenu();
|
||||
m_spu->DrawDebugMenu();
|
||||
m_timers->DrawDebugMenu();
|
||||
m_mdec->DrawDebugMenu();
|
||||
}
|
||||
|
||||
void System::DrawDebugWindows()
|
||||
|
@ -334,4 +335,5 @@ void System::DrawDebugWindows()
|
|||
m_gpu->DrawDebugWindows();
|
||||
m_spu->DrawDebugWindow();
|
||||
m_timers->DrawDebugWindow();
|
||||
m_mdec->DrawDebugWindow();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue