From patchwork Fri Feb 28 03:29:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 2910 Return-Path: Received: from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net [195.74.38.228]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E659362714 for ; Fri, 28 Feb 2020 04:29:35 +0100 (CET) X-Halon-ID: 7f8e8fa9-59da-11ea-9f85-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2392.dip0.t-ipconnect.de [79.202.35.146]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id 7f8e8fa9-59da-11ea-9f85-005056917a89; Fri, 28 Feb 2020 04:29:34 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Fri, 28 Feb 2020 04:29:07 +0100 Message-Id: <20200228032913.497826-1-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC 0/6] libcamera: PixelFormat: Turn into a class 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-List-Received-Date: Fri, 28 Feb 2020 03:29:36 -0000 Hi, This series replaces the PixelFormat definition of a unisgned int with a class implementation that can translate between V4L2 and DRM fourccs in addition to adding support for DRM modifiers. As an added bonus it makes it much stricter who can create a PixelFormat from a V4L2 fourcc which hopefully will remedy the confusion that exist today about with fourcc namespace the variable is in. Patch 1/6 and 2/6 lay the ground work by more tightly integrating the PixelFormat defined as unsigned int into libcamera. Patch 3/6 do the big work and implements PixelFormat as a class. Patch 4/6 Adds some possible usability features that could be built ontop to make fourcc more friends to end users by allowing printing and selecting them with friendly string names. Patch 5/6 and 6/6 do some cleanup removing functions that are now redundant since the large change in 3/6. I post this as a RFC as the design for modifiers for Bayer formats in DRM are still up in the air so their is no real world test-case to verify the design is the one we will end up with. The aim is to develop RAW buffer format enumeration on top of this series. Since this is an RFC as the upstream design is not yet finished documentation is also lacking. Niklas Söderlund (6): libcamera: Use PixelFormat instead of unsigned int where appropriate libcamera: formats: Turn ImageFormats into a template libcamera: PixelFormat: Turn into a class libcamera: PixelFormat: Add operations to operate on names libcamera: v4l2_videodevice: Remove pixel format translators v4l2: camera_proxy: Switch to PixelFormat include/libcamera/pixelformats.h | 43 ++++++- src/cam/main.cpp | 11 +- src/libcamera/camera_sensor.cpp | 2 +- src/libcamera/formats.cpp | 22 +++- src/libcamera/include/formats.h | 11 +- src/libcamera/include/v4l2_subdevice.h | 2 +- src/libcamera/include/v4l2_videodevice.h | 6 +- src/libcamera/pipeline/ipu3/ipu3.cpp | 8 +- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 26 ++-- src/libcamera/pipeline/uvcvideo.cpp | 14 +-- src/libcamera/pipeline/vimc.cpp | 20 +-- src/libcamera/pixelformats.cpp | 148 +++++++++++++++++++++++ src/libcamera/stream.cpp | 6 +- src/libcamera/v4l2_subdevice.cpp | 4 +- src/libcamera/v4l2_videodevice.cpp | 145 +--------------------- src/qcam/format_converter.cpp | 4 +- src/qcam/format_converter.h | 6 +- src/qcam/viewfinder.cpp | 4 +- src/qcam/viewfinder.h | 6 +- src/v4l2/v4l2_camera_proxy.cpp | 73 ++++------- src/v4l2/v4l2_camera_proxy.h | 3 - test/camera/buffer_import.cpp | 2 +- test/stream/stream_formats.cpp | 33 +++-- test/v4l2_subdevice/list_formats.cpp | 2 +- 24 files changed, 321 insertions(+), 280 deletions(-)