Skip to content
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

Standard layout changes #40

Merged
merged 3 commits into from
Feb 26, 2025
Merged

Standard layout changes #40

merged 3 commits into from
Feb 26, 2025

Conversation

naushir
Copy link
Collaborator

@naushir naushir commented Feb 25, 2025

No description provided.

The smart resize config block does not need to be stored in a vector as
it will remain statically sized.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Use an array sized to PISP_BACK_END_NUM_TILES for the tile list in the
backend object.

This removes the use of std::vector which will be needed to ensure
class BackEnd is of standard-layout type.

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

naushir commented Feb 25, 2025

@kbingham this a bit more involved than I would have liked, but the changes should allow compilation with the -Dcpp_debugstl=true meson option.

@naushir
Copy link
Collaborator Author

naushir commented Feb 25, 2025

It seems like -Dcpp_debugstl=true adds instrumentation to std::vector that makes it non-standard layout. According to chatgpt, std::vector is not guaranteed to be standard layout, but generally is until this instrumentation is added. std::array on the other hand does have a guarantee, so I've switched to using that instead.

@davidplowman
Copy link
Collaborator

Yes, nothing jumps out as being questionable, or anything.

Introducing the new type names definitely makes things read better. I wonder just a teeny bit about wrapping up the array of tiles and the count together, but at that point we're heading down the SimpleVectorReallyGuaranteed class route, which I guess is overkill at this point.

So it's LGTM from me!

Switch to using std::array types for the default config parameters read
from the JSON config file. This allows the BackEnd class to be
standard layout compliant.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
@naushir naushir merged commit 9b5349c into main Feb 26, 2025
6 of 7 checks passed
@naushir
Copy link
Collaborator Author

naushir commented Feb 26, 2025

@kbingham this is now ready for you to test at release v1.2.0. I've updated my libcamera Pi 5 branch at https://github.com/naushir/libcamera/tree/pi5_upstream so the wrap file points to the new release as well, so the patches posted on the ML will need updating.

@naushir naushir deleted the standard_layout branch February 26, 2025 10:14
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.

2 participants