Module: Mesa
Branch: main
Commit: 85ca349be049fb8f8159fffa1c32c951662c7ce3
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=85ca349be049fb8f8159fffa1c32c951662c7ce3

Author: Dr. David Alan Gilbert <[email protected]>
Date:   Thu Jul  6 01:56:02 2023 +0100

rusticl: Wire the 'queued' profiling time up

Set it from the timestamp when it's added to the queue, and wire
the API up to read it.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24101>

---

 src/gallium/frontends/rusticl/api/event.rs  | 2 +-
 src/gallium/frontends/rusticl/core/queue.rs | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/gallium/frontends/rusticl/api/event.rs 
b/src/gallium/frontends/rusticl/api/event.rs
index 31b87570be0..1afd1318c47 100644
--- a/src/gallium/frontends/rusticl/api/event.rs
+++ b/src/gallium/frontends/rusticl/api/event.rs
@@ -50,7 +50,7 @@ impl CLInfo<cl_profiling_info> for cl_event {
 
         Ok(match *q {
             // TODO
-            CL_PROFILING_COMMAND_QUEUED => cl_prop::<cl_ulong>(0),
+            CL_PROFILING_COMMAND_QUEUED => 
cl_prop::<cl_ulong>(event.get_time(EventTimes::Queued)),
             CL_PROFILING_COMMAND_SUBMIT => cl_prop::<cl_ulong>(1),
             CL_PROFILING_COMMAND_START => cl_prop::<cl_ulong>(2),
             CL_PROFILING_COMMAND_END => cl_prop::<cl_ulong>(3),
diff --git a/src/gallium/frontends/rusticl/core/queue.rs 
b/src/gallium/frontends/rusticl/core/queue.rs
index f0d73345af2..22d37aa0238 100644
--- a/src/gallium/frontends/rusticl/core/queue.rs
+++ b/src/gallium/frontends/rusticl/core/queue.rs
@@ -118,6 +118,9 @@ impl Queue {
     }
 
     pub fn queue(&self, e: Arc<Event>) {
+        if self.is_profiling_enabled() {
+            e.set_time(EventTimes::Queued, 
self.device.screen().get_timestamp());
+        }
         self.state.lock().unwrap().pending.push(e);
     }
 
@@ -149,6 +152,10 @@ impl Queue {
         queues.remove(self);
         queues
     }
+
+    pub fn is_profiling_enabled(&self) -> bool {
+        (self.props & (CL_QUEUE_PROFILING_ENABLE as u64)) != 0
+    }
 }
 
 impl Drop for Queue {

Reply via email to