Adding vblank interrupt.
This commit is contained in:
@@ -8,7 +8,8 @@
|
||||
*/
|
||||
|
||||
#include <xenia/gpu/graphics_system.h>
|
||||
|
||||
|
||||
#include <xenia/cpu/processor.h>
|
||||
#include <xenia/gpu/ring_buffer_worker.h>
|
||||
|
||||
|
||||
@@ -16,7 +17,8 @@ using namespace xe;
|
||||
using namespace xe::gpu;
|
||||
|
||||
|
||||
GraphicsSystem::GraphicsSystem(const CreationParams* params) {
|
||||
GraphicsSystem::GraphicsSystem(const CreationParams* params) :
|
||||
interrupt_callback_(0), interrupt_callback_data_(0) {
|
||||
memory_ = xe_memory_retain(params->memory);
|
||||
|
||||
worker_ = new RingBufferWorker(memory_);
|
||||
@@ -33,6 +35,21 @@ xe_memory_ref GraphicsSystem::memory() {
|
||||
return xe_memory_retain(memory_);
|
||||
}
|
||||
|
||||
shared_ptr<cpu::Processor> GraphicsSystem::processor() {
|
||||
return processor_;
|
||||
}
|
||||
|
||||
void GraphicsSystem::set_processor(shared_ptr<cpu::Processor> processor) {
|
||||
processor_ = processor;
|
||||
}
|
||||
|
||||
void GraphicsSystem::SetInterruptCallback(uint32_t callback,
|
||||
uint32_t user_data) {
|
||||
interrupt_callback_ = callback;
|
||||
interrupt_callback_data_ = user_data;
|
||||
XELOGGPU("SetInterruptCallback(%.4X, %.4X)", callback, user_data);
|
||||
}
|
||||
|
||||
void GraphicsSystem::InitializeRingBuffer(uint32_t ptr, uint32_t page_count) {
|
||||
worker_->Initialize(ptr, page_count);
|
||||
}
|
||||
@@ -44,6 +61,12 @@ void GraphicsSystem::EnableReadPointerWriteBack(uint32_t ptr,
|
||||
|
||||
uint64_t GraphicsSystem::ReadRegister(uint32_t r) {
|
||||
XELOGGPU("ReadRegister(%.4X)", r);
|
||||
|
||||
switch (r) {
|
||||
case 0x6544: // ? vblank pending?
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -60,3 +83,12 @@ void GraphicsSystem::WriteRegister(uint32_t r, uint64_t value) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GraphicsSystem::DispatchInterruptCallback() {
|
||||
// NOTE: we may be executing in some random thread.
|
||||
if (!interrupt_callback_) {
|
||||
return;
|
||||
}
|
||||
processor_->ExecuteInterrupt(
|
||||
interrupt_callback_, 0, interrupt_callback_data_);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user