@@ -1346,4 +1346,11 @@ controls:
reduces the WdrExposureValue until the amount of pixels that are close
to saturation is lower than this value.
+ - LensDewarpEnable:
+ type: bool
+ direction: inout
+ description: |
+ Enable or disable lens dewarping. This control is only available if lens
+ dewarp parameters are configured in the tuning file.
+
...
@@ -1492,6 +1492,14 @@ int PipelineHandlerRkISP1::updateControls(RkISP1CameraData *data)
maxCrop);
}
+ if (data->dewarpParams_.has_value()) {
+ if (dewarper_->supportsRequests())
+ controls[&controls::LensDewarpEnable] = ControlInfo(false, true, true);
+ else
+ LOG(RkISP1, Warning)
+ << "dw100 kernel driver has no requests support."
+ " No dynamic configuration possible.";
+ }
}
/* Add the IPA registered controls to list of camera controls. */
@@ -1765,8 +1773,15 @@ void PipelineHandlerRkISP1::imageBufferReady(FrameBuffer *buffer)
availableDewarpRequests_.pop();
}
+ bool update = false;
auto &vertexMap = dewarper_->vertexMap(&data->mainPathStream_);
+ const auto &lensDewarpEnable = request->controls().get(controls::LensDewarpEnable);
+ if (lensDewarpEnable) {
+ vertexMap.setLensDewarpEnable(*lensDewarpEnable);
+ update = true;
+ }
+
/* Handle scaler crop control. */
const auto &crop = request->controls().get(controls::ScalerCrop);
if (crop) {
@@ -1775,9 +1790,12 @@ void PipelineHandlerRkISP1::imageBufferReady(FrameBuffer *buffer)
<< "Dynamically setting ScalerCrop requires a "
"dw100 driver with requests support";
vertexMap.setScalerCrop(*crop);
- dewarper_->applyVertexMap(&data->mainPathStream_, dewarpRequest);
+ update = true;
}
+ if (update)
+ dewarper_->applyVertexMap(&data->mainPathStream_, dewarpRequest);
+
/*
* Queue input and output buffers to the dewarper. The output
* buffers for the dewarper are the buffers of the request, supplied
@@ -1809,7 +1827,11 @@ void PipelineHandlerRkISP1::imageBufferReady(FrameBuffer *buffer)
}
}
- request->metadata().set(controls::ScalerCrop, vertexMap.effectiveScalerCrop());
+ auto &meta = request->metadata();
+ meta.set(controls::ScalerCrop, vertexMap.effectiveScalerCrop());
+
+ if (vertexMap.dewarpParamsValid())
+ meta.set(controls::LensDewarpEnable, vertexMap.lensDewarpEnable());
}
void PipelineHandlerRkISP1::dewarpRequestReady(V4L2Request *request)
Add a LensDewarpEnable control to enable or disable lens dewarping if it is configured. Implement it for the dw100 converter. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> --- Changes in v2: - Merged control definition and usage into one patch - Improved control description - Fixed actual handling of LensDewarpEnable control that got lost in a previous rebase --- src/libcamera/control_ids_core.yaml | 7 +++++++ src/libcamera/pipeline/rkisp1/rkisp1.cpp | 26 ++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-)