From patchwork Sat Jul 23 09:53:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 16739 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 5320DBE173 for ; Sat, 23 Jul 2022 09:53:47 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 941D763310; Sat, 23 Jul 2022 11:53:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1658570026; bh=qvOYRP+4AhAtY0WeVZ92HoLKQJgbvAbb6qPnAWl00rE=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=GWu9fzYunfRUNR2lr/qMY6jQyfxjsQ3oRUkYSDpEVuJI7gDN9AuNb5wIVDpvS72h2 1vnEho7IljT8LwX9CfUKjGqKLF7xAo3mybLT3BctjJ3n6AjFux4jiQ9ol3YwungNve xNXo8qqipFsyYbpEyyR06j1Gj5XyM3hCoFLzstqIJo7HbyKQxPGmvYtFYyosbQ+dfu qoM+u3CLBy54Kjmtm1dLZajl4cyjOe0z2Y2CreOb1yTHRoFedPkuMlNiBfEc4TWJcs 9AWJYVg4wypdTj0dicvGBecz9KUutr76RT939Q2yEMvnF8kdeBCDftKP361GnMQ4u5 6Vo/sS7v/8AlA== Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 572DD6330D for ; Sat, 23 Jul 2022 11:53:45 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 7EC531BF208; Sat, 23 Jul 2022 09:53:41 +0000 (UTC) To: libcamera-devel@lists.libcamera.org Date: Sat, 23 Jul 2022 11:53:22 +0200 Message-Id: <20220723095330.43542-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 0/8] libcamera: Map multiple V4L2 formats to a single libcamera::format 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: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Cc: jozef@mlich.cz, Pavel Machek Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This series addresses the requirement of mapping multiple V4L2 pixel formats to a single libcamera format. Specifically, it allows to map V4L2_PIX_FMT_JPEG and V4L2_PIX_FMT_MJPEG to libcamera::formats::MJPEG. The series starts by allowing to associate mulitple V4L2 FourCC in PixelFormatInfo and re-introduces toV4L2PixelFormat() in V4L2VideoDevice in order to select among from the list of V4L2 formats the first one supported from the video device. Patch [7/8] adds a multiplanar flag to V4L2VideoDevice::toV4L2PixelFormat() to allow selection of the contiguous or non-contiguous format versions. Finally, the last patches associate V4L2_PIX_FMT_JPEG to formats::MJPEG in the libcamera::formats enumeration and the conversely maps formats::MJPEG to V4L2_PIX_FMT_JPEG in the V4L2 formats enumeration. Tested with a UVC camera and on pinephone where the format is correctly mapped v1->v2: - Add a missing conversion using the video device in Simple converter - Map formats::MJPEG to V4L2_PIX_FMT_JPEG in v4l2 formats enumeration Jacopo Mondi (8): libcamera: formats: Support multiple V4L2 pixel formats libcamera: formats: Search PixelFormatInfo on multiple formats libcamera: v4l2_pixelformat: Return a format list in fromPixelFormat() libcamera: v4l2_videodevice: Reintroduce toV4L2PixelFormat() libcamera: v4l2_videodevice: Match formats supported by the device libcamera: v4l2_videodevice: Add multiplanar argument to toV4L2PixelFormat libcamera: formats: Map V4L2_PIX_FMT_JPEG to formats::MJPEG libcamera: v4l2_pixelformat: Map formats::MJPEG to V4L2_PIX_FMT_JPEG Documentation/guides/pipeline-handler.rst | 7 +- include/libcamera/internal/formats.h | 4 +- include/libcamera/internal/v4l2_device.h | 1 + include/libcamera/internal/v4l2_pixelformat.h | 6 +- include/libcamera/internal/v4l2_videodevice.h | 9 +- src/libcamera/formats.cpp | 262 +++++++++--------- src/libcamera/pipeline/ipu3/cio2.cpp | 2 +- src/libcamera/pipeline/ipu3/imgu.cpp | 2 +- .../pipeline/raspberrypi/raspberrypi.cpp | 34 ++- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 6 +- src/libcamera/pipeline/simple/converter.cpp | 10 +- src/libcamera/pipeline/simple/simple.cpp | 4 +- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 6 +- src/libcamera/pipeline/vimc/vimc.cpp | 8 +- src/libcamera/v4l2_device.cpp | 15 + src/libcamera/v4l2_pixelformat.cpp | 20 +- src/libcamera/v4l2_videodevice.cpp | 41 ++- src/v4l2/v4l2_camera_proxy.cpp | 6 +- test/libtest/buffer_source.cpp | 2 +- 19 files changed, 261 insertions(+), 184 deletions(-) --- 2.37.1