Qt/GPU Breakpoints: Added three more breakpoint types:

* IncomingDisplayTransfer: Triggered just before a display transfer is performed.
* GSPCommandProcessed: Triggered right after a GSP command is processed.
* BufferSwapped: Triggered when the frames flip
This commit is contained in:
Subv 2015-07-22 18:20:54 -05:00
parent 3a5352baf8
commit 6c0ea5f5e8
5 changed files with 24 additions and 7 deletions

View file

@ -42,11 +42,14 @@ QVariant BreakPointModel::data(const QModelIndex& index, int role) const
case 0: case 0:
{ {
static const std::map<Pica::DebugContext::Event, QString> map = { static const std::map<Pica::DebugContext::Event, QString> map = {
{ Pica::DebugContext::Event::CommandLoaded, tr("Pica command loaded") }, { Pica::DebugContext::Event::PicaCommandLoaded, tr("Pica command loaded") },
{ Pica::DebugContext::Event::CommandProcessed, tr("Pica command processed") }, { Pica::DebugContext::Event::PicaCommandProcessed, tr("Pica command processed") },
{ Pica::DebugContext::Event::IncomingPrimitiveBatch, tr("Incoming primitive batch") }, { Pica::DebugContext::Event::IncomingPrimitiveBatch, tr("Incoming primitive batch") },
{ Pica::DebugContext::Event::FinishedPrimitiveBatch, tr("Finished primitive batch") }, { Pica::DebugContext::Event::FinishedPrimitiveBatch, tr("Finished primitive batch") },
{ Pica::DebugContext::Event::VertexLoaded, tr("Vertex loaded") } { Pica::DebugContext::Event::VertexLoaded, tr("Vertex loaded") },
{ Pica::DebugContext::Event::IncomingDisplayTransfer, tr("Incoming display transfer") },
{ Pica::DebugContext::Event::GSPCommandProcessed, tr("GSP command processed") },
{ Pica::DebugContext::Event::BufferSwapped, tr("Buffers swapped") }
}; };
DEBUG_ASSERT(map.size() == static_cast<size_t>(Pica::DebugContext::Event::NumEvents)); DEBUG_ASSERT(map.size() == static_cast<size_t>(Pica::DebugContext::Event::NumEvents));

View file

@ -14,6 +14,7 @@
#include "core/hw/lcd.h" #include "core/hw/lcd.h"
#include "video_core/gpu_debugger.h" #include "video_core/gpu_debugger.h"
#include "video_core/debug_utils/debug_utils.h"
#include "video_core/renderer_base.h" #include "video_core/renderer_base.h"
#include "video_core/video_core.h" #include "video_core/video_core.h"
@ -226,6 +227,9 @@ void SetBufferSwap(u32 screen_id, const FrameBufferInfo& info) {
&info.format); &info.format);
WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].active_fb)), 4, WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].active_fb)), 4,
&info.shown_fb); &info.shown_fb);
if (Pica::g_debug_context)
Pica::g_debug_context->OnEvent(Pica::DebugContext::Event::BufferSwapped, nullptr);
} }
/** /**
@ -448,6 +452,9 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
default: default:
LOG_ERROR(Service_GSP, "unknown command 0x%08X", (int)command.id.Value()); LOG_ERROR(Service_GSP, "unknown command 0x%08X", (int)command.id.Value());
} }
if (Pica::g_debug_context)
Pica::g_debug_context->OnEvent(Pica::DebugContext::Event::GSPCommandProcessed, (void*)&command);
} }
/** /**

View file

@ -151,6 +151,10 @@ inline void Write(u32 addr, const T data) {
{ {
const auto& config = g_regs.display_transfer_config; const auto& config = g_regs.display_transfer_config;
if (config.trigger & 1) { if (config.trigger & 1) {
if (Pica::g_debug_context)
Pica::g_debug_context->OnEvent(Pica::DebugContext::Event::IncomingDisplayTransfer, nullptr);
u8* src_pointer = Memory::GetPhysicalPointer(config.GetPhysicalInputAddress()); u8* src_pointer = Memory::GetPhysicalPointer(config.GetPhysicalInputAddress());
u8* dst_pointer = Memory::GetPhysicalPointer(config.GetPhysicalOutputAddress()); u8* dst_pointer = Memory::GetPhysicalPointer(config.GetPhysicalOutputAddress());

View file

@ -50,7 +50,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
regs[id] = (old_value & ~mask) | (value & mask); regs[id] = (old_value & ~mask) | (value & mask);
if (g_debug_context) if (g_debug_context)
g_debug_context->OnEvent(DebugContext::Event::CommandLoaded, reinterpret_cast<void*>(&id)); g_debug_context->OnEvent(DebugContext::Event::PicaCommandLoaded, reinterpret_cast<void*>(&id));
DebugUtils::OnPicaRegWrite(id, regs[id]); DebugUtils::OnPicaRegWrite(id, regs[id]);
@ -428,7 +428,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
VideoCore::g_renderer->hw_rasterizer->NotifyPicaRegisterChanged(id); VideoCore::g_renderer->hw_rasterizer->NotifyPicaRegisterChanged(id);
if (g_debug_context) if (g_debug_context)
g_debug_context->OnEvent(DebugContext::Event::CommandProcessed, reinterpret_cast<void*>(&id)); g_debug_context->OnEvent(DebugContext::Event::PicaCommandProcessed, reinterpret_cast<void*>(&id));
} }
void ProcessCommandList(const u32* list, u32 size) { void ProcessCommandList(const u32* list, u32 size) {

View file

@ -25,11 +25,14 @@ public:
enum class Event { enum class Event {
FirstEvent = 0, FirstEvent = 0,
CommandLoaded = FirstEvent, PicaCommandLoaded = FirstEvent,
CommandProcessed, PicaCommandProcessed,
IncomingPrimitiveBatch, IncomingPrimitiveBatch,
FinishedPrimitiveBatch, FinishedPrimitiveBatch,
VertexLoaded, VertexLoaded,
IncomingDisplayTransfer,
GSPCommandProcessed,
BufferSwapped,
NumEvents NumEvents
}; };