Skip to content

drivers: media: rpi: cfe: Avoid unpack operation for 16-bit formats #6926

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

Merged
merged 1 commit into from
Jun 27, 2025

Conversation

naushir
Copy link
Contributor

@naushir naushir commented Jun 26, 2025

The unpack operation is redundant for 16-bit sensor formats, don't set the hardware to do it in these cases.

@@ -884,7 +884,9 @@ static void cfe_start_channel(struct cfe_node *node)
width = source_fmt->width;
height = source_fmt->height;

if (node->vid_fmt.fmt.pix.pixelformat ==
/* We don't need to repack in the case of 16-bit output. */
if (fmt.depth != 16 &&
Copy link
Contributor

Choose a reason for hiding this comment

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

fmt->depth

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Groan, I even had that locally!

The unpack operation is redundant for 16-bit sensor formats, don't set
the hardware to do it in these cases.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
@naushir
Copy link
Contributor Author

naushir commented Jun 27, 2025

@njhollinghurst sadly I think this fix is only partially complete. We only remove the REMAP mode for direct CSI-2 output, not the FE output.

From reading the spec, if mode == 2’b11 (route to FE), then REMAP happens unconditionally. This means we cannot apply a similar bit of logic to remove the REMAP 😢

@njhollinghurst
Copy link
Contributor

Yes, the only workaround when using FE is to use the 'wildcard' DT (which is equivalent to reverting 98b1f0d) with the side-effect that it will then capture metadata and other DTs.

FE could in theory crop out the different components, but better to avoid FE altogether if we can.

@naushir
Copy link
Contributor Author

naushir commented Jun 27, 2025

Merging this now as it's correct, but fixing the core issue still needs quite a bit of additional work.

@naushir naushir merged commit 274049e into raspberrypi:rpi-6.12.y Jun 27, 2025
12 checks passed
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.

3 participants