From patchwork Thu May 30 17:15:55 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: 20146 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 09DC1BD87C for ; Thu, 30 May 2024 17:16:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 25536634B6; Thu, 30 May 2024 19:16:08 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="RoSVxKPC"; 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 8A99361A43 for ; Thu, 30 May 2024 19:16:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717089365; 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=r9U5sSjdjo+5VzOD4SKvhOSeb+ugW+PTtSeCHIwkueE=; b=RoSVxKPCExqX7Meaqh6FHh103rHfwQB6pexoEXFwZ4gqVi+Wu9W/O0rgkpwpl/7owNVPHU V+8yHsB58QPA15dRV3IaIFUGUGhIcNIx/lmkUgb+l8z5CAABYBqQOiIgkNzKWjrDzMmP10 u8+Thy8bAEOzljN4hFP+JHqYOFhpGYk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-549-2tAfxOF_NUOjBHA8zRuC6A-1; Thu, 30 May 2024 13:16:03 -0400 X-MC-Unique: 2tAfxOF_NUOjBHA8zRuC6A-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 A0E11801780; Thu, 30 May 2024 17:16:02 +0000 (UTC) Received: from shalem.redhat.com (unknown [10.39.192.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8AEC0286E; Thu, 30 May 2024 17:16:01 +0000 (UTC) From: Hans de Goede To: libcamera-devel@lists.libcamera.org Cc: Andrey Konovalov , Pavel Machek , Bryan O'Donoghue , Milan Zamazal , Maxime Ripard , Hans de Goede Subject: [PATCH v2 0/5] libcamera: dma_buffer_allocator: Add support for using udmabuf to alloc dma-buffers Date: Thu, 30 May 2024 19:15:55 +0200 Message-ID: <20240530171600.259495-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 v2 of my patch-series to add /dev/udmabuf dma-buffer allocation support. This is based on: https://patchwork.libcamera.org/patch/18922/ 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 have also pushed these patches to: https://gitlab.freedesktop.org/camera/libcamera-softisp/-/commits/udmabuf-v2 for CI, CI is happy with it except for the lint task which does not like the kernel headers sync, which seems to be a false positive. Regards, Hans Hans de Goede (5): update-kernel-headers: Add linux/udmabuf.h to headers to sync include: linux: Update kernel headers to version v6.10-rc1 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 +- include/linux/README | 2 +- include/linux/drm_fourcc.h | 10 +- include/linux/media-bus-format.h | 9 + include/linux/rkisp1-config.h | 56 ++-- include/linux/udmabuf.h | 33 +++ include/linux/v4l2-controls.h | 6 + include/linux/v4l2-mediabus.h | 18 +- include/linux/v4l2-subdev.h | 29 ++- include/linux/videodev2.h | 72 ++++-- src/libcamera/dma_buf_allocator.cpp | 240 ++++++++++++++++++ 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 +- utils/update-kernel-headers.sh | 1 + 19 files changed, 465 insertions(+), 274 deletions(-) create mode 100644 include/libcamera/internal/dma_buf_allocator.h delete mode 100644 include/libcamera/internal/dma_heaps.h create mode 100644 include/linux/udmabuf.h create mode 100644 src/libcamera/dma_buf_allocator.cpp delete mode 100644 src/libcamera/dma_heaps.cpp Tested-by: Bryan O'Donoghue # Lenovo-x13s