Revert "Copy commit queue in check_new_wayland_res"
This reverts commit 9c9a8093ee
.
This commit is contained in:
parent
fb2fd1127a
commit
0757f2676b
1 changed files with 60 additions and 54 deletions
|
@ -2074,27 +2074,22 @@ void handle_done_commits( void )
|
||||||
|
|
||||||
void check_new_wayland_res( void )
|
void check_new_wayland_res( void )
|
||||||
{
|
{
|
||||||
// When importing buffer, we'll potentially need to perform operations with
|
// We need to release buffers without having a commit queue lock, otherwise
|
||||||
// a wlserver lock (e.g. wlr_buffer_lock). We can't do this with a
|
// we won't be able to lock wlserver without a deadlock
|
||||||
// wayland_commit_queue lock because that causes deadlocks.
|
std::vector<struct wlr_buffer *> release_queue;
|
||||||
std::vector<ResListEntry_t> tmp_queue;
|
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock( wayland_commit_lock );
|
std::lock_guard<std::mutex> lock( wayland_commit_lock );
|
||||||
tmp_queue = wayland_commit_queue;
|
|
||||||
wayland_commit_queue.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( uint32_t i = 0; i < tmp_queue.size(); i++ )
|
for ( uint32_t i = 0; i < wayland_commit_queue.size(); i++ )
|
||||||
{
|
{
|
||||||
struct wlr_buffer *buf = tmp_queue[ i ].buf;
|
struct wlr_buffer *buf = wayland_commit_queue[ i ].buf;
|
||||||
|
|
||||||
win *w = find_win( tmp_queue[ i ].surf );
|
win *w = find_win( wayland_commit_queue[ i ].surf );
|
||||||
|
|
||||||
if ( w == nullptr )
|
if ( w == nullptr )
|
||||||
{
|
{
|
||||||
wlserver_lock();
|
release_queue.push_back( buf );
|
||||||
wlr_buffer_unlock( buf );
|
|
||||||
wlserver_unlock();
|
|
||||||
fprintf (stderr, "waylandres but no win\n");
|
fprintf (stderr, "waylandres but no win\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2135,6 +2130,17 @@ void check_new_wayland_res( void )
|
||||||
// Wake up commit wait thread if chilling
|
// Wake up commit wait thread if chilling
|
||||||
waitListSem.signal();
|
waitListSem.signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wayland_commit_queue.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
wlserver_lock();
|
||||||
|
for ( uint32_t i = 0; i < release_queue.size(); i++ )
|
||||||
|
{
|
||||||
|
wlr_buffer_unlock( release_queue[ i ] );
|
||||||
|
}
|
||||||
|
wlserver_unlock();
|
||||||
|
release_queue.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in a new issue