[GPU] Small ring buffer setup function cleanup
This commit is contained in:
parent
330beaf552
commit
40ca4abc0b
|
@ -257,22 +257,21 @@ bool CommandProcessor::SetupContext() { return true; }
|
|||
|
||||
void CommandProcessor::ShutdownContext() { context_.reset(); }
|
||||
|
||||
void CommandProcessor::InitializeRingBuffer(uint32_t ptr, uint32_t log2_size) {
|
||||
void CommandProcessor::InitializeRingBuffer(uint32_t ptr, uint32_t size_log2) {
|
||||
read_ptr_index_ = 0;
|
||||
primary_buffer_ptr_ = ptr;
|
||||
primary_buffer_size_ = 1 << log2_size;
|
||||
primary_buffer_size_ = uint32_t(1) << (size_log2 + 3);
|
||||
}
|
||||
|
||||
void CommandProcessor::EnableReadPointerWriteBack(uint32_t ptr,
|
||||
uint32_t block_size) {
|
||||
uint32_t block_size_log2) {
|
||||
// CP_RB_RPTR_ADDR Ring Buffer Read Pointer Address 0x70C
|
||||
// ptr = RB_RPTR_ADDR, pointer to write back the address to.
|
||||
read_ptr_writeback_ptr_ = ptr;
|
||||
// CP_RB_CNTL Ring Buffer Control 0x704
|
||||
// block_size = RB_BLKSZ, number of quadwords read between updates of the
|
||||
// read pointer.
|
||||
read_ptr_update_freq_ =
|
||||
static_cast<uint32_t>(pow(2.0, static_cast<double>(block_size)) / 4);
|
||||
// block_size = RB_BLKSZ, log2 of number of quadwords read between updates of
|
||||
// the read pointer.
|
||||
read_ptr_update_freq_ = uint32_t(1) << block_size_log2 >> 2;
|
||||
}
|
||||
|
||||
void CommandProcessor::UpdateWritePointer(uint32_t value) {
|
||||
|
|
|
@ -144,8 +144,8 @@ class CommandProcessor {
|
|||
|
||||
virtual void RestoreEdramSnapshot(const void* snapshot) = 0;
|
||||
|
||||
void InitializeRingBuffer(uint32_t ptr, uint32_t page_count);
|
||||
void EnableReadPointerWriteBack(uint32_t ptr, uint32_t block_size);
|
||||
void InitializeRingBuffer(uint32_t ptr, uint32_t size_log2);
|
||||
void EnableReadPointerWriteBack(uint32_t ptr, uint32_t block_size_log2);
|
||||
|
||||
void UpdateWritePointer(uint32_t value);
|
||||
|
||||
|
|
|
@ -220,13 +220,13 @@ void GraphicsSystem::WriteRegister(uint32_t addr, uint32_t value) {
|
|||
register_file_.values[r].u32 = value;
|
||||
}
|
||||
|
||||
void GraphicsSystem::InitializeRingBuffer(uint32_t ptr, uint32_t log2_size) {
|
||||
command_processor_->InitializeRingBuffer(ptr, log2_size + 0x3);
|
||||
void GraphicsSystem::InitializeRingBuffer(uint32_t ptr, uint32_t size_log2) {
|
||||
command_processor_->InitializeRingBuffer(ptr, size_log2);
|
||||
}
|
||||
|
||||
void GraphicsSystem::EnableReadPointerWriteBack(uint32_t ptr,
|
||||
uint32_t block_size) {
|
||||
command_processor_->EnableReadPointerWriteBack(ptr, block_size);
|
||||
uint32_t block_size_log2) {
|
||||
command_processor_->EnableReadPointerWriteBack(ptr, block_size_log2);
|
||||
}
|
||||
|
||||
void GraphicsSystem::SetInterruptCallback(uint32_t callback,
|
||||
|
|
|
@ -55,8 +55,9 @@ class GraphicsSystem {
|
|||
return command_processor_.get();
|
||||
}
|
||||
|
||||
virtual void InitializeRingBuffer(uint32_t ptr, uint32_t log2_size);
|
||||
virtual void EnableReadPointerWriteBack(uint32_t ptr, uint32_t block_size);
|
||||
virtual void InitializeRingBuffer(uint32_t ptr, uint32_t size_log2);
|
||||
virtual void EnableReadPointerWriteBack(uint32_t ptr,
|
||||
uint32_t block_size_log2);
|
||||
|
||||
virtual void SetInterruptCallback(uint32_t callback, uint32_t user_data);
|
||||
void DispatchInterruptCallback(uint32_t source, uint32_t cpu);
|
||||
|
|
|
@ -228,19 +228,19 @@ void VdSetGraphicsInterruptCallback(function_t callback, lpvoid_t user_data) {
|
|||
}
|
||||
DECLARE_XBOXKRNL_EXPORT1(VdSetGraphicsInterruptCallback, kVideo, kImplemented);
|
||||
|
||||
void VdInitializeRingBuffer(lpvoid_t ptr, int_t log2_size) {
|
||||
void VdInitializeRingBuffer(lpvoid_t ptr, int_t size_log2) {
|
||||
// r3 = result of MmGetPhysicalAddress
|
||||
// r4 = log2(size)
|
||||
// Buffer pointers are from MmAllocatePhysicalMemory with WRITE_COMBINE.
|
||||
auto graphics_system = kernel_state()->emulator()->graphics_system();
|
||||
graphics_system->InitializeRingBuffer(ptr, log2_size);
|
||||
graphics_system->InitializeRingBuffer(ptr, size_log2);
|
||||
}
|
||||
DECLARE_XBOXKRNL_EXPORT1(VdInitializeRingBuffer, kVideo, kImplemented);
|
||||
|
||||
void VdEnableRingBufferRPtrWriteBack(lpvoid_t ptr, int_t block_size) {
|
||||
// r4 = 6, usually --- <=19
|
||||
void VdEnableRingBufferRPtrWriteBack(lpvoid_t ptr, int_t block_size_log2) {
|
||||
// r4 = log2(block size), 6, usually --- <=19
|
||||
auto graphics_system = kernel_state()->emulator()->graphics_system();
|
||||
graphics_system->EnableReadPointerWriteBack(ptr, block_size);
|
||||
graphics_system->EnableReadPointerWriteBack(ptr, block_size_log2);
|
||||
}
|
||||
DECLARE_XBOXKRNL_EXPORT1(VdEnableRingBufferRPtrWriteBack, kVideo, kImplemented);
|
||||
|
||||
|
|
Loading…
Reference in New Issue