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

Pispbe/port to mainline pisp be #30

Closed

Conversation

jmondi
Copy link
Collaborator

@jmondi jmondi commented Jul 2, 2024

Port libpisp to use the uAPI header introduced by raspberrypi/linux#6249

Most commits are trivial, but b128cb1 might be a bit annoying. I found no other smart ways of working this around.

Jacopo Mondi added 7 commits July 2, 2024 17:11
Update the pisp_be_config.h and pisp_common.h headers from v11
mainline patch series at:
https://lore.kernel.org/all/[email protected]/

Plus additional fixes on top sent at:
https://lore.kernel.org/linux-media/[email protected]/

Signed-off-by: Jacopo Mondi <[email protected]>
The mainline header now uses uppercase identifiers for the image
format macros. Adjust them in libpisp code.

Signed-off-by: Jacopo Mondi <[email protected]>
Now that pisp_common.h doesn't include pips_types.h (which will be
removed) the single files using C standard int types should include
the header explicitly.

Signed-off-by: Jacopo Mondi <[email protected]>
The 'abs()' symbol is undefined. Use the implementation from the
C++ STL.

Signed-off-by: Jacopo Mondi <[email protected]>
The pips_types.h header has been absorbed in pisp_common.h by
the mainline driver version.

Drop it from libpisp as well.

Signed-off-by: Jacopo Mondi <[email protected]>
The mainline version of pisp_be_config.h and pisp_common.h define
all types that are to be written directly to HW registers as
packed, to avoid the compiler inserting holes to force any alignment
of the types' members.

However, this triggers a compiler error when the types members are

error: taking address of packed member of ‘pisp_image_format_config’
may result in an unaligned pointer value
[-Werror=address-of-packed-member]

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36566#c6 for a more
detailed explanation about the compiler error is actually correct.

Albeit libpisp is only going to be compiled on architectures that allow
byte-alligned access (ARMv8) the compiler flags accesses by pointer to
packed struct members as errors.

Work this around by using a temporary variable to store the packed
structure member value and pass it by pointer. As the functions the
variables are passed to might modify the variable values, re-assign them
after the function call to the packed structure members.

Signed-off-by: Jacopo Mondi <[email protected]>
The mainline version of pisp_be_config.h header defines the
'num_tiles' member of 'struct pisp_be_tiles_config' as an unsigned
32-bit value.

Use an unsigned integer as loop variable to avoid the following
compilation error:

error: comparison of integer expressions of different signedness

Signed-off-by: Jacopo Mondi <[email protected]>
getOutputSize(i, image_config.width, image_config.height);
uint16_t width = image_config.width;
uint16_t height = image_config.height;
getOutputSize(i, width, height);
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to copy width/height to image_config here.

However, I think the easiest thing would be to remove this patch and add -Wno-address-of-packed-member to the compiler flags.

@naushir naushir mentioned this pull request Jul 8, 2024
@naushir naushir closed this Jul 9, 2024
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