From patchwork Fri Oct 30 14:19:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 28720 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 72B99C324C for ; Fri, 30 Oct 2026 14:19:44 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E1D8569104; Fri, 30 Oct 2026 15:19:42 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.b="SC4uJBml"; dkim=pass (2048-bit key; unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="RO5T3l+h"; dkim-atps=neutral Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1AC7B69075 for ; Fri, 30 Oct 2026 15:19:40 +0100 (CET) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 69UDnCu23468738 for ; Fri, 30 Oct 2026 14:19:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=qcppdkim1; bh=yY4nb1OhSeTVZ0BDYFtq6D krH4I3wv3P4Ywe2QMnc70=; b=SC4uJBml8ir+ATr2/PPjHjxzG2fvFzZJdqtT7q HChs5xwdN9/7hPHu4nNB6qGZS0H1dpvUEn4EQMITKMm/QvpkVzRuHIkqHiygk/sT ivQW6+e7uNKiGWyJyTuuOfhrwlpS9OdiC/vvslkcgNMM6ZjqZSNCxFYQHnOZRKLO 2iUvqP+ax2Q0sN8FMK33qyXXDiCNB9OMmyE9+T61YlCVvzmiuIgEavWDg0Bd6pc9 D7a4V8f6SmLFvChnemb4ZXM5MTDJ5mcrPNm0PVjhRUy5HFNzQLFnDIgPNgEilVg7 1NmOQ+S/iBhvt6vur3rWgqR6nkKDN89zmDTyWYYwGXlXl6Cg== Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4hme6qkdj6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 30 Oct 2026 14:19:39 +0000 (GMT) Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-91c7c7e8becso23526616d6.0 for ; Fri, 30 Oct 2026 07:19:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1793369979; x=1793974779; darn=lists.libcamera.org; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=yY4nb1OhSeTVZ0BDYFtq6DkrH4I3wv3P4Ywe2QMnc70=; b=RO5T3l+h1jv/cpfceYMSYhT9qN3eb9uG4utE59HQ+Fa4Kzm7XTZkAOZuczoyy6MlFI apkHxMM1aJUMYnt1TW96ms9avLyvdOTrJAtqxJ9nIO08eD1Uk9805MaRyTeSU4jiPT7w jIFmYuqx/RRrOgsi5RdtR8wrAO+S55ae2q75Amb+yhrW68TWDV4xAq+ZRUWRo7aswZFN TVflrVzIQ1isnII378IoDF/XxlXkxSQ+n9emjuPfMgtxU+AvfNtUrozyWlD82aoTxIDD zOIxrJdD8Jo3HzWFHJskovWQY6VvdmQ78k3zrx5YzcOMugk0goLU23P9z1MzlyfoSq/4 Xhlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793369979; x=1793974779; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=yY4nb1OhSeTVZ0BDYFtq6DkrH4I3wv3P4Ywe2QMnc70=; b=TUYEi9tAOwlhmkDJ/3zN4G9eKdhB+itxw8/uIXC7njoELWYsLBQeAvsh3P0O5qaKQm vJ7cF3Yk5EALUY3HEeMxiOGnmTZHGNFNnWKJXYCQtRGJz5q417OTN5bkHNfkCYp5buhJ AdjSfrn5IvqhLEnHYFP+4WuM9MPjV66mRPnTN9yVDGYnvsn6RoQhoQG0EzNu7mUr12nd NaqXIS+9Ku+gC9iiepcABiTwDgBbW010je5gjlRpi0nQlpCAVanKBeljspsdrouCK7Pa 5anbLu9ZL5Tt4hohCRxd00W7ZEsML63ilwZ/Nuom5RGgoDvL/42zZh5vEhK7Nji7TpOt /+Zg== X-Gm-Message-State: AFq9FYIPrrlFvrl/rCez8pEIomXPh5n4Agv10DlX5AD8Fdp07GCRpReT /octRX8V1VcBixa1J8RNk+JbHvfPOO97h1pWfXK8JHSyxteLvsKRnVWIm7xNmUykx5i2ic5wS8U JFGyvCt2bXK8eXNt2IY6NSAvgQIID8xuS4eog//0qVe0CTbWwbpx9HvDZHujCAxuywhTEPGPjPH D8W2wJ+9Q8 X-Gm-Gg: AYBFou3MiqnPCNDv0SuZ/hVAnReO+tWmG8oms6pAQKArngSRWntBIFw7ga6LXB5vWsF 2TlmETRqS3xA61W2VcecYOSlHejIAOZcdnfjDSGw4dKds7Fw3WaKc6u1/JmKljwk4tWEwPGBJpF KcoJvDOwsc/LZBJvD30umndOGQ7wGKdaYkspsJkNgRKT1MhRI8IZjMR5umI9/4Wvkoa7nbMkI7j kXD14o0bRzNFQIBSdgTgWeeLH2yS2vDcBKtJkqJqWxFRy32zCuqolyVR9WMyKyHK4h7gcPGeCZp bWtsm3a8eEhqcuDfVzhXPzI0K+NjoLebvN+yGiwNS/n3XI5WIsRM/qtlCUImPJUcMf/1DeexAUB jlxOhvvGCDWznPCzP1zAg0mHaXUFbhK6LbyMpWsYhxoF7RDeFen5TbUvLS0j2vqi1b+kQfG5Mef WE51hrNJlaDAaoNW+70KhxbshgDzLqHGSvtujB1tAf4uLu2SGxV5ffUlAGoVFrIOw0 X-Received: by 2002:a05:620a:84c4:b0:93e:66e6:fa4 with SMTP id af79cd13be357-94421712a8dmr382547085a.16.1793369978628; Fri, 30 Oct 2026 07:19:38 -0700 (PDT) X-Received: by 2002:a05:620a:84c4:b0:93e:66e6:fa4 with SMTP id af79cd13be357-94421712a8dmr382543085a.16.1793369978180; Fri, 30 Oct 2026 07:19:38 -0700 (PDT) Received: from shalem (2001-1c00-0c32-7800-5bfa-a036-83f0-f9ec.cable.dynamic.v6.ziggo.nl. [2001:1c00:c32:7800:5bfa:a036:83f0:f9ec]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c4cabcfd249sm70777166b.20.2026.10.30.07.19.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2026 07:19:37 -0700 (PDT) From: Hans de Goede To: libcamera-devel@lists.libcamera.org, Milan Zamazal Cc: Wenmeng Liu , Hans de Goede Subject: [PATCH v2 1/2] libcamera: software_isp: Add AllocCmaDmaBuffers constructor flag Date: Fri, 30 Oct 2026 15:19:35 +0100 Message-ID: <20261030141936.45238-1-johannes.goede@oss.qualcomm.com> X-Mailer: git-send-email 2.56.0 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: JqqBJEt1FtqqmJAGoGjlg5AZJHZhpv6q X-Proofpoint-Spam-Info: AW1haW4tMjYxMDMwMDA1NyBTYWx0ZWRfX1/5P7MzvJt+D MqtnpABOMtfk2grroiyNIQ5VpEsnv8we2izglMT/49cGwP12j0skH8pPUazB2pI/D4/HFxB9vDk NLOjuAGbm9gu9xAHIC0hsQ0x/RJzlr8= X-Authority-Analysis: v=2.4 cv=DfSCOftW c=1 sm=1 tr=0 ts=6ae4a77b cx=c_pps a=7E5Bxpl4vBhpaufnMqZlrw==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=660iZSQnnn4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=KX44GLdWSitf_MgFYFUA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=pJ04lnu7RYOZP9TFuWaZ:22 X-Proofpoint-GUID: JqqBJEt1FtqqmJAGoGjlg5AZJHZhpv6q X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDMwMDA1NyBTYWx0ZWRfXyVdAuMpWigVk 3rDPayRMGwiEdNNHKyozB8WZoznQD3ohq6nawLooKh5KU77e0mgf1G6pOGKUVH0KM6GRcsu4/wZ TzoiV3uKazCfQQYvo7zsr4DtaVfTmhPRGt1WEriwXge8pvSOso4EcE6wUAYtHieAerCCX8W76v7 RDGCdOWv9+Vlufsea0ZZ3NZFPs8RvAf7IbE2zLjTgPQPosmTzBqREsgwn1J8VIN8pfHozmDexTj bTHbQ89krYYCphQnZNImWmnSoh/0a54etoGFP0ZHSHTWMh1rHQzTEm5i/BUJQhw1GrVwEBYk+iQ Ixe/NuPHf5U4UvVfTYUC+RQBEpKq4ibUMMeILK/G3fQhdMxLk0FT1XGG9aL5m1oIIh1Tbk2Q7x3 vWE0tspmiK0+GT/wuWrN9/JQn4hzfXnPPn+G/LHUs9uHHnmDx3a16vx52zo6cp/sfb/MoyAlrKy 4hPgxOF9EaLbOGvlwCg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293, Aquarius:18.0.1176, Hydra:6.1.138, FMLib:17.12.100.49 definitions=2026-10-30_04,2026-10-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 adultscore=0 priorityscore=1501 spamscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610190000 definitions=main-2610300057 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" Allocating DMA buffers from the CMA pool is not necessary on platforms where the expected consumers (GPU, video-encoder) support non contiguous memory and allocating the buffers from the limited CMA pool may cause starvation of that pool for other processes which do actually require CMA. Add a new "SoftwareIspFlags flags" parameter to the SoftwareIsp() constructor, implement a single AllocCmaDmaBuffers flag for now and only request CmaHeap backed DmaBuffers when this flag is set. The only SoftwareIsp() constructor caller is modified to pass the new flag so this patch does not cause any behavior change. clang-format wants to make the lines with the "flags ? cma : none" code one single long line, so disable it for the dmaHeap_() initialization. Signed-off-by: Hans de Goede --- Changes in v2: - Keep SoftwareIsp->dmaHeap_ as an embedded object rather then changing it into a (raw) pointer and use the c++ "member initializer list" construction suggested by Barnabás to conditionally set the types parameter when initializing it --- .../libcamera/internal/software_isp/software_isp.h | 9 ++++++++- src/libcamera/pipeline/simple/simple.cpp | 4 +++- src/libcamera/software_isp/software_isp.cpp | 11 ++++++++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/include/libcamera/internal/software_isp/software_isp.h b/include/libcamera/internal/software_isp/software_isp.h index b64910637..2790e7389 100644 --- a/include/libcamera/internal/software_isp/software_isp.h +++ b/include/libcamera/internal/software_isp/software_isp.h @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -47,8 +48,14 @@ LOG_DECLARE_CATEGORY(SoftwareIsp) class SoftwareIsp : public Object { public: + enum class SoftwareIspFlag { + AllocCmaDmaBuffers = 1 << 0, + }; + + using SoftwareIspFlags = Flags; + SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor, - ControlInfoMap *ipaControls); + SoftwareIspFlags flags, ControlInfoMap *ipaControls); ~SoftwareIsp(); int loadConfiguration([[maybe_unused]] const std::string &filename) { return 0; } diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 35e066499..b645227bc 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -618,7 +618,9 @@ int SimpleCameraData::init() * Instantiate Soft ISP if this is enabled for the given driver and no converter is used. */ if (!converter_ && pipe->swIspEnabled()) { - swIsp_ = std::make_unique(pipe, sensor_.get(), &controlInfo_); + swIsp_ = std::make_unique(pipe, sensor_.get(), + SoftwareIsp::SoftwareIspFlag::AllocCmaDmaBuffers, + &controlInfo_); if (!swIsp_->isValid()) { LOG(SimplePipeline, Warning) << "Failed to create software ISP, disabling software debayering"; diff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp index 627625b4f..8ab114f63 100644 --- a/src/libcamera/software_isp/software_isp.cpp +++ b/src/libcamera/software_isp/software_isp.cpp @@ -24,6 +24,7 @@ #include #include "libcamera/internal/bayer_format.h" +#include "libcamera/internal/dma_buf_allocator.h" #include "libcamera/internal/framebuffer.h" #include "libcamera/internal/software_isp/debayer_params.h" @@ -76,14 +77,18 @@ LOG_DEFINE_CATEGORY(SoftwareIsp) * \brief Constructs SoftwareIsp object * \param[in] pipe The pipeline handler in use * \param[in] sensor Pointer to the CameraSensor instance owned by the pipeline handler + * \param[in] flags SoftwareIspFlags * \param[out] ipaControls The IPA controls to update */ SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor, - ControlInfoMap *ipaControls) + SoftwareIspFlags flags, ControlInfoMap *ipaControls) : ispWorkerThread_("SWIspWorker"), - dmaHeap_(DmaBufAllocator::DmaBufAllocatorFlag::CmaHeap | + /* clang-format off */ + dmaHeap_(DmaBufAllocator::DmaBufAllocatorFlag::UDmaBuf | DmaBufAllocator::DmaBufAllocatorFlag::SystemHeap | - DmaBufAllocator::DmaBufAllocatorFlag::UDmaBuf) + ((flags & SoftwareIsp::SoftwareIspFlag::AllocCmaDmaBuffers) ? + DmaBufAllocator::DmaBufAllocatorFlag::CmaHeap : + DmaBufAllocator::DmaBufAllocatorFlag{})) /* clang-format on */ { if (!dmaHeap_.isValid()) { LOG(SoftwareIsp, Error) << "Failed to create DmaBufAllocator object";