RSX/SPU: Import and improve RSX accurate reservations functionality

This commit is contained in:
Elad Ashkenazi 2024-05-23 11:12:38 +03:00
parent b3c9f7647f
commit d3ab62c4b1
2 changed files with 31 additions and 6 deletions

View file

@ -19,6 +19,7 @@
#include "Emu/Cell/lv2/sys_event.h"
#include "Emu/Cell/lv2/sys_time.h"
#include "Emu/Cell/Modules/cellGcmSys.h"
#include "Emu/Memory/vm_reservation.h"
#include "util/serialization_ext.hpp"
#include "Overlays/overlay_perf_metrics.h"
#include "Overlays/overlay_debug_overlay.h"
@ -3103,8 +3104,19 @@ namespace rsx
}
}
rsx::reservation_lock<true> lock(sink, 16);
vm::_ref<atomic_t<CellGcmReportData>>(sink).store({ timestamp(), value, 0});
CellGcmReportData report_data{ timestamp(), value, 0};
if (sink < label_addr || sink >= label_addr + sizeof(RsxReports::report))
{
vm::light_op<false>(vm::_ref<atomic_t<CellGcmReportData>>(sink), [&](atomic_t<CellGcmReportData>& data)
{
data.release(report_data);
});
}
else
{
vm::_ref<atomic_t<CellGcmReportData>>(sink).store(report_data);
}
}
u32 thread::copy_zcull_stats(u32 memory_range_start, u32 memory_range, u32 destination)

View file

@ -1,6 +1,7 @@
#include "stdafx.h"
#include "Core/RSXEngLock.hpp"
#include "Core/RSXReservationLock.hpp"
#include "Emu/Memory/vm_reservation.h"
#include "RSXThread.h"
namespace rsx
@ -346,14 +347,26 @@ namespace rsx
case CELL_GCM_ZCULL_STATS1:
case CELL_GCM_ZCULL_STATS:
default:
//Not implemented
// Not implemented
value = (write_enabled && stats_enabled) ? -1 : 0;
break;
}
rsx::reservation_lock<true> lock(sink, 16);
auto report = vm::get_super_ptr<atomic_t<CellGcmReportData>>(sink);
report->store({ timestamp, value, 0 });
const u32 label_addr = rsx::get_current_renderer()->label_addr;
CellGcmReportData report_data{ timestamp, value, 0 };
if (sink < label_addr || sink >= label_addr + sizeof(RsxReports::report))
{
vm::light_op<false>(*vm::get_super_ptr<atomic_t<CellGcmReportData>>(sink), [&](atomic_t<CellGcmReportData>& data)
{
data.release(report_data);
});
}
else
{
vm::get_super_ptr<atomic_t<CellGcmReportData>>(sink)->store(report_data);
}
}
void ZCULL_control::write(queued_report_write* writer, u64 timestamp, u32 value)