[libcamera-devel,8/9] libcamera: rkisp1: Add support for Transform
diff mbox series

Message ID 20221124121220.47000-9-jacopo@jmondi.org
State Accepted
Headers show
Series
  • libcamera: camera_sensor: Centralize flips handling
Related show

Commit Message

Jacopo Mondi Nov. 24, 2022, 12:12 p.m. UTC
Add support for Transform to the RkISP1 pipeline handler.

The pipeline rotates using the sensor's V/H flips, hence use the
CameraSensor helpers to handle transformation requests from
applications.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 14741e73e050..41afc98ae2b2 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -26,6 +26,7 @@ 
 #include <libcamera/property_ids.h>
 #include <libcamera/request.h>
 #include <libcamera/stream.h>
+#include <libcamera/transform.h>
 
 #include <libcamera/ipa/core_ipa_interface.h>
 #include <libcamera/ipa/rkisp1_ipa_interface.h>
@@ -430,17 +431,17 @@  CameraConfiguration::Status RkISP1CameraConfiguration::validate()
 
 	status = validateColorSpaces(ColorSpaceFlag::StreamsShareColorSpace);
 
-	if (transform != Transform::Identity) {
-		transform = Transform::Identity;
-		status = Adjusted;
-	}
-
 	/* Cap the number of entries to the available streams. */
 	if (config_.size() > pathCount) {
 		config_.resize(pathCount);
 		status = Adjusted;
 	}
 
+	Transform requestedTransform = transform;
+	Transform combined = sensor->validateTransform(&transform);
+	if (transform != requestedTransform)
+		status = Adjusted;
+
 	/*
 	 * If there are more than one stream in the configuration figure out the
 	 * order to evaluate the streams. The first stream has the highest
@@ -529,6 +530,8 @@  CameraConfiguration::Status RkISP1CameraConfiguration::validate()
 	if (sensorFormat_.size.isNull())
 		sensorFormat_.size = sensor->resolution();
 
+	sensorFormat_.transform = combined;
+
 	return status;
 }