mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 13:28:06 +02:00
rusticl/icd: fold leak_ref into its only consumer
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27376>
This commit is contained in:
parent
4ca11d5f06
commit
13241264f1
2 changed files with 6 additions and 12 deletions
|
|
@ -162,7 +162,12 @@ pub fn create_and_queue(
|
|||
work: EventSig,
|
||||
) -> CLResult<()> {
|
||||
let e = Event::new(&q, cmd_type, deps, work);
|
||||
cl_event::leak_ref(event, &e);
|
||||
if !event.is_null() {
|
||||
// SAFETY: we check for null and valid API use is to pass in a valid pointer
|
||||
unsafe {
|
||||
event.write(cl_event::from_arc(Arc::clone(&e)));
|
||||
}
|
||||
}
|
||||
q.queue(e);
|
||||
if block {
|
||||
q.flush(true)?;
|
||||
|
|
|
|||
|
|
@ -234,17 +234,6 @@ pub trait ReferenceCountedAPIPointer<T, const ERR: i32> {
|
|||
// implement that as part of the macro where we know the real type.
|
||||
fn from_ptr(ptr: *const T) -> Self;
|
||||
|
||||
fn leak_ref(ptr: *mut Self, r: &std::sync::Arc<T>)
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
if !ptr.is_null() {
|
||||
unsafe {
|
||||
ptr.write(Self::from_arc(r.clone()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn get_ref(&self) -> CLResult<&T> {
|
||||
unsafe { Ok(self.get_ptr()?.as_ref().unwrap()) }
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue