rusticl/event: drop from_cl_arr and use arcs_from_arr

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27376>
This commit is contained in:
Karol Herbst
2024-01-28 20:40:44 +01:00
committed by Marge Bot
parent 57e5d377da
commit 3be4f60f97
2 changed files with 2 additions and 14 deletions
+2 -8
View File
@@ -1,4 +1,4 @@
use crate::api::icd::CLResult;
use crate::api::icd::{CLObject, CLResult};
use crate::api::types::*;
use crate::core::event::*;
use crate::core::queue::*;
@@ -270,13 +270,7 @@ pub fn event_list_from_cl(
// CL_INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or
// event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in
// event_wait_list are not valid events.
if event_wait_list.is_null() && num_events_in_wait_list > 0
|| !event_wait_list.is_null() && num_events_in_wait_list == 0
{
return Err(CL_INVALID_EVENT_WAIT_LIST);
}
let res = Event::from_cl_arr(event_wait_list, num_events_in_wait_list)
let res = Event::arcs_from_arr(event_wait_list, num_events_in_wait_list)
.map_err(|_| CL_INVALID_EVENT_WAIT_LIST)?;
// CL_INVALID_CONTEXT if context associated with command_queue and events in event_list are not
@@ -10,7 +10,6 @@ use mesa_rust_util::static_assert;
use rusticl_opencl_gen::*;
use std::collections::HashSet;
use std::slice;
use std::sync::Arc;
use std::sync::Condvar;
use std::sync::Mutex;
@@ -96,11 +95,6 @@ impl Event {
})
}
pub fn from_cl_arr(events: *const cl_event, num_events: u32) -> CLResult<Vec<Arc<Event>>> {
let s = unsafe { slice::from_raw_parts(events, num_events as usize) };
s.iter().map(|e| e.get_arc()).collect()
}
fn state(&self) -> MutexGuard<EventMutState> {
self.state.lock().unwrap()
}