libcamera: pipeline: Replace explicit DRM FourCCs with libcamera formats

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 <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart
2020-05-22 04:02:06 +03:00
parent 98b05ba378
commit 56c99424ed
4 changed files with 31 additions and 27 deletions
@@ -13,12 +13,12 @@
#include <libcamera/camera.h>
#include <libcamera/control_ids.h>
#include <libcamera/formats.h>
#include <libcamera/ipa/raspberrypi.h>
#include <libcamera/logging.h>
#include <libcamera/request.h>
#include <libcamera/stream.h>
#include <linux/drm_fourcc.h>
#include <linux/videodev2.h>
#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;