Fix rsx capture replay

Allow to capture non-increment cmd flag that was missing in command.reg
This commit is contained in:
eladash 2018-12-09 14:55:14 +02:00 committed by kd-11
parent 87988e9da8
commit 45ed58cdaf
4 changed files with 45 additions and 35 deletions

View file

@ -6,6 +6,7 @@
extern rsx::frame_capture_data frame_capture;
extern bool user_asked_for_frame_capture;
extern bool capture_current_frame;
#define ENABLE_OPTIMIZATION_DEBUGGING 0
@ -179,6 +180,46 @@ namespace rsx
return;
}
if (UNLIKELY(capture_current_frame))
{
u32 reg = (cmd & 0xfffc) >> 2;
auto args = vm::_ptr<u32>(m_args_ptr);
for (u32 i = 0; i < count; i++, args++)
{
frame_debug.command_queue.push_back(std::make_pair(reg, *args));
if (!(reg == NV406E_SET_REFERENCE || reg == NV406E_SEMAPHORE_RELEASE || reg == NV406E_SEMAPHORE_ACQUIRE))
{
// todo: handle nv406e methods better?, do we care about call/jumps?
rsx::frame_capture_data::replay_command replay_cmd;
replay_cmd.rsx_command = std::make_pair(i == 0 ? cmd : 0, *args);
frame_capture.replay_commands.push_back(replay_cmd);
// to make this easier, use the replay command 'i' positions back
auto it = std::prev(frame_capture.replay_commands.end(), i + 1);
switch (reg)
{
case NV3089_IMAGE_IN:
capture::capture_image_in(rsx::get_current_renderer(), *it);
break;
case NV0039_BUFFER_NOTIFY:
capture::capture_buffer_notify(rsx::get_current_renderer(), *it);
break;
default:
break;
}
}
if (!(cmd & RSX_METHOD_NON_INCREMENT_CMD))
{
reg++;
}
}
}
if (count > 1)
{
// Set up readback parameters
@ -520,38 +561,6 @@ namespace rsx
for (int i = 0; command.reg != FIFO::FIFO_EMPTY; i++, fifo_ctrl->read_unsafe(command))
{
if (UNLIKELY(capture_current_frame))
{
const u32 reg = command.reg >> 2;
const u32 value = command.value;
frame_debug.command_queue.push_back(std::make_pair(reg, value));
if (!(reg == NV406E_SET_REFERENCE || reg == NV406E_SEMAPHORE_RELEASE || reg == NV406E_SEMAPHORE_ACQUIRE))
{
// todo: handle nv406e methods better?, do we care about call/jumps?
rsx::frame_capture_data::replay_command replay_cmd;
replay_cmd.rsx_command = std::make_pair(i == 0 ? command.reg : 0, value);
frame_capture.replay_commands.push_back(replay_cmd);
// to make this easier, use the replay command 'i' positions back
auto it = std::prev(frame_capture.replay_commands.end(), i + 1);
switch (reg)
{
case NV3089_IMAGE_IN:
capture::capture_image_in(this, *it);
break;
case NV0039_BUFFER_NOTIFY:
capture::capture_buffer_notify(this, *it);
break;
default:
break;
}
}
}
if (UNLIKELY(m_flattener.is_enabled()))
{
switch(m_flattener.test(command))

View file

@ -31,6 +31,7 @@ class GSRender;
#define CMD_DEBUG 0
bool user_asked_for_frame_capture = false;
bool capture_current_frame = false;
rsx::frame_trace_data frame_debug;
rsx::frame_capture_data frame_capture;
RSXIOTable RSXIOMem;

View file

@ -46,6 +46,7 @@ struct RSXIOTable
};
extern bool user_asked_for_frame_capture;
extern bool capture_current_frame;
extern rsx::frame_trace_data frame_debug;
extern rsx::frame_capture_data frame_capture;
extern RSXIOTable RSXIOMem;
@ -433,7 +434,6 @@ namespace rsx
GcmTileInfo tiles[limits::tiles_count];
GcmZcullInfo zculls[limits::zculls_count];
bool capture_current_frame = false;
void capture_frame(const std::string &name);
public:

View file

@ -139,7 +139,7 @@ namespace rsx
//
}
if (rsx->capture_current_frame)
if (capture_current_frame)
{
rsx->capture_frame("clear");
}
@ -149,7 +149,7 @@ namespace rsx
{
rsx->do_method(NV4097_CLEAR_ZCULL_SURFACE, arg);
if (rsx->capture_current_frame)
if (capture_current_frame)
{
rsx->capture_frame("clear zcull memory");
}