[RFC PATCH 4/9] rust: dma_fence: expose the fence's seqno publically

Maíra Canal mcanal at igalia.com
Fri Mar 17 12:12:08 UTC 2023


Each fence has a linear increasing sequence number inside the execution
context, that can be used to decide which fence would be signaled later.
So, expose this attribute to the Rust drivers through a method.

Signed-off-by: Maíra Canal <mcanal at igalia.com>
---
 rust/kernel/dma_fence.rs | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/rust/kernel/dma_fence.rs b/rust/kernel/dma_fence.rs
index 176e6d250e6c..94fead520274 100644
--- a/rust/kernel/dma_fence.rs
+++ b/rust/kernel/dma_fence.rs
@@ -60,6 +60,13 @@ pub trait RawDmaFence: crate::private::Sealed {
         }
     }
 
+    /// Return the seqno from this fence
+    fn seqno(&self) -> u64 {
+        // SAFETY: We hold a reference to a dma_fence and every dma_fence holds
+        // a seqno.
+        unsafe { (*self.raw()).seqno }
+    }
+
     /// Signal completion of this fence
     fn signal(&self) -> Result {
         to_result(unsafe { bindings::dma_fence_signal(self.raw()) })
-- 
2.39.2



More information about the dri-devel mailing list