-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IMX500: Add support for rotation and image flip #6584
base: rpi-6.6.y
Are you sure you want to change the base?
Conversation
Adds rotation support for the IMX500. Supported angles: - 0: 0 degrees - 1: 90 degrees - 2: 180 degrees - 3: 270 degrees Signed-off-by: Katsu Nakamura <[email protected]>
Adds image flip support for IMX500. Supported modes: 0: No flip 1: Flip horizontal 2: Flip vertical 3: Flip horizontal and vertical Signed-off-by: Katsu Nakamura <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flips patch looks like a straight NAK as flips are already implemented via V4L2_CID_HFLIP and V4L2_CID_VFLIP. There is no need for a custom control that would conflict with that.
Questions over implementing rotation.
@@ -235,6 +238,7 @@ enum pad_types { IMAGE_PAD, METADATA_PAD, NUM_PADS }; | |||
|
|||
#define V4L2_CID_USER_IMX500_INFERENCE_WINDOW (V4L2_CID_USER_IMX500_BASE + 0) | |||
#define V4L2_CID_USER_IMX500_NETWORK_FW_FD (V4L2_CID_USER_IMX500_BASE + 1) | |||
#define V4L2_CID_USER_IMX500_ROTATION (V4L2_CID_USER_IMX500_BASE + 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need to be a custom control rather than V4L2_CID_ROTATE? (Documented in https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/control.html)
How does this affect the resolution of the output image? Normally you'd rotate the 4056x3040 image to give a 3040x4056 output, so the output format needs to change.
.id = V4L2_CID_USER_IMX500_ROTATION, | ||
.ops = &imx500_ctrl_ops, | ||
.type = V4L2_CTRL_TYPE_INTEGER, | ||
.flags = V4L2_CTRL_FLAG_EXECUTE_ON_WRITE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really need to rewrite the register even if setting it to the same value?
@@ -217,6 +217,9 @@ | |||
/* Rotate angle */ | |||
#define IMX500_REG_ADDR_ROTATION CCI_REG8(0xD680) | |||
|
|||
/* Flip vertical/horizontal */ | |||
#define IMX500_REG_ADDR_IMG_ORIENTATION CCI_REG8(0x0101) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already defined and used as IMX500_REG_ORIENTATION
@@ -239,6 +242,7 @@ enum pad_types { IMAGE_PAD, METADATA_PAD, NUM_PADS }; | |||
#define V4L2_CID_USER_IMX500_INFERENCE_WINDOW (V4L2_CID_USER_IMX500_BASE + 0) | |||
#define V4L2_CID_USER_IMX500_NETWORK_FW_FD (V4L2_CID_USER_IMX500_BASE + 1) | |||
#define V4L2_CID_USER_IMX500_ROTATION (V4L2_CID_USER_IMX500_BASE + 2) | |||
#define V4L2_CID_USER_IMX500_IMG_FLIP (V4L2_CID_USER_IMX500_BASE + 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again why a custom control? V4L2_CID_HFLIP and V4L2_CIF_VFLIP exist and are already implemented.
This PR adds support for rotation and image flip functionality for the IMX500.
Rotation Support
Image Flip Support