Merge branch 'master' into armjit

This commit is contained in:
Henrik Rydgard 2013-01-10 23:52:11 +01:00
commit 2835a42289
15 changed files with 82 additions and 14 deletions

View File

@ -112,6 +112,7 @@ if(NOT MSVC)
add_definitions(-O2)
add_definitions(-Wno-multichar)
add_definitions(-fno-strict-aliasing)
add_definitions(-ffast-math)
if(NOT APPLE)
add_definitions(-Wno-psabi)
add_definitions(-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D__BSD_VISIBLE=1)

View File

@ -15,6 +15,7 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "base/timeutil.h"
#include "HLE.h"
#include <map>
#include <vector>
@ -344,6 +345,8 @@ inline void hleFinishSyscall(int modulenum, int funcnum)
void CallSyscall(u32 op)
{
time_update();
double start = time_now_d();
u32 callno = (op >> 6) & 0xFFFFF; //20 bits
int funcnum = callno & 0xFFF;
int modulenum = (callno & 0xFF000) >> 12;
@ -365,4 +368,14 @@ void CallSyscall(u32 op)
{
ERROR_LOG(HLE,"Unimplemented HLE function %s", moduleDB[modulenum].funcTable[funcnum].name);
}
time_update();
double total = time_now_d() - start;
if (total > kernelStats.slowestSyscallTime) {
const char *name = moduleDB[modulenum].funcTable[funcnum].name;
if (0 != strcmp(name, "_sceKernelIdle")) {
kernelStats.slowestSyscallTime = total;
kernelStats.slowestSyscallName = name;
}
}
kernelStats.msInSyscalls += total;
}

View File

@ -198,9 +198,8 @@ void __AudioUpdate()
}
}
section.lock();
if (g_Config.bEnableSound) {
section.lock();
if (outAudioQueue.room() >= hwBlockSize * 2) {
// Push the mixed samples onto the output audio queue.
for (int i = 0; i < hwBlockSize; i++) {
@ -210,14 +209,14 @@ void __AudioUpdate()
outAudioQueue.push((s16)sampleL);
outAudioQueue.push((s16)sampleR);
}
} else {
// This happens quite a lot. There's still something slightly off
// about the amount of audio we produce.
DEBUG_LOG(HLE, "Audio outbuffer overrun! room = %i / %i", outAudioQueue.room(), (u32)outAudioQueue.capacity());
}
section.unlock();
} else {
// This happens quite a lot. There's still something slightly off
// about the amount of audio we produce.
DEBUG_LOG(HLE, "Audio outbuffer overrun! room = %i / %i", outAudioQueue.room(), (u32)outAudioQueue.capacity());
}
section.unlock();
}
void __AudioSetOutputFrequency(int freq)

View File

@ -211,6 +211,9 @@ void hleEnterVblank(u64 userdata, int cyclesLate) {
char stats[512];
sprintf(stats,
"Frames: %i\n"
"DL processing time: %0.2f ms\n"
"Kernel processing time: %0.2f ms\n"
"Slowest syscall: %s : %0.2f ms\n"
"Draw calls: %i\n"
"Draw flushes: %i\n"
"Vertices Transformed: %i\n"
@ -221,6 +224,10 @@ void hleEnterVblank(u64 userdata, int cyclesLate) {
"Fragment shaders loaded: %i\n"
"Combined shaders loaded: %i\n",
gpuStats.numFrames,
gpuStats.msProcessingDisplayLists * 1000.0f,
kernelStats.msInSyscalls * 1000.0f,
kernelStats.slowestSyscallName ? kernelStats.slowestSyscallName : "(none)",
kernelStats.slowestSyscallTime * 1000.0f,
gpuStats.numDrawCalls,
gpuStats.numFlushes,
gpuStats.numVertsTransformed,
@ -238,6 +245,7 @@ void hleEnterVblank(u64 userdata, int cyclesLate) {
PPGeEnd();
gpuStats.resetFrame();
kernelStats.ResetFrame();
}
host->EndFrame();

View File

@ -71,6 +71,7 @@
static bool kernelRunning = false;
KernelObjectPool kernelObjects;
KernelStats kernelStats;
void __KernelInit()
{

View File

@ -377,6 +377,7 @@ public:
return t;
}
}
template <class T>
T* GetByModuleByEntryAddr(u32 entryAddr)
{
@ -410,13 +411,32 @@ public:
int GetCount();
private:
enum {maxCount=4096, handleOffset=0x100};
enum {
maxCount=4096,
handleOffset=0x100
};
KernelObject *pool[maxCount];
bool occupied[maxCount];
};
extern KernelObjectPool kernelObjects;
struct KernelStats {
void Reset() {
memset(this, 0, sizeof(this));
}
void ResetFrame() {
msInSyscalls = 0;
slowestSyscallTime = 0;
slowestSyscallName = 0;
}
double msInSyscalls;
double slowestSyscallTime;
const char *slowestSyscallName;
};
extern KernelStats kernelStats;
void Register_ThreadManForUser();
void Register_LoadExecForUser();

View File

@ -199,7 +199,7 @@ void GLES_GPU::DumpNextFrame() {
}
void GLES_GPU::BeginFrame() {
TextureCache_Decimate();
TextureCache_StartFrame();
if (dumpNextFrame_) {
NOTICE_LOG(G3D, "DUMPING THIS FRAME");

View File

@ -166,7 +166,8 @@ void FramebufferManager::DrawActiveTexture(float w, float h, bool flip) {
Matrix4x4 ortho;
ortho.setOrtho(0, 480, 272, 0, -1, 1);
glUniformMatrix4fv(draw2dprogram->u_viewproj, 1, GL_FALSE, ortho.getReadPtr());
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glEnableVertexAttribArray(draw2dprogram->a_position);
glEnableVertexAttribArray(draw2dprogram->a_texcoord0);
glVertexAttribPointer(draw2dprogram->a_position, 3, GL_FLOAT, GL_FALSE, 12, pos);

View File

@ -598,6 +598,13 @@ void convertColors(u8 *finalBuf, GLuint dstFmt, int numPixels) {
}
}
int lastBoundTexture = -1;
void TextureCache_StartFrame() {
lastBoundTexture = -1;
TextureCache_Decimate();
}
void PSPSetTexture() {
u32 texaddr = (gstate.texaddr[0] & 0xFFFFF0) | ((gstate.texbufwidth[0]<<8) & 0xFF000000);
texaddr &= 0xFFFFFFF;
@ -656,7 +663,10 @@ void PSPSetTexture() {
if (match) {
//got one!
entry.frameCounter = gpuStats.numFrames;
glBindTexture(GL_TEXTURE_2D, entry.texture);
if (entry.texture != lastBoundTexture) {
glBindTexture(GL_TEXTURE_2D, entry.texture);
lastBoundTexture = entry.texture;
}
UpdateSamplingParams(entry, false);
DEBUG_LOG(G3D, "Texture at %08x Found in Cache, applying", texaddr);
return; //Done!

View File

@ -24,6 +24,7 @@ void PSPSetTexture();
void TextureCache_Init();
void TextureCache_Shutdown();
void TextureCache_Clear(bool delete_them);
void TextureCache_StartFrame();
void TextureCache_Decimate(); // Run this once per frame to get rid of old textures.
void TextureCache_Invalidate(u32 addr, int size, bool force);
void TextureCache_InvalidateAll(bool force);

View File

@ -1,3 +1,4 @@
#include "base/timeutil.h"
#include "../Core/MemMap.h"
#include "GeDisasm.h"
#include "GPUCommon.h"
@ -41,7 +42,6 @@ u32 GPUCommon::EnqueueList(u32 listpc, u32 stall, int subIntrBase, bool head)
void GPUCommon::UpdateStall(int listid, u32 newstall)
{
for (auto iter = dlQueue.begin(); iter != dlQueue.end(); ++iter)
{
DisplayList &cur = *iter;
@ -56,6 +56,8 @@ void GPUCommon::UpdateStall(int listid, u32 newstall)
bool GPUCommon::InterpretList(DisplayList &list)
{
time_update();
double start = time_now_d();
currentList = &list;
// Reset stackptr for safety
stackptr = 0;
@ -91,13 +93,15 @@ bool GPUCommon::InterpretList(DisplayList &list)
list.pc += 4;
prev = op;
}
time_update();
gpuStats.msProcessingDisplayLists += time_now_d() - start;
return true;
}
bool GPUCommon::ProcessDLQueue()
{
DisplayListQueue::iterator iter = dlQueue.begin();
while (!(iter == dlQueue.end()))
while (iter != dlQueue.end())
{
DisplayList &l = *iter;
DEBUG_LOG(G3D,"Okay, starting DL execution at %08x - stall = %08x", l.pc, l.stall);

View File

@ -263,6 +263,7 @@ struct GPUStatistics
numShaderSwitches = 0;
numFlushes = 0;
numTexturesDecoded = 0;
msProcessingDisplayLists = 0;
}
// Per frame statistics
@ -274,6 +275,7 @@ struct GPUStatistics
int numTextureSwitches;
int numShaderSwitches;
int numTexturesDecoded;
double msProcessingDisplayLists;
// Total statistics, updated by the GPU core in UpdateStats
int numFrames;

View File

@ -41,6 +41,7 @@
EmuScreen::EmuScreen(const std::string &filename) : invalid_(true)
{
CheckGLExtensions();
std::string fileToStart = filename;
// This is probably where we should start up the emulated PSP.
INFO_LOG(BOOT, "Starting up hardware.");

View File

@ -31,6 +31,7 @@
#include "gfx/gl_lost_manager.h"
#include "gfx/texture.h"
#include "input/input_state.h"
#include "math/math_util.h"
#include "math/lin/matrix4x4.h"
#include "ui/screen.h"
#include "ui/ui.h"
@ -159,6 +160,7 @@ void NativeGetAppInfo(std::string *app_dir_name, std::string *app_nice_name, boo
void NativeInit(int argc, const char *argv[], const char *savegame_directory, const char *external_directory, const char *installID)
{
EnableFZ();
std::string user_data_path = savegame_directory;
// We want this to be FIRST.
@ -313,6 +315,11 @@ void NativeInitGraphics()
void NativeRender()
{
EnableFZ();
// Clearing the screen at the start of the frame is an optimization for tiled mobile GPUs, as it then doesn't need to keep it around between frames.
glClearColor(0,0,0,1);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glstate.Restore();
glViewport(0, 0, pixel_xres, pixel_yres);
Matrix4x4 ortho;

2
native

@ -1 +1 @@
Subproject commit c63061ddfd5aec3b9dd51aa4c71150de905d8d1e
Subproject commit 7ceecd22b421c697d4d8c8ad6bda7654226be8ca