[libcamera-devel,3/3] android: CameraDevice: Deny non ROTATION_0 stream configuration
diff mbox series

Message ID 20210325051931.3748204-4-hiroh@chromium.org
State Superseded
Headers show
Series
  • Regard crop_rotate_scale_degrees in configuration
Related show

Commit Message

Hirokazu Honda March 25, 2021, 5:19 a.m. UTC
Libcamera doesn't handle crop_rotate_scale_degrees. Therefore,
if it is requested, that is, crop_rotate_scale_degrees is not
CAMERA3_STREAM_ROTATION_0, the configuration should fail.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
---
 src/android/camera_device.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

--
2.31.0.291.g576ba9dcdaf-goog

Comments

Jacopo Mondi March 25, 2021, 10:52 a.m. UTC | #1
Hi Hiro

On Thu, Mar 25, 2021 at 02:19:31PM +0900, Hirokazu Honda wrote:
> Libcamera doesn't handle crop_rotate_scale_degrees. Therefore,
> if it is requested, that is, crop_rotate_scale_degrees is not
> CAMERA3_STREAM_ROTATION_0, the configuration should fail.

We also do not handle rotation != 0
Should you rule that out as well ?
>
> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
> ---
>  src/android/camera_device.cpp | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index d24b0b23..3aab643d 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -1657,6 +1657,13 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
>  		if (!format.isValid())
>  			return -EINVAL;
>
> +		/* \todo Support crop_rotate_scale_degrees. */
> +		if (stream->crop_rotate_scale_degrees != CAMERA3_STREAM_ROTATION_0) {
> +			LOG(HAL, Error)
> +				<< "crop_rotate_scale_degrees is not supported";
> +			return -EINVAL;
> +		}
> +
>  		/* Defer handling of MJPEG streams until all others are known. */
>  		if (stream->format == HAL_PIXEL_FORMAT_BLOB) {
>  			if (jpegStream) {
> --
> 2.31.0.291.g576ba9dcdaf-goog
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Hirokazu Honda March 28, 2021, 10:43 p.m. UTC | #2
Hi Jacopo, thanks for reviewing.

On Thu, Mar 25, 2021 at 7:52 PM Jacopo Mondi <jacopo@jmondi.org> wrote:
>
> Hi Hiro
>
> On Thu, Mar 25, 2021 at 02:19:31PM +0900, Hirokazu Honda wrote:
> > Libcamera doesn't handle crop_rotate_scale_degrees. Therefore,
> > if it is requested, that is, crop_rotate_scale_degrees is not
> > CAMERA3_STREAM_ROTATION_0, the configuration should fail.
>
> We also do not handle rotation != 0
> Should you rule that out as well ?

Well, as this is undocumented, rotation should not be filled as we
have crop_rotate_scale_degrees.
But checking it should be harmless. Added.

Best Regards,
-Hiro

> >
> > Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
> > ---
> >  src/android/camera_device.cpp | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> > index d24b0b23..3aab643d 100644
> > --- a/src/android/camera_device.cpp
> > +++ b/src/android/camera_device.cpp
> > @@ -1657,6 +1657,13 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
> >               if (!format.isValid())
> >                       return -EINVAL;
> >
> > +             /* \todo Support crop_rotate_scale_degrees. */
> > +             if (stream->crop_rotate_scale_degrees != CAMERA3_STREAM_ROTATION_0) {
> > +                     LOG(HAL, Error)
> > +                             << "crop_rotate_scale_degrees is not supported";
> > +                     return -EINVAL;
> > +             }
> > +
> >               /* Defer handling of MJPEG streams until all others are known. */
> >               if (stream->format == HAL_PIXEL_FORMAT_BLOB) {
> >                       if (jpegStream) {
> > --
> > 2.31.0.291.g576ba9dcdaf-goog
> > _______________________________________________
> > libcamera-devel mailing list
> > libcamera-devel@lists.libcamera.org
> > https://lists.libcamera.org/listinfo/libcamera-devel

Patch
diff mbox series

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index d24b0b23..3aab643d 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1657,6 +1657,13 @@  int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
 		if (!format.isValid())
 			return -EINVAL;

+		/* \todo Support crop_rotate_scale_degrees. */
+		if (stream->crop_rotate_scale_degrees != CAMERA3_STREAM_ROTATION_0) {
+			LOG(HAL, Error)
+				<< "crop_rotate_scale_degrees is not supported";
+			return -EINVAL;
+		}
+
 		/* Defer handling of MJPEG streams until all others are known. */
 		if (stream->format == HAL_PIXEL_FORMAT_BLOB) {
 			if (jpegStream) {