From patchwork Fri Nov 27 14:56:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 10520 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 65D61BE177 for ; Fri, 27 Nov 2020 14:56:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 33D2F6346E; Fri, 27 Nov 2020 15:56:19 +0100 (CET) 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="LtMb56+Z"; dkim-atps=neutral Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D2B6B630BB for ; Fri, 27 Nov 2020 15:56:17 +0100 (CET) Received: by mail-wr1-x435.google.com with SMTP id 23so5872315wrc.8 for ; Fri, 27 Nov 2020 06:56:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/DDJFCQc/TOkOsBjf6PBUSTKdArqBZ/Cd/CX/f9vj3M=; b=LtMb56+ZBl4W7KeZ851KxNTCuMOJ3gVaRWsgLohFQTJBh1tdDGnc7/WYV1j2VPZeyJ d8jowuXl8t8UcbWtyUms4upP4X/OgspP6SmWjPOyinOET7OxUoXY7abcw8E14oE4OuaH qqmaCoEDlxRPL1Yw8i3OYTHoH3iPGdLUJt/dz+K3ABjaF+zm792n4WW9Yf50sIUJoe5/ KckQ7/3d91QqibubphMnO1dudwCbiHd1sK+wIiVodhfulXORwGeXiceDuiRyl9Tv2paJ 5MQdehsK8sTtObr8TcS4srSqTjlMmF1Px/5Y/k8fGbI9Q4I4IQeRNy6kruKzGmd2ZmgM 0w3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/DDJFCQc/TOkOsBjf6PBUSTKdArqBZ/Cd/CX/f9vj3M=; b=MRKGAGgeFII8Gng/a7lNG4DWDE9VPIfGN6lwhGv9l/wSt0Dj11zfAJg4klcVtGPJad UW6OwLZfwrVIH2IULcZKqNCyN8Xfh4bWv65JrnxKTRxRhtR/CKSxK2m1Ais1sdfpWXFT M5PXQddekXWcq0s5GJ+16Fm+fZEstn/8SSU/tp4txz/cGcGJllTc7KNQVMqMMrB+GJjb S9mELNDoxvRHG4h9HAaDz/f/HC/uexOI1KGTUeV3pVuMMz+hoTjcCGLsVP7vc+UyKdtf OH+VXZl3++ZQUqvIbYkMZT5ylPfVcFpK5vGablkqNga3TbPIV3Ci5Qq0y+Foa1k5G0yq MiZA== X-Gm-Message-State: AOAM532TUudbtzamrTeoTGds/PM9mb0Bymu1p2d0/PbX1sMvv3HRbjxP qwZfxETO09dXSxw1ozcHAtyK8K/kKogQRg== X-Google-Smtp-Source: ABdhPJybF2x0NSVzd7pqQSw+tBLBTiZOtUqPTB+nnObeQGM9YIBh9/WC9VD/rlFfk/t/hzOGLFiFmg== X-Received: by 2002:a5d:4c4a:: with SMTP id n10mr11161732wrt.54.1606488977276; Fri, 27 Nov 2020 06:56:17 -0800 (PST) Received: from naushir-VirtualBox.pitowers.org ([2a00:1098:3142:14:a00:27ff:fe4d:f6a2]) by smtp.gmail.com with ESMTPSA id f16sm13121126wmh.7.2020.11.27.06.56.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Nov 2020 06:56:16 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 27 Nov 2020 14:56:12 +0000 Message-Id: <20201127145612.1105770-1-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2] pipeline: ipa: raspberrypi: Handle failures during IPA configuration 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" If the IPA fails during configuration, return an error flag to the pipeline handler and fail the use case gracefully. At present, the IPA configuration can fail for the following reasons: - The sensor is not recognised, and fails to open a CamHelper object. - The pipeline handler did not pass in controls for the ISP and sensor. Signed-off-by: Naushir Patuck Reviewed-by: Jacopo Mondi Reviewed-by: Paul Elder --- include/libcamera/ipa/raspberrypi.h | 1 + src/ipa/raspberrypi/raspberrypi.cpp | 12 +++++++++++- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h index 2b55dbfc..86c97ffa 100644 --- a/include/libcamera/ipa/raspberrypi.h +++ b/include/libcamera/ipa/raspberrypi.h @@ -21,6 +21,7 @@ enum ConfigParameters { IPA_CONFIG_STAGGERED_WRITE = (1 << 1), IPA_CONFIG_SENSOR = (1 << 2), IPA_CONFIG_DROP_FRAMES = (1 << 3), + IPA_CONFIG_FAILED = (1 << 4), }; enum Operations { diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 9853a343..57dd9c61 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -197,8 +197,11 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, const IPAOperationData &ipaConfig, IPAOperationData *result) { - if (entityControls.empty()) + if (entityControls.size() != 2) { + LOG(IPARPI, Error) << "No ISP or sensor controls found."; + result->operation = RPi::IPA_CONFIG_FAILED; return; + } result->operation = 0; @@ -217,6 +220,13 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, if (!helper_) { helper_ = std::unique_ptr(RPiController::CamHelper::Create(cameraName)); + if (!helper_) { + LOG(IPARPI, Error) << "Could not create camera helper for " + << cameraName; + result->operation = RPi::IPA_CONFIG_FAILED; + return; + } + /* * Pass out the sensor config to the pipeline handler in order * to setup the staggered writer class. diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 6fcdf557..76252806 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1194,6 +1194,11 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) ipa_->configure(sensorInfo_, streamConfig, entityControls, ipaConfig, &result); + if (result.operation & RPi::IPA_CONFIG_FAILED) { + LOG(RPI, Error) << "IPA configuration failed!"; + return -EPIPE; + } + unsigned int resultIdx = 0; if (result.operation & RPi::IPA_CONFIG_STAGGERED_WRITE) { /*