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
rsx: Fix gcm unmap events #6262
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2340,10 +2340,7 @@ namespace rsx | |
} | ||
} | ||
|
||
vm::ptr<CellGcmReportData> result = sink; | ||
result->value = value; | ||
result->padding = 0; | ||
result->timer = timestamp(); | ||
vm::_ref<atomic_t<CellGcmReportData>>(sink).store({ timestamp(), value, 0}); | ||
} | ||
|
||
void thread::sync() | ||
|
@@ -2398,25 +2395,45 @@ namespace rsx | |
{ | ||
if (!m_rsx_thread_exiting && address < rsx::constants::local_mem_base) | ||
{ | ||
u32 ea = address >> 20, io = RSXIOMem.io[ea]; | ||
|
||
if (io < 512) | ||
if (!isHLE) | ||
{ | ||
if (!isHLE) | ||
// Each bit represents io entry to be unmapped | ||
u64 unmap_status[512 / 64]{}; | ||
|
||
for (u32 ea = address >> 20, end = ea + size >> 20; ea < end; ea++) | ||
{ | ||
const u64 unmap_key = u64((1ull << (size >> 20)) - 1) << (io & 0x3f); | ||
const u64 gcm_flag = 0x100000000ull << (io >> 6); | ||
sys_event_port_send(fxm::get<SysRsxConfig>()->rsx_event_port, 0, gcm_flag, unmap_key); | ||
u32 io = RSXIOMem.io[ea]; | ||
|
||
if (io < 512) | ||
{ | ||
unmap_status[io / 64] |= 1ull << (io & 63); | ||
RSXIOMem.ea[io].raw() = 0xFFFF; | ||
RSXIOMem.io[ea].raw() = 0xFFFF; | ||
} | ||
} | ||
else | ||
|
||
for (u32 i = 0; i < std::size(unmap_status); i++) | ||
{ | ||
for (const u32 end = ea + (size >> 20); ea < end;) | ||
// TODO: Check order when sending multiple events | ||
if (u64 to_unmap = unmap_status[i]) | ||
{ | ||
offsetTable.ioAddress[ea++] = 0xFFFF; | ||
offsetTable.eaAddress[io++] = 0xFFFF; | ||
// Each 64 entries are grouped by a bit | ||
const u64 io_event = 0x100000000ull << i; | ||
sys_event_port_send(fxm::get<SysRsxConfig>()->rsx_event_port, 0, io_event, to_unmap); | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
// TODO: Fix this | ||
u32 ea = address >> 20, io = RSXIOMem.io[ea]; | ||
|
||
for (const u32 end = ea + (size >> 20); ea < end;) | ||
{ | ||
offsetTable.ioAddress[ea++] = 0xFFFF; | ||
offsetTable.eaAddress[io++] = 0xFFFF; | ||
} | ||
} | ||
|
||
// Queue up memory invalidation | ||
std::lock_guard lock(m_mtx_task); | ||
|
@@ -2799,7 +2816,7 @@ namespace rsx | |
m_cycles_delay = max_zcull_delay_us; | ||
} | ||
|
||
void ZCULL_control::write(vm::addr_t sink, u32 timestamp, u32 type, u32 value) | ||
void ZCULL_control::write(vm::addr_t sink, u64 timestamp, u32 type, u32 value) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice catch, this was a careless mistake on my part. |
||
{ | ||
verify(HERE), sink; | ||
|
||
|
@@ -2820,10 +2837,7 @@ namespace rsx | |
break; | ||
} | ||
|
||
vm::ptr<CellGcmReportData> out = sink; | ||
out->value = value; | ||
out->timer = timestamp; | ||
out->padding = 0; | ||
vm::_ref<atomic_t<CellGcmReportData>>(sink).store({ timestamp, value, 0}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would argue making this atomic is overkill, but I guess it doesn't matter much. Afaik FlexIO bus width is 64-bit so I would have expected no such guarantees in hardware. InterlockedExchange shouldn't be too bad I guess. |
||
} | ||
|
||
void ZCULL_control::sync(::rsx::thread* ptimer) | ||
|
@@ -2868,7 +2882,7 @@ namespace rsx | |
|
||
if (!writer.forwarder) | ||
//No other queries in the chain, write result | ||
write(writer.sink, (u32)ptimer->timestamp(), writer.type, result); | ||
write(writer.sink, ptimer->timestamp(), writer.type, result); | ||
|
||
processed++; | ||
} | ||
|
@@ -3029,7 +3043,7 @@ namespace rsx | |
//only zpass supported right now | ||
if (!writer.forwarder) | ||
//No other queries in the chain, write result | ||
write(writer.sink, (u32)ptimer->timestamp(), writer.type, result); | ||
write(writer.sink, ptimer->timestamp(), writer.type, result); | ||
|
||
processed++; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting find