Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed off-by-one in OrderingTable, fixed end-of-chain handling in DMA callback #3

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions psyqo/src/gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void psyqo::GPU::initialize(const psyqo::GPU::Configuration &config) {
}
case 2: { // was a linked DMA
uint32_t madr = DMA_CTRL[DMA_GPU].MADR;
if (madr != 0xff0000) {
if ((madr & 0xff0000) != 0xff0000) {
madr &= 0x7fffff;
// Did we get interrupted in the middle of a chain?
// It means we linked a node too big for the DMA engine to handle,
Expand All @@ -168,7 +168,7 @@ void psyqo::GPU::initialize(const psyqo::GPU::Configuration &config) {
uint32_t head = *next;
uint32_t count = head >> 24;
head &= 0xffffff;
if (head != 0xff0000) {
if ((head & 0xff0000) != 0xff0000) {
m_chainNext = reinterpret_cast<uint32_t *>(head & 0x7fffff);
}
scheduleNormalDMA(madr + 4, count);
Expand Down
2 changes: 1 addition & 1 deletion psyqo/src/ordering-table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void psyqo::OrderingTableBase::clear(uint32_t* table, size_t size) {

void psyqo::OrderingTableBase::insert(uint32_t* table, int32_t size, uint32_t* head, uint32_t shiftedFragmentSize,
int32_t z) {
z = eastl::clamp(z, int32_t(0), size) + 1;
z = eastl::clamp(z, int32_t(0), size - 1) + 1;
*head = shiftedFragmentSize | table[z];
table[z] = reinterpret_cast<uint32_t>(head) & 0xffffff;
}
Loading