From patchwork Tue Jul 29 16:20:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 24028 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 A53F8BDC71 for ; Tue, 29 Jul 2025 16:21:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9029D691EE; Tue, 29 Jul 2025 18:21:12 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="uhkJRG4j"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 65F02691E2 for ; Tue, 29 Jul 2025 18:21:10 +0200 (CEST) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 67C106DC; Tue, 29 Jul 2025 18:20:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1753806027; bh=VGJ8FRjG2GM8mo1khvvOrqjQu6tU80nXHPssSsHY1JA=; h=From:To:Cc:Subject:Date:From; b=uhkJRG4jXRojLrE/nxqbgPdYAaFGn+RI356caqKFPVLfUejTR3tG7dIlI1cU3s5lc ysrBe9tR4ix3g5cDtGqaaLPsHfz+HPQ7uF0WcrhxWYTf2amvhT+3l3ryfIRz0y82PI OU9GaZjCSMbujtJlLvLxaNYQjnNSgDuXoR7tyONc= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Cc: Han-Lin Chen , Harvey Yang Subject: [PATCH v2 0/2] libcamera: Introduce and use scope_exit Date: Tue, 29 Jul 2025 19:20:59 +0300 Message-ID: <20250729162101.13836-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.49.1 MIME-Version: 1.0 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" Hello, libcamera includes a ScopeExitActions class that simplifies error handling by gathering cleanup actions for automatic run on scope exit. The mechanism is quite versatile, but is not suitable for hot paths as it requires dynamic heap allocation. This series introduces in patch 1/2 a new simpler scope_exit class that implements the API defined in the C++ library fundamentals TS v3. It does not suffer from the same issue as ScopeExitActions, but is less versatile as a result. Patch 2/2 then uses the new class in V4L2VideoDevice::queueBuffer() to simplify error handling. Laurent Pinchart (2): libcamera: utils: Add scope_exit class libcamera: v4l2_videodevice: Use scope_exit include/libcamera/base/utils.h | 45 ++++++++++++++++++++++++++++++ src/libcamera/v4l2_videodevice.cpp | 11 ++------ 2 files changed, 48 insertions(+), 8 deletions(-) base-commit: 2d5a1367e2b14dab9671270655bbb1702e0826de --- Regards, Laurent Pinchart