From patchwork Fri Feb 3 09:44:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18249 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 5E2DCC323E for ; Fri, 3 Feb 2023 09:44:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 19497625EC; Fri, 3 Feb 2023 10:44:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1675417474; bh=e22OhAuSZ6QaESVtJ12ytzqvo4NrIJzbJGLoYQg+cPE=; 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=Qdyoumh0N3Loe78jjRvTMeBdCxGSe7za/fUBAXMZkbuGSIr4fbtuhMNuYFOhWKBvo SUonlvn31u+A1KQp/pKobU21VIRMsLkCwxDVFYvU/ptAYkqA5o4rfIo9gGwOoOeSXa TyLbCd/a+L1RRn+tcv4zG0yIpTBHWUsH2bqpkl/VieK8wkBB6XMpdv/Pu4H3rr6rrm XaRJF95GYekbAteAPWDk/dC+X2jGxi9xxWQ1xnmo9sTnK6Sl//M/8IG9xcPb48caRV 5TO/3oqAZQeI5OjFLD24J6vYKuNTyFn42sBXoNW1a9Sve5FoCW3kutYcJiyJgNaMKP mCkEEZdOKksug== Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 659ED625E8 for ; Fri, 3 Feb 2023 10:44:30 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="ZsuqgAtW"; dkim-atps=neutral Received: by mail-wr1-x429.google.com with SMTP id y1so4119786wru.2 for ; Fri, 03 Feb 2023 01:44:30 -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=CGZwAAnS7t1YLpDptrdLrTgq6Xa1I7+cWVR6KStCMIA=; b=ZsuqgAtW4Xsm0KdKbXJhY64IVZZJpx+MOsUxXJV5IFIwl64oWep2kIWlNPEQTe2fpS 4RHvjXJTPTHocLpLtqGMr49GJ1gtrdpr7jaaMVMZ/GEy4z1YaP8cvu3iVctqvT8eSYhf IfD83tAKlRM9m5TJcgYPAQ1Egt82eB/1+bxF7lK9LAaptMw0oLfptxn0PgOF+gkNjeyo yoMVEFqmQnOaxcW4gXi+PEUum02k92vxp8Z06nUEoVB/3ZenBVIAvEyDivJRndl9my30 4W5e1Nwo4KYg3BeSTjFXuCVezwEH8/9I/tXjqkdKUIhQI/137KAsA1Hy46lUmoNZ/LXk 1J0Q== 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=CGZwAAnS7t1YLpDptrdLrTgq6Xa1I7+cWVR6KStCMIA=; b=n7z9l4Ga/t7x1Nclumk/IlOnKACLPINYzzF5I2zkvXrSWlnic9Rgtep4Q+a/e/31ge z8Dju4WcdZCnNujeMawRwgMYR/eqZTzTF2kJFsCNHx0BFcI0r2mXBIGrZXzq38r1+tgT 31wdDZxIWeCa+6msCmxsaGpIMk+lNqoKvZa0LrU788HgdSJAJAdIvXcaCB3122EsduTu pveVHRHg7TZ33AYVaeUSK6b/2Qtfg83nt83bhssLy7k4qSjE1/KcsfqyB3nNnc7PGI9+ f8CNetvfLdx1BbZ/L6VoyLe+uBRPV9en8ycK5e5HboGu/nRr/NUc8gndrM8LECG5XGi1 AmMg== X-Gm-Message-State: AO0yUKUt6EB7lEoAPrTM9M26nhtk5wtWaKn/Mlx47QUl7fDDlEVYqA0k oQljC+hyvrUhBRDX3ypzja6WoO048mwA4SxhX4HiyQ== X-Google-Smtp-Source: AK7set8kEEqjGGc2jkZs7WeGuKpJSDSkKgR/3isVn1h3pJDHP/Pf7h+tJxRLQM9s3oqROupjp0roNA== X-Received: by 2002:a05:6000:18cd:b0:2c3:da85:ad7e with SMTP id w13-20020a05600018cd00b002c3da85ad7emr361409wrq.36.1675417469708; Fri, 03 Feb 2023 01:44:29 -0800 (PST) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id f17-20020a5d50d1000000b002bfe266d710sm1562503wrt.90.2023.02.03.01.44.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 01:44:29 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Feb 2023 09:44:20 +0000 Message-Id: <20230203094424.25243-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230203094424.25243-1-naush@raspberrypi.com> References: <20230203094424.25243-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 4/8] 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 0da167a7bc51..c0a368c1e66c 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -1146,6 +1146,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);