From patchwork Tue Mar 18 19:22:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Almeida X-Patchwork-Id: 14021464 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AE4F6C282EC for ; Tue, 18 Mar 2025 19:23:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2461510E4BD; Tue, 18 Mar 2025 19:23:16 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=collabora.com header.i=daniel.almeida@collabora.com header.b="d0jwSF2j"; dkim-atps=neutral Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) by gabe.freedesktop.org (Postfix) with ESMTPS id C1E1D10E4BD for ; Tue, 18 Mar 2025 19:23:14 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1742325793; cv=none; d=zohomail.com; s=zohoarc; b=SAQfVlQF7b55DuPTp3aOx88w8L/pt6UiQmJzJpDcWOdYTfFUZGnNHG8Bg53TqvCwlJcv5KJOURLsfg4ej9XwxH3L9wMfIHoYlYUHx6DR0OXC9BftuP2kfKev9i+pSUOYqiew0LbjkTyf4dPb6WA8oBXGyE39dyERRCir7Y3FP74= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1742325793; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=41leyn0Iy/le36Yq333crgJNdHUoVAR3VY1Fmw9OpxE=; b=MSG7911aBq/p6qBwdBOMIDepP/8CObB6tGzHjJXVcuEdBievLnOaph85Mot8/8iraynk9yIv6qNshqPZ4dzEjIqxTt4mFFmAy5kp1bIPp2dOJt+CoYMNvxU+N3XlnJAww6SydQvITMRXbjVbn3rSKeChoDVsgmwG5A2J1CWQZYU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=daniel.almeida@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1742325793; s=zohomail; d=collabora.com; i=daniel.almeida@collabora.com; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:References:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=41leyn0Iy/le36Yq333crgJNdHUoVAR3VY1Fmw9OpxE=; b=d0jwSF2j/SCoFYKJLteouhtl9/HvP4lGdOhgN+lbJj9xUKhvSb9pA3oXhqkN2D/8 J7l+80qIEo3hKCrrT1/06hP4vVH/2/SHLNGkid4bPB30OyCcGwKxJFzM/OUE4d0GTkh WzDlPGPoNCwM//WXv1UuOcyaBOypAoW4DvD7ofKE= Received: by mx.zohomail.com with SMTPS id 1742325791758998.0047779059205; Tue, 18 Mar 2025 12:23:11 -0700 (PDT) From: Daniel Almeida Date: Tue, 18 Mar 2025 16:22:37 -0300 Subject: [PATCH 3/7] rust: helpers: Add bindings/wrappers for dma_resv_lock MIME-Version: 1.0 Message-Id: <20250318-drm-gem-shmem-v1-3-64b96511a84f@collabora.com> References: <20250318-drm-gem-shmem-v1-0-64b96511a84f@collabora.com> In-Reply-To: <20250318-drm-gem-shmem-v1-0-64b96511a84f@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, Danilo Krummrich , Asahi Lina , Daniel Almeida X-Mailer: b4 0.14.2 X-ZohoMailClient: External X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Asahi Lina This is just for basic usage in the DRM shmem abstractions for implied locking, not intended as a full DMA Reservation abstraction yet. Signed-off-by: Asahi Lina Signed-off-by: Daniel Almeida --- rust/bindings/bindings_helper.h | 1 + rust/helpers/dma-resv.c | 13 +++++++++++++ rust/helpers/helpers.c | 1 + 3 files changed, 15 insertions(+) diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h index e67fd9c3db2f8fbd9766de4148d8a66942eb1f36..032416a23b31e8fcd4c820016e0ccc6f91af2682 100644 --- a/rust/bindings/bindings_helper.h +++ b/rust/bindings/bindings_helper.h @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/rust/helpers/dma-resv.c b/rust/helpers/dma-resv.c new file mode 100644 index 0000000000000000000000000000000000000000..05501cb814513b483afd0b7f220230d867863c2f --- /dev/null +++ b/rust/helpers/dma-resv.c @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include + +int rust_helper_dma_resv_lock(struct dma_resv *obj, struct ww_acquire_ctx *ctx) +{ + return dma_resv_lock(obj, ctx); +} + +void rust_helper_dma_resv_unlock(struct dma_resv *obj) +{ + dma_resv_unlock(obj); +} diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c index 2f2070c15f0952a953b9704a4e82968fb575aaed..be3e6c2ffbe6de02d6830014226fdce9630607ab 100644 --- a/rust/helpers/helpers.c +++ b/rust/helpers/helpers.c @@ -13,6 +13,7 @@ #include "build_bug.c" #include "cred.c" #include "device.c" +#include "dma-resv.c" #include "drm.c" #include "err.c" #include "fs.c"