From 56c99424edd64c5a2bfe255eabc9e00787fc75a0 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 22 May 2020 04:02:06 +0300 Subject: libcamera: pipeline: Replace explicit DRM FourCCs with libcamera formats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Niklas Söderlund --- src/libcamera/pipeline/vimc/vimc.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/libcamera/pipeline/vimc') diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp index 3881545b..b6530662 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,8 +109,8 @@ private: namespace { static const std::map pixelformats{ - { PixelFormat(DRM_FORMAT_RGB888), MEDIA_BUS_FMT_BGR888_1X24 }, - { PixelFormat(DRM_FORMAT_BGR888), MEDIA_BUS_FMT_RGB888_1X24 }, + { formats::RGB888, MEDIA_BUS_FMT_BGR888_1X24 }, + { formats::BGR888, MEDIA_BUS_FMT_RGB888_1X24 }, }; } /* namespace */ @@ -138,7 +139,7 @@ CameraConfiguration::Status VimcCameraConfiguration::validate() const std::vector formats = cfg.formats().pixelformats(); if (std::find(formats.begin(), formats.end(), cfg.pixelFormat) == formats.end()) { LOG(VIMC, Debug) << "Adjusting format to BGR888"; - cfg.pixelFormat = PixelFormat(DRM_FORMAT_BGR888); + cfg.pixelFormat = formats::BGR888; status = Adjusted; } @@ -184,7 +185,7 @@ CameraConfiguration *PipelineHandlerVimc::generateConfiguration(Camera *camera, * but it isn't functional within the pipeline. */ if (data->media_->version() < KERNEL_VERSION(5, 7, 0)) { - if (pixelformat.first != PixelFormat(DRM_FORMAT_BGR888)) { + if (pixelformat.first != formats::BGR888) { LOG(VIMC, Info) << "Skipping unsupported pixel format " << pixelformat.first.toString(); @@ -201,7 +202,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; -- cgit v1.2.1