From patchwork Fri Dec 9 09:00:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17973 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 0C936BDE6B for ; Fri, 9 Dec 2022 09:01:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AFEFB63364; Fri, 9 Dec 2022 10:01:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1670576501; bh=d7Qi8omVLjX6Hj2aZtGXJjcZEqUCQWLP8qUpHRkfNM4=; 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=p53K+Hqlgf1fdN1CSm7INzZumBHkcZiVhk8OIoLwFPRKSk3FvczI8JPAwRBTc0Cgw Z8gvIucbeWxCiv+ca7LwD5eEnxr6NqwvBfOFq9iJDcoPrdGiNsurn2ff6xNMxibgjo uGO3E9TcXDFqYw5qPtW0o0woUfwPERIGZvf2wFUuWA4S58HUZAnJeukYnuy4M2wKZm 7/++NYGW99m/mODMhfaa9h7YF6Ocn6fDHrcXDW2oonPEuZvkU3M8MKfbesqfjWecBc prIjY0m3bxcCnfSAOuCm6NCSzTTM+9blPLKxMI5BrHb0/zcBoMozbHQ0JHdGnWhg96 HQS545F1RrGPA== Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CD1BB63360 for ; Fri, 9 Dec 2022 10:01:35 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="WF1L/nOS"; dkim-atps=neutral Received: by mail-wm1-x331.google.com with SMTP id f13-20020a1cc90d000000b003d08c4cf679so2904970wmb.5 for ; Fri, 09 Dec 2022 01:01:35 -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=rCI8A1BvcyB6cCko9jaDzabqfodtnUyq6LuLmTxg2ik=; b=WF1L/nOSSIYSL0W2C+M8Tgc8zrdLhmHEP51n25hTbPn/KlhLfrJcJFUYNC8Jn3hks3 f8Be6WJC63e7pD8o0JOcnBEduJ59aJrlLzRImfXmXw1+yK8cEwMx9zUZ9XosoOK/S1TR tqjenMSDT3yAX2r1eQ3xOMaMzbu6F9q9ViYAJ2S0E59Y52q7FYPS6w1hfNERhDcLPisO hv6b2ScpfzhrFbZUZYHUD8dnAn949nNrcr1N78dcAkuNvBXnx9F7wdEQHJFzcpeYQTX5 bdmBJ9f2znCceatcTrKjbZpX5HOHQA6V98OtSsuoPFNqiPZ2X6QUShCml1ZTGCr6UmNk qqsw== 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=rCI8A1BvcyB6cCko9jaDzabqfodtnUyq6LuLmTxg2ik=; b=fRXczBZ5fIEoC+Ui/qCn2i4vLbE0rDKMktNJwCHL+aLZYWmjCW4JqR3eIxFC/ylmy7 NN//iU8EvyzImTFNrTnwZ/q94yWPTA2GnQ8FrC4+NdUt26cig2uviXY962o76RoNclao 9lVjuVaCXul1dwsZhQWSxxA4/IosE19eXGy2TXR+E57OZRtL1YysEVLEGmusLrXfqPCj Z733YlSohSqSlLKBWBDNYqa4LiA4PhiFUF7LBbAgXbwlnaxoRjvfs4cf22J6NW97R/Up 9XkjwDSSuvkvMBQ8dNolVnmmXlX4If8JILi7n9N/sVs0UF0zpjwo6l+eASQZo73IVmwS 4Cdg== X-Gm-Message-State: ANoB5pkv7aH5RE7t8zmyCeuzGBX1XhYQT2DLAI39FiyybqZ73dL6DPAW eUKjta2AslYZuGm63kokdRkCIuTv6x/37OS1 X-Google-Smtp-Source: AA0mqf6ApOc7NMiGg2UsNq6zJCf6mbUhmFi/7vgxJX6NrCVyYay3L6TOqybpTH5OtLM3K2Bvpb6ggw== X-Received: by 2002:a1c:cc1a:0:b0:3cf:5583:8b3f with SMTP id h26-20020a1ccc1a000000b003cf55838b3fmr4421669wmb.20.1670576495241; Fri, 09 Dec 2022 01:01:35 -0800 (PST) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id bd10-20020a05600c1f0a00b003cf774c31a0sm7773674wmb.16.2022.12.09.01.01.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 01:01:34 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Fri, 9 Dec 2022 09:00:47 +0000 Message-Id: <20221209090050.19441-10-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221209090050.19441-1-naush@raspberrypi.com> References: <20221209090050.19441-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 09/12] pipeline: raspberrypi: Validate MandatoryRequestBuffer in queueRequestDevice() 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 queueRequestDevice() to ensure that a frame buffer is provided in a Request if the MandatoryRequestBuffer flag has been set in the StreamConfiguration for every configured stream. Signed-off-by: Naushir Patuck --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 45e66839efb9..2c2b79fa021d 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1152,6 +1152,14 @@ int PipelineHandlerRPi::queueRequestDevice(Camera *camera, Request *request) stream->setExternalBuffer(buffer); } + if (!buffer && (stream->configuration().hints & + StreamConfiguration::Hint::MandatoryRequestBuffer)) { + LOG(RPI, Error) << "MandatoryRequestBuffer hint set for stream " + << stream->name() + << ", but no request buffer provided"; + return -EINVAL; + } + /* * If no buffer is provided by the request for this stream, we * queue a nullptr to the stream to signify that it must use an