GPU: Fix incorrectly calculating the primary ringbuffer's size
This commit is contained in:
@@ -200,15 +200,18 @@ void VdSetGraphicsInterruptCallback(function_t callback, lpvoid_t user_data) {
|
||||
}
|
||||
DECLARE_XBOXKRNL_EXPORT(VdSetGraphicsInterruptCallback, ExportTag::kVideo);
|
||||
|
||||
void VdInitializeRingBuffer(lpvoid_t ptr, int_t page_count) {
|
||||
void VdInitializeRingBuffer(lpvoid_t ptr, int_t log2_size) {
|
||||
// r3 = result of MmGetPhysicalAddress
|
||||
// r4 = number of pages? page size?
|
||||
// 0x8000 -> cntlzw=16 -> 0x1C - 16 = 12
|
||||
// r4 = log2(size)
|
||||
// r4 is or'd with 0x802 and then stuffed into CP_RB_CNTL
|
||||
// according to AMD docs, this corresponds with RB_BUFSZ, which is log2
|
||||
// actual size.
|
||||
// 0x8 is RB_BLKSZ, or number of words gpu will read before updating the
|
||||
// host read pointer.
|
||||
// So being or'd with 0x2 makes the ring buffer size always a multiple of 4.
|
||||
// Buffer pointers are from MmAllocatePhysicalMemory with WRITE_COMBINE.
|
||||
// Sizes could be zero? XBLA games seem to do this. Default sizes?
|
||||
// D3D does size / region_count - must be > 1024
|
||||
auto graphics_system = kernel_state()->emulator()->graphics_system();
|
||||
graphics_system->InitializeRingBuffer(ptr, page_count);
|
||||
graphics_system->InitializeRingBuffer(ptr, log2_size);
|
||||
}
|
||||
DECLARE_XBOXKRNL_EXPORT(VdInitializeRingBuffer, ExportTag::kVideo);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user