From patchwork Wed Jul 13 08:43:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Semkowicz X-Patchwork-Id: 16604 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 1E749BE173 for ; Wed, 13 Jul 2022 08:43:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E03E963323; Wed, 13 Jul 2022 10:43:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1657701825; bh=8AicMXYKV9hDctL83gvVRZlocz4NCdSpDdvYqi6X+ME=; 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=dklFeEKztKqrOdBJHuRuecmQwQmKdWNueGdmOJUf2p4NEAqqoc07vue+aE6wI4aIf 0ecEJFXpfgMbrVNRParB+V0y8h4BFj0IvFM/4N8MQw08aYkh0LiJ7YxrbfpHidreEi o8oHO4/xw+fwcJAzm4Qj3ysN1LhQmTRDCGPfopfLqOTLZW/xfVBSWo7gGCxcLYxdMC HVaRxxy457aHWlDqFKCdYsa/zQmAOQK7cCl1D0R2gBekky6WFmmQkk5tZr7plu5Pli 5kVOAwV/jGEk9OzJuQehglqj1bb0zXKsnPq+pkNjf6QFgD3ytHMRghov61Mq0NJkrz vj/76yMeOfysA== 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 A33B563318 for ; Wed, 13 Jul 2022 10:43:43 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=thaumatec-com.20210112.gappssmtp.com header.i=@thaumatec-com.20210112.gappssmtp.com header.b="Tu2QM8ly"; dkim-atps=neutral Received: by mail-wr1-x435.google.com with SMTP id q9so14475108wrd.8 for ; Wed, 13 Jul 2022 01:43:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thaumatec-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WLYgX0MOK5dxYWvj13HoLuJzqbo6TzjvgYk9MSezfsA=; b=Tu2QM8lym7p8bbY1fZl1QbWNKiUPncK9+P5Q1GKAcIIAsnIMs1B5DIyDviN0MuniEP vgEg0z6pLH2I/BnXftvMGVD3gcRqgOuhi/jBo8R2EMQyfIulXXeL3HmBr0WVf8HwhsBX ho/aJK53aE4Xi7OrXPNwwJYUYOG3+4nvM97GrjFcudRthxz1gqJunjo43jNBu/EDUcQY zE49KrdM7j1JORXTTT9OqFXUGhf6BtNGM90Gyp+tHrzCXX/CnfK+7inSJ232StK9nBxq hfGnGXCrBZLhNGs9aarsU1bnhxuWGgrQ63pZhqq1Vu6mJNu+jOW8EP8FFEVn+uxXUBtI SdaQ== 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=WLYgX0MOK5dxYWvj13HoLuJzqbo6TzjvgYk9MSezfsA=; b=3Yc5zqNVhrRWDVCPvCqkoFWU9TFAukcygFYFKhIZwDiTDqDX1qKvcLYoGBYdlyGbp7 4C8O2JMj/ONwH/IUULqDiyh7/oAjK3Kxw8YdxWRo3n5vTk1FFMOEAtKN7RfiVOBy1nLY NAwqSe2JCcEF3z68dc+cJCp8pJblv4uYcBuUFf1DXxKdrMgfPl70LAf46nDaD9fSUgs3 um3bLvOo4hedlEVhC6YM/2tXTqbZfl5vcH+WeFCkkBJvLNhJj1t/uWWqk0Zd954ibfT4 gyDaVJShB0ooWknDGLeeTO1BW14WSJU+ycXAKtTxZ5Q+YibsmWet5KiSypFZrFaKCi66 vInw== X-Gm-Message-State: AJIora8xuSgl/jX6i3jDUrqgcb81/s032pYEAL0OeFD1Pp1BYnvMG+7b oX44LiU7TX+Z5R/PVeec446Fl6Tm5mSFFw== X-Google-Smtp-Source: AGRyM1teV2f4ICFHFEN5c8mXZ4BHPjYXCTYkO76ISZ3YHD5sQpTe8NBe0Mp8bEAMuOUf62RsHvihkQ== X-Received: by 2002:a5d:5984:0:b0:21d:7f3a:a153 with SMTP id n4-20020a5d5984000000b0021d7f3aa153mr2022311wri.568.1657701823480; Wed, 13 Jul 2022 01:43:43 -0700 (PDT) Received: from localhost.localdomain (ip092042140082.rev.nessus.at. [92.42.140.82]) by smtp.gmail.com with ESMTPSA id bg32-20020a05600c3ca000b003a04d19dab3sm5667468wmb.3.2022.07.13.01.43.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 01:43:43 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 13 Jul 2022 10:43:12 +0200 Message-Id: <20220713084317.24268-7-dse@thaumatec.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220713084317.24268-1-dse@thaumatec.com> References: <20220713084317.24268-1-dse@thaumatec.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 06/11] ipa: rkisp1: Pass requests setting AF controls to the AF algorithm 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: Daniel Semkowicz via libcamera-devel From: Daniel Semkowicz Reply-To: Daniel Semkowicz Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Pass the controls set by top level API to the AF algorithm if it was enabled. Signed-off-by: Daniel Semkowicz --- src/ipa/rkisp1/rkisp1.cpp | 52 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 01bb54fb..53b53f12 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -28,6 +28,7 @@ #include "libcamera/internal/mapped_framebuffer.h" #include "libcamera/internal/yaml_parser.h" +#include "algorithms/af.h" #include "algorithms/agc.h" #include "algorithms/algorithm.h" #include "algorithms/awb.h" @@ -295,9 +296,56 @@ void IPARkISP1::unmapBuffers(const std::vector &ids) } void IPARkISP1::queueRequest([[maybe_unused]] const uint32_t frame, - [[maybe_unused]] const ControlList &controls) + const ControlList &controls) { - /* \todo Start processing for 'frame' based on 'controls'. */ + using namespace algorithms; + + for (auto const &ctrl : controls) { + unsigned int ctrlEnum = ctrl.first; + const ControlValue &ctrlValue = ctrl.second; + + LOG(IPARkISP1, Debug) << "Request ctrl: " + << controls::controls.at(ctrlEnum)->name() + << " = " << ctrlValue.toString(); + + switch (ctrlEnum) { + case controls::AF_MODE: { + Af *af = getAlgorithm(); + if (!af) { + LOG(IPARkISP1, Warning) << "Could not set AF_MODE - no AF algorithm"; + break; + } + + af->setMode(static_cast(ctrlValue.get())); + break; + } + case controls::AF_TRIGGER: { + Af *af = getAlgorithm(); + if (!af) { + LOG(IPARkISP1, Warning) << "Could not set AF_TRIGGER - no AF algorithm"; + break; + } + + af->setTrigger(static_cast(ctrlValue.get())); + break; + } + case controls::AF_PAUSE: { + Af *af = getAlgorithm(); + if (!af) { + LOG(IPARkISP1, Warning) << "Could not set AF_TRIGGER - no AF algorithm"; + break; + } + + af->setPause(static_cast(ctrlValue.get())); + break; + } + default: + LOG(IPARkISP1, Warning) + << "Ctrl " << controls::controls.at(ctrlEnum)->name() + << " is not handled."; + break; + } + } } void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)