From patchwork Wed Jul 7 13:40:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 12853 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 C8330BD794 for ; Wed, 7 Jul 2021 13:40:57 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3407768500; Wed, 7 Jul 2021 15:40:57 +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="FDJSiFab"; dkim-atps=neutral Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BD70760284 for ; Wed, 7 Jul 2021 15:40:55 +0200 (CEST) Received: by mail-wr1-x433.google.com with SMTP id t6so3091275wrm.9 for ; Wed, 07 Jul 2021 06:40:55 -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:mime-version :content-transfer-encoding; bh=+WdXorh0TB0kP0yTncn8sk169AUYYS2eQE+0DopgMZM=; b=FDJSiFabmt4SCf2G0vQYmvSz9hcri+NSx9oVrN7D0gi7juOR9vgbdpOV6VDZSn8/A6 10XXsoIUdKJtzDEyH7u3lyZ7MbCwK60m9K7I55Aw+ESGnP5yg4hVhH6uWczwe6Mlm9c1 BDOF/FG0R2U/5JxpLTVRJ7VO1VwWFOzymIWpMd26eZNDziPJ1mUjvtL6pNJsHAB4hzpi +0wrUDyC4kVa213Ll0QbNF3Kw0a7ym6z4976YpC7BoQu5s2b8Y5dpWIT17SeWqAVvK5S VNBU/ZPE37Cxseb7W7kBNxgPv/E5Lv0oyeujIp3GmhlKFXhP2M/p6IsNTOFal0sPWYgo AmGA== 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=+WdXorh0TB0kP0yTncn8sk169AUYYS2eQE+0DopgMZM=; b=NSVXCEI73WOtkGVPyYtBinrt7d3YqnftIigCbPZy8OeC91DMZ+R311Xhzz6IN39ze0 GusiNaUtUFRBMLoIvw3J3KoH6qlscI/DPeZoR/gys/WspfK1RMWqFIBvWA4B0/pAvp1b Ke13sKD382z7EIP7P18ujFCbKsphxY2hrIvQKc+UAUo06o9NhGDFERvlVnjFqFj5UM4F RUrKgWKZNN9gOk6h8Z2Y2h7JrRPQOCQ2GyFV4n3RXL1mbBfHqn2PdrwRvKruGXyC8WNo GeEGN+ttIkVpOCKBq8lYyuloJCkTmFtO/RiDEnTYoVuMfbf3uYbRGCvyMI677zYxiV6Q SpmA== X-Gm-Message-State: AOAM530+Nd4tubicnn9zeSgE+u3d/tCAYFrMGstCl+w8S4YO0h6mKt30 Euz92gLJmmCJJvlIZhU5kUeSOMDMPUiseg== X-Google-Smtp-Source: ABdhPJwLRTHFN0mCZFwmsKYozhfolilDUJxgq9rnUkw/y2m6y3c4mOGvwLrzgaDvpJyVEutL1+d8kg== X-Received: by 2002:adf:a74a:: with SMTP id e10mr27634494wrd.185.1625665255139; Wed, 07 Jul 2021 06:40:55 -0700 (PDT) Received: from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72]) by smtp.gmail.com with ESMTPSA id w22sm6392630wmc.4.2021.07.07.06.40.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 06:40:54 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Wed, 7 Jul 2021 14:40:51 +0100 Message-Id: <20210707134051.2740-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: raspberrypi: Allow the tuning file to be set by an environment variable 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" The configuration (camera tuning) file used by the Raspberry Pi comes by default from the sensor name. However, we now allow this to be overridden by the LIBCAMERA_RPI_TUNING_FILE environment variable. Signed-off-by: David Plowman Reviewed-by: Sebastian Fricke Reviewed-by: Naushir Patuck Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 082eb1ee..a738770a 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1232,8 +1232,18 @@ int RPiCameraData::loadIPA(ipa::RPi::SensorConfig *sensorConfig) ipa_->setIspControls.connect(this, &RPiCameraData::setIspControls); ipa_->setDelayedControls.connect(this, &RPiCameraData::setDelayedControls); - IPASettings settings(ipa_->configurationFile(sensor_->model() + ".json"), - sensor_->model()); + /* + * The configuration (tuning file) is made from the sensor name unless + * the environment variable overrides it. + */ + std::string configurationFile; + char const *configFromEnv = utils::secure_getenv("LIBCAMERA_RPI_TUNING_FILE"); + if (!configFromEnv || *configFromEnv == '\0') + configurationFile = ipa_->configurationFile(sensor_->model() + ".json"); + else + configurationFile = std::string(configFromEnv); + + IPASettings settings(configurationFile, sensor_->model()); return ipa_->init(settings, sensorConfig); }