summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-08-13 01:51:21 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-09-28 23:53:45 +0200
commit921c0cdc6a0c486c9b53af5746b1cce6a2501b3e (patch)
treea29d683f93daa23192cda188b96a7536a887f5b7
parent1beff36f5a47f6d4d79d2f428b6120db28bfbbe1 (diff)
libcamera: pipeline: rkisp1: Expose self path stream
Expose the self stream to applications and prefers it for the viewfinder and video roles as it can be extended to produce RGB. Keep preferring the main path for still capture as it could be extended to support RAW formats which makes most sense for still capture. With this change the self path becomes available to applications and a camera backed by this pipeline can produce two streams simultaneously. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/libcamera/pipeline/rkisp1/rkisp1.cpp63
1 files changed, 52 insertions, 11 deletions
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 8aae1697..acd946d1 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -710,21 +710,59 @@ CameraConfiguration *PipelineHandlerRkISP1::generateConfiguration(Camera *camera
{
RkISP1CameraData *data = cameraData(camera);
CameraConfiguration *config = new RkISP1CameraConfiguration(camera, data);
-
if (roles.empty())
return config;
- std::map<PixelFormat, std::vector<SizeRange>> streamFormats;
- for (const PixelFormat &format : RKISP1_RSZ_MP_FORMATS)
- streamFormats[format] =
- { { RKISP1_RSZ_MP_SRC_MIN, data->sensor_->resolution() } };
+ bool mainPathAvailable = true;
+ bool selfPathAvailable = true;
+ for (const StreamRole role : roles) {
+ bool useMainPath;
+
+ switch (role) {
+ case StreamRole::StillCapture: {
+ useMainPath = mainPathAvailable;
+ break;
+ }
+ case StreamRole::Viewfinder:
+ case StreamRole::VideoRecording: {
+ useMainPath = !selfPathAvailable;
+ break;
+ }
+ default:
+ LOG(RkISP1, Warning)
+ << "Requested stream role not supported: " << role;
+ delete config;
+ return nullptr;
+ }
+
+ std::map<PixelFormat, std::vector<SizeRange>> streamFormats;
+ Size maxResolution = data->sensor_->resolution();
+ if (useMainPath) {
+ mainPathAvailable = false;
+ maxResolution.boundTo(RKISP1_RSZ_MP_SRC_MAX);
+ for (const PixelFormat &format : RKISP1_RSZ_MP_FORMATS)
+ streamFormats[format] = { {
+ RKISP1_RSZ_MP_SRC_MIN,
+ maxResolution,
+ } };
+ } else {
+ selfPathAvailable = false;
+ maxResolution.boundTo(RKISP1_RSZ_SP_SRC_MAX);
+ for (const PixelFormat &format : RKISP1_RSZ_SP_FORMATS)
+ streamFormats[format] = { {
+ RKISP1_RSZ_SP_SRC_MIN,
+ maxResolution,
+ } };
+ }
- StreamFormats formats(streamFormats);
- StreamConfiguration cfg(formats);
- cfg.pixelFormat = formats::NV12;
- cfg.size = data->sensor_->resolution();
+ StreamFormats formats(streamFormats);
+ StreamConfiguration cfg(formats);
+ cfg.pixelFormat = formats::NV12;
+ cfg.size = maxResolution;
+ cfg.bufferCount = 4;
- config->addConfiguration(cfg);
+ config->addConfiguration(cfg);
+ }
config->validate();
@@ -1212,7 +1250,10 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)
if (ret)
return ret;
- std::set<Stream *> streams{ &data->mainPathStream_ };
+ std::set<Stream *> streams{
+ &data->mainPathStream_,
+ &data->selfPathStream_,
+ };
std::shared_ptr<Camera> camera =
Camera::create(this, data->sensor_->id(), streams);
registerCamera(std::move(camera), std::move(data));