From 3be4f60f978926d7ac7d0e76c6404e3772a82c5b Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Sun, 28 Jan 2024 20:40:44 +0100 Subject: [PATCH] rusticl/event: drop from_cl_arr and use arcs_from_arr Part-of: --- src/gallium/frontends/rusticl/api/util.rs | 10 ++-------- src/gallium/frontends/rusticl/core/event.rs | 6 ------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/gallium/frontends/rusticl/api/util.rs b/src/gallium/frontends/rusticl/api/util.rs index 934f46d848c..c16582cbf00 100644 --- a/src/gallium/frontends/rusticl/api/util.rs +++ b/src/gallium/frontends/rusticl/api/util.rs @@ -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 diff --git a/src/gallium/frontends/rusticl/core/event.rs b/src/gallium/frontends/rusticl/core/event.rs index 2640fb40009..cb462388eb8 100644 --- a/src/gallium/frontends/rusticl/core/event.rs +++ b/src/gallium/frontends/rusticl/core/event.rs @@ -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>> { - let s = unsafe { slice::from_raw_parts(events, num_events as usize) }; - s.iter().map(|e| e.get_arc()).collect() - } - fn state(&self) -> MutexGuard { self.state.lock().unwrap() }