From patchwork Tue Oct 5 08:57:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 14052 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 22ED7C3243 for ; Tue, 5 Oct 2021 08:57:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E2EC9691BF; Tue, 5 Oct 2021 10:57:06 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="DU+Rur+J"; dkim-atps=neutral Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 27155691B6 for ; Tue, 5 Oct 2021 10:57:05 +0200 (CEST) Received: by mail-wr1-x42b.google.com with SMTP id t2so12456955wrb.8 for ; Tue, 05 Oct 2021 01:57:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C6Q9gUAT8qKPbSNePbu6j+mP9BRvcQpY0uqUjKZufho=; b=DU+Rur+JNPi+aEbg/tNgrl/VtunmMfe9ucF8jpcxFE+XDkmFivaI/r7n13ZNDdV7rs 3KMR7QQducKdPDz9VCNUPreu7UF49870zyM6Mg7L4OBPdED7GMx363QqooJ+oblNWY+U PUpabha06r+0wnCZvkxm6roNvs+tINQANztpLy+UzeMAgIUzDxctJxPvJciHXWsK5MaZ dtV4T9c2YKJ6pPo1AzXmg6muqgplNRUq5LuBnQHmh92ihPHPcu204Fqk9g+i0rRCCSGL lI9NozaEcP4QltAdQvAkpmQadX2e2V2UpkpP1yfCAc5ozQTB/+Do3y7Co0lxzXqQOJwP LuIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=C6Q9gUAT8qKPbSNePbu6j+mP9BRvcQpY0uqUjKZufho=; b=D3bIRbOEmkBK4Ff/PE+JrEfABdDzIwts6G6id5slebJOJgHFBRnTTnYCG5wXHNb3DI 3ANBBl8aNRJB2ewH42hGjvc86woKxDK2pkVj3W+TP0uS2SM0UYjba6xyOoo9Uf4e/ecX BLmekGZPjid0X7feTaKg4sUezVA6A40V3Xe4eftkz1Nm3mtPQTzu2hJeQ/uyeptVe3mk 9f3bNxDLFj3gXLR0MmCgA2arK3pOwbZdNbgSUHW0Ugpd2LxpfVu7qAYuhG0qgxPXQQb/ XgonWIQxFSPczk+DaVsfCthteyJGdsf1KwDmXoZRK/siQWq6XK6q34XB7d6ssO+4aSWG tkXw== X-Gm-Message-State: AOAM532lOF1YE7uWZf5wEnaw4zoige+CIvySuayglipJM3OQyDX3+AAU j0q28gM3ikyf5skI0lv75hRKrR5NQsbdo3QS X-Google-Smtp-Source: ABdhPJzjx9ffh+nJG7Vyo23heoM5jwcDYya5nqhzYthWuML2B0bYO6swl/VmhT9GZTSgh1EBBYKVhg== X-Received: by 2002:a5d:64e5:: with SMTP id g5mr19688307wri.282.1633424224705; Tue, 05 Oct 2021 01:57:04 -0700 (PDT) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:1ce1:9965:4328:89c4]) by smtp.gmail.com with ESMTPSA id h18sm16508666wrs.75.2021.10.05.01.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 01:57:04 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Tue, 5 Oct 2021 09:57:00 +0100 Message-Id: <20211005085700.16708-2-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211005085700.16708-1-david.plowman@raspberrypi.com> References: <20211005085700.16708-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/1] pipeline: raspberrypi: Create empty control lists correctly 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" When the pipeline handler start() method is supplied with a NULL list of controls, we send an empty control list to the IPA. When the IPA is running in isolated mode the control list goes through the data serializer, for which it must be marked correctly as a list of "controls::controls", otherwise the IPA process will abort. The IPA has a similar problem returning a control list in its configure() method. We must be careful to initialise it properly even when empty. Signed-off-by: David Plowman Reviewed-by: Laurent Pinchart Reviewed-by: Naushir Patuck --- src/ipa/raspberrypi/raspberrypi.cpp | 13 +++++++++---- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 047123ab..fed82e22 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -389,21 +389,26 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo, /* Pass the camera mode to the CamHelper to setup algorithms. */ helper_->SetCameraMode(mode_); + /* + * Initialise this ControlList correctly, even if empty, in case the IPA is + * running is isolation mode (passing the ControlList through the IPC layer). + */ + ControlList ctrls(sensorCtrls_); + if (firstStart_) { /* Supply initial values for frame durations. */ applyFrameDurations(defaultMinFrameDuration, defaultMaxFrameDuration); /* Supply initial values for gain and exposure. */ - ControlList ctrls(sensorCtrls_); AgcStatus agcStatus; agcStatus.shutter_time = defaultExposureTime; agcStatus.analogue_gain = defaultAnalogueGain; applyAGC(&agcStatus, ctrls); - - ASSERT(controls); - *controls = std::move(ctrls); } + ASSERT(controls); + *controls = std::move(ctrls); + return 0; } diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 0bdfa727..1634ca98 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -825,7 +825,8 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls) /* Start the IPA. */ ipa::RPi::StartConfig startConfig; - data->ipa_->start(controls ? *controls : ControlList{}, &startConfig); + data->ipa_->start(controls ? *controls : ControlList{ controls::controls }, + &startConfig); /* Apply any gain/exposure settings that the IPA may have passed back. */ if (!startConfig.controls.empty())