From patchwork Mon May 23 09:24:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Sylvestre X-Patchwork-Id: 16001 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 617EFBD160 for ; Mon, 23 May 2022 09:24:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1586A65665; Mon, 23 May 2022 11:24:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1653297887; bh=cUEB+NwwZLYKyjLZOzZxvMQapwWS39paO/S54zNivfg=; 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=tGKrBJIKZ9bEsT0mB9EyVthoHpm90eUgii4MKDytJ7Koi7JhFEWw4FvSljbCZQX/Y o5yg55kybGjxITag7akNbOXyR5nIcZh1wIiWBknS+lrGD46YiNj+iS0IHkKn19nyyM XJiholTPIyOq+lCQW85ZvF07LPqPaD0pm9hBIJgQamFfuYsIKq779kx7VGHzs3dwVF q0K4n8eJkUpoHpKxGuSsHNc20J4TDVVHK14/xObLSQivyk6ho15DLx8LZZAB6Eaa9F tyahbIepatsuNATVWru0m4bSyQX7hxNeus8V3C/WDxnC2JFM6srYu+yIxXP3vhgSoG b6wH4apbJL8LQ== 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 04E4A6565E for ; Mon, 23 May 2022 11:24:45 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="AMINoZDi"; dkim-atps=neutral Received: by mail-wr1-x435.google.com with SMTP id h14so20424211wrc.6 for ; Mon, 23 May 2022 02:24:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=c87SE8ICoMPP/SKr7cW6b2KTo2OKSmdf4bbsdFw7VKQ=; b=AMINoZDifmeUtxSJyk5XyPShUHIn2kgihOMb0AxQxpJ1xP7LVaovODx7GXuKCdXkBZ DmddGjWnr1F6mgTgLXlckXpAL6g5+jTydGRs/NI9DcrDbId//8e2Z721lN/XNmiHWuVw qlJUnLoueHG9sEWEYOvffUU47jRh8rFL40wVFc+ykCrwT2eOkjzPFSPhRARA63HDVYSg tAQknMMBOjcNkPkIUlYFVpRH7KH/rW1QpfaddwxnihGbnkkDYXtr/YYw5ssdx6iRafKT pWveHlvizAQpZVxVV213yRWvXgSFIWDQEDZ44yStem2vftKcbykZleVVI22vFwhM2sDI PG4A== 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=c87SE8ICoMPP/SKr7cW6b2KTo2OKSmdf4bbsdFw7VKQ=; b=i1GRHSHj9mquxojTbcKPqJNu4m4P+bXkjnliPY8XxGAHL1oUifaHptvLoxeZPljRcd KW0iTegdlstbn/RMiA/a1s9wwCQ8PwIjrLxV7Xuq4JkN5kkULrz+KL3mSOnnu53U6t7G SFGSf8LLZuhVLZ69d6slaO/7jcVHoQpQ6gGzBnErWQ42CgFUM37LZzkYfBoGQBXoK1wS oGWR1U+nrzxbvBCyhPFnaue2rITnKbqfY8a+4n4EFiSHG3YvOQQMBtlsUxBP9WyNWCVP xgQlfk/XAWeRuc/YDEGAqN2NkAJoWxor7k+22TRIE+YDYdyr2fFpeMQENf6UqBT2p7R9 Leeg== X-Gm-Message-State: AOAM533kny7t+Nk9djAnPHHJryYdk+CCMlzq87n434aUhu1Fi1rQo8Iv 1ob8NCEI3+WCZdNFP8MSWoejVN6/d5uhYg== X-Google-Smtp-Source: ABdhPJxSXAq8EDVhF5k8Hj4OFcdR079KOc+sg0GZXB1LICqfdA4NnFlMsjfk6CgT8sqDGudaGm0TMA== X-Received: by 2002:a5d:4a82:0:b0:20d:3b9:740e with SMTP id o2-20020a5d4a82000000b0020d03b9740emr17725049wrq.718.1653297884534; Mon, 23 May 2022 02:24:44 -0700 (PDT) Received: from BL087.. ([2a01:e34:eea9:e630:1bc6:bcdb:60b7:f1d3]) by smtp.gmail.com with ESMTPSA id w22-20020a1cf616000000b003942a244eebsm8034250wmc.48.2022.05.23.02.24.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 02:24:44 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 23 May 2022 11:24:31 +0200 Message-Id: <20220523092435.475510-2-fsylvestre@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523092435.475510-1-fsylvestre@baylibre.com> References: <20220523092435.475510-1-fsylvestre@baylibre.com> MIME-Version: 1.0 Subject: [libcamera-devel] [libcamera-devel 1/5] pipeline: rkisp1: Support sensor tuning file 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: Florian Sylvestre via libcamera-devel From: Florian Sylvestre Reply-To: Florian Sylvestre Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Allow the usage of a Yaml configuration file that is either defined by the sensor name (sensor_name.yaml) or defined by LIBCAMERA_RKISP1_TUNING_FILE environment variable. Signed-off-by: Florian Sylvestre Reviewed-by: Laurent Pinchart Reviewed-by: Paul Elder --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 4b3d2cf7..865c4ab0 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -322,7 +322,18 @@ int RkISP1CameraData::loadIPA(unsigned int hwRevision) ipa_->paramsBufferReady.connect(this, &RkISP1CameraData::paramFilled); ipa_->metadataReady.connect(this, &RkISP1CameraData::metadataReady); - int ret = ipa_->init(IPASettings{ "", sensor_->model() }, hwRevision); + /* + * 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_RKISP1_TUNING_FILE"); + if (!configFromEnv || *configFromEnv == '\0') + configurationFile = ipa_->configurationFile(sensor_->model() + ".yaml"); + else + configurationFile = std::string(configFromEnv); + + int ret = ipa_->init({ configurationFile, sensor_->model() }, hwRevision); if (ret < 0) { LOG(RkISP1, Error) << "IPA initialization failure"; return ret;