Commit graph

3 commits

Author SHA1 Message Date
Barnabás Pőcze
cfa7488072 libcamera: tracing: fix header generation when built as subproject
Building libcamera as a subproject is failing when tracepoints are
enabled due to incorrectly managing the relative paths between the
source and build directory while generating tracepoint headers.

The previously used

  path = output.replace('include/', '', 1)

logic is not sufficient to correctly determine the proper path when
libcamera is built as a subproject, and does not correctly handle the
relative paths, causing path to be processed as:

  'subprojects/libcamera/include/libcamera/internal/tracepoints.h'.replace('include/', '', 1)

which evaluates to

  'subprojects/libcamera/libcamera/internal/tracepoints.h'

so the tracepoints.h header file will try to include:

  #define TRACEPOINT_INCLUDE "subprojects/libcamera/libcamera/internal/tracepoints.h"

which will fail.

Fix it by using Python's pathlib to calculate the relative path of the
output file with respect to the "include" directory of libcamera.

This has been tested with Pipewire. For non-subproject builds it should
generate the exact same path that was previously generated.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
[Kieran: Commit message expanded/reworded]
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-11-24 14:52:00 +00:00
Brian Olson
8ff5a8d548 utils: tracepoints: gen-tp-header: Add execute permission
The gen-tp-header script does not have execute permissions set on the
file.

Add the execute permission to ensure that meson runs this script
consistently in the same configuration as other scripts, without
invoking python itself separately.

Signed-off-by: Brian Olson <icic@bolson.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-12-14 10:49:20 +00:00
Paul Elder
fcc6d4bd76 libcamera: tracing: Implement tracing infrastructure
Implement tracing infrastructure in libcamera. It takes .tp files, as
required by lttng, and generates a tracepoint header and C file, as lttng
requires. meson is updated accordingly to get it to compile with the
rest of libcamera. Update the documentation accordingly.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-11-03 11:07:21 +09:00