rsx: Make overlay manager default lock-state exclusive

This commit is contained in:
kd-11 2024-03-28 01:16:07 +03:00 committed by Megamouse
parent 236ac7d062
commit 175aa510c8
4 changed files with 25 additions and 10 deletions

View File

@ -350,7 +350,7 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
{
if (m_overlay_manager->has_dirty())
{
m_overlay_manager->lock();
m_overlay_manager->lock_shared();
std::vector<u32> uids_to_dispose;
uids_to_dispose.reserve(m_overlay_manager->get_dirty().size());
@ -361,7 +361,7 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
uids_to_dispose.push_back(view->uid);
}
m_overlay_manager->unlock();
m_overlay_manager->unlock_shared();
m_overlay_manager->dispose(uids_to_dispose);
}

View File

@ -45,18 +45,27 @@ namespace rsx
void display_manager::lock()
{
m_list_mutex.lock_shared();
m_list_mutex.lock();
}
void display_manager::unlock()
{
m_list_mutex.unlock_shared();
if (m_pending_removals_count > 0)
{
std::lock_guard lock(m_list_mutex);
cleanup_internal();
}
m_list_mutex.unlock();
}
void display_manager::lock_shared()
{
m_list_mutex.lock_shared();
}
void display_manager::unlock_shared()
{
m_list_mutex.unlock_shared();
}
std::shared_ptr<overlay> display_manager::get(u32 uid)

View File

@ -150,12 +150,18 @@ namespace rsx
return {};
}
// Lock for read-only access (BasicLockable)
// Lock for exclusive access (BasicLockable)
void lock();
// Release read-only lock (BasicLockable). May perform internal cleanup before returning
// Release lock (BasicLockable). May perform internal cleanup before returning
void unlock();
// Lock for shared access (reader-lock)
void lock_shared();
// Unlock for shared access (reader-lock)
void unlock_shared();
// Enable input thread attach to the specified interface
void attach_thread_input(
u32 uid, // The input target

View File

@ -220,7 +220,7 @@ void VKGSRender::frame_context_cleanup(vk::frame_context_t *ctx)
if (m_overlay_manager && m_overlay_manager->has_dirty())
{
auto ui_renderer = vk::get_overlay_pass<vk::ui_overlay_renderer>();
m_overlay_manager->lock();
m_overlay_manager->lock_shared();
std::vector<u32> uids_to_dispose;
uids_to_dispose.reserve(m_overlay_manager->get_dirty().size());
@ -231,7 +231,7 @@ void VKGSRender::frame_context_cleanup(vk::frame_context_t *ctx)
uids_to_dispose.push_back(view->uid);
}
m_overlay_manager->unlock();
m_overlay_manager->unlock_shared();
m_overlay_manager->dispose(uids_to_dispose);
}