diff options
author | Paul Elder <paul.elder@ideasonboard.com> | 2020-07-04 17:56:11 +0900 |
---|---|---|
committer | Paul Elder <paul.elder@ideasonboard.com> | 2020-07-10 16:11:29 +0900 |
commit | 99b926bd124565aa98d7d47a40d8830813b7209e (patch) | |
tree | a4d99804b099d37751504061ce21777f7d0e8b60 /src | |
parent | 7ed827e0a09bffabf4b2c4bc2a506e9563207a93 (diff) |
libcamera: rkisp1: Fill stride and frameSize at config validation
Fill the stride and frameSize fields of the StreamConfiguration at
configuration validation time instead of at camera configuration time.
This allows applications to get the stride when trying a configuration
without modifying the active configuration of the camera.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/pipeline/rkisp1/rkisp1.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 051d77a6..7ce4140c 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -115,9 +115,9 @@ public: class RkISP1CameraData : public CameraData { public: - RkISP1CameraData(PipelineHandler *pipe) + RkISP1CameraData(PipelineHandler *pipe, V4L2VideoDevice *video) : CameraData(pipe), sensor_(nullptr), frame_(0), - frameInfo_(pipe) + frameInfo_(pipe), video_(video) { } @@ -135,6 +135,8 @@ public: RkISP1Frames frameInfo_; RkISP1Timeline timeline_; + V4L2VideoDevice *video_; + private: void queueFrameAction(unsigned int frame, const IPAOperationData &action); @@ -535,6 +537,17 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate() cfg.bufferCount = RKISP1_BUFFER_COUNT; + V4L2DeviceFormat format = {}; + format.fourcc = data_->video_->toV4L2PixelFormat(cfg.pixelFormat); + format.size = cfg.size; + + int ret = data_->video_->tryFormat(&format); + if (ret) + return Invalid; + + cfg.stride = format.planes[0].bpl; + cfg.frameSize = format.planes[0].size; + return status; } @@ -683,7 +696,6 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) return ret; cfg.setStream(&data->stream_); - cfg.stride = outputFormat.planes[0].bpl; return 0; } @@ -934,7 +946,7 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor) int ret; std::unique_ptr<RkISP1CameraData> data = - std::make_unique<RkISP1CameraData>(this); + std::make_unique<RkISP1CameraData>(this, video_); ControlInfoMap::Map ctrls; ctrls.emplace(std::piecewise_construct, |