Merge pull request #11565 from unknownbrackets/ge-dump2

GE Debugger: Fix display event record timing
This commit is contained in:
Henrik Rydgård 2018-11-17 23:31:24 +01:00 committed by GitHub
commit 328e367208
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 20 deletions

View File

@ -39,6 +39,7 @@
#include "GPU/Common/FramebufferCommon.h"
#include "GPU/Common/PostShader.h"
#include "GPU/Common/TextureCacheCommon.h"
#include "GPU/Debugger/Record.h"
#include "GPU/GPUInterface.h"
#include "GPU/GPUState.h"
@ -169,6 +170,7 @@ void FramebufferManagerCommon::SetDisplayFramebuffer(u32 framebuf, u32 stride, G
displayFramebufPtr_ = framebuf;
displayStride_ = stride;
displayFormat_ = format;
GPURecord::NotifyDisplay(framebuf, stride, format);
}
VirtualFramebuffer *FramebufferManagerCommon::GetVFBAt(u32 addr) {

View File

@ -372,23 +372,6 @@ static std::string GenRecordingFilename() {
return StringFromFormat("%s_%04d.ppdmp", prefix.c_str(), 9999);
}
static void EmitDisplayBuf() {
struct DisplayBufData {
PSPPointer<u8> topaddr;
u32 linesize, pixelFormat;
};
DisplayBufData disp{};
__DisplayGetFramebuf(&disp.topaddr, &disp.linesize, &disp.pixelFormat, 0);
u32 ptr = (u32)pushbuf.size();
u32 sz = (u32)sizeof(disp);
pushbuf.resize(pushbuf.size() + sz);
memcpy(pushbuf.data() + ptr, &disp, sz);
commands.push_back({CommandType::DISPLAY, sz, ptr});
}
static void BeginRecording() {
u32 ptr = (u32)pushbuf.size();
u32 sz = 512 * 4;
@ -412,7 +395,6 @@ static void WriteCompressed(FILE *fp, const void *p, size_t sz) {
static std::string WriteRecording() {
FlushRegisters();
EmitDisplayBuf();
const std::string filename = GenRecordingFilename();
@ -771,6 +753,27 @@ void NotifyUpload(u32 dest, u32 sz) {
NotifyMemcpy(dest, dest, sz);
}
void NotifyDisplay(u32 framebuf, int stride, int fmt) {
if (!active) {
return;
}
struct DisplayBufData {
PSPPointer<u8> topaddr;
int linesize, pixelFormat;
};
DisplayBufData disp{ framebuf, stride, fmt };
FlushRegisters();
u32 ptr = (u32)pushbuf.size();
u32 sz = (u32)sizeof(disp);
pushbuf.resize(pushbuf.size() + sz);
memcpy(pushbuf.data() + ptr, &disp, sz);
commands.push_back({ CommandType::DISPLAY, sz, ptr });
}
void NotifyFrame() {
if (active && !writePending && !commands.empty()) {
// Delay write until the first command of the next frame, so we get the right display buf.
@ -980,7 +983,7 @@ void DumpExecute::Texture(int level, u32 ptr, u32 sz) {
void DumpExecute::Display(u32 ptr, u32 sz) {
struct DisplayBufData {
PSPPointer<u8> topaddr;
u32 linesize, pixelFormat;
int linesize, pixelFormat;
};
DisplayBufData *disp = (DisplayBufData *)(pushbuf.data() + ptr);

View File

@ -1,4 +1,4 @@
// Copyright (c) 2017- PPSSPP Project.
// Copyright (c) 2017- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -33,6 +33,7 @@ void NotifyCommand(u32 pc);
void NotifyMemcpy(u32 dest, u32 src, u32 sz);
void NotifyMemset(u32 dest, int v, u32 sz);
void NotifyUpload(u32 dest, u32 sz);
void NotifyDisplay(u32 addr, int stride, int fmt);
void NotifyFrame();
bool RunMountedReplay(const std::string &filename);

View File

@ -143,6 +143,7 @@ void SoftGPU::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat for
displayStride_ = stride;
displayFormat_ = format;
GPUDebug::NotifyDisplay(framebuf, stride, format);
GPURecord::NotifyDisplay(framebuf, stride, format);
}
// Copies RGBA8 data from RAM to the currently bound render target.