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

Libcamera apps improvements #1205

Merged
merged 10 commits into from
Aug 8, 2023
Merged

Libcamera apps improvements #1205

merged 10 commits into from
Aug 8, 2023

Conversation

vivien
Copy link
Contributor

@vivien vivien commented Jul 27, 2023

This branch contains a few changes for the rpi-libcamera-apps package.

It fixes a runtime issue with the raspberrypi machine, adds support for DRM, and makes the package hardware-agnostic as it should be.

@vivien vivien changed the title Libcamera apps Libcamera apps improvements Jul 27, 2023
@vivien
Copy link
Contributor Author

vivien commented Jul 27, 2023

@kraj @agherzan It seems like meta-multimedia isn't included in your CI.

Copy link
Owner

@agherzan agherzan left a comment

Choose a reason for hiding this comment

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

It looks like this broke yocto-check-layer. meta-multimedia was never a dependency of this layer. Any idea why this MR requires it?

@vivien
Copy link
Contributor Author

vivien commented Jul 29, 2023

The error is ERROR: Nothing PROVIDES 'libcamera' (but /work/recipes-multimedia/libcamera-apps/libcamera-apps_git.bb DEPENDS on or otherwise requires it). and libcamera is part of meta-multimedia. I have no idea how the CI handled changes targeting rpi-libcamera-apps before.

@kraj
Copy link
Collaborator

kraj commented Jul 29, 2023

The error is ERROR: Nothing PROVIDES 'libcamera' (but /work/recipes-multimedia/libcamera-apps/libcamera-apps_git.bb DEPENDS on or otherwise requires it). and libcamera is part of meta-multimedia. I have no idea how the CI handled changes targeting rpi-libcamera-apps before.

I think the dependency on meta-multimedia should be added here.

@kraj
Copy link
Collaborator

kraj commented Aug 1, 2023

I think this recipe can be made conditional. There are couple of ways.

  1. Remove it from parsing if multimedia layer is absent
python() {
    if 'multimedia-layer' not in d.getVar('BBFILE_COLLECTIONS').split():
        raise bb.parse.SkipRecipe('Requires meta-multimedia to be present.')
}

or use the dynamic-layers technique, which means move the recipe into

dynamic-layers/multimedia-layer/recipes-multimedia

I think second approach is better.

@agherzan
Copy link
Owner

agherzan commented Aug 2, 2023

I also vote for dynamic layers, but I remember that when that was introduced, there was a "chicken and the egg" with this.

@shr-project
Copy link
Contributor

There is a dynamic-layer directory for this already as that's where libcamera bbappend is in:

meta-raspberrypi/dynamic-layers/multimedia-layer/recipes-multimedia/libcamera

Adding libcamera-apps there as well makes sense to me.
Does this PR fix:

rpi-libcamera-apps/1.1.2+gitAUTOINC+12098520a3-r0/git/core/libcamera_app.hpp:55:40: error: 'StreamRoles' in namespace 'libcamera' does not name a type; did you mean 'StreamRole'?
   55 |         using StreamRoles = libcamera::StreamRoles;
      |                                        ^~~~~~~~~~~
      |                                        StreamRole

?

I've just noticed it in my world builds.

@shr-project
Copy link
Contributor

rpi-libcamera-apps/1.1.2+gitAUTOINC+12098520a3-r0/git/core/libcamera_app.hpp:55:40: error: 'StreamRoles' in namespace 'libcamera' does not name a type; did you mean 'StreamRole'?
   55 |         using StreamRoles = libcamera::StreamRoles;
      |                                        ^~~~~~~~~~~
      |                                        StreamRole

?

I've just noticed it in my world builds.

We need to bump SRCREV to get a fix for current libcamera from meta-oe:
raspberrypi/rpicam-apps@3d9ac10

@shr-project
Copy link
Contributor

Thanks for update, I've tried to build it for rpi4-64 and fails with:

aarch64-oe-linux-g++: error: unrecognized command-line option '-mfpu=neon-fp-armv8'

Because even for aarch64 rpi4-64 it sets cpu to armv8-neon now (as raspberrypi4-64 OVERRIDES contain raspberrypi4 as well).

With armv8-neon being enforced for all ARM based machines, running
any libcamera app on raspberrypi (e.g. Raspberry Pi B Rev 2) results
in Illegal Instruction.

To fix this, set armv8-neon for 32bit raspberrypi3 and raspberrypi4
but defaults to TARGET_ARCH for other non-aarch64 machines.

Fixes: f162192 ("rpi-libcamera-apps: fix flags used in aarch64 builds")
Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
The 'opencv' PACKAGECONFIG entry was missing the build dependency.

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Add a 'drm' PACKAGECONFIG entry in order to provide support for a
DRM preview window while running the libcamera apps.

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
The 'tensorflow-lite' PACKAGECONFIG entry was missing the corresponding
build dependency. In order to be consistent with the build macros,
replace the feature with a 'tflite' package config entry.

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Even though the libcamera apps are a rewrite of the rpicam apps and
maintained by the raspberry folks, switching to libcamera makes the
code hardware agnostic and thus could be compiled and used on various
machines featuring a camera device supported by a libcamera pipeline.

For this reason, do not enforce COMPATIBLE_MACHINE.

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
The libcamera-apps project is written in a hardware-agnostic manner
thanks to libcamera, and thus isn't specific to the rpi SoC family.

Moreover, the project is correctly named libcamera-apps and not
rpi-libcamera-apps, so rename the recipe in order to reflect that.

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Move the libcamera-apps recipe to dynamic-layers/multimedia-layer
alongside with its libcamera dependency.

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Bump libcamera to 3d9ac10 to get a fix for the current libcamera from
meta-openembedded/meta-multimedia for the following issue:

    error: 'StreamRoles' in namespace 'libcamera' does not name a type; did you mean 'StreamRole'?
       55 |         using StreamRoles = libcamera::StreamRoles;
          |                                        ^~~~~~~~~~~
          |                                        StreamRole

Reported-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
@shr-project
Copy link
Contributor

Thanks, now it built OK in my world builds. LGTM

Next achievement is for switching the build to meson as CMake files were removed in latest:
raspberrypi/rpicam-apps@9e17265 :)

CMake is removed in upstream libcamera-apps as of 9e17265,
thus switch to meson to build the package from now on.

Add PACKAGECONFIG entries and neon flags matching the settings
project meson.build as described in the official documentation
https://www.raspberrypi.com/documentation/computers/camera_software.html#building-libcamera-apps

Default to "drm" for PACKAGECONFIG as it is the only option enabled
in both recommended meson setup for Raspberry Pi OS and Raspberry Pi
OS Lite.

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
Now that the libcamera package from meta-multimedia has support
for flicker controls and libcamera-apps uses meson, we can bump the
package to its latest revision.

Signed-off-by: Vivien Didelot <vivien.didelot@gmail.com>
@vivien
Copy link
Contributor Author

vivien commented Aug 3, 2023

bec7182 requires openembedded/meta-openembedded#727 to be merged first.

@agherzan
Copy link
Owner

agherzan commented Aug 4, 2023

bec7182 requires openembedded/meta-openembedded#727 to be merged first.

Did this land?

@shr-project
Copy link
Contributor

shr-project commented Aug 4, 2023

bec7182 requires openembedded/meta-openembedded#727 to be merged first.

Did this land?

It's in master-next since yesterday, will probably get merged to master soon. I've already tested them together.

I don't think you need to wait for meta-oe as rpi-camera-apps is already broken with the libcamera version currently in meta-oe/master (and this PR makes it compatible with master-next and future master).

@agherzan agherzan enabled auto-merge (rebase) August 7, 2023 14:16
@kraj
Copy link
Collaborator

kraj commented Aug 7, 2023

bec7182 requires openembedded/meta-openembedded#727 to be merged first.

Did this land?

now yes.

@agherzan
Copy link
Owner

agherzan commented Aug 7, 2023

This will get automerged on CI pass. Thanks @vivien.

@agherzan agherzan merged commit 5e2f79a into agherzan:master Aug 8, 2023
17 checks passed
@vivien vivien deleted the libcamera-apps branch August 8, 2023 13:20
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