From patchwork Sun Aug 6 18:01:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 18926 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 3C487C32A9 for ; Sun, 6 Aug 2023 18:02:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D4F75627ED; Sun, 6 Aug 2023 20:02:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1691344928; bh=DQrF5txzyFHQbU1zoqKHmA7Mq6yOXX+tka4gc5W3Oyo=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Qt9WqEMMGQzh4I8UJWf6PRWOgfer320RUcKCBWR/nztGVud5adtSn7piDipa6Ug1e WzAdaODaCsqYylSHrmRGUHPP/yGIZ5GxYlqvER+4WkZHT6QKXLzv1RtCO2jauOP/VS eccZd3L4q6vfm9icurnPAKI/zUSXvkUbj9hc4G6gJbWcXKY81vb4/F9wc0t6XFDKi4 MEgPvscsZ6TWjnysXTNNNiJaAsgJ1NXJ23sSiaOF2Ehatv8nzDt6Jw1G7C9E7azv4e sznl/0C3psZrf69xiZV1ULabP4T1IgCtfJQoIAhHS/1Ut9XFzQAfJwOcMiMzWXO5Z+ SuYlC6G8G0lmA== Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EC1A0627E9 for ; Sun, 6 Aug 2023 20:02:07 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="U0BVmJ9Z"; dkim-atps=neutral Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-99bccc9ec02so580930466b.2 for ; Sun, 06 Aug 2023 11:02:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691344927; x=1691949727; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/YB7of9WDJI9hMhptxdPm9+Lbuqc8NzAVcGxXJhM5bM=; b=U0BVmJ9ZP/NONAAccAjbbxelnMUeCICUt2MuQ72WpG1+0wiU5NXfehefYnXxgQBW5B 5OKGGjBpTULvGglqyHzmD97zhSd0nzhDPQ0sYLMUO3nbJEtNHPJDImDRj4RVRE4Vu8ek +su4BQzxFbF6aRBH/MqFOPEOblQat9NTccQSQd+c073j3TdnfnQTq4NEgANzzrYBLx6R 5Ci2CgAbTKIlWjQb0FP8iKIzyC+aFr9sfIUSOTfH3OsHcw8EPRYgVADpiYJevqa7h78G T5e1mMk9xIwZ7Z5fTKDZrpcsmLX9umt6fvAKwrglLpJw/8REULoCmYndzII3T7Qa3ii7 WuTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691344927; x=1691949727; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/YB7of9WDJI9hMhptxdPm9+Lbuqc8NzAVcGxXJhM5bM=; b=BjpTJ83RTq9ED2SYyLVDpM0ijHcpakND5apy4ejjFJee6hyN68qEwVVz7gm4L8C6tJ YwOMzo2a5tHJ2xiQ5a9GA3TiaZJAvIUANSEv6Op7TEPgpuyzf4stfaJklxJy7niABaoN K1g5UrvzxVDjNTqY4We6uH7nT0t2gxoarV0f7izYKZP+w1v+UD7hJKtBFf9p009qhvs1 LcOzzBNZlEITuk8xO81zdo/8q9mq0YadCG9Zx5dqgSRWxzWobQZ2HZWyRRBnmOlaMN0Z +ZXeBKK9Wqd0w7I/f3QKZ06VuHPksNkVw1iwC0I+AkEJcT8uzjTykClAJ6uZ5tWLOFdG t2bA== X-Gm-Message-State: AOJu0YzJWrnLp2cT2CfU4/tiIv/GIhFCueIJ1ndDZSprq66DY0oFOraB FWKrL2mstZFIshOUNJEtYwH/edggD1G63TLQf4Y= X-Google-Smtp-Source: AGHT+IGAN9g04jQ6FBC9L2lBHGmVsCPTx+6Kyh2b9XYFX4ZjVIP3JAb3U/5InYvgGS8psbI0j4hnQQ== X-Received: by 2002:a17:906:3196:b0:99c:c138:a694 with SMTP id 22-20020a170906319600b0099cc138a694mr4070551ejy.43.1691344927458; Sun, 06 Aug 2023 11:02:07 -0700 (PDT) Received: from Lat-5310.. ([87.116.165.37]) by smtp.gmail.com with ESMTPSA id j15-20020a170906430f00b0099b76c3041csm4197396ejm.7.2023.08.06.11.02.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Aug 2023 11:02:07 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Sun, 6 Aug 2023 21:01:36 +0300 Message-Id: <20230806180136.304156-3-andrey.konovalov@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230806180136.304156-1-andrey.konovalov@linaro.org> References: <20230806180136.304156-1-andrey.konovalov@linaro.org> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH 2/2] [DNI] libcamera: pipeline: simple: a hack to use sotware converter with qcom-camss 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: Andrey Konovalov via libcamera-devel From: Andrey Konovalov Reply-To: Andrey Konovalov Cc: bryan.odonoghue@linaro.org, srinivas.kandagatla@linaro.org Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Quick and simple hack mostly to avoid calling acquireMediaDevice() for a converter without a media device underneath. ConverterFactoryBase::create() also relies on MediaDevice, so this hack doesn't use it with the software converter for now. Signed-off-by: Andrey Konovalov --- src/libcamera/pipeline/simple/simple.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 05ba76bc..e5c53003 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -37,6 +37,7 @@ #include "libcamera/internal/v4l2_subdevice.h" #include "libcamera/internal/v4l2_videodevice.h" +#include "libcamera/internal/converter/converter_softw.h" namespace libcamera { @@ -194,7 +195,7 @@ static const SimplePipelineInfo supportedDevices[] = { { "imx7-csi", { { "pxp", 1 } } }, { "j721e-csi2rx", {} }, { "mxc-isi", {} }, - { "qcom-camss", {} }, + { "qcom-camss", { { "software", 1 } } }, { "sun6i-csi", {} }, }; @@ -359,6 +360,11 @@ private: std::map entities_; MediaDevice *converter_; + // dummy function to force Converter to work w/o media device: + MediaDevice *acquireSoftwareConverter(const char *name) + { + return (new MediaDevice(name)); + } }; /* ----------------------------------------------------------------------------- @@ -497,7 +503,11 @@ int SimpleCameraData::init() /* Open the converter, if any. */ MediaDevice *converter = pipe->converter(); if (converter) { - converter_ = ConverterFactoryBase::create(converter); + // hack to make Converter to work w/o media device underneath: + if (!converter->isValid() && converter->deviceNode() == "software") + converter_ = std::make_unique(converter); + else + converter_ = ConverterFactoryBase::create(converter); if (!converter_) { LOG(SimplePipeline, Warning) << "Failed to create converter, disabling format conversion"; @@ -1410,6 +1420,14 @@ bool SimplePipelineHandler::match(DeviceEnumerator *enumerator) return false; for (const auto &[name, streams] : info->converters) { + if (!strcmp(name, "software")) { + converter_ = acquireSoftwareConverter(name); + if (converter_) { + numStreams = streams; + break; + } + } + DeviceMatch converterMatch(name); converter_ = acquireMediaDevice(enumerator, converterMatch); if (converter_) {