Skip to content

media: i2c: ov5647: Grab [HV]FLIP controls when streaming - #7685

Merged
pelwell merged 1 commit into
raspberrypi:rpi-6.18.yfrom
6by9:rpi-6.18.y-ov5647
Oct 15, 2026
Merged

pelwell merged 1 commit into
raspberrypi:rpi-6.18.yfrom
6by9:rpi-6.18.y-ov5647

Conversation

@6by9

@6by9 6by9 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

The HFLIP and VFLIP controls change the pixel format, so can not be changed whilst streaming.

Grab those controls when starting streaming, and release them when stopping.

Fixes: 7435508 ("media: i2c: ov5647: Support HFLIP and VFLIP")

raspberrypi/libcamera#360

The HFLIP and VFLIP controls change the pixel format, so
can not be changed whilst streaming.

Grab those controls when starting streaming, and release
them when stopping.

Fixes: 7435508 ("media: i2c: ov5647: Support HFLIP and VFLIP")
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
@Kletternaut

Copy link
Copy Markdown

Thanks for the quick response and for preparing the fix so promptly. I really appreciate it!

@6by9

6by9 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the quick response and for preparing the fix so promptly. I really appreciate it!

This is why I say there's little point pointing AI at it - within the first line of your report I knew what the problem was going to be. A clear description of the issue is worth far more than masses of analysis.

@Kletternaut

Kletternaut commented Oct 15, 2026 •

Copy link
Copy Markdown

Hey 6by9,
You’re clearly a pro at this—I just wanted to help out as best I could (and keep the extra work to a minimum).

The funny thing is, I had already analyzed the root cause in detail a few weeks ago and it was definitely in the driver; unfortunately, I’d misplaced my notes on it, so I had to quickly go through the process again.

In my prompt, I even mentioned that there was an error in the driver and that I was looking for the cause...
That’s just how things go sometimes.

Tested successfully on my Raspberry Pi 5 with the kernel from sudo rpi-update pulls/7685.

With the OV5647 streaming using --rotation 180, starting a second rpicam-vid instance on the IMX477 no longer changes the OV5647's HFLIP/VFLIP controls or its preview orientation.

The patch fixes the issue in my setup. Thanks again for the quick fix!
Best, Tom

@pelwell
pelwell merged commit 76b3777 into raspberrypi:rpi-6.18.y Oct 15, 2026
12 checks passed

@JamesH65 JamesH65 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my own undersstanding, are these released automagically, rather than needing a specific ungrab?

@6by9

6by9 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

Just for my own undersstanding, are these released automagically, rather than needing a specific ungrab?

https://elixir.bootlin.com/linux/v7.2.10/source/include/media/v4l2-ctrls.h#L902

/**
 * __v4l2_ctrl_grab() - Unlocked variant of v4l2_ctrl_grab.
 *
 * @ctrl:	The control to (de)activate.
 * @grabbed:	True if the control should become grabbed.
 *
 * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically.
 * Does nothing if @ctrl == NULL.
 * The V4L2_EVENT_CTRL event will be generated afterwards.
 * This will usually be called when starting or stopping streaming in the
 * driver.

grabbed is passed from enable, so 1 when starting streaming and 0 when stopping streaming.

@JamesH65

Copy link
Copy Markdown
Contributor

Just for my own undersstanding, are these released automagically, rather than needing a specific ungrab?

https://elixir.bootlin.com/linux/v7.2.10/source/include/media/v4l2-ctrls.h#L902

/**
 * __v4l2_ctrl_grab() - Unlocked variant of v4l2_ctrl_grab.
 *
 * @ctrl:	The control to (de)activate.
 * @grabbed:	True if the control should become grabbed.
 *
 * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically.
 * Does nothing if @ctrl == NULL.
 * The V4L2_EVENT_CTRL event will be generated afterwards.
 * This will usually be called when starting or stopping streaming in the
 * driver.

grabbed is passed from enable, so 1 when starting streaming and 0 when stopping streaming.

Gotcha, I'd missed that this function could both start and stop. Ta!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants