From patchwork Tue Dec 6 13:54:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17953 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 BAB83BE08B for ; Tue, 6 Dec 2022 13:55:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7883F63352; Tue, 6 Dec 2022 14:55:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1670334918; bh=hPrH8CNehfseOHrZ0daJ77FFnMfBEWPFyMOoWal5a88=; 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=RQj/VU7gJ3IbZbJfylZsS8szrvbv826OVcuH0bGUEzU2L4e1J5q1rm14ISdiNZFua aroJ+ogZQxKlYAiBtWbCXMHsnBQzEnEuMjSWCDlNjiGuqo7h5d1FxuScMG7fl1jBRd F1uOkgVaxt7gcRr8NLLzG8Xjo+jb4LWYsdSZ3DiKaXlYdVibPbLmLUgj2V/nHDtTZT 9EnDDzFKgOP6b8oNQkZWkys1aozLabPrvaqaK2/rNH/ZXXKRq+ZIRvTe5Q7A9fZYi8 ahWi10ibgwYwEgWFe/p15EPvWmti56EN/zanwvXhX2ky2g2SRdrWVWQBsF9Vt1Ljts e2XiTLpnstnTg== Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5A9726334C for ; Tue, 6 Dec 2022 14:55:13 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="qgGzTBmO"; dkim-atps=neutral Received: by mail-wm1-x32b.google.com with SMTP id bg10so11245671wmb.1 for ; Tue, 06 Dec 2022 05:55:13 -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=jEQWUxMvjV8vykabVTIkhCGKopOoqCK5oGxbLTvPt0k=; b=qgGzTBmOc8TeS4wbSSL5loqEfsatIqPuK+OcQTYhhwpDQDJJM6RPk5Ak16z9uCOPrL KR/TDwZs364V0YhgdipEamxNEyj9uKvvW54HcyPXUbB/zE8HoKN0VKmRb1BCNsFRRUK+ f39hPIcXRXvXQqvUJA3z+1mVJDfyow8wmh0xdU4BAoeGUy/mijWHqSBxgVDEPlCUdpgp vg/uBFIo4fXkGc6CLBOE1u4Oviw4tul3Glj4X2znfsHRmF4U6untWhTmTfH+4gzRDGyL Cfyy8wkRhfN/b4rgca76q4+5bAYjaivSu/qGCDf30xWDOn/lORrP/Vpd1wLuZiAhsOXU srMg== 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=jEQWUxMvjV8vykabVTIkhCGKopOoqCK5oGxbLTvPt0k=; b=wzQFIOD54S8Hna5O6GbSJ08FY7zQdTQHvdZSD80mh6OUr8GgKOUA5tHzfSMnULL+b/ /efr5lB0BEcAzVB1na2+PnCnZ6/ohIrAxpKBTOH+5nBKnRfBofLMTdk4p2TlTGJh4/Oj 10rV0+ffSKPOYEIZHDJNffZVLAJEjRYJaMZokmtlEESpofRvs/C6WHCr8cYBjV4TpyKz 36UjKXAksIjeFF+2VkigHZvhh/42yZAO35bq9hWAzCqWZkloNgxgyXJd48+fh96Dgy3l IhQWfkh+5+xYsfOXTLJdT1PCAW23vNLpzg6CoU31d/gBb6Rgvz37MsVcfNr8/aTlP/VF DAcg== X-Gm-Message-State: ANoB5pn7RA3QMES5yMtidlkaEYTV8rQFuvuNQPgbJo5zZe7uLcZDFNtp 5ufl7gWzDQLCXFMhMSpkACi8AAzcNuKairkN X-Google-Smtp-Source: AA0mqf4XmntPBf2M12w4EEAACuMKTyftKXQ1914ayPhZ8KXaf7/wgfVa7PQTFj7YzV2H0YNosYMFKQ== X-Received: by 2002:a05:600c:3ba8:b0:3cf:59c9:4a4e with SMTP id n40-20020a05600c3ba800b003cf59c94a4emr52161844wms.17.1670334912832; Tue, 06 Dec 2022 05:55:12 -0800 (PST) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id q6-20020a05600c2e4600b003c6bd91caa5sm19444059wmf.17.2022.12.06.05.55.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 05:55:12 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Tue, 6 Dec 2022 13:54:56 +0000 Message-Id: <20221206135459.25521-11-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221206135459.25521-1-naush@raspberrypi.com> References: <20221206135459.25521-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 10/13] 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 371610be649a..b18e11bb438f 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1162,6 +1162,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