rsx: Avoid calling any blocking callbacks from threads that are not rsx::thread

- Defers on_notity_memory_unmapped to only run from within rsx context
- Avoids passive_lock + writer_lock deadlock
This commit is contained in:
kd-11 2018-05-23 12:55:14 +03:00 committed by kd-11
parent d2bf04796f
commit b957eac6e8
7 changed files with 80 additions and 47 deletions

View file

@ -1134,7 +1134,7 @@ namespace rsx
{
// Get timestamp, and convert it from microseconds to nanoseconds
return get_system_time() * 1000;
}
}
gsl::span<const gsl::byte> thread::get_raw_index_array(const std::vector<std::pair<u32, u32> >& draw_indexed_clause) const
{
@ -1276,6 +1276,19 @@ namespace rsx
}
}
void thread::do_local_task(bool /*idle*/)
{
if (!in_begin_end)
{
for (const auto& range : m_invalidated_memory_ranges)
{
on_invalidate_memory_range(range.first, range.second);
}
m_invalidated_memory_ranges.clear();
}
}
//std::future<void> thread::add_internal_task(std::function<bool()> callback)
//{
// std::lock_guard<shared_mutex> lock{ m_mtx_task };
@ -2312,6 +2325,11 @@ namespace rsx
check_zcull_status(false);
}
void thread::on_notify_memory_unmapped(u32 base_address, u32 size)
{
m_invalidated_memory_ranges.push_back({ base_address, size });
}
//Pause/cont wrappers for FIFO ctrl. Never call this from rsx thread itself!
void thread::pause()
{