mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-28 01:52:29 -06:00
Add measured frame cycles
This commit is contained in:
parent
5e95b35900
commit
03145e307b
2 changed files with 7 additions and 6 deletions
|
@ -30,8 +30,6 @@ namespace GPU {
|
||||||
Regs g_regs;
|
Regs g_regs;
|
||||||
Memory::MemorySystem* g_memory;
|
Memory::MemorySystem* g_memory;
|
||||||
|
|
||||||
/// 268MHz CPU clocks / 60Hz frames per second
|
|
||||||
const u64 frame_ticks = static_cast<u64>(BASE_CLOCK_RATE_ARM11 / SCREEN_REFRESH_RATE);
|
|
||||||
/// Event id for CoreTiming
|
/// Event id for CoreTiming
|
||||||
static Core::TimingEventType* vblank_event;
|
static Core::TimingEventType* vblank_event;
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "common/bit_field.h"
|
#include "common/bit_field.h"
|
||||||
#include "common/common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
#include "core/core_timing.h"
|
||||||
|
|
||||||
namespace Memory {
|
namespace Memory {
|
||||||
class MemorySystem;
|
class MemorySystem;
|
||||||
|
@ -19,10 +20,12 @@ class MemorySystem;
|
||||||
|
|
||||||
namespace GPU {
|
namespace GPU {
|
||||||
|
|
||||||
// TODO(xperia64): This should be defined by the number of
|
// Measured on hardware to be 2240568 timer cycles or 4481136 ARM11 cycles
|
||||||
// ARM11 cycles per vblank interval once that value is measured
|
constexpr u64 frame_ticks = 4481136ull;
|
||||||
// and not the other way around
|
|
||||||
constexpr double SCREEN_REFRESH_RATE = 59.833997376556916;
|
// Refresh rate defined by ratio of ARM11 frequency to ARM11 ticks per frame
|
||||||
|
// (268,111,856) / (4,481,136) = 59.83122493939037Hz
|
||||||
|
constexpr double SCREEN_REFRESH_RATE = BASE_CLOCK_RATE_ARM11 / static_cast<double>(frame_ticks);
|
||||||
|
|
||||||
// Returns index corresponding to the Regs member labeled by field_name
|
// Returns index corresponding to the Regs member labeled by field_name
|
||||||
#define GPU_REG_INDEX(field_name) (offsetof(GPU::Regs, field_name) / sizeof(u32))
|
#define GPU_REG_INDEX(field_name) (offsetof(GPU::Regs, field_name) / sizeof(u32))
|
||||||
|
|
Loading…
Reference in a new issue