[libcamera-devel] [PATCH v5 15/23] libcamera: rkisp1: Fill stride and frameSize at config validation
Paul Elder
paul.elder at ideasonboard.com
Thu Jul 9 15:28:27 CEST 2020
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 at ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
No change in v5
Changes in v4:
- mention motivation in commit message
- get stride and frameSize from tryFormat on the capture video node
New in v3
---
src/libcamera/pipeline/rkisp1/rkisp1.cpp | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 051d77a..7ce4140 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,
--
2.27.0
More information about the libcamera-devel
mailing list