From patchwork Tue Feb 24 19:37:41 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 26232 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 A231BC0DA4 for ; Tue, 24 Feb 2026 19:37:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D3731622A4; Tue, 24 Feb 2026 20:37:51 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.b="jqKu1BjO"; dkim=pass (2048-bit key; unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="WlXWEgf5"; 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 D92AC62080 for ; Tue, 24 Feb 2026 20:37:49 +0100 (CET) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 61OINYu22560032 for ; Tue, 24 Feb 2026 19:37:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=qcppdkim1; bh=64rlEuOYdbviyNQw0A2s83CgL5GfBgbapEf iAU7QnnM=; b=jqKu1BjOygCEVmjEZ8mVyIhlcK8isi3wypx2FPVelZQSXsrN3hr VUh30kGoJ0Yb/nyhPZPRs1WeqcHomyRUHvovcBgrOd60EcFhA7e1VJjlKsobckDh npMgZgm1YmBsUO9YA1G4M0l7o+6bML4Yu9lIhX7n3DsnOV2ET0hMuZXftvdusmsV XACPX/I4W5iIfkufba0gJM+syQgRDsH90RXHP403JT23KxvynUvouaiaZDeiUNOY f62LfwK79SPi7B+WqVsYGAFagMeXz6sst6Sdzboyy52sSBayogKuO/Ycn/Hwp5ub /GFmVQnhfrVAB39O9g4C5DWlPRkopGVkIqg== Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ch4e3auhd-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 24 Feb 2026 19:37:48 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-8cb3ad1b81aso7729226685a.2 for ; Tue, 24 Feb 2026 11:37:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1771961868; x=1772566668; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=64rlEuOYdbviyNQw0A2s83CgL5GfBgbapEfiAU7QnnM=; b=WlXWEgf5oVd9A9Nsj1pIKztT1AXeHx+Thfia3tsNvmCHX7u0mSKhkaBgH8Vnq0+AJX HkEG5QgU8SdhrNSea2eJwj3zDiwZ+3qXuRyIRfR/fxHq0HjcpNo6a5J7ikugUHF8fNqJ wySycJSTETm6Mqs9/9p+prZPJcBJu81LP/6PJyZ0I2FV9P3fYXiRrRchUompkHypqP6A Wukq8pdddjfbbPgEKWWEZb0h0CBGhwZ0vWqJlth6Wgu80aNTjI5K0940bgooPYeijPR5 kWpEJ8kOwk2W3foSO8+M1AgaIkMrO7hGgYHikpu5qsl2NcSNXAsdt16fJ8+km1qdmec3 /I1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771961868; x=1772566668; h=content-transfer-encoding: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; bh=64rlEuOYdbviyNQw0A2s83CgL5GfBgbapEfiAU7QnnM=; b=FT5mAt1l17whuHaJAKGsLXSWAlwKubquF50GAqVdSjByQYUH6DJ8BzFk22GssDYaAG rezrYWEus01+ZZjQzVn84nWZiAP3ddU3gaNL/ygspbRL5jpFKF+xyyBEk0QLI/E/gO6V B8nEWQR9kLHb5iGIDKyEllDx1FLIEMFYwibEPOXOkg3opWXLCVBWsBbz+ioVQWZvEsrR BXZ69vL4iIJoaRXOHfPoME2NofT0/d9liDpcZww1fAq0PlSBUU8DyETPDPS3sOGBz+9K qs+N0clXApoLhK5vBgfozAKTRVKU7u952pxiagpCSG5jnk1JF9rA8Y9kXgq8/bKHl7hm zQxQ== X-Gm-Message-State: AOJu0YzsPBrnl3vTTed91yHFnlJ/+jc3oKbvEEVlIkQzNirEwT5tlAfE 2LlME1COWKTNZZTgpL0deqWTAyEirzsNmp5SNzEjBqKSeOYzeqot/LeQqP0cqK1uBPbm7U3F4PN bAFMYRaSYBR/B0TW4SotBlEQyZY6q1+QheO0MVQT6DIbawQi31lIIPwExGkHbrcPpTHYcYy3bvm t9brjB34pt X-Gm-Gg: AZuq6aIE03XSO+T11R4PwZRjBqlZECq27vsqnXy8SVmjTuBqYB39sVFoFg3MjkuvOF9 WIkfcR9BiltB+C14vhVFyc8hQk/cD2kn0/GdF0lBXJhJAhWp5Qj5bL78QRuNjRk7aqaE26CsYiq /jDsOrFwCvW48Plp5GFEnMwnUgj2rWSR3WA7kxiOH6XrlXwcijoLUWuTiMkuQ+y43y8dbe5L8S6 pej4/JNqxAbCLduiOVP5u9kzSGyzbqsyuACGPJCyq/z1HhJFfsGHEwKnhLFoFFor6Sc79wZO7ki vIiIOKQNO3Wz8dwze3HFidWutLh0DyWnEcodsEF9OPf22vPB7WhCz1eDmM+M98weQu9KKYLBXEK 6bKKWiwDxEV5lim9bkywyHmFBFsLFeL3gDn4U+oF2ChrFlqUZ4Ifb/Dqko0JzoTWhGXdIWeaE6G BnnWMp4R1mQTTY9iS/gq/NrHKReq4l+memOn+Y X-Received: by 2002:a05:620a:4444:b0:8c8:8126:7770 with SMTP id af79cd13be357-8cb8ca8bf9bmr1547868085a.67.1771961867623; Tue, 24 Feb 2026 11:37:47 -0800 (PST) X-Received: by 2002:a05:620a:4444:b0:8c8:8126:7770 with SMTP id af79cd13be357-8cb8ca8bf9bmr1547864185a.67.1771961867040; Tue, 24 Feb 2026 11:37:47 -0800 (PST) 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-b9084e8cb3fsm458232866b.48.2026.02.24.11.37.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Feb 2026 11:37:46 -0800 (PST) From: Hans de Goede To: libcamera-devel@lists.libcamera.org, Milan Zamazal Cc: Hans de Goede Subject: [PATCH v3 0/4] software_isp: debayer_cpu: Add multi-threading support Date: Tue, 24 Feb 2026 20:37:41 +0100 Message-ID: <20260224193745.106186-1-johannes.goede@oss.qualcomm.com> X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 X-Authority-Analysis: v=2.4 cv=UtFu9uwB c=1 sm=1 tr=0 ts=699dfe0c cx=c_pps a=hnmNkyzTK/kJ09Xio7VxxA==:117 a=xqWC_Br6kY4A:10 a=HzLeVaNsDn8A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=41hSnr9hGZ3gkYn28OYA:9 a=PEH46H7Ffwr30OY-TuGO:22 X-Proofpoint-GUID: VjKi4v_zZmkrhbJc8mDhsVXbEHP8BnC4 X-Proofpoint-ORIG-GUID: VjKi4v_zZmkrhbJc8mDhsVXbEHP8BnC4 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjI0MDE2OCBTYWx0ZWRfX7WiNc3G3k4B8 NS07eP+Olzle8NszaNsCeDY+4nLd7JlMW8S+nOyGqi4Lm+SR0EY6n+F8MERmeF1FKsQmb0BfrWT sT6sNuDrMnbJ2WIZhBP9epjoJJMaS43zGCx+lQG/K/y5Q4mf6j0/Zx+o8w7Vh0EOstsxHgMt+nD jrEcK1OqjImzBaDWUaRG9yDnKuo2EBszTSY2h8zPOkeRvPPb/6DaWg1owIhRR/aExTk0W7FB73o B1tWaAloOmmYfHh2EcjQ0r2ktBCfRvL1+2HwsMTcf0ccq1QIj+guLYfCuB64nknmXU06OZ6SjfL gh0pmioqbXXxr+lK0DsU5p2XxYLWWvCL3LV8gYWLO80nEAYqThx1X+abJGRvOr3gGdVv9ZKfBzq YSdj+EA9CxTYcwvEvYPJ82GDdl/eoDZouCL6KPzpbWJK/vEGGO4sa38H7MKTy7IJFTlc/vHwksH 8cas6sGV/lQVZErJEMA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293, Aquarius:18.0.1121, Hydra:6.1.51, FMLib:17.12.100.49 definitions=2026-02-24_02,2026-02-23_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 spamscore=0 adultscore=0 malwarescore=0 suspectscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2602240168 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, The QCM2290 SoC used on the Arduino Uno-Q seems to have a weak GPU, so weak that it is barely faster then a single CPU core (CPU without CCM). This has made me code-up the long envisioned multi-threading support for the CPU softISP. Changes in v3: - Use std::unique_ptr for the DebayerCpuThread pointers - Document new DebayerCpuThread class - Make DebayerCpuThread inherit from both Thread and Object - Use for (auto &thread : threads_) - Use for (auto &s : stats_) {} - Move input format logging from DebayerCpu::configure() to SoftwareIsp::configure() Changes in v2: - Quite a bit of refactoring based on v1 feedback, dropped patch 3/5 and 4/5 from v2 since these now no longer make sense - Move the allocation of the vector of SwIspStats objects to inside the SwStatsCpu class, controlled by a configure() arguments instead of making the caller allocate the objects - Replace the DebayerCpuThreadData struct from v1 with a DebayerCpuThread class, derived from Object to allow calling invokeMethod for thread re-use in followup patches - As part of this also move a bunch of methods which primarily deal with per thread data: setupInputMemcpy(), shiftLinePointers(), memcpyNextLine(), process*() to the new DebayerCpuThread class - Re-use threads instead of starting new threads every frame - Add a new patch adding some extra DebayerCpu input format logging Benchmark results for the Uno-Q + IMX219 running at 3280x2464 -> 3272x2464 without CCM: 1 thread : 147ms / frame, ~6.5 fps 2 threads: 80ms / frame, ~12.5 fps 3 threads: 65ms / frame, ~15 fps GPU: 130ms / frame, ~7,5 fps GPU 0-copy: 110ms / frame, ~9.5 fps (requires pipeline + camss hacks) GPU lite: 85ms / frame, ~12 fps (CCM, contrast and gamma disabled) Regards, Hans Hans de Goede (4): software_isp: swstats_cpu: Prepare for multi-threading support software_isp: debayer_cpu: Add DebayerCpuThread class software_isp: debayer_cpu: Add multi-threading support software_isp: Log input config from configure() .../internal/software_isp/swstats_cpu.h | 25 +- src/libcamera/software_isp/debayer_cpu.cpp | 283 ++++++++++++++---- src/libcamera/software_isp/debayer_cpu.h | 26 +- src/libcamera/software_isp/software_isp.cpp | 12 +- src/libcamera/software_isp/swstats_cpu.cpp | 54 ++-- 5 files changed, 294 insertions(+), 106 deletions(-)