dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Maíra Canal" <mcanal@igalia.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	Miguel Ojeda <ojeda@kernel.org>,
	Alex Gaynor <alex.gaynor@gmail.com>,
	Wedson Almeida Filho <wedsonaf@gmail.com>,
	Boqun Feng <boqun.feng@gmail.com>, Gary Guo <gary@garyguo.net>,
	Asahi Lina <lina@asahilina.net>,
	Faith Ekstrand <faith.ekstrand@collabora.com>
Cc: "Melissa Wen" <mwen@igalia.com>,
	"Maíra Canal" <mcanal@igalia.com>,
	dri-devel@lists.freedesktop.org, rust-for-linux@vger.kernel.org
Subject: [RFC PATCH 3/9] rust: dma_fence: add method to return an indication if the fence is signaled
Date: Fri, 17 Mar 2023 09:12:07 -0300	[thread overview]
Message-ID: <20230317121213.93991-4-mcanal@igalia.com> (raw)
In-Reply-To: <20230317121213.93991-1-mcanal@igalia.com>

To indicate the current status of the fence, there is a kernel function that
returns an indication if the fence is signaled yet. Therefore, add a method
in the Rust abstraction to return an indication if the fence is signaled.

Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
 rust/helpers.c           | 6 ++++++
 rust/kernel/dma_fence.rs | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/rust/helpers.c b/rust/helpers.c
index 18c0c434ad73..f77bfa10d5f5 100644
--- a/rust/helpers.c
+++ b/rust/helpers.c
@@ -420,6 +420,12 @@ void rust_helper_dma_fence_put(struct dma_fence *fence)
 }
 EXPORT_SYMBOL_GPL(rust_helper_dma_fence_put);
 
+bool rust_helper_dma_fence_is_signaled(struct dma_fence *fence)
+{
+	return dma_fence_is_signaled(fence);
+}
+EXPORT_SYMBOL_GPL(rust_helper_dma_fence_is_signaled);
+
 struct dma_fence_chain *rust_helper_dma_fence_chain_alloc(void)
 {
 	return dma_fence_chain_alloc();
diff --git a/rust/kernel/dma_fence.rs b/rust/kernel/dma_fence.rs
index ca93380d9da2..176e6d250e6c 100644
--- a/rust/kernel/dma_fence.rs
+++ b/rust/kernel/dma_fence.rs
@@ -65,6 +65,11 @@ pub trait RawDmaFence: crate::private::Sealed {
         to_result(unsafe { bindings::dma_fence_signal(self.raw()) })
     }
 
+    /// Return an indication if the fence is signaled yet.
+    fn is_signaled(&self) -> bool {
+        unsafe { bindings::dma_fence_is_signaled(self.raw()) }
+    }
+
     /// Set the error flag on this fence
     fn set_error(&self, err: Error) {
         unsafe { bindings::dma_fence_set_error(self.raw(), err.to_kernel_errno()) };
-- 
2.39.2


  parent reply	other threads:[~2023-03-17 12:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17 12:12 [RFC PATCH 0/9] Rust version of the VGEM driver Maíra Canal
2023-03-17 12:12 ` [RFC PATCH 1/9] rust: dma_resv: add DMA Reservation abstraction Maíra Canal
2023-03-17 12:12 ` [RFC PATCH 2/9] rust: drm: gem: add method to return DmaResv from GEMObject Maíra Canal
2023-03-22 19:45   ` Björn Roy Baron
2023-03-22 19:57     ` Björn Roy Baron
2023-03-17 12:12 ` Maíra Canal [this message]
2023-03-17 12:12 ` [RFC PATCH 4/9] rust: dma_fence: expose the fence's seqno publically Maíra Canal
2023-03-17 12:12 ` [RFC PATCH 5/9] rust: drm: gem: shmem: set map_wc on gem_create_object callback Maíra Canal
2023-03-17 12:12 ` [RFC PATCH 6/9] drm/vgem: move IOCTLs numbers to enum Maíra Canal
2023-03-17 12:12 ` [RFC PATCH 7/9] drm/rustgem: implement a Rust version of VGEM Maíra Canal
2023-03-17 12:12 ` [RFC PATCH 8/9] drm/rustgem: implement timeout to prevent hangs Maíra Canal
2023-03-17 12:12 ` [RFC PATCH 9/9] drm/rustgem: create dummy IOCTL with number 0x00 Maíra Canal
2023-04-13  9:08   ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230317121213.93991-4-mcanal@igalia.com \
    --to=mcanal@igalia.com \
    --cc=airlied@gmail.com \
    --cc=alex.gaynor@gmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=faith.ekstrand@collabora.com \
    --cc=gary@garyguo.net \
    --cc=lina@asahilina.net \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=mwen@igalia.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tzimmermann@suse.de \
    --cc=wedsonaf@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).