{"id":10514,"url":"https://patchwork.libcamera.org/api/1.1/patches/10514/?format=json","web_url":"https://patchwork.libcamera.org/patch/10514/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20201127133031.1103686-1-naush@raspberrypi.com>","date":"2020-11-27T13:30:31","name":"[libcamera-devel] pipeline: ipa: raspberrypi: Handle failures during IPA configuration","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"e60eec081ffceb2c17f4e142460968275a564077","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/10514/mbox/","series":[{"id":1486,"url":"https://patchwork.libcamera.org/api/1.1/series/1486/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1486","date":"2020-11-27T13:30:31","name":"[libcamera-devel] pipeline: ipa: raspberrypi: Handle failures during IPA configuration","version":1,"mbox":"https://patchwork.libcamera.org/series/1486/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10514/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10514/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 61C2FBE08A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 Nov 2020 13:30:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E8A256346E;\n\tFri, 27 Nov 2020 14:30:37 +0100 (CET)","from mail-wm1-x334.google.com (mail-wm1-x334.google.com\n\t[IPv6:2a00:1450:4864:20::334])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 987A9632EE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Nov 2020 14:30:36 +0100 (CET)","by mail-wm1-x334.google.com with SMTP id h21so6531686wmb.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Nov 2020 05:30:36 -0800 (PST)","from naushir-VirtualBox.pitowers.org\n\t([2a00:1098:3142:14:a00:27ff:fe4d:f6a2])\n\tby smtp.gmail.com with ESMTPSA id\n\tc17sm15156773wro.19.2020.11.27.05.30.34\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 27 Nov 2020 05:30:34 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"IgdzUavi\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=c5u+7kK7gaL3YrmjBIpJG4sIyhM9GSoffX8wgpE3mBc=;\n\tb=IgdzUavisqHfhtsCimIuwbvQfDT6x7VXkdf7y38NH+vi5RQsP2Eq098lud+NhbTso5\n\tPMRWx+HAh/AIH34FWky0oLstULGdjY5F187muBORQcs6JT89l7I+csV4UnodhEoZ/Uch\n\tQAZfwiK1VSFWbVP0YYej0aBqNOdQBCC4rnbTPp+CZkPq1GyyMS2DZccqt8qShR6E1Z9c\n\tkA/vuBn1EmXnKRFpZ2tZlpoq7BJcCwg603mcd/wrNVx8gQg8kW0EXCOaLUX/bNSwMz8C\n\t/d2sLCmSJWMfvWPz8OpFhLIPvdJRwc1T5e2RjZDaRn3CDM3UIPmFC/mngStK14+OVGur\n\t3O+g==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=c5u+7kK7gaL3YrmjBIpJG4sIyhM9GSoffX8wgpE3mBc=;\n\tb=oix3ELfUzKUNUkAlpYRebJK3VyAgtgU9z+BGGFP2cDJ3sb8xyDjKLI1r8cV5cWzg2Y\n\t25ztCt5CH112HjGoFIVJ96CzEU/9Gu29IIGx+nWF73X9kicOZ4KeAXbqDdhjvPMjUuZy\n\t1T9dN4RMLwbwZInLVMTv8BpN7vsiYOsVdWRTikNNtTNPE2kU56kVpIJZbfMmMNGLO7Ty\n\tVlsPdkF1wOdy1Btp5jYTV1VW4Vf55lVu7C8V3ZiRypkpqhyXBIKBpg5apiUSFKRrjA9R\n\tu3vLV4Bpcqzc8DGUc9mW8AiWzR5dIQ1nnUMQq09svKZtzf3qDY/rH2OorbEB87hbCTaX\n\t434w==","X-Gm-Message-State":"AOAM530YSb6A/gmYy6htVHa2uzBu6RThG2/5OLFVDVXUFKHrPJsjgsu0\n\tea/DqF61EvmfosCW6OR4Ugio0+sK93Qb4g==","X-Google-Smtp-Source":"ABdhPJzyn9FSwPRQhYGR0BObGTP/L7fXd4GVzeEeYDr6GrG1/I/bQGLxZZN2gRr8T43EJpiooPu0YA==","X-Received":"by 2002:a1c:1b85:: with SMTP id\n\tb127mr9020848wmb.163.1606483835927; \n\tFri, 27 Nov 2020 05:30:35 -0800 (PST)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 27 Nov 2020 13:30:31 +0000","Message-Id":"<20201127133031.1103686-1-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH] pipeline: ipa: raspberrypi: Handle\n\tfailures during IPA configuration","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"If the IPA fails during configuration, return an error flag to the\npipeline handler and fail the use case gracefully.\n\nAt preset, the IPA configuration can fail for the following reasons:\n- The sensor is not recognised, and fails to open a CamHelper object.\n- The pipeline handler did not pass in controls for the ISP and sensor.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n include/libcamera/ipa/raspberrypi.h              |  1 +\n src/ipa/raspberrypi/raspberrypi.cpp              | 16 ++++++++++++++--\n .../pipeline/raspberrypi/raspberrypi.cpp         |  5 +++++\n 3 files changed, 20 insertions(+), 2 deletions(-)","diff":"diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h\nindex 2b55dbfc..86c97ffa 100644\n--- a/include/libcamera/ipa/raspberrypi.h\n+++ b/include/libcamera/ipa/raspberrypi.h\n@@ -21,6 +21,7 @@ enum ConfigParameters {\n \tIPA_CONFIG_STAGGERED_WRITE = (1 << 1),\n \tIPA_CONFIG_SENSOR = (1 << 2),\n \tIPA_CONFIG_DROP_FRAMES = (1 << 3),\n+\tIPA_CONFIG_FAILED = (1 << 4),\n };\n \n enum Operations {\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 9853a343..7542dd26 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -197,8 +197,14 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,\n \t\t       const IPAOperationData &ipaConfig,\n \t\t       IPAOperationData *result)\n {\n-\tif (entityControls.empty())\n+\tstd::string cameraName(sensorInfo.model);\n+\n+\tif (entityControls.size() != 2) {\n+\t\tLOG(IPARPI, Error) << \"No ISP or sensor controls found for \"\n+\t\t\t\t   << cameraName;\n+\t\tresult->operation = RPi::IPA_CONFIG_FAILED;\n \t\treturn;\n+\t}\n \n \tresult->operation = 0;\n \n@@ -213,10 +219,16 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,\n \t * that the kernel driver doesn't. We only do this the first time; we don't need\n \t * to re-parse the metadata after a simple mode-switch for no reason.\n \t */\n-\tstd::string cameraName(sensorInfo.model);\n \tif (!helper_) {\n \t\thelper_ = std::unique_ptr<RPiController::CamHelper>(RPiController::CamHelper::Create(cameraName));\n \n+\t\tif (!helper_) {\n+\t\t\tLOG(IPARPI, Error) << \"Could not create camera helper for \"\n+\t\t\t\t\t   << cameraName;\n+\t\t\tresult->operation = RPi::IPA_CONFIG_FAILED;\n+\t\t\treturn;\n+\t\t}\n+\n \t\t/*\n \t\t * Pass out the sensor config to the pipeline handler in order\n \t\t * to setup the staggered writer class.\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex 6fcdf557..76252806 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1194,6 +1194,11 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config)\n \tipa_->configure(sensorInfo_, streamConfig, entityControls, ipaConfig,\n \t\t\t&result);\n \n+\tif (result.operation & RPi::IPA_CONFIG_FAILED) {\n+\t\tLOG(RPI, Error) << \"IPA configuration failed!\";\n+\t\treturn -EPIPE;\n+\t}\n+\n \tunsigned int resultIdx = 0;\n \tif (result.operation & RPi::IPA_CONFIG_STAGGERED_WRITE) {\n \t\t/*\n","prefixes":["libcamera-devel"]}