From patchwork Sat Mar 18 23:40:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 18413 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 31F90C329D for ; Sat, 18 Mar 2023 23:40:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 440A662704; Sun, 19 Mar 2023 00:40:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1679182838; bh=mg3vg7yK637j32aLnAVSbE70YKXnTFJtwb5a4rprn7k=; 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=Tn5LVuLP4D4pvNNg67wTWfy0IhhU2A5/d5FO2UP9qwJdnDNGV6MA0yg1T5G4a5k+d x9kAIjgXkrUYvEm1RE3GrYz+Yps5VVGbzZEwcXoQsOdddvCBlidLwGb0eH0W3He7Lk D08EzDswVs5reHHdRxXoXCUDsc37wjsVoZY4L/cOZMPZ4CUOpfIYxTPmZKT8mXV+Bk HUV6lAf0F9n+FLqiZ5trYV+9bgk0anHTOjvQsnDN3cmzHh3bSznfqqtElrFEfHSN+H kDg3ZgVM6VsQ5wYE3UopN8HzM01uMbnve/M6ZqTAbwH1VtSue0SZkDAuLNZS0nnrCO lEB204yYhDjrw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 153F8626E9 for ; Sun, 19 Mar 2023 00:40:33 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Pgq8SAg6"; dkim-atps=neutral Received: from mail.ideasonboard.com (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id ADD7FDF7; Sun, 19 Mar 2023 00:40:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1679182832; bh=mg3vg7yK637j32aLnAVSbE70YKXnTFJtwb5a4rprn7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pgq8SAg6pUzcOdrHUaW2uqMW+jXdMONgcvdOTlYnKX5gl3dtklv7g/r40y3ya2Q9s QGrCjKoz/Mj7WUVPtfTGDYogGQt0Oke7lOVGgHtZulLUSX2ahLzinSp3Xx7e/Vnd1t voW4F+6Szfa1KhqOF3o0bW40U2CrCZjXH6wRTjBQ= To: libcamera-devel@lists.libcamera.org Date: Sat, 18 Mar 2023 23:40:07 +0000 Message-Id: <20230318234014.29506-5-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230318234014.29506-1-dan.scally@ideasonboard.com> References: <20230318234014.29506-1-dan.scally@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 04/11] pipeline: ipu3: Identify sensors that do not need the Imgu 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 Scally via libcamera-devel From: Dan Scally Reply-To: Daniel Scally Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Some sensors connected to the CIO2 device do not need to be connected to the Imgu - for example the OmniVision 7251 outputs Y10 data which needn't be debayered and which is unsupported by the kernel's ipu3-imgu driver. To be able to handle those sensors we need to be able to skip the Imgu related parts of the processing in the IPU3 pipeline. As a preliminary step, check whether the sensor needs the Imgu during CIO2Device::init() and provide a method to check that later. Signed-off-by: Daniel Scally --- src/libcamera/pipeline/ipu3/cio2.cpp | 20 ++++++++++++++++++++ src/libcamera/pipeline/ipu3/cio2.h | 4 ++++ 2 files changed, 24 insertions(+) diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp index 7400cb0b..d100df57 100644 --- a/src/libcamera/pipeline/ipu3/cio2.cpp +++ b/src/libcamera/pipeline/ipu3/cio2.cpp @@ -17,6 +17,7 @@ #include #include +#include "libcamera/internal/bayer_format.h" #include "libcamera/internal/camera_sensor.h" #include "libcamera/internal/framebuffer.h" #include "libcamera/internal/media_device.h" @@ -160,6 +161,25 @@ int CIO2Device::init(const MediaDevice *media, unsigned int index) return -EINVAL; } + /* + * A camera sensor connected to the CIO2 device need not necessarily be + * connected to the Imgu. This is the case for some IR cameras for + * example, which output IPU3-packed Y10 data rather than packed data in + * bayer patterns. In the case of those sensors we need to be able to + * skip dealing with the Imgu during the pipeline, so we need to be able + * to identify them. + * + * Check whether this sensor needs to be connected to the Imgu. + */ + needsImgu_ = false; + for (unsigned int mbusCode : sensorCodes) { + const BayerFormat &bayerFormat = BayerFormat::fromMbusCode(mbusCode); + if (bayerFormat.isValid() && bayerFormat.order < BayerFormat::MONO) { + needsImgu_ = true; + break; + } + } + /* * \todo Define when to open and close video device nodes, as they * might impact on power consumption. diff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h index bbd87eb8..064673d9 100644 --- a/src/libcamera/pipeline/ipu3/cio2.h +++ b/src/libcamera/pipeline/ipu3/cio2.h @@ -63,6 +63,8 @@ public: Signal<> bufferAvailable; + bool needsImgu() { return needsImgu_; } + private: void freeBuffers(); @@ -74,6 +76,8 @@ private: std::vector> buffers_; std::queue availableBuffers_; + + bool needsImgu_; }; } /* namespace libcamera */