From cc12f0b96a08f29b73b90712b132000536ab7ac8 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sun, 13 Oct 2013 11:06:13 -0700 Subject: [PATCH] Periodically fire interrupts. --- src/xenia/gpu/d3d11/d3d11_graphics_system.cc | 5 +++++ src/xenia/gpu/graphics_system.cc | 7 +++++-- src/xenia/gpu/graphics_system.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/xenia/gpu/d3d11/d3d11_graphics_system.cc b/src/xenia/gpu/d3d11/d3d11_graphics_system.cc index d3266f440..bb79b156c 100644 --- a/src/xenia/gpu/d3d11/d3d11_graphics_system.cc +++ b/src/xenia/gpu/d3d11/d3d11_graphics_system.cc @@ -130,6 +130,11 @@ void D3D11GraphicsSystem::Pump() { // Dispatch interrupt callback to let the game know it can keep drawing. DispatchInterruptCallback(); + } else { + // If we have gone too long without an interrupt, fire one. + if (xe_pal_now() - last_interrupt_time_ > 16 / 1000.0) { + DispatchInterruptCallback(); + } } } diff --git a/src/xenia/gpu/graphics_system.cc b/src/xenia/gpu/graphics_system.cc index 00d9e76a7..d3813657b 100644 --- a/src/xenia/gpu/graphics_system.cc +++ b/src/xenia/gpu/graphics_system.cc @@ -22,7 +22,7 @@ using namespace xe::gpu::xenos; GraphicsSystem::GraphicsSystem(const CreationParams* params) : interrupt_callback_(0), interrupt_callback_data_(0), - swap_pending_(false) { + last_interrupt_time_(0), swap_pending_(false) { memory_ = xe_memory_retain(params->memory); worker_ = new RingBufferWorker(memory_); @@ -147,15 +147,18 @@ void GraphicsSystem::WriteRegister(uint32_t r, uint64_t value) { case 0x0714: // CP_RB_WPTR worker_->UpdateWritePointer((uint32_t)value); break; + default: + XELOGW("Unknown GPU register %.4X write: %.8X", r, value); + break; } XEASSERT(r >= 0 && r < kXEGpuRegisterCount); - XELOGW("Unknown GPU register %.4X write: %.8X", r, value); regs->values[r].u32 = (uint32_t)value; } void GraphicsSystem::DispatchInterruptCallback() { // NOTE: we may be executing in some random thread. + last_interrupt_time_ = xe_pal_now(); if (!interrupt_callback_) { return; } diff --git a/src/xenia/gpu/graphics_system.h b/src/xenia/gpu/graphics_system.h index 6491461f8..670676523 100644 --- a/src/xenia/gpu/graphics_system.h +++ b/src/xenia/gpu/graphics_system.h @@ -93,6 +93,7 @@ protected: uint32_t interrupt_callback_; uint32_t interrupt_callback_data_; + double last_interrupt_time_; bool swap_pending_; };