From patchwork Thu Jun 30 14:35:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Semkowicz X-Patchwork-Id: 16488 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 0D379BE173 for ; Thu, 30 Jun 2022 14:36:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B1A996564E; Thu, 30 Jun 2022 16:36:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656599764; 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=sBgclG8RGyPStTxsJGpAL8e1wiNqpp+6z6BGgp+gt17JpduxgNx3nv3lMi2t5qODb r3G1ycs8f6ZmPdUF3aBS0STsTgbjYy6SupjekMYyKJ3JXYTpFPS/AmwTEPdUEeM/8z 0PdcwiGpRj1lS30SaTHB6oMTsVR+B0dpTQfrXJyWmFAWTKZrSXf5BnseAt1Qg8IqEP PY0wUW8CVjSIMU6Rs+C6bRRqV7jcRVFFDeOq6br7VH4PiWyRuK5Rzb+ctP9eCy8fTo 2WCVhwF+NtgSdw+iunkvzx4D9NvBEzxquvaOwrHChXgqwwoqmnv2FqxXh9vUYLF2IG f5zF3c3yUvH1g== Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6E55F65657 for ; Thu, 30 Jun 2022 16:36:01 +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="hVQ5qB/Q"; dkim-atps=neutral Received: by mail-wm1-x335.google.com with SMTP id o16-20020a05600c379000b003a02eaea815so2751580wmr.0 for ; Thu, 30 Jun 2022 07:36:01 -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=hVQ5qB/QYpBBC4/0Hjj+Q/EUKDKXy4OXGVAQTdBaEjNysa59hmG5dbrpA8AXhDxEcm oGMDtorol7AZMesjJ4Vu3C2ctrMOXPUvPkZxwbcXw39kMmilaSi020n0e9PAYzRt8zRJ fUBACUkgnCrGed/C3hEI3Ycrfc/FJT7gKlcNU8rOzKSkTAcuXwjnSBQdLwJtv0Vgs0Yu AztsuUJPPaj5X6WsfNwqww/4pym7uzKX5bOXhov4g2o2GrsTSLxq7x8caLrJ5aGP9W1E i8QbTOYWFI4V5cDQ7eIE7/TvtW7T2ObfFPOWxUjVtIzVU5bSjUqF/szsIqZdVOCAikD5 CkhA== 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=nYiU6bgogYNv1Fh237v4RRbMRBqsCpXTR/nWqvhv0CtWpda1Xf1nug8DhitOmU4PDR Ttrc7bQrcsj9Ub1p2SLr9jcindNm1w6OzL6LaWyfmXgKTuxC/VXzqGxz2tx0ZyBanaIf zCpOTQLssi9HqG4mzQOFsQMa+Jy9OQCY/cDnhVYwMMJAXk5/ie0IWHbbUjzcZC62lhC3 5aMdNSYN9Vd7sA91ngFfsIkpKexmtsVgtQmXEG+/Wt9loZ8CqTzT8j6t8AwH83SSpOW0 vu2xly7KajHMVCgMT3gQFASMnsNF3dOwiLVL2Xcr6mOExf6/2GeDY0DHYtBph/CaAHw2 75Nw== X-Gm-Message-State: AJIora+iPFetd5xsEJKVlv8w+eHphXZlo+06HKLz2PA9+PjbNH1OCt0c bAxnbqrQ3tGr1whSEsy1ITlral8ftI7Qgw== X-Google-Smtp-Source: AGRyM1ujyMr63jZD745Vx9rWXilAiRp06oj9CHO5tnf7+on1a2znNB+hXVsOHOviTb/joSkL0C9aRw== X-Received: by 2002:a7b:c003:0:b0:39c:5642:e415 with SMTP id c3-20020a7bc003000000b0039c5642e415mr12198498wmb.111.1656599761227; Thu, 30 Jun 2022 07:36:01 -0700 (PDT) Received: from localhost.localdomain (ip092042140082.rev.nessus.at. [92.42.140.82]) by smtp.gmail.com with ESMTPSA id r5-20020a05600c320500b0039db500714fsm6405945wmp.6.2022.06.30.07.36.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jun 2022 07:36:00 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Thu, 30 Jun 2022 16:35:41 +0200 Message-Id: <20220630143543.39599-7-dse@thaumatec.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220630143543.39599-1-dse@thaumatec.com> References: <20220630143543.39599-1-dse@thaumatec.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 6/8] 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)