From patchwork Fri Jan 27 15:43:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18209 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 2ABA4C3242 for ; Fri, 27 Jan 2023 15:43:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DE4FB625EE; Fri, 27 Jan 2023 16:43:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1674834229; bh=LHFc9oAT7V0oKglt+dmod6zeVMnswHwmpo6gmQVvMlU=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=s5O9lYkEWT7MJ9T6MU0lxNg1oHhG9/2P8z+DqesmkLlnf6HnQfZc/e1ACc6woYqVe +sfPzkk6SwiUG/BBglK5x8EqvDGQLWA+r+l8k7eSfpAqOtMQHGZ50xMk8EzPFMwc2C w/e2uMfYFKlG+rcs2Cw6rRMwP2IbAd48/O5+3Up4sOyGAnwZsbiSpBRzFlfCtBl0ss GF/ko7D5+HIyeVPvD+HSh5toi2Z+UUhfZe2Ujbr3sMqRtlvJsjDPfGGMKvCI0gSABX TKBjS+ngQmqgRMIVlQklQEoS2Kncyp0kEJevp+KWiCyvsb+QZeOLNbWdpbDvFOUAlo DoAAXGbbUpzJg== Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 42B0B625DD for ; Fri, 27 Jan 2023 16:43:41 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="YOLrR94L"; dkim-atps=neutral Received: by mail-wm1-x329.google.com with SMTP id j17so3774991wms.0 for ; Fri, 27 Jan 2023 07:43:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U/rJVWuxNB0Zl6v7nsB+2X3RSr+G8CnS+bjX1/c2Tvo=; b=YOLrR94LzwutjpenSznjrAr3gJNv4SRhq5W4roa6jMv8wSwZODxzuyep0z7dKPGnJV fwBteb4Q4xvGqWQ5Ye71SgzPnItpJ+BDA5YIfG4SrLkU7tJnEl3b2w9T+qo1PlyLc4r6 l2nnXQSjww5fkAMgwP4ItHVLzFWf2j6hrQcGehwoZczfatuM3PHu3sltvKDUoJfQ1dNC u9PI0+LAvhZt8uVqquO7r/HMmciJypkfqwcd8RK2SXQCqvCWcguN/qdSHmnZep1GpI3Y zaS9DnJ+eIYmbBs7qWzhntx6qPAPq6TYtbBfzySKpwhnm2PYSCHyHWZiGRCEtMNFFrR5 P3og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U/rJVWuxNB0Zl6v7nsB+2X3RSr+G8CnS+bjX1/c2Tvo=; b=rFydXtBkc4IEkqzcqjdS8cBDMVBxG/9rX+nsxRVcOBDfS3dbvtAKCp+LEaJ6WfRKiN T4btHUsGemv13OcfD85d+6KQZDW7bgnTQhoRrQ5M2Bl+TRX2EqUDuAegq/95/3EmxOUq Lw+eZbBMI+mhX6fMpGB8HoKbncorPP7DGEhuMZPbHlqNTmVkqZvl7hBQXLGfZYvsDvRr ghKwe1jFLB68BaAPMtTittERsdL9+4aU8b/aa0io0vVilQm2iXgHuiC/jTw7c/LPU47L zV6YGnc6UWjRmus+vSBFpQiI9UtQjFrMf0+8RIg1hj2wvZYlT58MH/RjMwNt8cb8/zP8 jU8g== X-Gm-Message-State: AO0yUKUZD+CDqoQOVMLJ+fglYkIdcQyInMy+/8B51qgDNykQX31Tsujn YFrAl5isiIuHRcl7wa9TPXhcFtHL1Zi7XO3zekY= X-Google-Smtp-Source: AK7set8nLi4fhMrRK0oEdaCqIyF7DOEBWdYbiluWeituViYIF/izskLhL49HqvlAyN0O8zqCgGQs9w== X-Received: by 2002:a05:600c:314d:b0:3dc:2039:1710 with SMTP id h13-20020a05600c314d00b003dc20391710mr9820047wmo.20.1674834220780; Fri, 27 Jan 2023 07:43:40 -0800 (PST) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id h18-20020a05600c30d200b003c21ba7d7d6sm4549566wmn.44.2023.01.27.07.43.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jan 2023 07:43:40 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Fri, 27 Jan 2023 15:43:16 +0000 Message-Id: <20230127154322.29019-10-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127154322.29019-1-naush@raspberrypi.com> References: <20230127154322.29019-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 09/15] libcamera: camera: Validate MandatoryStream in queueRequest() 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: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add some validation in queueRequest() to ensure that a frame buffer is provided in a Request if the MandatoryStream flag has been set in the StreamConfiguration for every active stream. Signed-off-by: Naushir Patuck --- src/libcamera/camera.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 2d947a442bff..b0b0a5cb5bb3 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -1144,6 +1144,18 @@ int Camera::queueRequest(Request *request) } } + for (auto const stream : d->activeStreams_) { + const StreamConfiguration &config = stream->configuration(); + FrameBuffer *buffer = request->findBuffer(stream); + + if (!buffer && config.hints & StreamConfiguration::Hint::MandatoryStream) { + LOG(Camera, Error) + << "No buffer provided for mandatory stream"; + request->_d()->reset(); + return -ENOMEM; + } + } + d->pipe_->invokeMethod(&PipelineHandler::queueRequest, ConnectionTypeQueued, request);