[libcamera-devel] [PATCH 3/6] libcamera-platform: Move utils to the platform library

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sat Jun 19 01:26:38 CEST 2021


Hi Kieran,

On Sat, Jun 19, 2021 at 12:15:25AM +0100, Kieran Bingham wrote:
> On 17/06/2021 04:09, Laurent Pinchart wrote:
> > On Wed, Jun 16, 2021 at 04:11:49PM +0100, Kieran Bingham wrote:
> >> Move the utils functionality to the libcamera-platform library.
> >>
> >> Please note that the build_rpath addition that was previously added to
> >> the libcamera.so is now moved to this library to ensure the
> >> functionality of isLibcameraInstalled continues.
> > 
> > I wonder, should isLibcameraInstalled(), libcameraBuildPath() and
> > libcameraSourcePath() stay in libcamera itself ?
> 
> I didn't really want to break these out of utils, and I sort of liked
> that we weren't messing around with the rpath on libcamera itself anymore.
> 
> But of course they could also be renamed in utils, and given wrappers
> with these names in libcamera ... but I'm not sure there's enough
> benefit there.

The reason why I thought moving them to libcamera instead of
libcamera-platform is because this is really a hack tighlty coupled with
the needs of libcamera, and with the build system. It doesn't feel like
a generic base helper or platform abstraction to me.

> >> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> >> ---
> >>  include/libcamera/internal/log.h                   |  2 +-
> >>  include/libcamera/internal/meson.build             |  1 -
> >>  include/libcamera/internal/thread.h                |  3 ++-
> >>  include/libcamera/platform/meson.build             |  1 +
> >>  include/libcamera/{internal => platform}/utils.h   |  8 ++++----
> >>  src/android/camera_device.cpp                      |  3 ++-
> >>  src/android/jpeg/exif.cpp                          |  3 ++-
> >>  src/ipa/raspberrypi/cam_helper.hpp                 |  3 ++-
> >>  src/ipa/raspberrypi/controller/agc_algorithm.hpp   |  3 ++-
> >>  src/ipa/raspberrypi/controller/agc_status.h        |  2 +-
> >>  src/ipa/raspberrypi/controller/camera_mode.h       |  2 +-
> >>  src/ipa/raspberrypi/controller/device_status.h     |  2 +-
> >>  src/ipa/raspberrypi/controller/rpi/agc.hpp         |  2 +-
> >>  src/ipa/raspberrypi/controller/rpi/lux.hpp         |  2 +-
> >>  src/libcamera-platform/meson.build                 | 10 ++++++++++
> >>  src/{libcamera => libcamera-platform}/utils.cpp    |  8 ++++----
> >>  src/libcamera/camera_manager.cpp                   |  3 ++-
> >>  src/libcamera/camera_sensor.cpp                    |  3 ++-
> >>  src/libcamera/controls.cpp                         |  3 ++-
> >>  src/libcamera/event_dispatcher_poll.cpp            |  3 ++-
> >>  src/libcamera/ipa_manager.cpp                      |  3 ++-
> >>  src/libcamera/ipa_module.cpp                       |  3 ++-
> >>  src/libcamera/ipa_proxy.cpp                        |  3 ++-
> >>  src/libcamera/log.cpp                              |  3 ++-
> >>  src/libcamera/meson.build                          |  7 -------
> >>  src/libcamera/object.cpp                           |  3 ++-
> >>  src/libcamera/pipeline/ipu3/imgu.cpp               |  3 ++-
> >>  src/libcamera/pipeline/ipu3/ipu3.cpp               |  3 ++-
> >>  src/libcamera/pipeline/raspberrypi/raspberrypi.cpp |  3 ++-
> >>  src/libcamera/pipeline/rkisp1/rkisp1.cpp           |  3 ++-
> >>  src/libcamera/pipeline/simple/converter.cpp        |  3 ++-
> >>  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp       |  3 ++-
> >>  src/libcamera/pipeline/vimc/vimc.cpp               |  3 ++-
> >>  src/libcamera/pipeline_handler.cpp                 |  3 ++-
> >>  src/libcamera/process.cpp                          |  3 ++-
> >>  src/libcamera/stream.cpp                           |  3 ++-
> >>  src/libcamera/timer.cpp                            |  3 ++-
> >>  src/libcamera/v4l2_device.cpp                      |  3 ++-
> >>  src/libcamera/v4l2_subdevice.cpp                   |  3 ++-
> >>  src/v4l2/v4l2_camera_proxy.cpp                     |  3 ++-
> >>  src/v4l2/v4l2_compat_manager.cpp                   |  3 ++-
> >>  test/camera-sensor.cpp                             |  3 ++-
> >>  test/file-descriptor.cpp                           |  2 +-
> >>  test/ipc/unixsocket_ipc.cpp                        |  3 ++-
> >>  test/log/log_process.cpp                           |  3 ++-
> >>  test/pixel-format.cpp                              |  2 +-
> >>  test/process/process_test.cpp                      |  3 ++-
> >>  test/signal-threads.cpp                            |  3 ++-
> >>  test/utils.cpp                                     |  2 +-
> >>  test/v4l2_subdevice/list_formats.cpp               |  3 ++-
> >>  test/v4l2_videodevice/formats.cpp                  |  3 ++-
> >>  51 files changed, 100 insertions(+), 61 deletions(-)
> >>  rename include/libcamera/{internal => platform}/utils.h (97%)
> >>  rename src/{libcamera => libcamera-platform}/utils.cpp (99%)
> > 
> > libcamera-platform or libcamera/platform ?
> 
> I've fought myself over this question too.
> 
> As it's a separate 'library', I went for libcamera-platform to
> distinguish the compilation steps, and ensure the subdir is parsed
> before libcamera itself.
> 
> Of course this could also be accomplished by having subdir('platform')
> as the first entry in src/libcamera/meson.build too.
> 
> > Apart from those questions, this patch looks good to me.
> > 
> >> diff --git a/include/libcamera/internal/log.h b/include/libcamera/internal/log.h
> >> index b8efb161407c..9cdb8de15fe7 100644
> >> --- a/include/libcamera/internal/log.h
> >> +++ b/include/libcamera/internal/log.h
> >> @@ -12,7 +12,7 @@
> >>  
> >>  #include <libcamera/class.h>
> >>  
> >> -#include "libcamera/internal/utils.h"
> >> +#include <libcamera/platform/utils.h>
> 
> But even with the separate library, I really wanted the 'platform' to be
> contained within the include hierarchy still ...
> 
> so indeed, it mixes the two 'options' a little.
> 
> But I like the idea that src/libcamera/ could be pared down to be
> simpler and really be the libcamera layer, which makes me prefer
> libcamera-platform/ (or libcamera-base or such) for the platform and
> object abstractions.

While thinking about this topic, I wondered if

src/libcamera/base/	(or platform)
src/libcamera/core/	(for the existing contents of src/libcamera/)
src/libcamera/pipeline/	(for the pipeline handlers)

would be a good option. I'm sure there are thousands of other
possibilities :-) Let's go with your option, I'm fine with it.

> >>  namespace libcamera {
> >>  
> >> diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build
> >> index f019cfb3b0de..d88a8c6b9235 100644
> >> --- a/include/libcamera/internal/meson.build
> >> +++ b/include/libcamera/internal/meson.build
> >> @@ -42,7 +42,6 @@ libcamera_internal_headers = files([
> >>      'sysfs.h',
> >>      'thread.h',
> >>      'timer.h',
> >> -    'utils.h',
> >>      'v4l2_device.h',
> >>      'v4l2_pixelformat.h',
> >>      'v4l2_subdevice.h',
> >> diff --git a/include/libcamera/internal/thread.h b/include/libcamera/internal/thread.h
> >> index 25d0308d05b4..b3ae8f51ac17 100644
> >> --- a/include/libcamera/internal/thread.h
> >> +++ b/include/libcamera/internal/thread.h
> >> @@ -14,8 +14,9 @@
> >>  
> >>  #include <libcamera/signal.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/message.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  namespace libcamera {
> >>  
> >> diff --git a/include/libcamera/platform/meson.build b/include/libcamera/platform/meson.build
> >> index c8e0d0c5ba12..84a0f8d20ef0 100644
> >> --- a/include/libcamera/platform/meson.build
> >> +++ b/include/libcamera/platform/meson.build
> >> @@ -3,6 +3,7 @@
> >>  libcamera_platform_include_dir = libcamera_include_dir / 'platform'
> >>  
> >>  libcamera_platform_headers = files([
> >> +    'utils.h',
> >>  ])
> >>  
> >>  install_headers(libcamera_platform_headers,
> >> diff --git a/include/libcamera/internal/utils.h b/include/libcamera/platform/utils.h
> >> similarity index 97%
> >> rename from include/libcamera/internal/utils.h
> >> rename to include/libcamera/platform/utils.h
> >> index 15beb0f44172..eb904bc37d59 100644
> >> --- a/include/libcamera/internal/utils.h
> >> +++ b/include/libcamera/platform/utils.h
> >> @@ -4,8 +4,8 @@
> >>   *
> >>   * utils.h - Miscellaneous utility functions
> >>   */
> >> -#ifndef __LIBCAMERA_INTERNAL_UTILS_H__
> >> -#define __LIBCAMERA_INTERNAL_UTILS_H__
> >> +#ifndef __LIBCAMERA_PLATFORM_UTILS_H__
> >> +#define __LIBCAMERA_PLATFORM_UTILS_H__
> >>  
> >>  #include <algorithm>
> >>  #include <chrono>
> >> @@ -23,7 +23,7 @@
> >>  
> >>  /* uClibc and uClibc-ng don't provide O_TMPFILE */
> >>  #ifndef O_TMPFILE
> >> -#define O_TMPFILE	(020000000 | O_DIRECTORY)
> >> +#define O_TMPFILE (020000000 | O_DIRECTORY)
> >>  #endif
> >>  
> >>  #endif
> >> @@ -352,4 +352,4 @@ std::basic_ostream<CharT, Traits> &operator<<(std::basic_ostream<CharT, Traits>
> >>  
> >>  } /* namespace libcamera */
> >>  
> >> -#endif /* __LIBCAMERA_INTERNAL_UTILS_H__ */
> >> +#endif /* __LIBCAMERA_PLATFORM_UTILS_H__ */
> >> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> >> index aca273cc5b75..8b5aa7f91214 100644
> >> --- a/src/android/camera_device.cpp
> >> +++ b/src/android/camera_device.cpp
> >> @@ -23,10 +23,11 @@
> >>  #include <libcamera/formats.h>
> >>  #include <libcamera/property_ids.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/formats.h"
> >>  #include "libcamera/internal/log.h"
> >>  #include "libcamera/internal/thread.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  #include "system/graphics.h"
> >>  
> >> diff --git a/src/android/jpeg/exif.cpp b/src/android/jpeg/exif.cpp
> >> index 922086cdf6bc..07a047ea1d68 100644
> >> --- a/src/android/jpeg/exif.cpp
> >> +++ b/src/android/jpeg/exif.cpp
> >> @@ -14,8 +14,9 @@
> >>  #include <tuple>
> >>  #include <uchar.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/log.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  using namespace libcamera;
> >>  
> >> diff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp
> >> index f53f5c39b01c..0d2688ced02a 100644
> >> --- a/src/ipa/raspberrypi/cam_helper.hpp
> >> +++ b/src/ipa/raspberrypi/cam_helper.hpp
> >> @@ -15,7 +15,8 @@
> >>  #include "controller/metadata.hpp"
> >>  #include "md_parser.hpp"
> >>  
> >> -#include "libcamera/internal/utils.h"
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/v4l2_videodevice.h"
> >>  
> >>  namespace RPiController {
> >> diff --git a/src/ipa/raspberrypi/controller/agc_algorithm.hpp b/src/ipa/raspberrypi/controller/agc_algorithm.hpp
> >> index 134bbcda50ce..192b75db37ac 100644
> >> --- a/src/ipa/raspberrypi/controller/agc_algorithm.hpp
> >> +++ b/src/ipa/raspberrypi/controller/agc_algorithm.hpp
> >> @@ -6,7 +6,8 @@
> >>   */
> >>  #pragma once
> >>  
> >> -#include "libcamera/internal/utils.h"
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "algorithm.hpp"
> >>  
> >>  namespace RPiController {
> >> diff --git a/src/ipa/raspberrypi/controller/agc_status.h b/src/ipa/raspberrypi/controller/agc_status.h
> >> index 5d50e177f0dc..c7e280ec5b68 100644
> >> --- a/src/ipa/raspberrypi/controller/agc_status.h
> >> +++ b/src/ipa/raspberrypi/controller/agc_status.h
> >> @@ -6,7 +6,7 @@
> >>   */
> >>  #pragma once
> >>  
> >> -#include "libcamera/internal/utils.h"
> >> +#include <libcamera/platform/utils.h>
> >>  
> >>  // The AGC algorithm should post the following structure into the image's
> >>  // "agc.status" metadata.
> >> diff --git a/src/ipa/raspberrypi/controller/camera_mode.h b/src/ipa/raspberrypi/controller/camera_mode.h
> >> index 2aa2335dcf90..2224b0f05745 100644
> >> --- a/src/ipa/raspberrypi/controller/camera_mode.h
> >> +++ b/src/ipa/raspberrypi/controller/camera_mode.h
> >> @@ -8,7 +8,7 @@
> >>  
> >>  #include <libcamera/transform.h>
> >>  
> >> -#include "libcamera/internal/utils.h"
> >> +#include <libcamera/platform/utils.h>
> >>  
> >>  // Description of a "camera mode", holding enough information for control
> >>  // algorithms to adapt their behaviour to the different modes of the camera,
> >> diff --git a/src/ipa/raspberrypi/controller/device_status.h b/src/ipa/raspberrypi/controller/device_status.h
> >> index 131b4cd344ee..1b6c258befee 100644
> >> --- a/src/ipa/raspberrypi/controller/device_status.h
> >> +++ b/src/ipa/raspberrypi/controller/device_status.h
> >> @@ -6,7 +6,7 @@
> >>   */
> >>  #pragma once
> >>  
> >> -#include "libcamera/internal/utils.h"
> >> +#include <libcamera/platform/utils.h>
> >>  
> >>  // Definition of "device metadata" which stores things like shutter time and
> >>  // analogue gain that downstream control algorithms will want to know.
> >> diff --git a/src/ipa/raspberrypi/controller/rpi/agc.hpp b/src/ipa/raspberrypi/controller/rpi/agc.hpp
> >> index 750789482b49..39898c66cf34 100644
> >> --- a/src/ipa/raspberrypi/controller/rpi/agc.hpp
> >> +++ b/src/ipa/raspberrypi/controller/rpi/agc.hpp
> >> @@ -9,7 +9,7 @@
> >>  #include <vector>
> >>  #include <mutex>
> >>  
> >> -#include "libcamera/internal/utils.h"
> >> +#include <libcamera/platform/utils.h>
> >>  
> >>  #include "../agc_algorithm.hpp"
> >>  #include "../agc_status.h"
> >> diff --git a/src/ipa/raspberrypi/controller/rpi/lux.hpp b/src/ipa/raspberrypi/controller/rpi/lux.hpp
> >> index 45c844393e62..af6d6a11773a 100644
> >> --- a/src/ipa/raspberrypi/controller/rpi/lux.hpp
> >> +++ b/src/ipa/raspberrypi/controller/rpi/lux.hpp
> >> @@ -8,7 +8,7 @@
> >>  
> >>  #include <mutex>
> >>  
> >> -#include "libcamera/internal/utils.h"
> >> +#include <libcamera/platform/utils.h>
> >>  
> >>  #include "../lux_status.h"
> >>  #include "../algorithm.hpp"
> >> diff --git a/src/libcamera-platform/meson.build b/src/libcamera-platform/meson.build
> >> index 64d0dfee2731..d53413fdffde 100644
> >> --- a/src/libcamera-platform/meson.build
> >> +++ b/src/libcamera-platform/meson.build
> >> @@ -1,15 +1,25 @@
> >>  # SPDX-License-Identifier: CC0-1.0
> >>  
> >>  libcamera_platform_sources = files([
> >> +    'utils.cpp',
> >>  ])
> >>  
> >> +libdl = cc.find_library('dl')
> >> +
> >>  libcamera_platform_deps = [
> >> +    libdl,
> >>  ]
> >>  
> >> +# We add '/' to the build_rpath as a 'safe' path to act as a boolean flag.
> >> +# The build_rpath is stripped at install time by meson, so we determine at
> >> +# runtime if the library is running from an installed location by checking
> >> +# for the presence or abscence of the dynamic tag.
> >> +
> >>  libcamera_platform_lib = shared_library('libcamera_platform',
> >>                                         [libcamera_platform_sources, libcamera_platform_headers],
> >>                                         name_prefix : '',
> >>                                         install : true,
> >> +                                       build_rpath : '/',
> >>                                         cpp_args : libcamera_cpp_args,
> >>                                         include_directories : libcamera_includes,
> >>                                         dependencies : libcamera_platform_deps)
> >> diff --git a/src/libcamera/utils.cpp b/src/libcamera-platform/utils.cpp
> >> similarity index 99%
> >> rename from src/libcamera/utils.cpp
> >> rename to src/libcamera-platform/utils.cpp
> >> index 2e7d35fb1173..cfd3a4becdde 100644
> >> --- a/src/libcamera/utils.cpp
> >> +++ b/src/libcamera-platform/utils.cpp
> >> @@ -5,7 +5,7 @@
> >>   * utils.cpp - Miscellaneous utility functions
> >>   */
> >>  
> >> -#include "libcamera/internal/utils.h"
> >> +#include <libcamera/platform/utils.h>
> >>  
> >>  #include <dlfcn.h>
> >>  #include <elf.h>
> >> @@ -20,7 +20,7 @@
> >>  #include <unistd.h>
> >>  
> >>  /**
> >> - * \file utils.h
> >> + * \file platform/utils.h
> >>   * \brief Miscellaneous utility functions
> >>   */
> >>  
> >> @@ -44,8 +44,8 @@ namespace utils {
> >>   */
> >>  const char *basename(const char *path)
> >>  {
> >> -       const char *base = strrchr(path, '/');
> >> -       return base ? base + 1 : path;
> >> +	const char *base = strrchr(path, '/');
> >> +	return base ? base + 1 : path;
> >>  }
> >>  
> >>  /**
> >> diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
> >> index 1ecf2b07d5a3..8198494e439c 100644
> >> --- a/src/libcamera/camera_manager.cpp
> >> +++ b/src/libcamera/camera_manager.cpp
> >> @@ -12,13 +12,14 @@
> >>  
> >>  #include <libcamera/camera.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/device_enumerator.h"
> >>  #include "libcamera/internal/ipa_manager.h"
> >>  #include "libcamera/internal/log.h"
> >>  #include "libcamera/internal/pipeline_handler.h"
> >>  #include "libcamera/internal/process.h"
> >>  #include "libcamera/internal/thread.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  /**
> >>   * \file camera_manager.h
> >> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
> >> index 3e135353f1d7..64468e7e5288 100644
> >> --- a/src/libcamera/camera_sensor.cpp
> >> +++ b/src/libcamera/camera_sensor.cpp
> >> @@ -18,11 +18,12 @@
> >>  
> >>  #include <libcamera/property_ids.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/bayer_format.h"
> >>  #include "libcamera/internal/camera_sensor_properties.h"
> >>  #include "libcamera/internal/formats.h"
> >>  #include "libcamera/internal/sysfs.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  /**
> >>   * \file camera_sensor.h
> >> diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp
> >> index 5aef4e7145bd..d23349eb953f 100644
> >> --- a/src/libcamera/controls.cpp
> >> +++ b/src/libcamera/controls.cpp
> >> @@ -12,9 +12,10 @@
> >>  #include <string>
> >>  #include <string.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/control_validator.h"
> >>  #include "libcamera/internal/log.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  /**
> >>   * \file controls.h
> >> diff --git a/src/libcamera/event_dispatcher_poll.cpp b/src/libcamera/event_dispatcher_poll.cpp
> >> index 456c6def075b..30ffeaf5d4d8 100644
> >> --- a/src/libcamera/event_dispatcher_poll.cpp
> >> +++ b/src/libcamera/event_dispatcher_poll.cpp
> >> @@ -16,11 +16,12 @@
> >>  #include <sys/eventfd.h>
> >>  #include <unistd.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/event_notifier.h"
> >>  #include "libcamera/internal/log.h"
> >>  #include "libcamera/internal/thread.h"
> >>  #include "libcamera/internal/timer.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  /**
> >>   * \file event_dispatcher_poll.h
> >> diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp
> >> index 93d02d947c46..0f8e5de87f99 100644
> >> --- a/src/libcamera/ipa_manager.cpp
> >> +++ b/src/libcamera/ipa_manager.cpp
> >> @@ -12,12 +12,13 @@
> >>  #include <string.h>
> >>  #include <sys/types.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/file.h"
> >>  #include "libcamera/internal/ipa_module.h"
> >>  #include "libcamera/internal/ipa_proxy.h"
> >>  #include "libcamera/internal/log.h"
> >>  #include "libcamera/internal/pipeline_handler.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  /**
> >>   * \file ipa_manager.h
> >> diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp
> >> index f53e529b0380..bf272ba35df7 100644
> >> --- a/src/libcamera/ipa_module.cpp
> >> +++ b/src/libcamera/ipa_module.cpp
> >> @@ -23,10 +23,11 @@
> >>  
> >>  #include <libcamera/span.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/file.h"
> >>  #include "libcamera/internal/log.h"
> >>  #include "libcamera/internal/pipeline_handler.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  /**
> >>   * \file ipa_module.h
> >> diff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp
> >> index b70fde581eeb..d659230f55c9 100644
> >> --- a/src/libcamera/ipa_proxy.cpp
> >> +++ b/src/libcamera/ipa_proxy.cpp
> >> @@ -12,9 +12,10 @@
> >>  #include <sys/types.h>
> >>  #include <unistd.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/ipa_module.h"
> >>  #include "libcamera/internal/log.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  /**
> >>   * \file ipa_proxy.h
> >> diff --git a/src/libcamera/log.cpp b/src/libcamera/log.cpp
> >> index 74829a56916e..72c80208f583 100644
> >> --- a/src/libcamera/log.cpp
> >> +++ b/src/libcamera/log.cpp
> >> @@ -23,8 +23,9 @@
> >>  
> >>  #include <libcamera/logging.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/thread.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  /**
> >>   * \file log.h
> >> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
> >> index 6ba59e4006cb..870d4c4276e9 100644
> >> --- a/src/libcamera/meson.build
> >> +++ b/src/libcamera/meson.build
> >> @@ -51,7 +51,6 @@ libcamera_sources = files([
> >>      'thread.cpp',
> >>      'timer.cpp',
> >>      'transform.cpp',
> >> -    'utils.cpp',
> >>      'v4l2_device.cpp',
> >>      'v4l2_pixelformat.cpp',
> >>      'v4l2_subdevice.cpp',
> >> @@ -131,18 +130,12 @@ libcamera_deps = [
> >>      dependency('threads'),
> >>  ]
> >>  
> >> -# We add '/' to the build_rpath as a 'safe' path to act as a boolean flag.
> >> -# The build_rpath is stripped at install time by meson, so we determine at
> >> -# runtime if the library is running from an installed location by checking
> >> -# for the presence or abscence of the dynamic tag.
> >> -
> >>  libcamera = shared_library('camera',
> >>                             libcamera_sources,
> >>                             install : true,
> >>                             cpp_args : libcamera_cpp_args,
> >>                             include_directories : includes,
> >>                             objects : libcamera_objects,
> >> -                           build_rpath : '/',
> >>                             dependencies : libcamera_deps)
> >>  
> >>  # TODO Drop libcamera_generated_ipa_headers from libcamera_dep as libcamera_dep
> >> diff --git a/src/libcamera/object.cpp b/src/libcamera/object.cpp
> >> index 5e6b73f9af84..71739d6c2fff 100644
> >> --- a/src/libcamera/object.cpp
> >> +++ b/src/libcamera/object.cpp
> >> @@ -11,11 +11,12 @@
> >>  
> >>  #include <libcamera/signal.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/log.h"
> >>  #include "libcamera/internal/message.h"
> >>  #include "libcamera/internal/semaphore.h"
> >>  #include "libcamera/internal/thread.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  /**
> >>   * \file object.h
> >> diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp
> >> index 4eb3f7b730a9..297685bc597f 100644
> >> --- a/src/libcamera/pipeline/ipu3/imgu.cpp
> >> +++ b/src/libcamera/pipeline/ipu3/imgu.cpp
> >> @@ -16,9 +16,10 @@
> >>  #include <libcamera/formats.h>
> >>  #include <libcamera/stream.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/log.h"
> >>  #include "libcamera/internal/media_device.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  namespace libcamera {
> >>  
> >> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> >> index 6c93bc6d161d..269ab18938c6 100644
> >> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> >> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> >> @@ -20,6 +20,8 @@
> >>  #include <libcamera/request.h>
> >>  #include <libcamera/stream.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/camera_sensor.h"
> >>  #include "libcamera/internal/delayed_controls.h"
> >>  #include "libcamera/internal/device_enumerator.h"
> >> @@ -27,7 +29,6 @@
> >>  #include "libcamera/internal/log.h"
> >>  #include "libcamera/internal/media_device.h"
> >>  #include "libcamera/internal/pipeline_handler.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  #include "cio2.h"
> >>  #include "frames.h"
> >> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> >> index a65b4568256c..dc3fe63112d4 100644
> >> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> >> +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> >> @@ -24,6 +24,8 @@
> >>  #include <libcamera/property_ids.h>
> >>  #include <libcamera/request.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include <linux/bcm2835-isp.h>
> >>  #include <linux/videodev2.h>
> >>  
> >> @@ -35,7 +37,6 @@
> >>  #include "libcamera/internal/ipa_manager.h"
> >>  #include "libcamera/internal/media_device.h"
> >>  #include "libcamera/internal/pipeline_handler.h"
> >> -#include "libcamera/internal/utils.h"
> >>  #include "libcamera/internal/v4l2_videodevice.h"
> >>  
> >>  #include "dma_heaps.h"
> >> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> >> index 6699839c4623..30a015e2ed59 100644
> >> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> >> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> >> @@ -24,6 +24,8 @@
> >>  #include <libcamera/request.h>
> >>  #include <libcamera/stream.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/camera_sensor.h"
> >>  #include "libcamera/internal/delayed_controls.h"
> >>  #include "libcamera/internal/device_enumerator.h"
> >> @@ -31,7 +33,6 @@
> >>  #include "libcamera/internal/log.h"
> >>  #include "libcamera/internal/media_device.h"
> >>  #include "libcamera/internal/pipeline_handler.h"
> >> -#include "libcamera/internal/utils.h"
> >>  #include "libcamera/internal/v4l2_subdevice.h"
> >>  #include "libcamera/internal/v4l2_videodevice.h"
> >>  
> >> diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp
> >> index 68644ef6477f..6c729408cb08 100644
> >> --- a/src/libcamera/pipeline/simple/converter.cpp
> >> +++ b/src/libcamera/pipeline/simple/converter.cpp
> >> @@ -15,9 +15,10 @@
> >>  #include <libcamera/signal.h>
> >>  #include <libcamera/stream.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/log.h"
> >>  #include "libcamera/internal/media_device.h"
> >> -#include "libcamera/internal/utils.h"
> >>  #include "libcamera/internal/v4l2_videodevice.h"
> >>  
> >>  namespace libcamera {
> >> diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
> >> index 12a85b2407db..d5b325bd6b34 100644
> >> --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
> >> +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
> >> @@ -19,12 +19,13 @@
> >>  #include <libcamera/request.h>
> >>  #include <libcamera/stream.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/device_enumerator.h"
> >>  #include "libcamera/internal/log.h"
> >>  #include "libcamera/internal/media_device.h"
> >>  #include "libcamera/internal/pipeline_handler.h"
> >>  #include "libcamera/internal/sysfs.h"
> >> -#include "libcamera/internal/utils.h"
> >>  #include "libcamera/internal/v4l2_videodevice.h"
> >>  
> >>  namespace libcamera {
> >> diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
> >> index 8bbac0085c9b..b20bef0f5ace 100644
> >> --- a/src/libcamera/pipeline/vimc/vimc.cpp
> >> +++ b/src/libcamera/pipeline/vimc/vimc.cpp
> >> @@ -23,13 +23,14 @@
> >>  #include <libcamera/request.h>
> >>  #include <libcamera/stream.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/camera_sensor.h"
> >>  #include "libcamera/internal/device_enumerator.h"
> >>  #include "libcamera/internal/ipa_manager.h"
> >>  #include "libcamera/internal/log.h"
> >>  #include "libcamera/internal/media_device.h"
> >>  #include "libcamera/internal/pipeline_handler.h"
> >> -#include "libcamera/internal/utils.h"
> >>  #include "libcamera/internal/v4l2_subdevice.h"
> >>  #include "libcamera/internal/v4l2_videodevice.h"
> >>  
> >> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
> >> index e507a8bba8a6..a138db9fda4a 100644
> >> --- a/src/libcamera/pipeline_handler.cpp
> >> +++ b/src/libcamera/pipeline_handler.cpp
> >> @@ -13,11 +13,12 @@
> >>  #include <libcamera/camera.h>
> >>  #include <libcamera/camera_manager.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/device_enumerator.h"
> >>  #include "libcamera/internal/log.h"
> >>  #include "libcamera/internal/media_device.h"
> >>  #include "libcamera/internal/tracepoints.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  /**
> >>   * \file pipeline_handler.h
> >> diff --git a/src/libcamera/process.cpp b/src/libcamera/process.cpp
> >> index 40a434a6b0c2..94dce3c7de46 100644
> >> --- a/src/libcamera/process.cpp
> >> +++ b/src/libcamera/process.cpp
> >> @@ -20,9 +20,10 @@
> >>  #include <unistd.h>
> >>  #include <vector>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/event_notifier.h"
> >>  #include "libcamera/internal/log.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  /**
> >>   * \file process.h
> >> diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp
> >> index f7bafcf8fc97..fae217fe21fa 100644
> >> --- a/src/libcamera/stream.cpp
> >> +++ b/src/libcamera/stream.cpp
> >> @@ -15,8 +15,9 @@
> >>  
> >>  #include <libcamera/request.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/log.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  /**
> >>   * \file stream.h
> >> diff --git a/src/libcamera/timer.cpp b/src/libcamera/timer.cpp
> >> index c242113a782e..22bf4ffe3704 100644
> >> --- a/src/libcamera/timer.cpp
> >> +++ b/src/libcamera/timer.cpp
> >> @@ -11,11 +11,12 @@
> >>  
> >>  #include <libcamera/camera_manager.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/event_dispatcher.h"
> >>  #include "libcamera/internal/log.h"
> >>  #include "libcamera/internal/message.h"
> >>  #include "libcamera/internal/thread.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  /**
> >>   * \file timer.h
> >> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
> >> index 5660e6ea5839..693c62a1f895 100644
> >> --- a/src/libcamera/v4l2_device.cpp
> >> +++ b/src/libcamera/v4l2_device.cpp
> >> @@ -16,10 +16,11 @@
> >>  #include <sys/syscall.h>
> >>  #include <unistd.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/event_notifier.h"
> >>  #include "libcamera/internal/log.h"
> >>  #include "libcamera/internal/sysfs.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  /**
> >>   * \file v4l2_device.h
> >> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp
> >> index 721ff5a92a2b..8091b4cadd58 100644
> >> --- a/src/libcamera/v4l2_subdevice.cpp
> >> +++ b/src/libcamera/v4l2_subdevice.cpp
> >> @@ -19,10 +19,11 @@
> >>  
> >>  #include <libcamera/geometry.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/log.h"
> >>  #include "libcamera/internal/media_device.h"
> >>  #include "libcamera/internal/media_object.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  /**
> >>   * \file v4l2_subdevice.h
> >> diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
> >> index f8bfe595e90e..a94132e2511b 100644
> >> --- a/src/v4l2/v4l2_camera_proxy.cpp
> >> +++ b/src/v4l2/v4l2_camera_proxy.cpp
> >> @@ -20,9 +20,10 @@
> >>  #include <libcamera/formats.h>
> >>  #include <libcamera/object.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/formats.h"
> >>  #include "libcamera/internal/log.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  #include "v4l2_camera.h"
> >>  #include "v4l2_camera_file.h"
> >> diff --git a/src/v4l2/v4l2_compat_manager.cpp b/src/v4l2/v4l2_compat_manager.cpp
> >> index 96dbcdf28f04..1ab706b9a60f 100644
> >> --- a/src/v4l2/v4l2_compat_manager.cpp
> >> +++ b/src/v4l2/v4l2_compat_manager.cpp
> >> @@ -22,8 +22,9 @@
> >>  #include <libcamera/camera.h>
> >>  #include <libcamera/camera_manager.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/log.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  #include "v4l2_camera_file.h"
> >>  
> >> diff --git a/test/camera-sensor.cpp b/test/camera-sensor.cpp
> >> index 8c7fd1d2d444..90772e7a3eb3 100644
> >> --- a/test/camera-sensor.cpp
> >> +++ b/test/camera-sensor.cpp
> >> @@ -10,10 +10,11 @@
> >>  
> >>  #include <linux/media-bus-format.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/camera_sensor.h"
> >>  #include "libcamera/internal/device_enumerator.h"
> >>  #include "libcamera/internal/media_device.h"
> >> -#include "libcamera/internal/utils.h"
> >>  #include "libcamera/internal/v4l2_subdevice.h"
> >>  
> >>  #include "test.h"
> >> diff --git a/test/file-descriptor.cpp b/test/file-descriptor.cpp
> >> index aa3c896fb937..890fd297f115 100644
> >> --- a/test/file-descriptor.cpp
> >> +++ b/test/file-descriptor.cpp
> >> @@ -13,7 +13,7 @@
> >>  
> >>  #include <libcamera/file_descriptor.h>
> >>  
> >> -#include "libcamera/internal/utils.h"
> >> +#include <libcamera/platform/utils.h>
> >>  
> >>  #include "test.h"
> >>  
> >> diff --git a/test/ipc/unixsocket_ipc.cpp b/test/ipc/unixsocket_ipc.cpp
> >> index 3049eaa8bb2a..21a5580db7fe 100644
> >> --- a/test/ipc/unixsocket_ipc.cpp
> >> +++ b/test/ipc/unixsocket_ipc.cpp
> >> @@ -15,6 +15,8 @@
> >>  #include <sys/wait.h>
> >>  #include <unistd.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/event_dispatcher.h"
> >>  #include "libcamera/internal/ipa_data_serializer.h"
> >>  #include "libcamera/internal/ipc_pipe.h"
> >> @@ -22,7 +24,6 @@
> >>  #include "libcamera/internal/process.h"
> >>  #include "libcamera/internal/thread.h"
> >>  #include "libcamera/internal/timer.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  #include "test.h"
> >>  
> >> diff --git a/test/log/log_process.cpp b/test/log/log_process.cpp
> >> index c0a1a012d366..43c269dc0176 100644
> >> --- a/test/log/log_process.cpp
> >> +++ b/test/log/log_process.cpp
> >> @@ -16,12 +16,13 @@
> >>  
> >>  #include <libcamera/logging.h>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/event_dispatcher.h"
> >>  #include "libcamera/internal/log.h"
> >>  #include "libcamera/internal/process.h"
> >>  #include "libcamera/internal/thread.h"
> >>  #include "libcamera/internal/timer.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  #include "test.h"
> >>  
> >> diff --git a/test/pixel-format.cpp b/test/pixel-format.cpp
> >> index c4a08f468ade..36dafcf1e78f 100644
> >> --- a/test/pixel-format.cpp
> >> +++ b/test/pixel-format.cpp
> >> @@ -10,7 +10,7 @@
> >>  #include <libcamera/formats.h>
> >>  #include <libcamera/pixel_format.h>
> >>  
> >> -#include "libcamera/internal/utils.h"
> >> +#include <libcamera/platform/utils.h>
> >>  
> >>  #include "test.h"
> >>  
> >> diff --git a/test/process/process_test.cpp b/test/process/process_test.cpp
> >> index 1279d8c17598..54b2b8fda2b5 100644
> >> --- a/test/process/process_test.cpp
> >> +++ b/test/process/process_test.cpp
> >> @@ -9,11 +9,12 @@
> >>  #include <unistd.h>
> >>  #include <vector>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/event_dispatcher.h"
> >>  #include "libcamera/internal/process.h"
> >>  #include "libcamera/internal/thread.h"
> >>  #include "libcamera/internal/timer.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  #include "test.h"
> >>  
> >> diff --git a/test/signal-threads.cpp b/test/signal-threads.cpp
> >> index 3c5f3792e385..c3145aebe85f 100644
> >> --- a/test/signal-threads.cpp
> >> +++ b/test/signal-threads.cpp
> >> @@ -9,9 +9,10 @@
> >>  #include <iostream>
> >>  #include <thread>
> >>  
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/message.h"
> >>  #include "libcamera/internal/thread.h"
> >> -#include "libcamera/internal/utils.h"
> >>  
> >>  #include "test.h"
> >>  
> >> diff --git a/test/utils.cpp b/test/utils.cpp
> >> index f170ae4c2f35..b65de56bf6c5 100644
> >> --- a/test/utils.cpp
> >> +++ b/test/utils.cpp
> >> @@ -14,7 +14,7 @@
> >>  #include <libcamera/geometry.h>
> >>  #include <libcamera/span.h>
> >>  
> >> -#include "libcamera/internal/utils.h"
> >> +#include <libcamera/platform/utils.h>
> >>  
> >>  #include "test.h"
> >>  
> >> diff --git a/test/v4l2_subdevice/list_formats.cpp b/test/v4l2_subdevice/list_formats.cpp
> >> index 74ec81a8560c..5fadfc935a3e 100644
> >> --- a/test/v4l2_subdevice/list_formats.cpp
> >> +++ b/test/v4l2_subdevice/list_formats.cpp
> >> @@ -10,7 +10,8 @@
> >>  
> >>  #include <libcamera/geometry.h>
> >>  
> >> -#include "libcamera/internal/utils.h"
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/v4l2_subdevice.h"
> >>  
> >>  #include "v4l2_subdevice_test.h"
> >> diff --git a/test/v4l2_videodevice/formats.cpp b/test/v4l2_videodevice/formats.cpp
> >> index 255446fe758a..2bf64f341084 100644
> >> --- a/test/v4l2_videodevice/formats.cpp
> >> +++ b/test/v4l2_videodevice/formats.cpp
> >> @@ -8,7 +8,8 @@
> >>  #include <iostream>
> >>  #include <limits.h>
> >>  
> >> -#include "libcamera/internal/utils.h"
> >> +#include <libcamera/platform/utils.h>
> >> +
> >>  #include "libcamera/internal/v4l2_videodevice.h"
> >>  
> >>  #include "v4l2_videodevice_test.h"

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list