From patchwork Thu Jan 5 04:37:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng-Hao Yang X-Patchwork-Id: 18095 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 CE0F3C3292 for ; Thu, 5 Jan 2023 04:38:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 82307625FD; Thu, 5 Jan 2023 05:38:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1672893488; bh=CkyxTn6n0AAiFnrLaW8GKfez29P9A54x6SYJExejOi8=; 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=tESrlmipitcSczRytIDNxe48RRPrdb/G3R9+VoHslbGeW65+ntOmaLNTn5yYpQk4S z0MqSHjlQn9Kw0SAdFN/6juLdko3yQKdvFrSgkdflRsrCdJcH5AOXvW5AtU37EO2IW zW+y5GPVSA5gusbkj+4rCAjt4zbOK9upvgCqAvr60RrDGwj+LGU2WZjkfth9JW30NM xr6/I/WK1Lhkf+7FE8K6IIeZKjTJO6XqI8hoZ+aFHpfhUoRRHnNmVPCe8KJ2n9yGAP WfhvyRB85zMXlnHzeVd9lRnva7qfqPhL9VIPjx32vpDda39CkHc5qvHqYfxyQZC0PQ RP/53nX0x8zHA== Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B6552625E0 for ; Thu, 5 Jan 2023 05:38:05 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="T6JohQQM"; dkim-atps=neutral Received: by mail-pj1-x102b.google.com with SMTP id q64so209644pjq.4 for ; Wed, 04 Jan 2023 20:38:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; 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=rtUHUJiSnMDtdnPKjGrXewZAUK+DgyGNd3X25jltl2g=; b=T6JohQQMeHEIMcOvMl/ZkK8spCppWZZQzl9j+v2HUyl+qcXnV4M/acUasBTJBtUtP4 mWDSp3kI+OYWsvOQgXIkQSn9ttywIhNOlRp/Z9f8c9OhRF2FBJKeZrpE9rrNtu6HtTqM LovOaAh3dbcdbT4iWnZiQkDK04D+wbhTGs0Wc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=rtUHUJiSnMDtdnPKjGrXewZAUK+DgyGNd3X25jltl2g=; b=Lt9zcJBMmoImtlRkIMboJ+Xmu2YKvbGfcO9CUDzz98SPn4D6Q/pBAV8axNYBoe6lEg ezekf3zS+XE5FRyjIdlvXefYG0L3D4Wct1HizQsPqQi9KvSNyrNctfIaw5Poc2Fmuf9s 8b9LdonuyJvX9c8kn6CASMhPr0CV0KEKFioMfZZBjxFXMXi0UJYbYElOWlVoywGdX2Co 6++NoDecqXEC0UOLkwLV6Ezs2rQ2chd9RhmnTdmUAI6aFDJYxHjw7r958tm7YcsdlBFU JIX5s5X7zluvlHIRNcdKh3+lFk2awk7F8bYTkpXQXsOBEFsPEhw1qstrhN9a0lt0oNVj mBJA== X-Gm-Message-State: AFqh2krEr24BC5sTs2JSPDwRNs6KoVdsYrluq9UWjKnZDVQPmwRGkEoF VDscLcjkTjpZOuqyxpMKdCEzoerAExOp9PvE X-Google-Smtp-Source: AMrXdXtZCFrJ/K5cGmK5YRegqrARLHLek9MGmFIBNK5uV6f8XFqsGZNbTptog3hExRoBjtNn4BlqFQ== X-Received: by 2002:a17:903:264b:b0:185:441e:90b4 with SMTP id je11-20020a170903264b00b00185441e90b4mr44776090plb.26.1672893483887; Wed, 04 Jan 2023 20:38:03 -0800 (PST) Received: from chenghaoyang-low.c.googlers.com.com (46.165.189.35.bc.googleusercontent.com. [35.189.165.46]) by smtp.gmail.com with ESMTPSA id x23-20020a170902b41700b00188c5f0f9e9sm25015200plr.199.2023.01.04.20.38.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 20:38:03 -0800 (PST) X-Google-Original-From: Harvey Yang To: libcamera-devel@lists.libcamera.org Date: Thu, 5 Jan 2023 04:37:26 +0000 Message-Id: <20230105043726.679968-10-chenghaoyang@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog In-Reply-To: <20230105043726.679968-1-chenghaoyang@google.com> References: <20230105043726.679968-1-chenghaoyang@google.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 9/9] libcamera: pipeline: virtual: Set camera properties & controls 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: Harvey Yang via libcamera-devel From: Cheng-Hao Yang Reply-To: Harvey Yang Cc: Harvey Yang , Harvey Yang Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Initialize the CameraData properties with Location, Model, and PixelArrayActiveAreas, and the control attribute: FrameDurationLimits. Updating `/etc/camera/libcamera/camera_hal.yaml` on a chromebook DUT is required to find the virtual camera with id `Virtual0`. Signed-off-by: Harvey Yang --- src/libcamera/pipeline/virtual/virtual.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp index db6fe14c..d56989b2 100644 --- a/src/libcamera/pipeline/virtual/virtual.cpp +++ b/src/libcamera/pipeline/virtual/virtual.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include "libcamera/internal/camera.h" #include "libcamera/internal/media_device_virtual.h" @@ -20,6 +21,10 @@ namespace libcamera { LOG_DEFINE_CATEGORY(VIRTUAL) +static const ControlInfoMap::Map VirtualControls = { + { &controls::draft::PipelineDepth, ControlInfo(2, 3) }, +}; + uint64_t CurrentTimestamp() { struct timespec ts; @@ -272,6 +277,16 @@ bool PipelineHandlerVirtual::match(DeviceEnumerator *enumerator) data->supportedResolutions_[0] = { .size = Size(1920, 1080), .frame_rates = { 30 }, .formats = { "YCbCr_420_888" } }; data->supportedResolutions_[1] = { .size = Size(1280, 720), .frame_rates = { 30, 60 }, .formats = { "YCbCr_420_888" } }; + data->properties_.set(properties::Location, properties::CameraLocationFront); + data->properties_.set(properties::Model, "Virtual Video Device"); + data->properties_.set(properties::PixelArrayActiveAreas, { Rectangle(Size(1920, 1080)) }); + + // TODO: Set FrameDurationLimits based on config. + ControlInfoMap::Map controls = VirtualControls; + int64_t min_frame_duration = 30, max_frame_duration = 60; + controls[&controls::FrameDurationLimits] = ControlInfo(min_frame_duration, max_frame_duration); + data->controlInfo_ = ControlInfoMap(std::move(controls), controls::controls); + /* Create and register the camera. */ std::set streams{ &data->stream_ }; const std::string id = "Virtual0";