From patchwork Sat Jan 20 21:14:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elias Naur X-Patchwork-Id: 19420 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 3FC4DBDB1C for ; Sat, 20 Jan 2024 21:15:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8ED9962916; Sat, 20 Jan 2024 22:15:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1705785331; bh=5w8+Ux43VxLY7wW1ujYiyz8fIq2Z9WTQXpq/Q4/cvX0=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Qe+mKceSE0djg9+vSiIpfsr7DSTNMT91PtL45FxiUCunzsCVfIr0qTB595mE6kPhh cHK6RXEr1lqScKccFS0m/g7pawnn4ILBo1P1mw0mPGv3HxpC4SSKtDfINd5TGeIj1m PeNjLOQ1yTl3aRB8uNn2apHcOEuGFc5lYcUQBNsA4vl7sO1pDhQKyTwSNjtgGHZbxq l15RUDrmHkveLTE25iQCDUlDzsXqO0C/LSupFRtd2XM8gJSYLGvDTzB7C0KmqXRi0V StwCNLBuWLRvNs87MHupGLgunlh+SGwPmEC9LHT0ilklyh3Ex3uySjhQoHVHBZIeyG RZu/hiTo4JyEQ== Received: from mail-oa1-x2a.google.com (mail-oa1-x2a.google.com [IPv6:2001:4860:4864:20::2a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EAE5361D41 for ; Sat, 20 Jan 2024 22:15:29 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=eliasnaur.com header.i=@eliasnaur.com header.b="1JVfQCCP"; dkim-atps=neutral Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-2107f19e331so1083784fac.3 for ; Sat, 20 Jan 2024 13:15:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eliasnaur.com; s=google; t=1705785328; x=1706390128; 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=G2Qh4/5taZGzucpEjTWccjVQvAYbubX/HU96THPsdbU=; b=1JVfQCCPuXWKfSWVKKmx0Yi6vdbsNzi56N0c1whO51rp7mLlkp3TMhOYf2MayQ+uFm EB7ZadZ/2HFYblI7UF/QDrezOp7M0TSPz8tVcXMh5fXpQr9QBIA/PIoSlHNNhXz+kaXz tYal1CdfCjRyqcFC3t6RO4D6bS/xtgbaChbPgoUHPv4OTe95J6B1NHmZWQsuQ85ENyAX kEqCd8y3nK0XjwaQtJ2My0Df0BZ1BikGp7Ki5Domnq/PhxWkgeak8PuoT+UK1C6R9coY eMza96vBQpwCKv/b9yQQ1qv4P85KNbget4OnDaG0OFgBSCUAWaRMULQhczk7pcfXsVuL lh2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705785328; x=1706390128; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=G2Qh4/5taZGzucpEjTWccjVQvAYbubX/HU96THPsdbU=; b=KAwL8DKGFasI3xkJNZZtvkxlRPy2FB+Zbt8ltdffGidxjrc9bdjeDyjiGA7YxejHtS ll3Xu1iT1qiJ15Gd8L74RSG23GqavU+tvg/MP8AqyniqHoKNCxacNw7xcaL5/nNeC+og D61Ncvs7yIM95jSNY7NhSj1rs5kV+poxextyen5HWLPEKN7sGDZkpbixt4Jy7kkYuBio tWWOohvFTp0AeVVUbwWJVelBOSa14qKMLt0KiBtCjnwdjjCbRkQ5fqtFrRrCKd9DEUKm Yp1mX/++E4z/NK/2FvOtUrc69M3xuhxh+HIfECFk5NhURKLdz/LV9HTknMRTH/XYfbcl L+Zw== X-Gm-Message-State: AOJu0Ywqi69r9rOCKoaZs8fu8i9Fi2UkTMAk+cNibhtMgYPNMAR9+BEv tM7cKY0LnsahO8wzTf+d0mE0NZyHo5yOyVdIzb4aU+gTLslo8wIjFKCF2lAOuUIHRo/mp/g6g+1 HwQ== X-Google-Smtp-Source: AGHT+IFiLB1dp5BhAgIhD2wOOml9kO0aeMsGL80ReRVk3yz4kFRvd2MKWbR0rzTAbLkr6QAWTuMriw== X-Received: by 2002:a05:6870:56a7:b0:210:8057:6d5b with SMTP id p39-20020a05687056a700b0021080576d5bmr1375548oao.119.1705785327898; Sat, 20 Jan 2024 13:15:27 -0800 (PST) Received: from localhost.localdomain ([189.174.206.139]) by smtp.gmail.com with ESMTPSA id qa12-20020a056871e70c00b00210d2c251cbsm1044294oac.39.2024.01.20.13.15.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Jan 2024 13:15:27 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Sat, 20 Jan 2024 16:14:49 -0500 Message-ID: <20240120211508.14742-1-mail@eliasnaur.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] pipeline: rpi: always initialize the embedded buffer in tryRunPipeline 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: , X-Patchwork-Original-From: Elias Naur via libcamera-devel From: Elias Naur Reply-To: Elias Naur Cc: Elias Naur Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Vc4CameraData::findMatchBuffers may return successfully without setting the embedded buffer. Make sure to initialize the buffer and id to avoid accessing garbage data. Without this change, libcamera v0.2.0 usually crashes with an assertion error: ipa_base.cpp:397 assertion "it != buffers_.end()" failed in prepareIsp() Signed-off-by: Elias Naur Reviewed-by: Naushir Patuck --- src/libcamera/pipeline/rpi/vc4/vc4.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp index 26102ea7..d76389f3 100644 --- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp +++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp @@ -906,7 +906,7 @@ void Vc4CameraData::setCameraTimeout(uint32_t maxFrameLengthMs) void Vc4CameraData::tryRunPipeline() { - FrameBuffer *embeddedBuffer; + FrameBuffer *embeddedBuffer = nullptr; BayerFrame bayerFrame; /* If any of our request or buffer queues are empty, we cannot proceed. */ @@ -945,6 +945,7 @@ void Vc4CameraData::tryRunPipeline() params.requestControls = request->controls(); params.ipaContext = request->sequence(); params.delayContext = bayerFrame.delayContext; + params.buffers.embedded = 0; if (embeddedBuffer) { unsigned int embeddedId = unicam_[Unicam::Embedded].getBufferId(embeddedBuffer);