rusticl/queue: format file

Reviewed-by: @LingMan
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30215>
This commit is contained in:
Karol Herbst
2024-07-17 14:04:57 +02:00
committed by Marge Bot
parent 00540594df
commit bcc79499fa

View File

@@ -137,64 +137,64 @@ impl Queue {
// GPU contexts
let mut last_err = CL_SUCCESS as cl_int;
loop {
let r = rx_t.recv();
if r.is_err() {
break;
}
let new_events = r.unwrap();
let mut flushed = Vec::new();
for e in new_events {
// If we hit any deps from another queue, flush so we don't risk a dead
// lock.
if e.deps.iter().any(|ev| ev.queue != e.queue) {
flush_events(&mut flushed, &ctx);
let r = rx_t.recv();
if r.is_err() {
break;
}
// check if any dependency has an error
for dep in &e.deps {
// We have to wait on user events or events from other queues.
let dep_err = if dep.is_user() || dep.queue != e.queue {
dep.wait()
let new_events = r.unwrap();
let mut flushed = Vec::new();
for e in new_events {
// If we hit any deps from another queue, flush so we don't risk a dead
// lock.
if e.deps.iter().any(|ev| ev.queue != e.queue) {
flush_events(&mut flushed, &ctx);
}
// check if any dependency has an error
for dep in &e.deps {
// We have to wait on user events or events from other queues.
let dep_err = if dep.is_user() || dep.queue != e.queue {
dep.wait()
} else {
dep.status()
};
last_err = cmp::min(last_err, dep_err);
}
if last_err < 0 {
// If a dependency failed, fail this event as well.
e.set_user_status(last_err);
continue;
}
// if there is an execution error don't bother signaling it as the context
// might be in a broken state. How queues behave after any event hit an
// error is entirely implementation defined.
last_err = e.call(&ctx);
if last_err < 0 {
continue;
}
if e.is_user() {
// On each user event we flush our events as application might
// wait on them before signaling user events.
flush_events(&mut flushed, &ctx);
// Wait on user events as they are synchronization points in the
// application's control.
e.wait();
} else if Platform::dbg().sync_every_event {
flushed.push(e);
flush_events(&mut flushed, &ctx);
} else {
dep.status()
};
last_err = cmp::min(last_err, dep_err);
flushed.push(e);
}
}
if last_err < 0 {
// If a dependency failed, fail this event as well.
e.set_user_status(last_err);
continue;
}
// if there is an execution error don't bother signaling it as the context
// might be in a broken state. How queues behave after any event hit an
// error is entirely implementation defined.
last_err = e.call(&ctx);
if last_err < 0 {
continue;
}
if e.is_user() {
// On each user event we flush our events as application might
// wait on them before signaling user events.
flush_events(&mut flushed, &ctx);
// Wait on user events as they are synchronization points in the
// application's control.
e.wait();
} else if Platform::dbg().sync_every_event {
flushed.push(e);
flush_events(&mut flushed, &ctx);
} else {
flushed.push(e);
}
}
flush_events(&mut flushed, &ctx);
flush_events(&mut flushed, &ctx);
}
})
.unwrap(),