From patchwork Fri May 22 14:54:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3840 Return-Path: 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 7B680603D7 for ; Fri, 22 May 2020 16:55:19 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="h3WawItl"; dkim-atps=neutral Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 19A46528 for ; Fri, 22 May 2020 16:55:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1590159319; bh=fUcZv2BHrO81ER5WBhyLOJ756arZ1hinkUqNxKjLMmM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=h3WawItlS3jiWxZJPbXx1GLf6pX14II1T6kWpfVM5Ipn8cHeQxL6DvR9f8kuk012o mnkXZ3HpvReJqMnJmfTLlIU2xssyTSJVIuJ+A4J8umQ7eKePxfJ53i9r1kM+qXWAjK K6NV/5547hVgh0XUWWQ/8FoHX/jRa14RxLo1I5Ak= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 22 May 2020 17:54:48 +0300 Message-Id: <20200522145459.16836-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> References: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH/RFC 01/11] libcamera: Rename pixelformats.{cpp, h} to pixel_format.{cpp, h} 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, 22 May 2020 14:55:19 -0000 The libcamera source files are named after class names, using snake_case. pixelformats.h and pixelformats.cpp don't comply with that rule. Fix them. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- include/libcamera/internal/formats.h | 2 +- include/libcamera/internal/v4l2_pixelformat.h | 2 +- include/libcamera/internal/v4l2_videodevice.h | 2 +- include/libcamera/meson.build | 2 +- include/libcamera/{pixelformats.h => pixel_format.h} | 8 ++++---- include/libcamera/stream.h | 2 +- src/libcamera/meson.build | 2 +- src/libcamera/pipeline/simple/converter.h | 2 +- src/libcamera/{pixelformats.cpp => pixel_format.cpp} | 8 ++++---- src/libcamera/v4l2_pixelformat.cpp | 2 +- src/qcam/format_converter.h | 2 +- src/qcam/viewfinder.h | 2 +- 12 files changed, 18 insertions(+), 18 deletions(-) rename include/libcamera/{pixelformats.h => pixel_format.h} (82%) rename src/libcamera/{pixelformats.cpp => pixel_format.cpp} (95%) diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h index 4092a93ef973..4455b0f9b050 100644 --- a/include/libcamera/internal/formats.h +++ b/include/libcamera/internal/formats.h @@ -12,7 +12,7 @@ #include #include -#include +#include #include "libcamera/internal/v4l2_pixelformat.h" diff --git a/include/libcamera/internal/v4l2_pixelformat.h b/include/libcamera/internal/v4l2_pixelformat.h index 0fe8a017de34..4d0e034b8b51 100644 --- a/include/libcamera/internal/v4l2_pixelformat.h +++ b/include/libcamera/internal/v4l2_pixelformat.h @@ -13,7 +13,7 @@ #include -#include +#include namespace libcamera { diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h index dc259523599c..c93cf816373b 100644 --- a/include/libcamera/internal/v4l2_videodevice.h +++ b/include/libcamera/internal/v4l2_videodevice.h @@ -17,7 +17,7 @@ #include #include -#include +#include #include #include "libcamera/internal/formats.h" diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build index 27760c19f9b9..73c5b999acf4 100644 --- a/include/libcamera/meson.build +++ b/include/libcamera/meson.build @@ -13,7 +13,7 @@ libcamera_public_headers = files([ 'geometry.h', 'logging.h', 'object.h', - 'pixelformats.h', + 'pixel_format.h', 'request.h', 'signal.h', 'span.h', diff --git a/include/libcamera/pixelformats.h b/include/libcamera/pixel_format.h similarity index 82% rename from include/libcamera/pixelformats.h rename to include/libcamera/pixel_format.h index 89966e5e664c..e3b371ef92bb 100644 --- a/include/libcamera/pixelformats.h +++ b/include/libcamera/pixel_format.h @@ -2,10 +2,10 @@ /* * Copyright (C) 2019, Google Inc. * - * pixelformats.h - libcamera pixel formats + * pixel_format.h - libcamera Pixel Format */ -#ifndef __LIBCAMERA_PIXEL_FORMATS_H__ -#define __LIBCAMERA_PIXEL_FORMATS_H__ +#ifndef __LIBCAMERA_PIXEL_FORMAT_H__ +#define __LIBCAMERA_PIXEL_FORMAT_H__ #include #include @@ -40,4 +40,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_PIXEL_FORMATS_H__ */ +#endif /* __LIBCAMERA_PIXEL_FORMAT_H__ */ diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h index b3cbea3d5229..1a68bd23a81a 100644 --- a/include/libcamera/stream.h +++ b/include/libcamera/stream.h @@ -14,7 +14,7 @@ #include #include -#include +#include namespace libcamera { diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index b88f295d251d..611fc061e1cf 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -34,7 +34,7 @@ libcamera_sources = files([ 'message.cpp', 'object.cpp', 'pipeline_handler.cpp', - 'pixelformats.cpp', + 'pixel_format.cpp', 'process.cpp', 'pub_key.cpp', 'request.cpp', diff --git a/src/libcamera/pipeline/simple/converter.h b/src/libcamera/pipeline/simple/converter.h index 1f770eb844b5..ef18cf73a2ed 100644 --- a/src/libcamera/pipeline/simple/converter.h +++ b/src/libcamera/pipeline/simple/converter.h @@ -12,7 +12,7 @@ #include #include -#include +#include #include namespace libcamera { diff --git a/src/libcamera/pixelformats.cpp b/src/libcamera/pixel_format.cpp similarity index 95% rename from src/libcamera/pixelformats.cpp rename to src/libcamera/pixel_format.cpp index 1330dc5ab3d9..d8718739152d 100644 --- a/src/libcamera/pixelformats.cpp +++ b/src/libcamera/pixel_format.cpp @@ -2,14 +2,14 @@ /* * Copyright (C) 2019, Google Inc. * - * pixelformats.cpp - libcamera pixel formats + * pixel_format.cpp - libcamera Pixel Format */ -#include +#include /** - * \file pixelformats.h - * \brief libcamera pixel formats + * \file pixel_format.h + * \brief libcamera pixel format */ namespace libcamera { diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index 36776be99e59..94fae470f926 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -14,7 +14,7 @@ #include -#include +#include #include "libcamera/internal/formats.h" #include "libcamera/internal/log.h" diff --git a/src/qcam/format_converter.h b/src/qcam/format_converter.h index 5e28adf0ef63..e389b24a69f7 100644 --- a/src/qcam/format_converter.h +++ b/src/qcam/format_converter.h @@ -11,7 +11,7 @@ #include -#include +#include class QImage; diff --git a/src/qcam/viewfinder.h b/src/qcam/viewfinder.h index b3f1d25d9d60..26a1320537d2 100644 --- a/src/qcam/viewfinder.h +++ b/src/qcam/viewfinder.h @@ -17,7 +17,7 @@ #include #include -#include +#include #include "format_converter.h" From patchwork Fri May 22 14:54:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3842 Return-Path: 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 181F0603D7 for ; Fri, 22 May 2020 16:55:20 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="RUjK6uHx"; dkim-atps=neutral Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B5D6A528 for ; Fri, 22 May 2020 16:55:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1590159319; bh=f+YmrMKowvOk1M8CL2X9bwKcz3Iv3UB4ZvLqdEcBtKc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RUjK6uHx5mLioDbv/LpbowJXm1p3jvkbnH3tr4Tb1FJxoMaCRIwP4/ekoUtRHN/zf GgavfAcb/nwRkaOCdgI4kLgWM3M9+phAf6Vqm7Gj0yG1RhwRFtlnpVPs/4zBCfCSA3 oXwYRcKMIRBTvSk1mppb7j4NNr63mR0LW7aLZT+M= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 22 May 2020 17:54:50 +0300 Message-Id: <20200522145459.16836-4-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> References: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH/RFC 02/11] libcamera: Replace C++ comments with C comments 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, 22 May 2020 14:55:20 -0000 The control_ids.h.in and property_ids.h.in headers use C++-style comments, when the coding style mandates C-style comments. Fix them. While at it, adjust three minor typos in comments. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Niklas Söderlund --- include/libcamera/control_ids.h.in | 4 ++-- include/libcamera/property_ids.h.in | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/libcamera/control_ids.h.in b/include/libcamera/control_ids.h.in index 6ff0e4186983..95a7a7f1e260 100644 --- a/include/libcamera/control_ids.h.in +++ b/include/libcamera/control_ids.h.in @@ -2,7 +2,7 @@ /* * Copyright (C) 2019, Google Inc. * - * control_ids.h : Control ID list + * control_ids.h - Control ID list * * This file is auto-generated. Do not edit. */ @@ -30,4 +30,4 @@ extern const ControlIdMap controls; } /* namespace libcamera */ -#endif // __LIBCAMERA_CONTROL_IDS_H__ +#endif /* __LIBCAMERA_CONTROL_IDS_H__ */ diff --git a/include/libcamera/property_ids.h.in b/include/libcamera/property_ids.h.in index 62799b3e8c54..e4dea335cd3b 100644 --- a/include/libcamera/property_ids.h.in +++ b/include/libcamera/property_ids.h.in @@ -2,7 +2,7 @@ /* * Copyright (C) 2019, Google Inc. * - * property_ids.h : Property ID list + * property_ids.h - Property ID list * * This file is auto-generated. Do not edit. */ @@ -26,8 +26,8 @@ ${controls} extern const ControlIdMap properties; -} /* namespace propertiess */ +} /* namespace properties */ } /* namespace libcamera */ -#endif // __LIBCAMERA_PROPERTY_IDS_H__ +#endif /* __LIBCAMERA_PROPERTY_IDS_H__ */ From patchwork Fri May 22 14:54:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3843 Return-Path: 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 765A861075 for ; Fri, 22 May 2020 16:55:20 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="t4Z24fGg"; dkim-atps=neutral Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 124AC24D for ; Fri, 22 May 2020 16:55:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1590159320; bh=Imc2QEyOv/kZuE9LrLhXWLg0KcnDy0+Rf3Y0mBDeIYM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=t4Z24fGgLfA9LFxgj1o7SwjG80Jf5LheEJ2qQzG+q0TejVQ5hfR98LbbYCJ5slwPz FiLpstjrzzwhQj/mu2C4zP03nwOeMY7Ei3R14kaFRptbaUVpHErI/5FyZXF0rpf93X NNjhAWKHeCdbYk1MCAX7kezgfmrBlb6mW8gOVcuQ= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 22 May 2020 17:54:51 +0300 Message-Id: <20200522145459.16836-5-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> References: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH/RFC 03/11] libcamera: Rename header guards for internal headers 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, 22 May 2020 14:55:20 -0000 With the internal headers now in include/libcamera/internal/, we may have identically named headers in include/libcamera/. Their header guards would clash. Rename the header guards of internal headers to prevent any issue. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Niklas Söderlund --- include/libcamera/internal/byte_stream_buffer.h | 6 +++--- include/libcamera/internal/camera_controls.h | 6 +++--- include/libcamera/internal/camera_sensor.h | 6 +++--- include/libcamera/internal/control_serializer.h | 6 +++--- include/libcamera/internal/control_validator.h | 6 +++--- include/libcamera/internal/device_enumerator.h | 6 +++--- include/libcamera/internal/device_enumerator_sysfs.h | 6 +++--- include/libcamera/internal/device_enumerator_udev.h | 6 +++--- include/libcamera/internal/event_dispatcher_poll.h | 6 +++--- include/libcamera/internal/file.h | 6 +++--- include/libcamera/internal/formats.h | 6 +++--- include/libcamera/internal/ipa_context_wrapper.h | 6 +++--- include/libcamera/internal/ipa_manager.h | 6 +++--- include/libcamera/internal/ipa_module.h | 6 +++--- include/libcamera/internal/ipa_proxy.h | 6 +++--- include/libcamera/internal/ipc_unixsocket.h | 6 +++--- include/libcamera/internal/log.h | 6 +++--- include/libcamera/internal/media_device.h | 6 +++--- include/libcamera/internal/media_object.h | 6 +++--- include/libcamera/internal/message.h | 6 +++--- include/libcamera/internal/pipeline_handler.h | 6 +++--- include/libcamera/internal/process.h | 6 +++--- include/libcamera/internal/pub_key.h | 6 +++--- include/libcamera/internal/semaphore.h | 6 +++--- include/libcamera/internal/thread.h | 6 +++--- include/libcamera/internal/utils.h | 6 +++--- include/libcamera/internal/v4l2_controls.h | 6 +++--- include/libcamera/internal/v4l2_device.h | 6 +++--- include/libcamera/internal/v4l2_pixelformat.h | 6 +++--- include/libcamera/internal/v4l2_subdevice.h | 6 +++--- include/libcamera/internal/v4l2_videodevice.h | 6 +++--- 31 files changed, 93 insertions(+), 93 deletions(-) diff --git a/include/libcamera/internal/byte_stream_buffer.h b/include/libcamera/internal/byte_stream_buffer.h index b3aaa8b9fb28..db59577dc332 100644 --- a/include/libcamera/internal/byte_stream_buffer.h +++ b/include/libcamera/internal/byte_stream_buffer.h @@ -4,8 +4,8 @@ * * byte_stream_buffer.h - Byte stream buffer */ -#ifndef __LIBCAMERA_BYTE_STREAM_BUFFER_H__ -#define __LIBCAMERA_BYTE_STREAM_BUFFER_H__ +#ifndef __LIBCAMERA_INTERNAL_BYTE_STREAM_BUFFER_H__ +#define __LIBCAMERA_INTERNAL_BYTE_STREAM_BUFFER_H__ #include #include @@ -86,4 +86,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_BYTE_STREAM_BUFFER_H__ */ +#endif /* __LIBCAMERA_INTERNAL_BYTE_STREAM_BUFFER_H__ */ diff --git a/include/libcamera/internal/camera_controls.h b/include/libcamera/internal/camera_controls.h index dc8b3ba84bc4..6e40f4436cad 100644 --- a/include/libcamera/internal/camera_controls.h +++ b/include/libcamera/internal/camera_controls.h @@ -4,8 +4,8 @@ * * camera_controls.h - Camera controls */ -#ifndef __LIBCAMERA_CAMERA_CONTROLS_H__ -#define __LIBCAMERA_CAMERA_CONTROLS_H__ +#ifndef __LIBCAMERA_INTERNAL_CAMERA_CONTROLS_H__ +#define __LIBCAMERA_INTERNAL_CAMERA_CONTROLS_H__ #include "libcamera/internal/control_validator.h" @@ -27,4 +27,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_CAMERA_CONTROLS_H__ */ +#endif /* __LIBCAMERA_INTERNAL_CAMERA_CONTROLS_H__ */ diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h index d79bd9ce9d58..1f9de03c7563 100644 --- a/include/libcamera/internal/camera_sensor.h +++ b/include/libcamera/internal/camera_sensor.h @@ -4,8 +4,8 @@ * * camera_sensor.h - A camera sensor */ -#ifndef __LIBCAMERA_CAMERA_SENSOR_H__ -#define __LIBCAMERA_CAMERA_SENSOR_H__ +#ifndef __LIBCAMERA_INTERNAL_CAMERA_SENSOR_H__ +#define __LIBCAMERA_INTERNAL_CAMERA_SENSOR_H__ #include #include @@ -85,4 +85,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_CAMERA_SENSOR_H__ */ +#endif /* __LIBCAMERA_INTERNAL_CAMERA_SENSOR_H__ */ diff --git a/include/libcamera/internal/control_serializer.h b/include/libcamera/internal/control_serializer.h index 99bacd920fce..0ab29d9ad8bc 100644 --- a/include/libcamera/internal/control_serializer.h +++ b/include/libcamera/internal/control_serializer.h @@ -4,8 +4,8 @@ * * control_serializer.h - Control (de)serializer */ -#ifndef __LIBCAMERA_CONTROL_SERIALIZER_H__ -#define __LIBCAMERA_CONTROL_SERIALIZER_H__ +#ifndef __LIBCAMERA_INTERNAL_CONTROL_SERIALIZER_H__ +#define __LIBCAMERA_INTERNAL_CONTROL_SERIALIZER_H__ #include #include @@ -52,4 +52,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_CONTROL_SERIALIZER_H__ */ +#endif /* __LIBCAMERA_INTERNAL_CONTROL_SERIALIZER_H__ */ diff --git a/include/libcamera/internal/control_validator.h b/include/libcamera/internal/control_validator.h index f1c9110b158f..4a00b9b7f686 100644 --- a/include/libcamera/internal/control_validator.h +++ b/include/libcamera/internal/control_validator.h @@ -4,8 +4,8 @@ * * control_validator.h - Control validator */ -#ifndef __LIBCAMERA_CONTROL_VALIDATOR_H__ -#define __LIBCAMERA_CONTROL_VALIDATOR_H__ +#ifndef __LIBCAMERA_INTERNAL_CONTROL_VALIDATOR_H__ +#define __LIBCAMERA_INTERNAL_CONTROL_VALIDATOR_H__ #include @@ -24,4 +24,4 @@ public: } /* namespace libcamera */ -#endif /* __LIBCAMERA_CONTROL_VALIDATOR_H__ */ +#endif /* __LIBCAMERA_INTERNAL_CONTROL_VALIDATOR_H__ */ diff --git a/include/libcamera/internal/device_enumerator.h b/include/libcamera/internal/device_enumerator.h index 433e357aebae..25a363086e49 100644 --- a/include/libcamera/internal/device_enumerator.h +++ b/include/libcamera/internal/device_enumerator.h @@ -4,8 +4,8 @@ * * device_enumerator.h - API to enumerate and find media devices */ -#ifndef __LIBCAMERA_DEVICE_ENUMERATOR_H__ -#define __LIBCAMERA_DEVICE_ENUMERATOR_H__ +#ifndef __LIBCAMERA_INTERNAL_DEVICE_ENUMERATOR_H__ +#define __LIBCAMERA_INTERNAL_DEVICE_ENUMERATOR_H__ #include #include @@ -54,4 +54,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_DEVICE_ENUMERATOR_H__ */ +#endif /* __LIBCAMERA_INTERNAL_DEVICE_ENUMERATOR_H__ */ diff --git a/include/libcamera/internal/device_enumerator_sysfs.h b/include/libcamera/internal/device_enumerator_sysfs.h index a63e737a78d5..2112bc543054 100644 --- a/include/libcamera/internal/device_enumerator_sysfs.h +++ b/include/libcamera/internal/device_enumerator_sysfs.h @@ -4,8 +4,8 @@ * * device_enumerator_sysfs.h - sysfs-based device enumerator */ -#ifndef __LIBCAMERA_DEVICE_ENUMERATOR_SYSFS_H__ -#define __LIBCAMERA_DEVICE_ENUMERATOR_SYSFS_H__ +#ifndef __LIBCAMERA_INTERNAL_DEVICE_ENUMERATOR_SYSFS_H__ +#define __LIBCAMERA_INTERNAL_DEVICE_ENUMERATOR_SYSFS_H__ #include #include @@ -29,4 +29,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_DEVICE_ENUMERATOR_SYSFS_H__ */ +#endif /* __LIBCAMERA_INTERNAL_DEVICE_ENUMERATOR_SYSFS_H__ */ diff --git a/include/libcamera/internal/device_enumerator_udev.h b/include/libcamera/internal/device_enumerator_udev.h index fdaa20968ef0..818d8bc71d67 100644 --- a/include/libcamera/internal/device_enumerator_udev.h +++ b/include/libcamera/internal/device_enumerator_udev.h @@ -4,8 +4,8 @@ * * device_enumerator_udev.h - udev-based device enumerator */ -#ifndef __LIBCAMERA_DEVICE_ENUMERATOR_UDEV_H__ -#define __LIBCAMERA_DEVICE_ENUMERATOR_UDEV_H__ +#ifndef __LIBCAMERA_INTERNAL_DEVICE_ENUMERATOR_UDEV_H__ +#define __LIBCAMERA_INTERNAL_DEVICE_ENUMERATOR_UDEV_H__ #include #include @@ -72,4 +72,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_DEVICE_ENUMERATOR_UDEV_H__ */ +#endif /* __LIBCAMERA_INTERNAL_DEVICE_ENUMERATOR_UDEV_H__ */ diff --git a/include/libcamera/internal/event_dispatcher_poll.h b/include/libcamera/internal/event_dispatcher_poll.h index 1f0738617425..fb774efd3d97 100644 --- a/include/libcamera/internal/event_dispatcher_poll.h +++ b/include/libcamera/internal/event_dispatcher_poll.h @@ -4,8 +4,8 @@ * * event_dispatcher_poll.h - Poll-based event dispatcher */ -#ifndef __LIBCAMERA_EVENT_DISPATCHER_POLL_H__ -#define __LIBCAMERA_EVENT_DISPATCHER_POLL_H__ +#ifndef __LIBCAMERA_INTERNAL_EVENT_DISPATCHER_POLL_H__ +#define __LIBCAMERA_INTERNAL_EVENT_DISPATCHER_POLL_H__ #include #include @@ -55,4 +55,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_EVENT_DISPATCHER_POLL_H__ */ +#endif /* __LIBCAMERA_INTERNAL_EVENT_DISPATCHER_POLL_H__ */ diff --git a/include/libcamera/internal/file.h b/include/libcamera/internal/file.h index f020f2ccba1d..e3e72132e336 100644 --- a/include/libcamera/internal/file.h +++ b/include/libcamera/internal/file.h @@ -4,8 +4,8 @@ * * file.h - File I/O operations */ -#ifndef __LIBCAMERA_FILE_H__ -#define __LIBCAMERA_FILE_H__ +#ifndef __LIBCAMERA_INTERNAL_FILE_H__ +#define __LIBCAMERA_INTERNAL_FILE_H__ #include #include @@ -68,4 +68,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_FILE_H__ */ +#endif /* __LIBCAMERA_INTERNAL_FILE_H__ */ diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h index 4455b0f9b050..4b172efc6588 100644 --- a/include/libcamera/internal/formats.h +++ b/include/libcamera/internal/formats.h @@ -5,8 +5,8 @@ * formats.h - libcamera image formats */ -#ifndef __LIBCAMERA_FORMATS_H__ -#define __LIBCAMERA_FORMATS_H__ +#ifndef __LIBCAMERA_INTERNAL_FORMATS_H__ +#define __LIBCAMERA_INTERNAL_FORMATS_H__ #include #include @@ -55,4 +55,4 @@ public: } /* namespace libcamera */ -#endif /* __LIBCAMERA_FORMATS_H__ */ +#endif /* __LIBCAMERA_INTERNAL_FORMATS_H__ */ diff --git a/include/libcamera/internal/ipa_context_wrapper.h b/include/libcamera/internal/ipa_context_wrapper.h index bd770e132c0c..4e6f791d18e6 100644 --- a/include/libcamera/internal/ipa_context_wrapper.h +++ b/include/libcamera/internal/ipa_context_wrapper.h @@ -4,8 +4,8 @@ * * ipa_context_wrapper.h - Image Processing Algorithm context wrapper */ -#ifndef __LIBCAMERA_IPA_CONTEXT_WRAPPER_H__ -#define __LIBCAMERA_IPA_CONTEXT_WRAPPER_H__ +#ifndef __LIBCAMERA_INTERNAL_IPA_CONTEXT_WRAPPER_H__ +#define __LIBCAMERA_INTERNAL_IPA_CONTEXT_WRAPPER_H__ #include @@ -47,4 +47,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_IPA_CONTEXT_WRAPPER_H__ */ +#endif /* __LIBCAMERA_INTERNAL_IPA_CONTEXT_WRAPPER_H__ */ diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h index 2412d75746ac..63430ade8a7a 100644 --- a/include/libcamera/internal/ipa_manager.h +++ b/include/libcamera/internal/ipa_manager.h @@ -4,8 +4,8 @@ * * ipa_manager.h - Image Processing Algorithm module manager */ -#ifndef __LIBCAMERA_IPA_MANAGER_H__ -#define __LIBCAMERA_IPA_MANAGER_H__ +#ifndef __LIBCAMERA_INTERNAL_IPA_MANAGER_H__ +#define __LIBCAMERA_INTERNAL_IPA_MANAGER_H__ #include #include @@ -48,4 +48,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_IPA_MANAGER_H__ */ +#endif /* __LIBCAMERA_INTERNAL_IPA_MANAGER_H__ */ diff --git a/include/libcamera/internal/ipa_module.h b/include/libcamera/internal/ipa_module.h index 5b54cb31a48a..c80aaf46f81b 100644 --- a/include/libcamera/internal/ipa_module.h +++ b/include/libcamera/internal/ipa_module.h @@ -4,8 +4,8 @@ * * ipa_module.h - Image Processing Algorithm module */ -#ifndef __LIBCAMERA_IPA_MODULE_H__ -#define __LIBCAMERA_IPA_MODULE_H__ +#ifndef __LIBCAMERA_INTERNAL_IPA_MODULE_H__ +#define __LIBCAMERA_INTERNAL_IPA_MODULE_H__ #include #include @@ -58,4 +58,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_IPA_MODULE_H__ */ +#endif /* __LIBCAMERA_INTERNAL_IPA_MODULE_H__ */ diff --git a/include/libcamera/internal/ipa_proxy.h b/include/libcamera/internal/ipa_proxy.h index e9a36608bd31..aec8f04ffc15 100644 --- a/include/libcamera/internal/ipa_proxy.h +++ b/include/libcamera/internal/ipa_proxy.h @@ -4,8 +4,8 @@ * * ipa_proxy.h - Image Processing Algorithm proxy */ -#ifndef __LIBCAMERA_IPA_PROXY_H__ -#define __LIBCAMERA_IPA_PROXY_H__ +#ifndef __LIBCAMERA_INTERNAL_IPA_PROXY_H__ +#define __LIBCAMERA_INTERNAL_IPA_PROXY_H__ #include #include @@ -67,4 +67,4 @@ static proxy##Factory global_##proxy##Factory; } /* namespace libcamera */ -#endif /* __LIBCAMERA_IPA_PROXY_H__ */ +#endif /* __LIBCAMERA_INTERNAL_IPA_PROXY_H__ */ diff --git a/include/libcamera/internal/ipc_unixsocket.h b/include/libcamera/internal/ipc_unixsocket.h index 820d05611049..9dcaaa26956d 100644 --- a/include/libcamera/internal/ipc_unixsocket.h +++ b/include/libcamera/internal/ipc_unixsocket.h @@ -5,8 +5,8 @@ * ipc_unixsocket.h - IPC mechanism based on Unix sockets */ -#ifndef __LIBCAMERA_IPC_UNIXSOCKET_H__ -#define __LIBCAMERA_IPC_UNIXSOCKET_H__ +#ifndef __LIBCAMERA_INTERNAL_IPC_UNIXSOCKET_H__ +#define __LIBCAMERA_INTERNAL_IPC_UNIXSOCKET_H__ #include #include @@ -56,4 +56,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_IPC_UNIXSOCKET_H__ */ +#endif /* __LIBCAMERA_INTERNAL_IPC_UNIXSOCKET_H__ */ diff --git a/include/libcamera/internal/log.h b/include/libcamera/internal/log.h index cab2034aae6b..4b10087a4718 100644 --- a/include/libcamera/internal/log.h +++ b/include/libcamera/internal/log.h @@ -4,8 +4,8 @@ * * log.h - Logging infrastructure */ -#ifndef __LIBCAMERA_LOG_H__ -#define __LIBCAMERA_LOG_H__ +#ifndef __LIBCAMERA_INTERNAL_LOG_H__ +#define __LIBCAMERA_INTERNAL_LOG_H__ #include #include @@ -127,4 +127,4 @@ LogMessage _log(const char *file, unsigned int line, } /* namespace libcamera */ -#endif /* __LIBCAMERA_LOG_H__ */ +#endif /* __LIBCAMERA_INTERNAL_LOG_H__ */ diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h index 9fe76c514b17..24093674fe15 100644 --- a/include/libcamera/internal/media_device.h +++ b/include/libcamera/internal/media_device.h @@ -4,8 +4,8 @@ * * media_device.h - Media device handler */ -#ifndef __LIBCAMERA_MEDIA_DEVICE_H__ -#define __LIBCAMERA_MEDIA_DEVICE_H__ +#ifndef __LIBCAMERA_INTERNAL_MEDIA_DEVICE_H__ +#define __LIBCAMERA_INTERNAL_MEDIA_DEVICE_H__ #include #include @@ -91,4 +91,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_MEDIA_DEVICE_H__ */ +#endif /* __LIBCAMERA_INTERNAL_MEDIA_DEVICE_H__ */ diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h index 748eafdc880b..d9b1c19bbf96 100644 --- a/include/libcamera/internal/media_object.h +++ b/include/libcamera/internal/media_object.h @@ -4,8 +4,8 @@ * * media_object.h - Media Device objects: entities, pads and links. */ -#ifndef __LIBCAMERA_MEDIA_OBJECT_H__ -#define __LIBCAMERA_MEDIA_OBJECT_H__ +#ifndef __LIBCAMERA_INTERNAL_MEDIA_OBJECT_H__ +#define __LIBCAMERA_INTERNAL_MEDIA_OBJECT_H__ #include #include @@ -121,4 +121,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_MEDIA_OBJECT_H__ */ +#endif /* __LIBCAMERA_INTERNAL_MEDIA_OBJECT_H__ */ diff --git a/include/libcamera/internal/message.h b/include/libcamera/internal/message.h index 8e8b013dcd18..92ea64a5d714 100644 --- a/include/libcamera/internal/message.h +++ b/include/libcamera/internal/message.h @@ -4,8 +4,8 @@ * * message.h - Message queue support */ -#ifndef __LIBCAMERA_MESSAGE_H__ -#define __LIBCAMERA_MESSAGE_H__ +#ifndef __LIBCAMERA_INTERNAL_MESSAGE_H__ +#define __LIBCAMERA_INTERNAL_MESSAGE_H__ #include @@ -67,4 +67,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_MESSAGE_H__ */ +#endif /* __LIBCAMERA_INTERNAL_MESSAGE_H__ */ diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h index 428f5887c76b..56968d14a6e8 100644 --- a/include/libcamera/internal/pipeline_handler.h +++ b/include/libcamera/internal/pipeline_handler.h @@ -4,8 +4,8 @@ * * pipeline_handler.h - Pipeline handler infrastructure */ -#ifndef __LIBCAMERA_PIPELINE_HANDLER_H__ -#define __LIBCAMERA_PIPELINE_HANDLER_H__ +#ifndef __LIBCAMERA_INTERNAL_PIPELINE_HANDLER_H__ +#define __LIBCAMERA_INTERNAL_PIPELINE_HANDLER_H__ #include #include @@ -148,4 +148,4 @@ static handler##Factory global_##handler##Factory; } /* namespace libcamera */ -#endif /* __LIBCAMERA_PIPELINE_HANDLER_H__ */ +#endif /* __LIBCAMERA_INTERNAL_PIPELINE_HANDLER_H__ */ diff --git a/include/libcamera/internal/process.h b/include/libcamera/internal/process.h index d322fce13ae4..36595106f3b9 100644 --- a/include/libcamera/internal/process.h +++ b/include/libcamera/internal/process.h @@ -4,8 +4,8 @@ * * process.h - Process object */ -#ifndef __LIBCAMERA_PROCESS_H__ -#define __LIBCAMERA_PROCESS_H__ +#ifndef __LIBCAMERA_INTERNAL_PROCESS_H__ +#define __LIBCAMERA_INTERNAL_PROCESS_H__ #include #include @@ -52,4 +52,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_PROCESS_H__ */ +#endif /* __LIBCAMERA_INTERNAL_PROCESS_H__ */ diff --git a/include/libcamera/internal/pub_key.h b/include/libcamera/internal/pub_key.h index f35bf3738c6f..f5f988b58f74 100644 --- a/include/libcamera/internal/pub_key.h +++ b/include/libcamera/internal/pub_key.h @@ -4,8 +4,8 @@ * * pub_key.h - Public key signature verification */ -#ifndef __LIBCAMERA_PUB_KEY_H__ -#define __LIBCAMERA_PUB_KEY_H__ +#ifndef __LIBCAMERA_INTERNAL_PUB_KEY_H__ +#define __LIBCAMERA_INTERNAL_PUB_KEY_H__ #include @@ -35,4 +35,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_PUB_KEY_H__ */ +#endif /* __LIBCAMERA_INTERNAL_PUB_KEY_H__ */ diff --git a/include/libcamera/internal/semaphore.h b/include/libcamera/internal/semaphore.h index 4d93077c776f..9dc65d299cfd 100644 --- a/include/libcamera/internal/semaphore.h +++ b/include/libcamera/internal/semaphore.h @@ -4,8 +4,8 @@ * * semaphore.h - General-purpose counting semaphore */ -#ifndef __LIBCAMERA_SEMAPHORE_H__ -#define __LIBCAMERA_SEMAPHORE_H__ +#ifndef __LIBCAMERA_INTERNAL_SEMAPHORE_H__ +#define __LIBCAMERA_INTERNAL_SEMAPHORE_H__ #include @@ -31,4 +31,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_SEMAPHORE_H__ */ +#endif /* __LIBCAMERA_INTERNAL_SEMAPHORE_H__ */ diff --git a/include/libcamera/internal/thread.h b/include/libcamera/internal/thread.h index 6594c9b06b8d..7b59e583c19f 100644 --- a/include/libcamera/internal/thread.h +++ b/include/libcamera/internal/thread.h @@ -4,8 +4,8 @@ * * thread.h - Thread support */ -#ifndef __LIBCAMERA_THREAD_H__ -#define __LIBCAMERA_THREAD_H__ +#ifndef __LIBCAMERA_INTERNAL_THREAD_H__ +#define __LIBCAMERA_INTERNAL_THREAD_H__ #include #include @@ -74,4 +74,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_THREAD_H__ */ +#endif /* __LIBCAMERA_INTERNAL_THREAD_H__ */ diff --git a/include/libcamera/internal/utils.h b/include/libcamera/internal/utils.h index 3334ff16613d..0953423ee8d0 100644 --- a/include/libcamera/internal/utils.h +++ b/include/libcamera/internal/utils.h @@ -4,8 +4,8 @@ * * utils.h - Miscellaneous utility functions */ -#ifndef __LIBCAMERA_UTILS_H__ -#define __LIBCAMERA_UTILS_H__ +#ifndef __LIBCAMERA_INTERNAL_UTILS_H__ +#define __LIBCAMERA_INTERNAL_UTILS_H__ #include #include @@ -194,4 +194,4 @@ std::string libcameraSourcePath(); } /* namespace libcamera */ -#endif /* __LIBCAMERA_UTILS_H__ */ +#endif /* __LIBCAMERA_INTERNAL_UTILS_H__ */ diff --git a/include/libcamera/internal/v4l2_controls.h b/include/libcamera/internal/v4l2_controls.h index cffe9efd9919..0851b8ddb128 100644 --- a/include/libcamera/internal/v4l2_controls.h +++ b/include/libcamera/internal/v4l2_controls.h @@ -5,8 +5,8 @@ * v4l2_controls.h - V4L2 Controls Support */ -#ifndef __LIBCAMERA_V4L2_CONTROLS_H__ -#define __LIBCAMERA_V4L2_CONTROLS_H__ +#ifndef __LIBCAMERA_INTERNAL_V4L2_CONTROLS_H__ +#define __LIBCAMERA_INTERNAL_V4L2_CONTROLS_H__ #include @@ -28,4 +28,4 @@ public: } /* namespace libcamera */ -#endif /* __LIBCAMERA_V4L2_CONTROLS_H__ */ +#endif /* __LIBCAMERA_INTERNAL_V4L2_CONTROLS_H__ */ diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h index d491eafd262e..bf643f2ec966 100644 --- a/include/libcamera/internal/v4l2_device.h +++ b/include/libcamera/internal/v4l2_device.h @@ -4,8 +4,8 @@ * * v4l2_device.h - Common base for V4L2 video devices and subdevices */ -#ifndef __LIBCAMERA_V4L2_DEVICE_H__ -#define __LIBCAMERA_V4L2_DEVICE_H__ +#ifndef __LIBCAMERA_INTERNAL_V4L2_DEVICE_H__ +#define __LIBCAMERA_INTERNAL_V4L2_DEVICE_H__ #include #include @@ -57,4 +57,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_V4L2_DEVICE_H__ */ +#endif /* __LIBCAMERA_INTERNAL_V4L2_DEVICE_H__ */ diff --git a/include/libcamera/internal/v4l2_pixelformat.h b/include/libcamera/internal/v4l2_pixelformat.h index 4d0e034b8b51..9bfd81ad6651 100644 --- a/include/libcamera/internal/v4l2_pixelformat.h +++ b/include/libcamera/internal/v4l2_pixelformat.h @@ -5,8 +5,8 @@ * * v4l2_pixelformat.h - V4L2 Pixel Format */ -#ifndef __LIBCAMERA_V4L2_PIXELFORMAT_H__ -#define __LIBCAMERA_V4L2_PIXELFORMAT_H__ +#ifndef __LIBCAMERA_INTERNAL_V4L2_PIXELFORMAT_H__ +#define __LIBCAMERA_INTERNAL_V4L2_PIXELFORMAT_H__ #include #include @@ -46,4 +46,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_V4L2_PIXELFORMAT_H__ */ +#endif /* __LIBCAMERA_INTERNAL_V4L2_PIXELFORMAT_H__ */ diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h index 1be454f0ddda..8016fa5da68c 100644 --- a/include/libcamera/internal/v4l2_subdevice.h +++ b/include/libcamera/internal/v4l2_subdevice.h @@ -4,8 +4,8 @@ * * v4l2_subdevice.h - V4L2 Subdevice */ -#ifndef __LIBCAMERA_V4L2_SUBDEVICE_H__ -#define __LIBCAMERA_V4L2_SUBDEVICE_H__ +#ifndef __LIBCAMERA_INTERNAL_V4L2_SUBDEVICE_H__ +#define __LIBCAMERA_INTERNAL_V4L2_SUBDEVICE_H__ #include #include @@ -74,4 +74,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_V4L2_SUBDEVICE_H__ */ +#endif /* __LIBCAMERA_INTERNAL_V4L2_SUBDEVICE_H__ */ diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h index c93cf816373b..29d819a8dacd 100644 --- a/include/libcamera/internal/v4l2_videodevice.h +++ b/include/libcamera/internal/v4l2_videodevice.h @@ -4,8 +4,8 @@ * * v4l2_videodevice.h - V4L2 Video Device */ -#ifndef __LIBCAMERA_V4L2_VIDEODEVICE_H__ -#define __LIBCAMERA_V4L2_VIDEODEVICE_H__ +#ifndef __LIBCAMERA_INTERNAL_V4L2_VIDEODEVICE_H__ +#define __LIBCAMERA_INTERNAL_V4L2_VIDEODEVICE_H__ #include #include @@ -274,4 +274,4 @@ private: } /* namespace libcamera */ -#endif /* __LIBCAMERA_V4L2_VIDEODEVICE_H__ */ +#endif /* __LIBCAMERA_INTERNAL_V4L2_VIDEODEVICE_H__ */ From patchwork Fri May 22 14:54:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3844 Return-Path: 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 D026261093 for ; Fri, 22 May 2020 16:55:20 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="c+cmQMQB"; dkim-atps=neutral Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 65EC5528 for ; Fri, 22 May 2020 16:55:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1590159320; bh=EjaHA3mCUC1q9lumqgXwfmJ5iTZYRoYKvTME5PCWUtk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=c+cmQMQBkzGBSdWJzD9AkdBoLq8+tEiZvZ71h7GGhVxEejSYRL4K+I1iC6HyEBywf 3dIiG8o2BRlY1NVeHDNs8m07qiuB7wO1wPpUqVJbrCZlkVmffi1cVW0sbVYF3XMGVd TJrwMoD8tfBr2Y8vHvz93LCpLBLcsrD9Q7Wk6Oco= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 22 May 2020 17:54:52 +0300 Message-Id: <20200522145459.16836-6-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> References: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH/RFC 04/11] libcamera: pixel_format: Make PixelFormat usable as a constexpr 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, 22 May 2020 14:55:24 -0000 The PixelFormat class is a lightweight wrapper around a 32-bit FourCC and a 64-bit modifier. Make is usable as a constexpr. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Niklas Söderlund --- include/libcamera/pixel_format.h | 19 +++++++++++++------ src/libcamera/pixel_format.cpp | 10 ++-------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/libcamera/pixel_format.h b/include/libcamera/pixel_format.h index e3b371ef92bb..8dfeb8922418 100644 --- a/include/libcamera/pixel_format.h +++ b/include/libcamera/pixel_format.h @@ -18,18 +18,25 @@ namespace libcamera { class PixelFormat { public: - PixelFormat(); - explicit PixelFormat(uint32_t fourcc, uint64_t modifier = 0); + constexpr PixelFormat() + : fourcc_(0), modifier_(0) + { + } + + explicit constexpr PixelFormat(uint32_t fourcc, uint64_t modifier = 0) + : fourcc_(fourcc), modifier_(modifier) + { + } bool operator==(const PixelFormat &other) const; bool operator!=(const PixelFormat &other) const { return !(*this == other); } bool operator<(const PixelFormat &other) const; - bool isValid() const { return fourcc_ != 0; } + constexpr bool isValid() const { return fourcc_ != 0; } - operator uint32_t() const { return fourcc_; } - uint32_t fourcc() const { return fourcc_; } - uint64_t modifier() const { return modifier_; } + constexpr operator uint32_t() const { return fourcc_; } + constexpr uint32_t fourcc() const { return fourcc_; } + constexpr uint64_t modifier() const { return modifier_; } std::string toString() const; diff --git a/src/libcamera/pixel_format.cpp b/src/libcamera/pixel_format.cpp index d8718739152d..d501c5f09c6b 100644 --- a/src/libcamera/pixel_format.cpp +++ b/src/libcamera/pixel_format.cpp @@ -25,25 +25,19 @@ namespace libcamera { */ /** + * \fn PixelFormat::PixelFormat() * \brief Construct a PixelFormat with an invalid format * * PixelFormat instances constructed with the default constructor are * invalid, calling the isValid() function returns false. */ -PixelFormat::PixelFormat() - : fourcc_(0) -{ -} /** + * \fn PixelFormat::PixelFormat(uint32_t fourcc, uint64_t modifier) * \brief Construct a PixelFormat from a DRM FourCC and a modifier * \param[in] fourcc A DRM FourCC * \param[in] modifier A DRM FourCC modifier */ -PixelFormat::PixelFormat(uint32_t fourcc, uint64_t modifier) - : fourcc_(fourcc), modifier_(modifier) -{ -} /** * \brief Compare pixel formats for equality From patchwork Fri May 22 14:54:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3845 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1AD156109B for ; Fri, 22 May 2020 16:55:21 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ctUN9YJq"; dkim-atps=neutral Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B664624D for ; Fri, 22 May 2020 16:55:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1590159320; bh=o0cFGE0QnKfZi5QmFcBBYOTZoLQkGPzfoafuTZJGCE4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ctUN9YJqjIZqufbZ+EC81McZAGsYfa5jOV4xhIgm0mvEFHTbjJ8mmdXV7yZm4VuFC PzyGeWxC+tctG/mg1lZckWqClhiyKpAXfjhpdFmU7hhdBOzvB3PXLRQVI3MEAC2C/v kvfc54LitJ1TTETRnnY7H0sopw5dRmjD3ElpyYD4= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 22 May 2020 17:54:53 +0300 Message-Id: <20200522145459.16836-7-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> References: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH/RFC 05/11] libcamera: Define constants for pixel formats in the public API 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, 22 May 2020 14:55:24 -0000 libcamera uses pixel format FourCC and modifier values from DRM. This requires inclusion of drm_fourcc.h, creating a dependency on a header that is packaged differently between distributions, and causing possible issues with third-party applications. Define constants for the supported pixel formats in the public API, in order to remove the dependency on drm_fourcc.h. The numerical values are still identical to the DRM pixel formats, keeping the direct interoperability. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- include/libcamera/formats.h | 94 ++++++++++++++++++++++++++++++++++ include/libcamera/meson.build | 1 + src/libcamera/formats.cpp | 2 +- src/libcamera/pixel_format.cpp | 1 + 4 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 include/libcamera/formats.h diff --git a/include/libcamera/formats.h b/include/libcamera/formats.h new file mode 100644 index 000000000000..bd164226d712 --- /dev/null +++ b/include/libcamera/formats.h @@ -0,0 +1,94 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2020, Google Inc. + * + * formats.h - Formats + */ +#ifndef __LIBCAMERA_FORMATS_H__ +#define __LIBCAMERA_FORMATS_H__ + +#include + +#include + +namespace libcamera { + +namespace formats { + +namespace { + +constexpr uint32_t __fourcc(char a, char b, char c, char d) +{ + return (static_cast(a) << 0) | + (static_cast(b) << 8) | + (static_cast(c) << 16) | + (static_cast(d) << 24); +} + +constexpr uint64_t __mod(unsigned int vendor, unsigned int mod) +{ + return (static_cast(vendor) << 56) | + (static_cast(mod) << 0); +} + +} /* namespace */ + +constexpr PixelFormat R8{ __fourcc('R', '8', ' ', ' ') }; + +constexpr PixelFormat RGB888{ __fourcc('R', 'G', '2', '4') }; +constexpr PixelFormat BGR888{ __fourcc('B', 'G', '2', '4') }; + +constexpr PixelFormat XRGB8888{ __fourcc('X', 'R', '2', '4') }; +constexpr PixelFormat XBGR8888{ __fourcc('X', 'B', '2', '4') }; +constexpr PixelFormat RGBX8888{ __fourcc('R', 'X', '2', '4') }; +constexpr PixelFormat BGRX8888{ __fourcc('B', 'X', '2', '4') }; + +constexpr PixelFormat ARGB8888{ __fourcc('A', 'R', '2', '4') }; +constexpr PixelFormat ABGR8888{ __fourcc('A', 'B', '2', '4') }; +constexpr PixelFormat RGBA8888{ __fourcc('R', 'A', '2', '4') }; +constexpr PixelFormat BGRA8888{ __fourcc('B', 'A', '2', '4') }; + +constexpr PixelFormat YUYV{ __fourcc('Y', 'U', 'Y', 'V') }; +constexpr PixelFormat YVYU{ __fourcc('Y', 'V', 'Y', 'U') }; +constexpr PixelFormat UYVY{ __fourcc('U', 'Y', 'V', 'Y') }; +constexpr PixelFormat VYUY{ __fourcc('V', 'Y', 'U', 'Y') }; + +constexpr PixelFormat NV12{ __fourcc('N', 'V', '1', '2') }; +constexpr PixelFormat NV21{ __fourcc('N', 'V', '2', '1') }; +constexpr PixelFormat NV16{ __fourcc('N', 'V', '1', '6') }; +constexpr PixelFormat NV61{ __fourcc('N', 'V', '6', '1') }; +constexpr PixelFormat NV24{ __fourcc('N', 'V', '2', '4') }; +constexpr PixelFormat NV42{ __fourcc('N', 'V', '4', '2') }; + +constexpr PixelFormat MJPEG{ __fourcc('M', 'J', 'P', 'G') }; + +constexpr PixelFormat SRGGB8{ __fourcc('R', 'G', 'G', 'B') }; +constexpr PixelFormat SGRBG8{ __fourcc('G', 'R', 'B', 'G') }; +constexpr PixelFormat SGBRG8{ __fourcc('G', 'B', 'R', 'G') }; +constexpr PixelFormat SBGGR8{ __fourcc('B', 'A', '8', '1') }; + +constexpr PixelFormat SRGGB10{ __fourcc('R', 'G', '1', '0') }; +constexpr PixelFormat SGRBG10{ __fourcc('B', 'A', '1', '0') }; +constexpr PixelFormat SGBRG10{ __fourcc('G', 'B', '1', '0') }; +constexpr PixelFormat SBGGR10{ __fourcc('B', 'G', '1', '0') }; + +constexpr PixelFormat SRGGB12{ __fourcc('R', 'G', '1', '2') }; +constexpr PixelFormat SGRBG12{ __fourcc('B', 'A', '1', '2') }; +constexpr PixelFormat SGBRG12{ __fourcc('G', 'B', '1', '2') }; +constexpr PixelFormat SBGGR12{ __fourcc('B', 'G', '1', '2') }; + +constexpr PixelFormat SRGGB10_CSI2P{ __fourcc('R', 'G', '1', '0'), __mod(10, 1) }; +constexpr PixelFormat SGRBG10_CSI2P{ __fourcc('B', 'A', '1', '0'), __mod(10, 1) }; +constexpr PixelFormat SGBRG10_CSI2P{ __fourcc('G', 'B', '1', '0'), __mod(10, 1) }; +constexpr PixelFormat SBGGR10_CSI2P{ __fourcc('B', 'G', '1', '0'), __mod(10, 1) }; + +constexpr PixelFormat SRGGB12_CSI2P{ __fourcc('R', 'G', '1', '2'), __mod(10, 1) }; +constexpr PixelFormat SGRBG12_CSI2P{ __fourcc('B', 'A', '1', '2'), __mod(10, 1) }; +constexpr PixelFormat SGBRG12_CSI2P{ __fourcc('G', 'B', '1', '2'), __mod(10, 1) }; +constexpr PixelFormat SBGGR12_CSI2P{ __fourcc('B', 'G', '1', '2'), __mod(10, 1) }; + +} /* namespace formats */ + +} /* namespace libcamera */ + +#endif /* __LIBCAMERA_FORMATS_H__ */ diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build index 73c5b999acf4..170744d0fbbc 100644 --- a/include/libcamera/meson.build +++ b/include/libcamera/meson.build @@ -9,6 +9,7 @@ libcamera_public_headers = files([ 'event_dispatcher.h', 'event_notifier.h', 'file_descriptor.h', + 'formats.h', 'framebuffer_allocator.h', 'geometry.h', 'logging.h', diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp index 2ac3b412ecdb..74c239a5e710 100644 --- a/src/libcamera/formats.cpp +++ b/src/libcamera/formats.cpp @@ -12,7 +12,7 @@ #include "libcamera/internal/log.h" /** - * \file formats.h + * \file internal/formats.h * \brief Types and helper methods to handle libcamera image formats */ diff --git a/src/libcamera/pixel_format.cpp b/src/libcamera/pixel_format.cpp index d501c5f09c6b..0709d1526b82 100644 --- a/src/libcamera/pixel_format.cpp +++ b/src/libcamera/pixel_format.cpp @@ -5,6 +5,7 @@ * pixel_format.cpp - libcamera Pixel Format */ +#include #include /** From patchwork Fri May 22 14:54:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3846 Return-Path: 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 73F136108A for ; Fri, 22 May 2020 16:55:21 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="GDt27NM1"; dkim-atps=neutral Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0FE1D528 for ; Fri, 22 May 2020 16:55:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1590159321; bh=xu8GOP5HbBM65fpE8v4RrcN9ikFEEfRvQ98iksGeDXg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GDt27NM1K4Cw82s4uuInfQ6XWkw65qU86M5OUjo+Zd9cjqi3fXVnlosGxxCcFyIsP FfXDD1zWnA+20BJhkPs/J/6MxaBYRzKRgvoct+j0NLi48CC5nOmFfY/ZyNKxn0Mbaw jb0SMkVzydEhBlib8scQWHmxQXYFxfnA1pQuUzbg= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 22 May 2020 17:54:54 +0300 Message-Id: <20200522145459.16836-8-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> References: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH/RFC 06/11] gst: Replace explicit DRM FourCCs with libcamera formats 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, 22 May 2020 14:55:24 -0000 Use the new pixel format constants to replace usage of macros from drm_fourcc.h. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/gstreamer/gstlibcamera-utils.cpp | 62 ++++++++++++++-------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp index a3cb0746e012..61370d5fad56 100644 --- a/src/gstreamer/gstlibcamera-utils.cpp +++ b/src/gstreamer/gstlibcamera-utils.cpp @@ -8,56 +8,56 @@ #include "gstlibcamera-utils.h" -#include +#include using namespace libcamera; static struct { GstVideoFormat gst_format; - guint drm_fourcc; + PixelFormat format; } format_map[] = { - { GST_VIDEO_FORMAT_ENCODED, DRM_FORMAT_MJPEG }, - { GST_VIDEO_FORMAT_RGB, DRM_FORMAT_BGR888 }, - { GST_VIDEO_FORMAT_BGR, DRM_FORMAT_RGB888 }, - { GST_VIDEO_FORMAT_ARGB, DRM_FORMAT_BGRA8888 }, - { GST_VIDEO_FORMAT_NV12, DRM_FORMAT_NV12 }, - { GST_VIDEO_FORMAT_NV21, DRM_FORMAT_NV21 }, - { GST_VIDEO_FORMAT_NV16, DRM_FORMAT_NV16 }, - { GST_VIDEO_FORMAT_NV61, DRM_FORMAT_NV61 }, - { GST_VIDEO_FORMAT_NV24, DRM_FORMAT_NV24 }, - { GST_VIDEO_FORMAT_UYVY, DRM_FORMAT_UYVY }, - { GST_VIDEO_FORMAT_VYUY, DRM_FORMAT_VYUY }, - { GST_VIDEO_FORMAT_YUY2, DRM_FORMAT_YUYV }, - { GST_VIDEO_FORMAT_YVYU, DRM_FORMAT_YVYU }, + { GST_VIDEO_FORMAT_ENCODED, formats::MJPEG }, + { GST_VIDEO_FORMAT_RGB, formats::BGR888 }, + { GST_VIDEO_FORMAT_BGR, formats::RGB888 }, + { GST_VIDEO_FORMAT_ARGB, formats::BGRA8888 }, + { GST_VIDEO_FORMAT_NV12, formats::NV12 }, + { GST_VIDEO_FORMAT_NV21, formats::NV21 }, + { GST_VIDEO_FORMAT_NV16, formats::NV16 }, + { GST_VIDEO_FORMAT_NV61, formats::NV61 }, + { GST_VIDEO_FORMAT_NV24, formats::NV24 }, + { GST_VIDEO_FORMAT_UYVY, formats::UYVY }, + { GST_VIDEO_FORMAT_VYUY, formats::VYUY }, + { GST_VIDEO_FORMAT_YUY2, formats::YUYV }, + { GST_VIDEO_FORMAT_YVYU, formats::YVYU }, /* \todo NV42 is used in libcamera but is not mapped in GStreamer yet. */ }; static GstVideoFormat -drm_to_gst_format(guint drm_fourcc) +pixel_format_to_gst_format(const PixelFormat &format) { for (const auto &item : format_map) { - if (item.drm_fourcc == drm_fourcc) + if (item.format == format) return item.gst_format; } return GST_VIDEO_FORMAT_UNKNOWN; } -static guint -gst_format_to_drm(GstVideoFormat gst_format) +static PixelFormat +gst_format_to_pixel_format(GstVideoFormat gst_format) { if (gst_format == GST_VIDEO_FORMAT_ENCODED) - return DRM_FORMAT_INVALID; + return PixelFormat{}; for (const auto &item : format_map) if (item.gst_format == gst_format) - return item.drm_fourcc; - return DRM_FORMAT_INVALID; + return item.format; + return PixelFormat{}; } static GstStructure * -bare_structure_from_fourcc(guint fourcc) +bare_structure_from_format(const PixelFormat &format) { - GstVideoFormat gst_format = drm_to_gst_format(fourcc); + GstVideoFormat gst_format = pixel_format_to_gst_format(format); if (gst_format == GST_VIDEO_FORMAT_UNKNOWN) return nullptr; @@ -66,8 +66,8 @@ bare_structure_from_fourcc(guint fourcc) return gst_structure_new("video/x-raw", "format", G_TYPE_STRING, gst_video_format_to_string(gst_format), nullptr); - switch (fourcc) { - case DRM_FORMAT_MJPEG: + switch (format) { + case formats::MJPEG: return gst_structure_new_empty("image/jpeg"); default: return nullptr; @@ -80,7 +80,7 @@ gst_libcamera_stream_formats_to_caps(const StreamFormats &formats) GstCaps *caps = gst_caps_new_empty(); for (PixelFormat pixelformat : formats.pixelformats()) { - g_autoptr(GstStructure) bare_s = bare_structure_from_fourcc(pixelformat); + g_autoptr(GstStructure) bare_s = bare_structure_from_format(pixelformat); if (!bare_s) { GST_WARNING("Unsupported DRM format %" GST_FOURCC_FORMAT, @@ -120,7 +120,7 @@ GstCaps * gst_libcamera_stream_configuration_to_caps(const StreamConfiguration &stream_cfg) { GstCaps *caps = gst_caps_new_empty(); - GstStructure *s = bare_structure_from_fourcc(stream_cfg.pixelFormat); + GstStructure *s = bare_structure_from_format(stream_cfg.pixelFormat); gst_structure_set(s, "width", G_TYPE_INT, stream_cfg.size.width, @@ -135,7 +135,7 @@ void gst_libcamera_configure_stream_from_caps(StreamConfiguration &stream_cfg, GstCaps *caps) { - GstVideoFormat gst_format = drm_to_gst_format(stream_cfg.pixelFormat); + GstVideoFormat gst_format = pixel_format_to_gst_format(stream_cfg.pixelFormat); /* First fixate the caps using default configuration value. */ g_assert(gst_caps_is_writable(caps)); @@ -154,9 +154,9 @@ gst_libcamera_configure_stream_from_caps(StreamConfiguration &stream_cfg, if (gst_structure_has_name(s, "video/x-raw")) { const gchar *format = gst_structure_get_string(s, "format"); gst_format = gst_video_format_from_string(format); - stream_cfg.pixelFormat = PixelFormat(gst_format_to_drm(gst_format)); + stream_cfg.pixelFormat = gst_format_to_pixel_format(gst_format); } else if (gst_structure_has_name(s, "image/jpeg")) { - stream_cfg.pixelFormat = PixelFormat(DRM_FORMAT_MJPEG); + stream_cfg.pixelFormat = formats::MJPEG; } else { g_critical("Unsupported media type: %s", gst_structure_get_name(s)); } From patchwork Fri May 22 14:54:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3847 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DC216610A5 for ; Fri, 22 May 2020 16:55:21 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="qyV2CUbI"; dkim-atps=neutral Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 850FA24D for ; Fri, 22 May 2020 16:55:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1590159321; bh=APopVhowemftgOb84BkW+32SjbNmvPM+X1kozn6VODY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qyV2CUbIzUuu0tFVtk0liO+U74SnLYbeZQ1Cxq9GIfU9TLNeb8js7BcWeO5uRP0qo qPmW2kwrEhvMBuxi1jTTVTfw8wHzjxRFFALfBBiFyioEsxIN1aU4R70KQbbOAkeLRY 593WakXupQUzObAxJ8EKW1FOE+kdssAZWThdvWZM= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 22 May 2020 17:54:55 +0300 Message-Id: <20200522145459.16836-9-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> References: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH/RFC 07/11] qcam: Replace explicit DRM FourCCs with libcamera formats 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, 22 May 2020 14:55:24 -0000 Use the new pixel format constants to replace usage of macros from drm_fourcc.h. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/qcam/dng_writer.cpp | 17 +++++++++-------- src/qcam/format_converter.cpp | 36 ++++++++++++++++++----------------- src/qcam/viewfinder.cpp | 10 ++++++---- 3 files changed, 34 insertions(+), 29 deletions(-) diff --git a/src/qcam/dng_writer.cpp b/src/qcam/dng_writer.cpp index cbd8bed3e6d0..1aa2eaa9a501 100644 --- a/src/qcam/dng_writer.cpp +++ b/src/qcam/dng_writer.cpp @@ -14,6 +14,7 @@ #include #include +#include using namespace libcamera; @@ -83,49 +84,49 @@ void thumbScanlineSBGGRxxP(const FormatInfo &info, void *output, } static const std::map formatInfo = { - { PixelFormat(DRM_FORMAT_SBGGR10, MIPI_FORMAT_MOD_CSI2_PACKED), { + { formats::SBGGR10_CSI2P, { .bitsPerSample = 10, .pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed }, .packScanline = packScanlineSBGGR10P, .thumbScanline = thumbScanlineSBGGRxxP, } }, - { PixelFormat(DRM_FORMAT_SGBRG10, MIPI_FORMAT_MOD_CSI2_PACKED), { + { formats::SGBRG10_CSI2P, { .bitsPerSample = 10, .pattern = { CFAPatternGreen, CFAPatternBlue, CFAPatternRed, CFAPatternGreen }, .packScanline = packScanlineSBGGR10P, .thumbScanline = thumbScanlineSBGGRxxP, } }, - { PixelFormat(DRM_FORMAT_SGRBG10, MIPI_FORMAT_MOD_CSI2_PACKED), { + { formats::SGRBG10_CSI2P, { .bitsPerSample = 10, .pattern = { CFAPatternGreen, CFAPatternRed, CFAPatternBlue, CFAPatternGreen }, .packScanline = packScanlineSBGGR10P, .thumbScanline = thumbScanlineSBGGRxxP, } }, - { PixelFormat(DRM_FORMAT_SRGGB10, MIPI_FORMAT_MOD_CSI2_PACKED), { + { formats::SRGGB10_CSI2P, { .bitsPerSample = 10, .pattern = { CFAPatternRed, CFAPatternGreen, CFAPatternGreen, CFAPatternBlue }, .packScanline = packScanlineSBGGR10P, .thumbScanline = thumbScanlineSBGGRxxP, } }, - { PixelFormat(DRM_FORMAT_SBGGR12, MIPI_FORMAT_MOD_CSI2_PACKED), { + { formats::SBGGR12_CSI2P, { .bitsPerSample = 12, .pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed }, .packScanline = packScanlineSBGGR12P, .thumbScanline = thumbScanlineSBGGRxxP, } }, - { PixelFormat(DRM_FORMAT_SGBRG12, MIPI_FORMAT_MOD_CSI2_PACKED), { + { formats::SGBRG12_CSI2P, { .bitsPerSample = 12, .pattern = { CFAPatternGreen, CFAPatternBlue, CFAPatternRed, CFAPatternGreen }, .packScanline = packScanlineSBGGR12P, .thumbScanline = thumbScanlineSBGGRxxP, } }, - { PixelFormat(DRM_FORMAT_SGRBG12, MIPI_FORMAT_MOD_CSI2_PACKED), { + { formats::SGRBG12_CSI2P, { .bitsPerSample = 12, .pattern = { CFAPatternGreen, CFAPatternRed, CFAPatternBlue, CFAPatternGreen }, .packScanline = packScanlineSBGGR12P, .thumbScanline = thumbScanlineSBGGRxxP, } }, - { PixelFormat(DRM_FORMAT_SRGGB12, MIPI_FORMAT_MOD_CSI2_PACKED), { + { formats::SRGGB12_CSI2P, { .bitsPerSample = 12, .pattern = { CFAPatternRed, CFAPatternGreen, CFAPatternGreen, CFAPatternBlue }, .packScanline = packScanlineSBGGR12P, diff --git a/src/qcam/format_converter.cpp b/src/qcam/format_converter.cpp index bf887ad446eb..4b9722d4ecf7 100644 --- a/src/qcam/format_converter.cpp +++ b/src/qcam/format_converter.cpp @@ -11,6 +11,8 @@ #include +#include + #define RGBSHIFT 8 #ifndef MAX #define MAX(a,b) ((a)>(b)?(a):(b)) @@ -29,79 +31,79 @@ int FormatConverter::configure(const libcamera::PixelFormat &format, const QSize &size) { switch (format) { - case DRM_FORMAT_NV12: + case libcamera::formats::NV12: formatFamily_ = NV; horzSubSample_ = 2; vertSubSample_ = 2; nvSwap_ = false; break; - case DRM_FORMAT_NV21: + case libcamera::formats::NV21: formatFamily_ = NV; horzSubSample_ = 2; vertSubSample_ = 2; nvSwap_ = true; break; - case DRM_FORMAT_NV16: + case libcamera::formats::NV16: formatFamily_ = NV; horzSubSample_ = 2; vertSubSample_ = 1; nvSwap_ = false; break; - case DRM_FORMAT_NV61: + case libcamera::formats::NV61: formatFamily_ = NV; horzSubSample_ = 2; vertSubSample_ = 1; nvSwap_ = true; break; - case DRM_FORMAT_NV24: + case libcamera::formats::NV24: formatFamily_ = NV; horzSubSample_ = 1; vertSubSample_ = 1; nvSwap_ = false; break; - case DRM_FORMAT_NV42: + case libcamera::formats::NV42: formatFamily_ = NV; horzSubSample_ = 1; vertSubSample_ = 1; nvSwap_ = true; break; - case DRM_FORMAT_RGB888: + case libcamera::formats::RGB888: formatFamily_ = RGB; r_pos_ = 2; g_pos_ = 1; b_pos_ = 0; bpp_ = 3; break; - case DRM_FORMAT_BGR888: + case libcamera::formats::BGR888: formatFamily_ = RGB; r_pos_ = 0; g_pos_ = 1; b_pos_ = 2; bpp_ = 3; break; - case DRM_FORMAT_ARGB8888: + case libcamera::formats::ARGB8888: formatFamily_ = RGB; r_pos_ = 2; g_pos_ = 1; b_pos_ = 0; bpp_ = 4; break; - case DRM_FORMAT_RGBA8888: + case libcamera::formats::RGBA8888: formatFamily_ = RGB; r_pos_ = 3; g_pos_ = 2; b_pos_ = 1; bpp_ = 4; break; - case DRM_FORMAT_ABGR8888: + case libcamera::formats::ABGR8888: formatFamily_ = RGB; r_pos_ = 0; g_pos_ = 1; b_pos_ = 2; bpp_ = 4; break; - case DRM_FORMAT_BGRA8888: + case libcamera::formats::BGRA8888: formatFamily_ = RGB; r_pos_ = 1; g_pos_ = 2; @@ -109,28 +111,28 @@ int FormatConverter::configure(const libcamera::PixelFormat &format, bpp_ = 4; break; - case DRM_FORMAT_VYUY: + case libcamera::formats::VYUY: formatFamily_ = YUV; y_pos_ = 1; cb_pos_ = 2; break; - case DRM_FORMAT_YVYU: + case libcamera::formats::YVYU: formatFamily_ = YUV; y_pos_ = 0; cb_pos_ = 3; break; - case DRM_FORMAT_UYVY: + case libcamera::formats::UYVY: formatFamily_ = YUV; y_pos_ = 1; cb_pos_ = 0; break; - case DRM_FORMAT_YUYV: + case libcamera::formats::YUYV: formatFamily_ = YUV; y_pos_ = 0; cb_pos_ = 1; break; - case DRM_FORMAT_MJPEG: + case libcamera::formats::MJPEG: formatFamily_ = MJPEG; break; diff --git a/src/qcam/viewfinder.cpp b/src/qcam/viewfinder.cpp index 0d68f62ee6d7..ac83d7e6c397 100644 --- a/src/qcam/viewfinder.cpp +++ b/src/qcam/viewfinder.cpp @@ -17,18 +17,20 @@ #include #include +#include + #include "format_converter.h" static const QMap nativeFormats { #if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) - { libcamera::PixelFormat{ DRM_FORMAT_ABGR8888 }, QImage::Format_RGBA8888 }, + { libcamera::formats::ABGR8888, QImage::Format_RGBA8888 }, #endif - { libcamera::PixelFormat{ DRM_FORMAT_ARGB8888 }, QImage::Format_RGB32 }, + { libcamera::formats::ARGB8888, QImage::Format_RGB32 }, #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) - { libcamera::PixelFormat{ DRM_FORMAT_BGR888 }, QImage::Format_BGR888 }, + { libcamera::formats::BGR888, QImage::Format_BGR888 }, #endif - { libcamera::PixelFormat{ DRM_FORMAT_RGB888 }, QImage::Format_RGB888 }, + { libcamera::formats::RGB888, QImage::Format_RGB888 }, }; ViewFinder::ViewFinder(QWidget *parent) From patchwork Fri May 22 14:54:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3848 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 35F1661080 for ; Fri, 22 May 2020 16:55:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="nDYkLPS8"; dkim-atps=neutral Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D2237528 for ; Fri, 22 May 2020 16:55:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1590159322; bh=LV6EivWD6EkXkHQJ2rEecT0NHLBMB4eBAWio0Aia/HI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=nDYkLPS8wYDK+B3D3AcH3rLbfViO+U6yLl2l/6QiDEVd1+jcLa6+8RCrgLt3qCKTE LbmpbAm4cmznA6hPDB8cmxosIKcveu9c0OK+KeU+IUMqp/K8w6yonEz/SXykAf/mKb 4nsoFlIJCV3CInUVVt/MTDQY+rpVtWz6qJCVeIHI= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 22 May 2020 17:54:56 +0300 Message-Id: <20200522145459.16836-10-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> References: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH/RFC 08/11] v4l2: Replace explicit DRM FourCCs with libcamera formats 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, 22 May 2020 14:55:25 -0000 Use the new pixel format constants to replace usage of macros from drm_fourcc.h. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/v4l2/v4l2_camera_proxy.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp index 19e8f6d3b98d..f440882aae00 100644 --- a/src/v4l2/v4l2_camera_proxy.cpp +++ b/src/v4l2/v4l2_camera_proxy.cpp @@ -15,6 +15,7 @@ #include #include +#include #include #include "libcamera/internal/log.h" @@ -536,21 +537,21 @@ namespace { static const std::array pixelFormatInfo = {{ /* RGB formats. */ - { PixelFormat(DRM_FORMAT_RGB888), V4L2_PIX_FMT_BGR24, 1, {{ { 24, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} }, - { PixelFormat(DRM_FORMAT_BGR888), V4L2_PIX_FMT_RGB24, 1, {{ { 24, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} }, - { PixelFormat(DRM_FORMAT_BGRA8888), V4L2_PIX_FMT_ARGB32, 1, {{ { 32, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} }, + { formats::RGB888, V4L2_PIX_FMT_BGR24, 1, {{ { 24, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} }, + { formats::BGR888, V4L2_PIX_FMT_RGB24, 1, {{ { 24, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} }, + { formats::BGRA8888, V4L2_PIX_FMT_ARGB32, 1, {{ { 32, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} }, /* YUV packed formats. */ - { PixelFormat(DRM_FORMAT_UYVY), V4L2_PIX_FMT_UYVY, 1, {{ { 16, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} }, - { PixelFormat(DRM_FORMAT_VYUY), V4L2_PIX_FMT_VYUY, 1, {{ { 16, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} }, - { PixelFormat(DRM_FORMAT_YUYV), V4L2_PIX_FMT_YUYV, 1, {{ { 16, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} }, - { PixelFormat(DRM_FORMAT_YVYU), V4L2_PIX_FMT_YVYU, 1, {{ { 16, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} }, + { formats::UYVY, V4L2_PIX_FMT_UYVY, 1, {{ { 16, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} }, + { formats::VYUY, V4L2_PIX_FMT_VYUY, 1, {{ { 16, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} }, + { formats::YUYV, V4L2_PIX_FMT_YUYV, 1, {{ { 16, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} }, + { formats::YVYU, V4L2_PIX_FMT_YVYU, 1, {{ { 16, 1, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }} }, /* YUY planar formats. */ - { PixelFormat(DRM_FORMAT_NV12), V4L2_PIX_FMT_NV12, 2, {{ { 8, 1, 1 }, { 16, 2, 2 }, { 0, 0, 0 } }} }, - { PixelFormat(DRM_FORMAT_NV21), V4L2_PIX_FMT_NV21, 2, {{ { 8, 1, 1 }, { 16, 2, 2 }, { 0, 0, 0 } }} }, - { PixelFormat(DRM_FORMAT_NV16), V4L2_PIX_FMT_NV16, 2, {{ { 8, 1, 1 }, { 16, 2, 1 }, { 0, 0, 0 } }} }, - { PixelFormat(DRM_FORMAT_NV61), V4L2_PIX_FMT_NV61, 2, {{ { 8, 1, 1 }, { 16, 2, 1 }, { 0, 0, 0 } }} }, - { PixelFormat(DRM_FORMAT_NV24), V4L2_PIX_FMT_NV24, 2, {{ { 8, 1, 1 }, { 16, 2, 1 }, { 0, 0, 0 } }} }, - { PixelFormat(DRM_FORMAT_NV42), V4L2_PIX_FMT_NV42, 2, {{ { 8, 1, 1 }, { 16, 1, 1 }, { 0, 0, 0 } }} }, + { formats::NV12, V4L2_PIX_FMT_NV12, 2, {{ { 8, 1, 1 }, { 16, 2, 2 }, { 0, 0, 0 } }} }, + { formats::NV21, V4L2_PIX_FMT_NV21, 2, {{ { 8, 1, 1 }, { 16, 2, 2 }, { 0, 0, 0 } }} }, + { formats::NV16, V4L2_PIX_FMT_NV16, 2, {{ { 8, 1, 1 }, { 16, 2, 1 }, { 0, 0, 0 } }} }, + { formats::NV61, V4L2_PIX_FMT_NV61, 2, {{ { 8, 1, 1 }, { 16, 2, 1 }, { 0, 0, 0 } }} }, + { formats::NV24, V4L2_PIX_FMT_NV24, 2, {{ { 8, 1, 1 }, { 16, 2, 1 }, { 0, 0, 0 } }} }, + { formats::NV42, V4L2_PIX_FMT_NV42, 2, {{ { 8, 1, 1 }, { 16, 1, 1 }, { 0, 0, 0 } }} }, }}; } /* namespace */ From patchwork Fri May 22 14:54:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3850 Return-Path: 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 86E1561085 for ; Fri, 22 May 2020 16:55:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="bn2b88oN"; dkim-atps=neutral Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2BBA324D for ; Fri, 22 May 2020 16:55:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1590159322; bh=scXvpaaINCb41IpZh+g8JEnJYPs328hlpso4zGduGgo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bn2b88oNupPa/caunz1xGuZ0UjGZTkXMmqPoxsgSRP2ezGyPaLt1JnDjJNvSBbUk1 qmRtvUxDQ7zwwfFtTymyQWcKbsHd7uMdez634ZVEt/AZTm98ZCpH7DlDr8Jt5jUmbB jjnhQKxgvKaDYS9nhHn1+zPLXbeCvqcUsod9by2s= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 22 May 2020 17:54:57 +0300 Message-Id: <20200522145459.16836-11-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> References: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH/RFC 09/11] test: Replace explicit DRM FourCCs with libcamera formats 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, 22 May 2020 14:55:26 -0000 Use the new pixel format constants to replace usage of macros from drm_fourcc.h. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- test/v4l2_videodevice/buffer_cache.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/v4l2_videodevice/buffer_cache.cpp b/test/v4l2_videodevice/buffer_cache.cpp index d730e7550377..b22de88e214c 100644 --- a/test/v4l2_videodevice/buffer_cache.cpp +++ b/test/v4l2_videodevice/buffer_cache.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include "buffer_source.h" @@ -142,7 +143,7 @@ public: const unsigned int numBuffers = 8; StreamConfiguration cfg; - cfg.pixelFormat = PixelFormat(DRM_FORMAT_YUYV); + cfg.pixelFormat = formats::YUYV; cfg.size = Size(600, 800); cfg.bufferCount = numBuffers; From patchwork Fri May 22 14:54:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3849 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D0FD6610DA for ; Fri, 22 May 2020 16:55:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="lmKvnjDF"; dkim-atps=neutral Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 79E7A528 for ; Fri, 22 May 2020 16:55:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1590159322; bh=3LsHp4Viomojxqj844xcEW+zWLhu8tsNu0n1sdnDHW0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lmKvnjDFQjlx3022piDyyNGxg26V090iiRMz3Ow0eizL9ZImFFXXBiLvs9IstCUGb Z5UPIns1hk0zvyGhlwCuA+XdQ5KvokRFHZ6G36lHqqocD0+8QnyDfDbkUqQL92uT2P sCKOHieasCmhqNDP4XHVyhz9mIbAr+8NqSk7zQ2M= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 22 May 2020 17:54:58 +0300 Message-Id: <20200522145459.16836-12-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> References: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH/RFC 10/11] libcamera: pipeline: Replace explicit DRM FourCCs with libcamera formats 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, 22 May 2020 14:55:26 -0000 Use the new pixel format constants to replace usage of macros from drm_fourcc.h. The IPU3 pipeline handler still uses DRM FourCCs for IPU3-specific formats that are not defined in the libcamera public API. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/ipu3/ipu3.cpp | 8 +++++--- .../pipeline/raspberrypi/raspberrypi.cpp | 10 +++++----- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 19 ++++++++++--------- src/libcamera/pipeline/vimc/vimc.cpp | 11 ++++++----- 4 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index b805fea71c2d..f23f338d4eb7 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -11,9 +11,11 @@ #include #include +#include #include #include +#include #include #include @@ -261,7 +263,7 @@ IPU3CameraConfiguration::IPU3CameraConfiguration(Camera *camera, void IPU3CameraConfiguration::adjustStream(StreamConfiguration &cfg, bool scale) { /* The only pixel format the driver supports is NV12. */ - cfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12); + cfg.pixelFormat = formats::NV12; if (scale) { /* @@ -430,7 +432,7 @@ CameraConfiguration *PipelineHandlerIPU3::generateConfiguration(Camera *camera, StreamConfiguration cfg = {}; IPU3Stream *stream = nullptr; - cfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12); + cfg.pixelFormat = formats::NV12; switch (role) { case StreamRole::StillCapture: @@ -1193,7 +1195,7 @@ int ImgUDevice::configureOutput(ImgUOutput *output, return 0; *outputFormat = {}; - outputFormat->fourcc = dev->toV4L2PixelFormat(PixelFormat(DRM_FORMAT_NV12)); + outputFormat->fourcc = dev->toV4L2PixelFormat(formats::NV12); outputFormat->size = cfg.size; outputFormat->planesCount = 2; diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index e16a9c7f10d3..d3d11f87ecb5 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -13,12 +13,12 @@ #include #include +#include #include #include #include #include -#include #include #include "libcamera/internal/camera_sensor.h" @@ -490,7 +490,7 @@ CameraConfiguration::Status RPiCameraConfiguration::validate() if (fmts.find(V4L2PixelFormat::fromPixelFormat(cfgPixFmt, false)) == fmts.end()) { /* If we cannot find a native format, use a default one. */ - cfgPixFmt = PixelFormat(DRM_FORMAT_NV12); + cfgPixFmt = formats::NV12; status = Adjusted; } } @@ -537,20 +537,20 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera, break; case StreamRole::StillCapture: - cfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12); + cfg.pixelFormat = formats::NV12; /* Return the largest sensor resolution. */ cfg.size = data->sensor_->resolution(); cfg.bufferCount = 1; break; case StreamRole::VideoRecording: - cfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12); + cfg.pixelFormat = formats::NV12; cfg.size = { 1920, 1080 }; cfg.bufferCount = 4; break; case StreamRole::Viewfinder: - cfg.pixelFormat = PixelFormat(DRM_FORMAT_ARGB8888); + cfg.pixelFormat = formats::ARGB8888; cfg.size = { 800, 600 }; cfg.bufferCount = 4; break; diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index d807fc2cf535..401e777fbbf7 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -459,13 +460,13 @@ RkISP1CameraConfiguration::RkISP1CameraConfiguration(Camera *camera, CameraConfiguration::Status RkISP1CameraConfiguration::validate() { static const std::array formats{ - PixelFormat(DRM_FORMAT_YUYV), - PixelFormat(DRM_FORMAT_YVYU), - PixelFormat(DRM_FORMAT_VYUY), - PixelFormat(DRM_FORMAT_NV16), - PixelFormat(DRM_FORMAT_NV61), - PixelFormat(DRM_FORMAT_NV21), - PixelFormat(DRM_FORMAT_NV12), + formats::YUYV, + formats::YVYU, + formats::VYUY, + formats::NV16, + formats::NV61, + formats::NV21, + formats::NV12, /* \todo Add support for 8-bit greyscale to DRM formats */ }; @@ -487,7 +488,7 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate() if (std::find(formats.begin(), formats.end(), cfg.pixelFormat) == formats.end()) { LOG(RkISP1, Debug) << "Adjusting format to NV12"; - cfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12), + cfg.pixelFormat = formats::NV12, status = Adjusted; } @@ -566,7 +567,7 @@ CameraConfiguration *PipelineHandlerRkISP1::generateConfiguration(Camera *camera return config; StreamConfiguration cfg{}; - cfg.pixelFormat = PixelFormat(DRM_FORMAT_NV12); + cfg.pixelFormat = formats::NV12; cfg.size = data->sensor_->resolution(); config->addConfiguration(cfg); diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp index ca36348a5eb6..ce6db27ce576 100644 --- a/src/libcamera/pipeline/vimc/vimc.cpp +++ b/src/libcamera/pipeline/vimc/vimc.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -108,9 +109,9 @@ private: namespace { static const std::array pixelformats{ - PixelFormat(DRM_FORMAT_RGB888), - PixelFormat(DRM_FORMAT_BGR888), - PixelFormat(DRM_FORMAT_BGRA8888), + formats::RGB888, + formats::BGR888, + formats::BGRA8888, }; } /* namespace */ @@ -139,7 +140,7 @@ CameraConfiguration::Status VimcCameraConfiguration::validate() if (std::find(pixelformats.begin(), pixelformats.end(), cfg.pixelFormat) == pixelformats.end()) { LOG(VIMC, Debug) << "Adjusting format to RGB24"; - cfg.pixelFormat = PixelFormat(DRM_FORMAT_BGR888); + cfg.pixelFormat = formats::BGR888; status = Adjusted; } @@ -188,7 +189,7 @@ CameraConfiguration *PipelineHandlerVimc::generateConfiguration(Camera *camera, StreamConfiguration cfg(formats); - cfg.pixelFormat = PixelFormat(DRM_FORMAT_BGR888); + cfg.pixelFormat = formats::BGR888; cfg.size = { 1920, 1080 }; cfg.bufferCount = 4; From patchwork Fri May 22 14:54:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 3851 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2AE05610E5 for ; Fri, 22 May 2020 16:55:23 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="OdJK2bTJ"; dkim-atps=neutral Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C8DAC24D for ; Fri, 22 May 2020 16:55:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1590159322; bh=mqAfoh+gwLQh6tmQigrZNh60M7lmsaftPdw3cxtjmOw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=OdJK2bTJmpHxDctHT3WhwNSdmPtJWw/zOBXEjyA3zug0I0wXMTzV/7biAsuoi8Nxz i7AFSMFXsHo3X8SWmxSqRFEKRHFGHSEV1JhdTx3IBNtnbp/ecSKFzPg3aVvhdXcHhl 1bUcno/BMMrrwt/2AxK0papKXbLINH6n1NMhelN0= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Fri, 22 May 2020 17:54:59 +0300 Message-Id: <20200522145459.16836-13-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> References: <20200522145459.16836-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH/RFC 11/11] libcamera: Replace explicit DRM FourCCs with libcamera formats 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, 22 May 2020 14:55:26 -0000 Use the new pixel format constants to replace usage of macros from drm_fourcc.h. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- include/libcamera/pixel_format.h | 2 - src/libcamera/formats.cpp | 146 +++++++++++++++-------------- src/libcamera/v4l2_pixelformat.cpp | 83 ++++++++-------- 3 files changed, 111 insertions(+), 120 deletions(-) diff --git a/include/libcamera/pixel_format.h b/include/libcamera/pixel_format.h index 8dfeb8922418..6727315a11b1 100644 --- a/include/libcamera/pixel_format.h +++ b/include/libcamera/pixel_format.h @@ -11,8 +11,6 @@ #include #include -#include - namespace libcamera { class PixelFormat diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp index 74c239a5e710..97e986786cc8 100644 --- a/src/libcamera/formats.cpp +++ b/src/libcamera/formats.cpp @@ -9,6 +9,8 @@ #include +#include + #include "libcamera/internal/log.h" /** @@ -166,43 +168,43 @@ namespace { const std::map pixelFormatInfo{ /* RGB formats. */ - { PixelFormat(DRM_FORMAT_BGR888), { - .format = PixelFormat(DRM_FORMAT_BGR888), + { formats::BGR888, { + .format = formats::BGR888, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_RGB24), .bitsPerPixel = 24, .colourEncoding = PixelFormatInfo::ColourEncodingRGB, .packed = false, } }, - { PixelFormat(DRM_FORMAT_RGB888), { - .format = PixelFormat(DRM_FORMAT_RGB888), + { formats::RGB888, { + .format = formats::RGB888, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_BGR24), .bitsPerPixel = 24, .colourEncoding = PixelFormatInfo::ColourEncodingRGB, .packed = false, } }, - { PixelFormat(DRM_FORMAT_ABGR8888), { - .format = PixelFormat(DRM_FORMAT_ABGR8888), + { formats::ABGR8888, { + .format = formats::ABGR8888, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), .bitsPerPixel = 32, .colourEncoding = PixelFormatInfo::ColourEncodingRGB, .packed = false, } }, - { PixelFormat(DRM_FORMAT_ARGB8888), { - .format = PixelFormat(DRM_FORMAT_ARGB8888), + { formats::ARGB8888, { + .format = formats::ARGB8888, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), .bitsPerPixel = 32, .colourEncoding = PixelFormatInfo::ColourEncodingRGB, .packed = false, } }, - { PixelFormat(DRM_FORMAT_BGRA8888), { - .format = PixelFormat(DRM_FORMAT_BGRA8888), + { formats::BGRA8888, { + .format = formats::BGRA8888, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_ARGB32), .bitsPerPixel = 32, .colourEncoding = PixelFormatInfo::ColourEncodingRGB, .packed = false, } }, - { PixelFormat(DRM_FORMAT_RGBA8888), { - .format = PixelFormat(DRM_FORMAT_RGBA8888), + { formats::RGBA8888, { + .format = formats::RGBA8888, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_BGRA32), .bitsPerPixel = 32, .colourEncoding = PixelFormatInfo::ColourEncodingRGB, @@ -210,29 +212,29 @@ const std::map pixelFormatInfo{ } }, /* YUV packed formats. */ - { PixelFormat(DRM_FORMAT_YUYV), { - .format = PixelFormat(DRM_FORMAT_YUYV), + { formats::YUYV, { + .format = formats::YUYV, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_YUYV), .bitsPerPixel = 16, .colourEncoding = PixelFormatInfo::ColourEncodingYUV, .packed = false, } }, - { PixelFormat(DRM_FORMAT_YVYU), { - .format = PixelFormat(DRM_FORMAT_YVYU), + { formats::YVYU, { + .format = formats::YVYU, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_YVYU), .bitsPerPixel = 16, .colourEncoding = PixelFormatInfo::ColourEncodingYUV, .packed = false, } }, - { PixelFormat(DRM_FORMAT_UYVY), { - .format = PixelFormat(DRM_FORMAT_UYVY), + { formats::UYVY, { + .format = formats::UYVY, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_UYVY), .bitsPerPixel = 16, .colourEncoding = PixelFormatInfo::ColourEncodingYUV, .packed = false, } }, - { PixelFormat(DRM_FORMAT_VYUY), { - .format = PixelFormat(DRM_FORMAT_VYUY), + { formats::VYUY, { + .format = formats::VYUY, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_VYUY), .bitsPerPixel = 16, .colourEncoding = PixelFormatInfo::ColourEncodingYUV, @@ -240,29 +242,29 @@ const std::map pixelFormatInfo{ } }, /* YUV planar formats. */ - { PixelFormat(DRM_FORMAT_NV16), { - .format = PixelFormat(DRM_FORMAT_NV16), + { formats::NV16, { + .format = formats::NV16, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_NV16), .bitsPerPixel = 16, .colourEncoding = PixelFormatInfo::ColourEncodingYUV, .packed = false, } }, - { PixelFormat(DRM_FORMAT_NV61), { - .format = PixelFormat(DRM_FORMAT_NV61), + { formats::NV61, { + .format = formats::NV61, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_NV61), .bitsPerPixel = 16, .colourEncoding = PixelFormatInfo::ColourEncodingYUV, .packed = false, } }, - { PixelFormat(DRM_FORMAT_NV12), { - .format = PixelFormat(DRM_FORMAT_NV12), + { formats::NV12, { + .format = formats::NV12, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_NV12), .bitsPerPixel = 12, .colourEncoding = PixelFormatInfo::ColourEncodingYUV, .packed = false, } }, - { PixelFormat(DRM_FORMAT_NV21), { - .format = PixelFormat(DRM_FORMAT_NV21), + { formats::NV21, { + .format = formats::NV21, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_NV21), .bitsPerPixel = 12, .colourEncoding = PixelFormatInfo::ColourEncodingYUV, @@ -270,8 +272,8 @@ const std::map pixelFormatInfo{ } }, /* Greyscale formats. */ - { PixelFormat(DRM_FORMAT_R8), { - .format = PixelFormat(DRM_FORMAT_R8), + { formats::R8, { + .format = formats::R8, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_GREY), .bitsPerPixel = 8, .colourEncoding = PixelFormatInfo::ColourEncodingYUV, @@ -279,141 +281,141 @@ const std::map pixelFormatInfo{ } }, /* Bayer formats. */ - { PixelFormat(DRM_FORMAT_SBGGR8), { - .format = PixelFormat(DRM_FORMAT_SBGGR8), + { formats::SBGGR8, { + .format = formats::SBGGR8, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8), .bitsPerPixel = 8, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = false, } }, - { PixelFormat(DRM_FORMAT_SGBRG8), { - .format = PixelFormat(DRM_FORMAT_SGBRG8), + { formats::SGBRG8, { + .format = formats::SGBRG8, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8), .bitsPerPixel = 8, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = false, } }, - { PixelFormat(DRM_FORMAT_SGRBG8), { - .format = PixelFormat(DRM_FORMAT_SGRBG8), + { formats::SGRBG8, { + .format = formats::SGRBG8, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8), .bitsPerPixel = 8, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = false, } }, - { PixelFormat(DRM_FORMAT_SRGGB8), { - .format = PixelFormat(DRM_FORMAT_SRGGB8), + { formats::SRGGB8, { + .format = formats::SRGGB8, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8), .bitsPerPixel = 8, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = false, } }, - { PixelFormat(DRM_FORMAT_SBGGR10), { - .format = PixelFormat(DRM_FORMAT_SBGGR10), + { formats::SBGGR10, { + .format = formats::SBGGR10, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10), .bitsPerPixel = 10, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = false, } }, - { PixelFormat(DRM_FORMAT_SGBRG10), { - .format = PixelFormat(DRM_FORMAT_SGBRG10), + { formats::SGBRG10, { + .format = formats::SGBRG10, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10), .bitsPerPixel = 10, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = false, } }, - { PixelFormat(DRM_FORMAT_SGRBG10), { - .format = PixelFormat(DRM_FORMAT_SGRBG10), + { formats::SGRBG10, { + .format = formats::SGRBG10, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10), .bitsPerPixel = 10, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = false, } }, - { PixelFormat(DRM_FORMAT_SRGGB10), { - .format = PixelFormat(DRM_FORMAT_SRGGB10), + { formats::SRGGB10, { + .format = formats::SRGGB10, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10), .bitsPerPixel = 10, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = false, } }, - { PixelFormat(DRM_FORMAT_SBGGR10, MIPI_FORMAT_MOD_CSI2_PACKED), { - .format = PixelFormat(DRM_FORMAT_SBGGR10, MIPI_FORMAT_MOD_CSI2_PACKED), + { formats::SBGGR10_CSI2P, { + .format = formats::SBGGR10_CSI2P, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P), .bitsPerPixel = 10, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = true, } }, - { PixelFormat(DRM_FORMAT_SGBRG10, MIPI_FORMAT_MOD_CSI2_PACKED), { - .format = PixelFormat(DRM_FORMAT_SGBRG10, MIPI_FORMAT_MOD_CSI2_PACKED), + { formats::SGBRG10_CSI2P, { + .format = formats::SGBRG10_CSI2P, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P), .bitsPerPixel = 10, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = true, } }, - { PixelFormat(DRM_FORMAT_SGRBG10, MIPI_FORMAT_MOD_CSI2_PACKED), { - .format = PixelFormat(DRM_FORMAT_SGRBG10, MIPI_FORMAT_MOD_CSI2_PACKED), + { formats::SGRBG10_CSI2P, { + .format = formats::SGRBG10_CSI2P, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P), .bitsPerPixel = 10, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = true, } }, - { PixelFormat(DRM_FORMAT_SRGGB10, MIPI_FORMAT_MOD_CSI2_PACKED), { - .format = PixelFormat(DRM_FORMAT_SRGGB10, MIPI_FORMAT_MOD_CSI2_PACKED), + { formats::SRGGB10_CSI2P, { + .format = formats::SRGGB10_CSI2P, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P), .bitsPerPixel = 10, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = true, } }, - { PixelFormat(DRM_FORMAT_SBGGR12), { - .format = PixelFormat(DRM_FORMAT_SBGGR12), + { formats::SBGGR12, { + .format = formats::SBGGR12, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12), .bitsPerPixel = 12, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = false, } }, - { PixelFormat(DRM_FORMAT_SGBRG12), { - .format = PixelFormat(DRM_FORMAT_SGBRG12), + { formats::SGBRG12, { + .format = formats::SGBRG12, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12), .bitsPerPixel = 12, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = false, } }, - { PixelFormat(DRM_FORMAT_SGRBG12), { - .format = PixelFormat(DRM_FORMAT_SGRBG12), + { formats::SGRBG12, { + .format = formats::SGRBG12, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12), .bitsPerPixel = 12, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = false, } }, - { PixelFormat(DRM_FORMAT_SRGGB12), { - .format = PixelFormat(DRM_FORMAT_SRGGB12), + { formats::SRGGB12, { + .format = formats::SRGGB12, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12), .bitsPerPixel = 12, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = false, } }, - { PixelFormat(DRM_FORMAT_SBGGR12, MIPI_FORMAT_MOD_CSI2_PACKED), { - .format = PixelFormat(DRM_FORMAT_SBGGR12, MIPI_FORMAT_MOD_CSI2_PACKED), + { formats::SBGGR12_CSI2P, { + .format = formats::SBGGR12_CSI2P, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P), .bitsPerPixel = 12, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = true, } }, - { PixelFormat(DRM_FORMAT_SGBRG12, MIPI_FORMAT_MOD_CSI2_PACKED), { - .format = PixelFormat(DRM_FORMAT_SGBRG12, MIPI_FORMAT_MOD_CSI2_PACKED), + { formats::SGBRG12_CSI2P, { + .format = formats::SGBRG12_CSI2P, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P), .bitsPerPixel = 12, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = true, } }, - { PixelFormat(DRM_FORMAT_SGRBG12, MIPI_FORMAT_MOD_CSI2_PACKED), { - .format = PixelFormat(DRM_FORMAT_SGRBG12, MIPI_FORMAT_MOD_CSI2_PACKED), + { formats::SGRBG12_CSI2P, { + .format = formats::SGRBG12_CSI2P, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P), .bitsPerPixel = 12, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, .packed = true, } }, - { PixelFormat(DRM_FORMAT_SRGGB12, MIPI_FORMAT_MOD_CSI2_PACKED), { - .format = PixelFormat(DRM_FORMAT_SRGGB12, MIPI_FORMAT_MOD_CSI2_PACKED), + { formats::SRGGB12_CSI2P, { + .format = formats::SRGGB12_CSI2P, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P), .bitsPerPixel = 12, .colourEncoding = PixelFormatInfo::ColourEncodingRAW, @@ -421,8 +423,8 @@ const std::map pixelFormatInfo{ } }, /* Compressed formats. */ - { PixelFormat(DRM_FORMAT_MJPEG), { - .format = PixelFormat(DRM_FORMAT_MJPEG), + { formats::MJPEG, { + .format = formats::MJPEG, .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_MJPEG), .bitsPerPixel = 0, .colourEncoding = PixelFormatInfo::ColourEncodingYUV, diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index 94fae470f926..741f6c2646bc 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -12,8 +12,7 @@ #include #include -#include - +#include #include #include "libcamera/internal/formats.h" @@ -46,60 +45,52 @@ namespace { const std::map vpf2pf{ /* RGB formats. */ - { V4L2PixelFormat(V4L2_PIX_FMT_RGB24), PixelFormat(DRM_FORMAT_BGR888) }, - { V4L2PixelFormat(V4L2_PIX_FMT_BGR24), PixelFormat(DRM_FORMAT_RGB888) }, - { V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), PixelFormat(DRM_FORMAT_ABGR8888) }, - { V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), PixelFormat(DRM_FORMAT_ARGB8888) }, - { V4L2PixelFormat(V4L2_PIX_FMT_ARGB32), PixelFormat(DRM_FORMAT_BGRA8888) }, - { V4L2PixelFormat(V4L2_PIX_FMT_BGRA32), PixelFormat(DRM_FORMAT_RGBA8888) }, + { V4L2PixelFormat(V4L2_PIX_FMT_RGB24), formats::BGR888 }, + { V4L2PixelFormat(V4L2_PIX_FMT_BGR24), formats::RGB888 }, + { V4L2PixelFormat(V4L2_PIX_FMT_RGBA32), formats::ABGR8888 }, + { V4L2PixelFormat(V4L2_PIX_FMT_ABGR32), formats::ARGB8888 }, + { V4L2PixelFormat(V4L2_PIX_FMT_ARGB32), formats::BGRA8888 }, + { V4L2PixelFormat(V4L2_PIX_FMT_BGRA32), formats::RGBA8888 }, /* YUV packed formats. */ - { V4L2PixelFormat(V4L2_PIX_FMT_YUYV), PixelFormat(DRM_FORMAT_YUYV) }, - { V4L2PixelFormat(V4L2_PIX_FMT_YVYU), PixelFormat(DRM_FORMAT_YVYU) }, - { V4L2PixelFormat(V4L2_PIX_FMT_UYVY), PixelFormat(DRM_FORMAT_UYVY) }, - { V4L2PixelFormat(V4L2_PIX_FMT_VYUY), PixelFormat(DRM_FORMAT_VYUY) }, + { V4L2PixelFormat(V4L2_PIX_FMT_YUYV), formats::YUYV }, + { V4L2PixelFormat(V4L2_PIX_FMT_YVYU), formats::YVYU }, + { V4L2PixelFormat(V4L2_PIX_FMT_UYVY), formats::UYVY }, + { V4L2PixelFormat(V4L2_PIX_FMT_VYUY), formats::VYUY }, /* YUV planar formats. */ - { V4L2PixelFormat(V4L2_PIX_FMT_NV16), PixelFormat(DRM_FORMAT_NV16) }, - { V4L2PixelFormat(V4L2_PIX_FMT_NV61), PixelFormat(DRM_FORMAT_NV61) }, - { V4L2PixelFormat(V4L2_PIX_FMT_NV12), PixelFormat(DRM_FORMAT_NV12) }, - { V4L2PixelFormat(V4L2_PIX_FMT_NV21), PixelFormat(DRM_FORMAT_NV21) }, + { V4L2PixelFormat(V4L2_PIX_FMT_NV16), formats::NV16 }, + { V4L2PixelFormat(V4L2_PIX_FMT_NV61), formats::NV61 }, + { V4L2PixelFormat(V4L2_PIX_FMT_NV12), formats::NV12 }, + { V4L2PixelFormat(V4L2_PIX_FMT_NV21), formats::NV21 }, /* Greyscale formats. */ - { V4L2PixelFormat(V4L2_PIX_FMT_GREY), PixelFormat(DRM_FORMAT_R8) }, + { V4L2PixelFormat(V4L2_PIX_FMT_GREY), formats::R8 }, /* Bayer formats. */ - { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8), PixelFormat(DRM_FORMAT_SBGGR8) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8), PixelFormat(DRM_FORMAT_SGBRG8) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8), PixelFormat(DRM_FORMAT_SGRBG8) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8), PixelFormat(DRM_FORMAT_SRGGB8) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10), PixelFormat(DRM_FORMAT_SBGGR10) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10), PixelFormat(DRM_FORMAT_SGBRG10) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10), PixelFormat(DRM_FORMAT_SGRBG10) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10), PixelFormat(DRM_FORMAT_SRGGB10) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P), - PixelFormat(DRM_FORMAT_SBGGR10, MIPI_FORMAT_MOD_CSI2_PACKED) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P), - PixelFormat(DRM_FORMAT_SGBRG10, MIPI_FORMAT_MOD_CSI2_PACKED) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P), - PixelFormat(DRM_FORMAT_SGRBG10, MIPI_FORMAT_MOD_CSI2_PACKED) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P), - PixelFormat(DRM_FORMAT_SRGGB10, MIPI_FORMAT_MOD_CSI2_PACKED) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12), PixelFormat(DRM_FORMAT_SBGGR12) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12), PixelFormat(DRM_FORMAT_SGBRG12) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12), PixelFormat(DRM_FORMAT_SGRBG12) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12), PixelFormat(DRM_FORMAT_SRGGB12) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P), - PixelFormat(DRM_FORMAT_SBGGR12, MIPI_FORMAT_MOD_CSI2_PACKED) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P), - PixelFormat(DRM_FORMAT_SGBRG12, MIPI_FORMAT_MOD_CSI2_PACKED) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P), - PixelFormat(DRM_FORMAT_SGRBG12, MIPI_FORMAT_MOD_CSI2_PACKED) }, - { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P), - PixelFormat(DRM_FORMAT_SRGGB12, MIPI_FORMAT_MOD_CSI2_PACKED) }, + { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8), formats::SBGGR8 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8), formats::SGBRG8 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8), formats::SGRBG8 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8), formats::SRGGB8 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10), formats::SBGGR10 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10), formats::SGBRG10 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10), formats::SGRBG10 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10), formats::SRGGB10 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P), formats::SBGGR10_CSI2P }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P), formats::SGBRG10_CSI2P }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P), formats::SGRBG10_CSI2P }, + { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P), formats::SRGGB10_CSI2P }, + { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12), formats::SBGGR12 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12), formats::SGBRG12 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12), formats::SGRBG12 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12), formats::SRGGB12 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P), formats::SBGGR12_CSI2P }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P), formats::SGBRG12_CSI2P }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P), formats::SGRBG12_CSI2P }, + { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P), formats::SRGGB12_CSI2P }, /* Compressed formats. */ - { V4L2PixelFormat(V4L2_PIX_FMT_MJPEG), PixelFormat(DRM_FORMAT_MJPEG) }, + { V4L2PixelFormat(V4L2_PIX_FMT_MJPEG), formats::MJPEG }, }; } /* namespace */