summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Mader <robert.mader@collabora.com>2023-04-27 12:53:56 +0200
committerKieran Bingham <kieran.bingham@ideasonboard.com>2023-05-01 00:25:13 +0100
commit137b8d6fdcc9ca898acecb57fa0639cf59122726 (patch)
tree4ac65fb41a76e27185c4cb1a8cb9469c166a2569 /src
parentad1cd9e33fc019c0601472444b4889a09f48eaa6 (diff)
pipeline: simple: Validate transform
Just like we do for other pipeline handlers already. This ensures we corretly pass on transforms that are not handled by the sensor - e.g. rotations - back to the app via the config, which is required on devices like the Pinephone. Signed-off-by: Robert Mader <robert.mader@collabora.com> Tested-by: Arnav Singh <me@arnavion.dev> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/pipeline/simple/simple.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 2423ec10..e1f8b989 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -211,7 +211,8 @@ public:
int init();
int setupLinks();
int setupFormats(V4L2SubdeviceFormat *format,
- V4L2Subdevice::Whence whence);
+ V4L2Subdevice::Whence whence,
+ Transform transform = Transform::Identity);
void bufferReady(FrameBuffer *buffer);
unsigned int streamIndex(const Stream *stream) const
@@ -292,6 +293,7 @@ public:
}
bool needConversion() const { return needConversion_; }
+ const Transform &combinedTransform() const { return combinedTransform_; }
private:
/*
@@ -304,6 +306,7 @@ private:
const SimpleCameraData::Configuration *pipeConfig_;
bool needConversion_;
+ Transform combinedTransform_;
};
class SimplePipelineHandler : public PipelineHandler
@@ -664,7 +667,8 @@ int SimpleCameraData::setupLinks()
}
int SimpleCameraData::setupFormats(V4L2SubdeviceFormat *format,
- V4L2Subdevice::Whence whence)
+ V4L2Subdevice::Whence whence,
+ Transform transform)
{
SimplePipelineHandler *pipe = SimpleCameraData::pipe();
int ret;
@@ -673,7 +677,7 @@ int SimpleCameraData::setupFormats(V4L2SubdeviceFormat *format,
* Configure the format on the sensor output and propagate it through
* the pipeline.
*/
- ret = sensor_->setFormat(format);
+ ret = sensor_->setFormat(format, transform);
if (ret < 0)
return ret;
@@ -877,15 +881,16 @@ SimpleCameraConfiguration::SimpleCameraConfiguration(Camera *camera,
CameraConfiguration::Status SimpleCameraConfiguration::validate()
{
+ const CameraSensor *sensor = data_->sensor_.get();
Status status = Valid;
if (config_.empty())
return Invalid;
- if (transform != Transform::Identity) {
- transform = Transform::Identity;
+ Transform requestedTransform = transform;
+ combinedTransform_ = sensor->validateTransform(&transform);
+ if (transform != requestedTransform)
status = Adjusted;
- }
/* Cap the number of entries to the available streams. */
if (config_.size() > data_->streams_.size()) {
@@ -1116,7 +1121,8 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)
format.mbus_code = pipeConfig->code;
format.size = pipeConfig->sensorSize;
- ret = data->setupFormats(&format, V4L2Subdevice::ActiveFormat);
+ ret = data->setupFormats(&format, V4L2Subdevice::ActiveFormat,
+ config->combinedTransform());
if (ret < 0)
return ret;