From patchwork Mon Jun 3 11:12:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 20187 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 9B900BD87C for ; Mon, 3 Jun 2024 11:13:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 53A88634B2; Mon, 3 Jun 2024 13:13:06 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="V/o69XQs"; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 299FE61A3B for ; Mon, 3 Jun 2024 13:13:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717413183; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=z+rguGAvFAMsef6YUaV+Q/8DonQY95ApezL9ucuCKS8=; b=V/o69XQswvviRsfsth9o/54ucgSWAv2M6ajTqKvM13exXMoV1XdThICgluYeyNLoDFVvet FGzF4dK/r1sc36GL3oe3IljgO4xewznoz42Ioaf+9mKPFxU6fPJgPuZA0lhQV/Gzgc8muE 7FoO6mSWsyXfwdgPOS194z7HA7N1LGw= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-413-rM0mOmPJOm2dX5zuTxKm5g-1; Mon, 03 Jun 2024 07:13:01 -0400 X-MC-Unique: rM0mOmPJOm2dX5zuTxKm5g-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5CE961C0512B for ; Mon, 3 Jun 2024 11:13:01 +0000 (UTC) Received: from x1.localdomain.com (unknown [10.39.193.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5CEE28E3; Mon, 3 Jun 2024 11:13:00 +0000 (UTC) From: Hans de Goede To: libcamera-devel@lists.libcamera.org Cc: Maxime Ripard , Milan Zamazal , Hans de Goede Subject: [PATCH v3 0/3] libcamera: dma_buffer_allocator: Add support for using udmabuf to alloc dma-buffers Date: Mon, 3 Jun 2024 13:12:56 +0200 Message-ID: <20240603111259.54321-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Hi All, Here is v3 of my patch-series to add /dev/udmabuf dma-buffer allocation support. This is based on: https://patchwork.libcamera.org/patch/18922/ Changes in v3: - Rebase on top of latest master which includes Milan's "[PATCH v6 0/5] Software ISP levels cleanup" series and Laurent's "[PATCH 0/3] libcamera: Update to the new upstream subdev routing API" series - Drop include/linux related patches (included in Laurent's merged series) - Wrap comments and error message logging at 80 chars - Style fixes to some comments - Drop the unnecessary checking of the created dma-buf size Changes in v2: - New patch: Add linux/udmabuf.h to libcamera's local kernel headers - New patch: Rename DmaHeap class to DmaBufAllocator - libcamera: DmaBufAllocator: Support allocating from /dev/udmabuf : - Reword the commit message - Add a new DmaBufAllocator::DmaBufAllocatorFlag::UDmaBuf type for udmabuf - Drop unnecessary size != size check - Reword log messages to be more like the DMA heap alloc path - Move UniqueFD(ret) up so as to not leak the fd on errors -New patch: software_isp: Allow using dma-buffers from /dev/udmabuf I did not push out a branch for this to libcamera-softisp because of fdo gitlab maintenance. Note CI was happy with v2 and I see no reason why v3 would be different. Regards, Hans Hans de Goede (3): libcamera: Rename DmaHeap class to DmaBufAllocator libcamera: DmaBufAllocator: Support allocating from /dev/udmabuf libcamera: software_isp: Allow using dma-buffers from /dev/udmabuf .../libcamera/internal/dma_buf_allocator.h | 42 ++++ include/libcamera/internal/dma_heaps.h | 38 --- include/libcamera/internal/meson.build | 2 +- .../internal/software_isp/software_isp.h | 4 +- src/libcamera/dma_buf_allocator.cpp | 233 ++++++++++++++++++ src/libcamera/dma_heaps.cpp | 165 ------------- src/libcamera/meson.build | 2 +- src/libcamera/pipeline/rpi/vc4/vc4.cpp | 4 +- src/libcamera/software_isp/software_isp.cpp | 6 +- 9 files changed, 285 insertions(+), 211 deletions(-) create mode 100644 include/libcamera/internal/dma_buf_allocator.h delete mode 100644 include/libcamera/internal/dma_heaps.h create mode 100644 src/libcamera/dma_buf_allocator.cpp delete mode 100644 src/libcamera/dma_heaps.cpp