[libcamera-devel,13/16] libcamera/base: Move span to base library
diff mbox series

Message ID 20210625013539.625803-14-kieran.bingham@ideasonboard.com
State Accepted
Headers show
Series
  • libcamera-base: A new split on libcamera
Related show

Commit Message

Kieran Bingham June 25, 2021, 1:35 a.m. UTC
Move span, and adjust the Doxygen exlusion as well.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 Documentation/Doxyfile.in                       | 2 +-
 include/libcamera/base/file.h                   | 3 +--
 include/libcamera/base/meson.build              | 1 +
 include/libcamera/{ => base}/span.h             | 0
 include/libcamera/controls.h                    | 2 +-
 include/libcamera/internal/buffer.h             | 2 +-
 include/libcamera/internal/byte_stream_buffer.h | 3 +--
 include/libcamera/internal/pub_key.h            | 2 +-
 include/libcamera/internal/v4l2_device.h        | 2 +-
 include/libcamera/meson.build                   | 1 -
 src/android/camera_buffer.h                     | 3 +--
 src/android/jpeg/encoder.h                      | 3 ++-
 src/android/jpeg/exif.h                         | 3 ++-
 src/ipa/libipa/histogram.h                      | 2 +-
 src/ipa/raspberrypi/cam_helper.hpp              | 3 +--
 src/ipa/raspberrypi/md_parser.hpp               | 2 +-
 src/ipa/raspberrypi/raspberrypi.cpp             | 2 +-
 src/libcamera/control_serializer.cpp            | 2 +-
 src/libcamera/ipa_module.cpp                    | 3 +--
 src/libcamera/pipeline/rkisp1/rkisp1_path.h     | 2 +-
 test/span.cpp                                   | 2 +-
 test/utils.cpp                                  | 6 +++---
 22 files changed, 24 insertions(+), 27 deletions(-)
 rename include/libcamera/{ => base}/span.h (100%)

Comments

Hirokazu Honda June 25, 2021, 4:15 a.m. UTC | #1
Hi Kieran, thank you for the patch.

On Fri, Jun 25, 2021 at 10:35 AM Kieran Bingham
<kieran.bingham@ideasonboard.com> wrote:
>
> Move span, and adjust the Doxygen exlusion as well.

s/exlusion/exclusion/
>
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>  Documentation/Doxyfile.in                       | 2 +-
>  include/libcamera/base/file.h                   | 3 +--
>  include/libcamera/base/meson.build              | 1 +
>  include/libcamera/{ => base}/span.h             | 0
>  include/libcamera/controls.h                    | 2 +-
>  include/libcamera/internal/buffer.h             | 2 +-
>  include/libcamera/internal/byte_stream_buffer.h | 3 +--
>  include/libcamera/internal/pub_key.h            | 2 +-
>  include/libcamera/internal/v4l2_device.h        | 2 +-
>  include/libcamera/meson.build                   | 1 -
>  src/android/camera_buffer.h                     | 3 +--
>  src/android/jpeg/encoder.h                      | 3 ++-
>  src/android/jpeg/exif.h                         | 3 ++-
>  src/ipa/libipa/histogram.h                      | 2 +-
>  src/ipa/raspberrypi/cam_helper.hpp              | 3 +--
>  src/ipa/raspberrypi/md_parser.hpp               | 2 +-
>  src/ipa/raspberrypi/raspberrypi.cpp             | 2 +-
>  src/libcamera/control_serializer.cpp            | 2 +-
>  src/libcamera/ipa_module.cpp                    | 3 +--
>  src/libcamera/pipeline/rkisp1/rkisp1_path.h     | 2 +-
>  test/span.cpp                                   | 2 +-
>  test/utils.cpp                                  | 6 +++---
>  22 files changed, 24 insertions(+), 27 deletions(-)
>  rename include/libcamera/{ => base}/span.h (100%)
>
> diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in
> index 8305f56af7a8..a79d37706faf 100644
> --- a/Documentation/Doxyfile.in
> +++ b/Documentation/Doxyfile.in
> @@ -834,7 +834,7 @@ RECURSIVE              = YES
>  # Note that relative paths are relative to the directory from which doxygen is
>  # run.
>
> -EXCLUDE                = @TOP_SRCDIR@/include/libcamera/span.h \
> +EXCLUDE                = @TOP_SRCDIR@/include/libcamera/base/span.h \
>                          @TOP_SRCDIR@/include/libcamera/internal/device_enumerator_sysfs.h \
>                          @TOP_SRCDIR@/include/libcamera/internal/device_enumerator_udev.h \
>                          @TOP_SRCDIR@/include/libcamera/internal/ipc_pipe_unixsocket.h \
> diff --git a/include/libcamera/base/file.h b/include/libcamera/base/file.h
> index cecbb254591f..c3c7ca6013a8 100644
> --- a/include/libcamera/base/file.h
> +++ b/include/libcamera/base/file.h
> @@ -13,8 +13,7 @@
>
>  #include <libcamera/base/class.h>
>  #include <libcamera/base/private.h>
> -
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>
>  namespace libcamera {
>
> diff --git a/include/libcamera/base/meson.build b/include/libcamera/base/meson.build
> index aaac324d7149..7c499b558fb0 100644
> --- a/include/libcamera/base/meson.build
> +++ b/include/libcamera/base/meson.build
> @@ -15,6 +15,7 @@ libcamera_base_headers = files([
>      'private.h',
>      'semaphore.h',
>      'signal.h',
> +    'span.h',
>      'thread.h',
>      'timer.h',
>      'utils.h',
> diff --git a/include/libcamera/span.h b/include/libcamera/base/span.h
> similarity index 100%

Shall we change a header guard?

Isn't span not one which should not be exposed to public?

> rename from include/libcamera/span.h
> rename to include/libcamera/base/span.h
> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
> index f62b6cf055d6..1bc958a43b22 100644
> --- a/include/libcamera/controls.h
> +++ b/include/libcamera/controls.h
> @@ -15,9 +15,9 @@
>  #include <vector>
>
>  #include <libcamera/base/class.h>
> +#include <libcamera/base/span.h>
>
>  #include <libcamera/geometry.h>
> -#include <libcamera/span.h>
>
>  namespace libcamera {
>
> diff --git a/include/libcamera/internal/buffer.h b/include/libcamera/internal/buffer.h
> index 91dd24969385..beae0cb98544 100644
> --- a/include/libcamera/internal/buffer.h
> +++ b/include/libcamera/internal/buffer.h
> @@ -11,9 +11,9 @@
>  #include <vector>
>
>  #include <libcamera/base/class.h>
> +#include <libcamera/base/span.h>
>
>  #include <libcamera/buffer.h>
> -#include <libcamera/span.h>
>
>  namespace libcamera {
>
> diff --git a/include/libcamera/internal/byte_stream_buffer.h b/include/libcamera/internal/byte_stream_buffer.h
> index 7eefb1a71f07..d0f0df5ee87b 100644
> --- a/include/libcamera/internal/byte_stream_buffer.h
> +++ b/include/libcamera/internal/byte_stream_buffer.h
> @@ -12,8 +12,7 @@
>  #include <type_traits>
>
>  #include <libcamera/base/class.h>
> -
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>
>  namespace libcamera {
>
> diff --git a/include/libcamera/internal/pub_key.h b/include/libcamera/internal/pub_key.h
> index f5f988b58f74..9261c9c2a0ee 100644
> --- a/include/libcamera/internal/pub_key.h
> +++ b/include/libcamera/internal/pub_key.h
> @@ -9,7 +9,7 @@
>
>  #include <stdint.h>
>
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>
>  #if HAVE_GNUTLS
>  struct gnutls_pubkey_st;
> diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h
> index 1edd664a9aef..77b835b3cb80 100644
> --- a/include/libcamera/internal/v4l2_device.h
> +++ b/include/libcamera/internal/v4l2_device.h
> @@ -15,9 +15,9 @@
>
>  #include <libcamera/base/log.h>
>  #include <libcamera/base/signal.h>
> +#include <libcamera/base/span.h>
>
>  #include <libcamera/controls.h>
> -#include <libcamera/span.h>
>
>  namespace libcamera {
>
> diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build
> index d08bb3096aff..9a120d13346e 100644
> --- a/include/libcamera/meson.build
> +++ b/include/libcamera/meson.build
> @@ -12,7 +12,6 @@ libcamera_public_headers = files([
>      'logging.h',
>      'pixel_format.h',
>      'request.h',
> -    'span.h',
>      'stream.h',
>      'transform.h',
>  ])
> diff --git a/src/android/camera_buffer.h b/src/android/camera_buffer.h
> index e850c4e36668..2617ff6b11a1 100644
> --- a/src/android/camera_buffer.h
> +++ b/src/android/camera_buffer.h
> @@ -10,8 +10,7 @@
>  #include <hardware/camera3.h>
>
>  #include <libcamera/base/class.h>
> -
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>
>  class CameraBuffer final : public libcamera::Extensible
>  {
> diff --git a/src/android/jpeg/encoder.h b/src/android/jpeg/encoder.h
> index 8d449369869f..28e7f92a3ecb 100644
> --- a/src/android/jpeg/encoder.h
> +++ b/src/android/jpeg/encoder.h
> @@ -7,8 +7,9 @@
>  #ifndef __ANDROID_JPEG_ENCODER_H__
>  #define __ANDROID_JPEG_ENCODER_H__
>
> +#include <libcamera/base/span.h>
> +
>  #include <libcamera/buffer.h>
> -#include <libcamera/span.h>
>  #include <libcamera/stream.h>
>
>  class Encoder
> diff --git a/src/android/jpeg/exif.h b/src/android/jpeg/exif.h
> index 8aa1b123a737..23b0e0974459 100644
> --- a/src/android/jpeg/exif.h
> +++ b/src/android/jpeg/exif.h
> @@ -13,8 +13,9 @@
>
>  #include <libexif/exif-data.h>
>
> +#include <libcamera/base/span.h>
> +
>  #include <libcamera/geometry.h>
> -#include <libcamera/span.h>
>
>  class Exif
>  {
> diff --git a/src/ipa/libipa/histogram.h b/src/ipa/libipa/histogram.h
> index e06f1884395e..c2761cb29e7a 100644
> --- a/src/ipa/libipa/histogram.h
> +++ b/src/ipa/libipa/histogram.h
> @@ -13,7 +13,7 @@
>
>  #include <vector>
>
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>
>  namespace libcamera {
>
> diff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp
> index a66648197140..b19c95f67453 100644
> --- a/src/ipa/raspberrypi/cam_helper.hpp
> +++ b/src/ipa/raspberrypi/cam_helper.hpp
> @@ -8,8 +8,7 @@
>
>  #include <string>
>
> -#include <libcamera/span.h>
> -
> +#include <libcamera/base/span.h>
>  #include <libcamera/base/utils.h>
>
>  #include "camera_mode.h"
> diff --git a/src/ipa/raspberrypi/md_parser.hpp b/src/ipa/raspberrypi/md_parser.hpp
> index 65aab02d51b6..8497216f8db7 100644
> --- a/src/ipa/raspberrypi/md_parser.hpp
> +++ b/src/ipa/raspberrypi/md_parser.hpp
> @@ -8,7 +8,7 @@
>
>  #include <stdint.h>
>
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>
>  /*
>   * Camera metadata parser class. Usage as shown below.
> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
> index a3f014495e80..4d09a84f6532 100644
> --- a/src/ipa/raspberrypi/raspberrypi.cpp
> +++ b/src/ipa/raspberrypi/raspberrypi.cpp
> @@ -16,6 +16,7 @@
>  #include <linux/bcm2835-isp.h>
>
>  #include <libcamera/base/log.h>
> +#include <libcamera/base/span.h>
>
>  #include <libcamera/buffer.h>
>  #include <libcamera/control_ids.h>
> @@ -26,7 +27,6 @@
>  #include <libcamera/ipa/raspberrypi.h>
>  #include <libcamera/ipa/raspberrypi_ipa_interface.h>
>  #include <libcamera/request.h>
> -#include <libcamera/span.h>
>
>  #include "libcamera/internal/buffer.h"
>
> diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp
> index dd5a26083747..300466285a57 100644
> --- a/src/libcamera/control_serializer.cpp
> +++ b/src/libcamera/control_serializer.cpp
> @@ -12,11 +12,11 @@
>  #include <vector>
>
>  #include <libcamera/base/log.h>
> +#include <libcamera/base/span.h>
>
>  #include <libcamera/control_ids.h>
>  #include <libcamera/controls.h>
>  #include <libcamera/ipa/ipa_controls.h>
> -#include <libcamera/span.h>
>
>  #include "libcamera/internal/byte_stream_buffer.h"
>
> diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp
> index 984c1fed9bdb..adfb8d407697 100644
> --- a/src/libcamera/ipa_module.cpp
> +++ b/src/libcamera/ipa_module.cpp
> @@ -21,10 +21,9 @@
>  #include <sys/types.h>
>  #include <unistd.h>
>
> -#include <libcamera/span.h>
> -
>  #include <libcamera/base/file.h>
>  #include <libcamera/base/log.h>
> +#include <libcamera/base/span.h>
>  #include <libcamera/base/utils.h>
>
>  #include "libcamera/internal/pipeline_handler.h"
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
> index c185ac3992dd..91757600ccdc 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
> @@ -11,11 +11,11 @@
>  #include <vector>
>
>  #include <libcamera/base/signal.h>
> +#include <libcamera/base/span.h>
>
>  #include <libcamera/camera.h>
>  #include <libcamera/geometry.h>
>  #include <libcamera/pixel_format.h>
> -#include <libcamera/span.h>
>
>  #include "libcamera/internal/media_object.h"
>  #include "libcamera/internal/v4l2_videodevice.h"
> diff --git a/test/span.cpp b/test/span.cpp
> index ca037c8f02fa..abf3a5d681bf 100644
> --- a/test/span.cpp
> +++ b/test/span.cpp
> @@ -9,7 +9,7 @@
>   * Include first to ensure the header is self-contained, as there's no span.cpp
>   * in libcamera.
>   */
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>
>  #include <array>
>  #include <iostream>
> diff --git a/test/utils.cpp b/test/utils.cpp
> index 9cd2cd070cb9..d7f810e95e7a 100644
> --- a/test/utils.cpp
> +++ b/test/utils.cpp
> @@ -11,11 +11,11 @@
>  #include <string>
>  #include <vector>
>
> -#include <libcamera/geometry.h>
> -#include <libcamera/span.h>
> -
> +#include <libcamera/base/span.h>
>  #include <libcamera/base/utils.h>
>
> +#include <libcamera/geometry.h>
> +
>  #include "test.h"
>
>  using namespace std;
> --
> 2.30.2
>
Paul Elder June 25, 2021, 8:11 a.m. UTC | #2
Hi Kieran,

On Fri, Jun 25, 2021 at 02:35:36AM +0100, Kieran Bingham wrote:
> Move span, and adjust the Doxygen exlusion as well.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

With the typo fix and the header guard as suggested by Hiro,

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  Documentation/Doxyfile.in                       | 2 +-
>  include/libcamera/base/file.h                   | 3 +--
>  include/libcamera/base/meson.build              | 1 +
>  include/libcamera/{ => base}/span.h             | 0
>  include/libcamera/controls.h                    | 2 +-
>  include/libcamera/internal/buffer.h             | 2 +-
>  include/libcamera/internal/byte_stream_buffer.h | 3 +--
>  include/libcamera/internal/pub_key.h            | 2 +-
>  include/libcamera/internal/v4l2_device.h        | 2 +-
>  include/libcamera/meson.build                   | 1 -
>  src/android/camera_buffer.h                     | 3 +--
>  src/android/jpeg/encoder.h                      | 3 ++-
>  src/android/jpeg/exif.h                         | 3 ++-
>  src/ipa/libipa/histogram.h                      | 2 +-
>  src/ipa/raspberrypi/cam_helper.hpp              | 3 +--
>  src/ipa/raspberrypi/md_parser.hpp               | 2 +-
>  src/ipa/raspberrypi/raspberrypi.cpp             | 2 +-
>  src/libcamera/control_serializer.cpp            | 2 +-
>  src/libcamera/ipa_module.cpp                    | 3 +--
>  src/libcamera/pipeline/rkisp1/rkisp1_path.h     | 2 +-
>  test/span.cpp                                   | 2 +-
>  test/utils.cpp                                  | 6 +++---
>  22 files changed, 24 insertions(+), 27 deletions(-)
>  rename include/libcamera/{ => base}/span.h (100%)
> 
> diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in
> index 8305f56af7a8..a79d37706faf 100644
> --- a/Documentation/Doxyfile.in
> +++ b/Documentation/Doxyfile.in
> @@ -834,7 +834,7 @@ RECURSIVE              = YES
>  # Note that relative paths are relative to the directory from which doxygen is
>  # run.
>  
> -EXCLUDE                = @TOP_SRCDIR@/include/libcamera/span.h \
> +EXCLUDE                = @TOP_SRCDIR@/include/libcamera/base/span.h \
>  			 @TOP_SRCDIR@/include/libcamera/internal/device_enumerator_sysfs.h \
>  			 @TOP_SRCDIR@/include/libcamera/internal/device_enumerator_udev.h \
>  			 @TOP_SRCDIR@/include/libcamera/internal/ipc_pipe_unixsocket.h \
> diff --git a/include/libcamera/base/file.h b/include/libcamera/base/file.h
> index cecbb254591f..c3c7ca6013a8 100644
> --- a/include/libcamera/base/file.h
> +++ b/include/libcamera/base/file.h
> @@ -13,8 +13,7 @@
>  
>  #include <libcamera/base/class.h>
>  #include <libcamera/base/private.h>
> -
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>  
>  namespace libcamera {
>  
> diff --git a/include/libcamera/base/meson.build b/include/libcamera/base/meson.build
> index aaac324d7149..7c499b558fb0 100644
> --- a/include/libcamera/base/meson.build
> +++ b/include/libcamera/base/meson.build
> @@ -15,6 +15,7 @@ libcamera_base_headers = files([
>      'private.h',
>      'semaphore.h',
>      'signal.h',
> +    'span.h',
>      'thread.h',
>      'timer.h',
>      'utils.h',
> diff --git a/include/libcamera/span.h b/include/libcamera/base/span.h
> similarity index 100%
> rename from include/libcamera/span.h
> rename to include/libcamera/base/span.h
> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
> index f62b6cf055d6..1bc958a43b22 100644
> --- a/include/libcamera/controls.h
> +++ b/include/libcamera/controls.h
> @@ -15,9 +15,9 @@
>  #include <vector>
>  
>  #include <libcamera/base/class.h>
> +#include <libcamera/base/span.h>
>  
>  #include <libcamera/geometry.h>
> -#include <libcamera/span.h>
>  
>  namespace libcamera {
>  
> diff --git a/include/libcamera/internal/buffer.h b/include/libcamera/internal/buffer.h
> index 91dd24969385..beae0cb98544 100644
> --- a/include/libcamera/internal/buffer.h
> +++ b/include/libcamera/internal/buffer.h
> @@ -11,9 +11,9 @@
>  #include <vector>
>  
>  #include <libcamera/base/class.h>
> +#include <libcamera/base/span.h>
>  
>  #include <libcamera/buffer.h>
> -#include <libcamera/span.h>
>  
>  namespace libcamera {
>  
> diff --git a/include/libcamera/internal/byte_stream_buffer.h b/include/libcamera/internal/byte_stream_buffer.h
> index 7eefb1a71f07..d0f0df5ee87b 100644
> --- a/include/libcamera/internal/byte_stream_buffer.h
> +++ b/include/libcamera/internal/byte_stream_buffer.h
> @@ -12,8 +12,7 @@
>  #include <type_traits>
>  
>  #include <libcamera/base/class.h>
> -
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>  
>  namespace libcamera {
>  
> diff --git a/include/libcamera/internal/pub_key.h b/include/libcamera/internal/pub_key.h
> index f5f988b58f74..9261c9c2a0ee 100644
> --- a/include/libcamera/internal/pub_key.h
> +++ b/include/libcamera/internal/pub_key.h
> @@ -9,7 +9,7 @@
>  
>  #include <stdint.h>
>  
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>  
>  #if HAVE_GNUTLS
>  struct gnutls_pubkey_st;
> diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h
> index 1edd664a9aef..77b835b3cb80 100644
> --- a/include/libcamera/internal/v4l2_device.h
> +++ b/include/libcamera/internal/v4l2_device.h
> @@ -15,9 +15,9 @@
>  
>  #include <libcamera/base/log.h>
>  #include <libcamera/base/signal.h>
> +#include <libcamera/base/span.h>
>  
>  #include <libcamera/controls.h>
> -#include <libcamera/span.h>
>  
>  namespace libcamera {
>  
> diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build
> index d08bb3096aff..9a120d13346e 100644
> --- a/include/libcamera/meson.build
> +++ b/include/libcamera/meson.build
> @@ -12,7 +12,6 @@ libcamera_public_headers = files([
>      'logging.h',
>      'pixel_format.h',
>      'request.h',
> -    'span.h',
>      'stream.h',
>      'transform.h',
>  ])
> diff --git a/src/android/camera_buffer.h b/src/android/camera_buffer.h
> index e850c4e36668..2617ff6b11a1 100644
> --- a/src/android/camera_buffer.h
> +++ b/src/android/camera_buffer.h
> @@ -10,8 +10,7 @@
>  #include <hardware/camera3.h>
>  
>  #include <libcamera/base/class.h>
> -
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>  
>  class CameraBuffer final : public libcamera::Extensible
>  {
> diff --git a/src/android/jpeg/encoder.h b/src/android/jpeg/encoder.h
> index 8d449369869f..28e7f92a3ecb 100644
> --- a/src/android/jpeg/encoder.h
> +++ b/src/android/jpeg/encoder.h
> @@ -7,8 +7,9 @@
>  #ifndef __ANDROID_JPEG_ENCODER_H__
>  #define __ANDROID_JPEG_ENCODER_H__
>  
> +#include <libcamera/base/span.h>
> +
>  #include <libcamera/buffer.h>
> -#include <libcamera/span.h>
>  #include <libcamera/stream.h>
>  
>  class Encoder
> diff --git a/src/android/jpeg/exif.h b/src/android/jpeg/exif.h
> index 8aa1b123a737..23b0e0974459 100644
> --- a/src/android/jpeg/exif.h
> +++ b/src/android/jpeg/exif.h
> @@ -13,8 +13,9 @@
>  
>  #include <libexif/exif-data.h>
>  
> +#include <libcamera/base/span.h>
> +
>  #include <libcamera/geometry.h>
> -#include <libcamera/span.h>
>  
>  class Exif
>  {
> diff --git a/src/ipa/libipa/histogram.h b/src/ipa/libipa/histogram.h
> index e06f1884395e..c2761cb29e7a 100644
> --- a/src/ipa/libipa/histogram.h
> +++ b/src/ipa/libipa/histogram.h
> @@ -13,7 +13,7 @@
>  
>  #include <vector>
>  
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>  
>  namespace libcamera {
>  
> diff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp
> index a66648197140..b19c95f67453 100644
> --- a/src/ipa/raspberrypi/cam_helper.hpp
> +++ b/src/ipa/raspberrypi/cam_helper.hpp
> @@ -8,8 +8,7 @@
>  
>  #include <string>
>  
> -#include <libcamera/span.h>
> -
> +#include <libcamera/base/span.h>
>  #include <libcamera/base/utils.h>
>  
>  #include "camera_mode.h"
> diff --git a/src/ipa/raspberrypi/md_parser.hpp b/src/ipa/raspberrypi/md_parser.hpp
> index 65aab02d51b6..8497216f8db7 100644
> --- a/src/ipa/raspberrypi/md_parser.hpp
> +++ b/src/ipa/raspberrypi/md_parser.hpp
> @@ -8,7 +8,7 @@
>  
>  #include <stdint.h>
>  
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>  
>  /*
>   * Camera metadata parser class. Usage as shown below.
> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
> index a3f014495e80..4d09a84f6532 100644
> --- a/src/ipa/raspberrypi/raspberrypi.cpp
> +++ b/src/ipa/raspberrypi/raspberrypi.cpp
> @@ -16,6 +16,7 @@
>  #include <linux/bcm2835-isp.h>
>  
>  #include <libcamera/base/log.h>
> +#include <libcamera/base/span.h>
>  
>  #include <libcamera/buffer.h>
>  #include <libcamera/control_ids.h>
> @@ -26,7 +27,6 @@
>  #include <libcamera/ipa/raspberrypi.h>
>  #include <libcamera/ipa/raspberrypi_ipa_interface.h>
>  #include <libcamera/request.h>
> -#include <libcamera/span.h>
>  
>  #include "libcamera/internal/buffer.h"
>  
> diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp
> index dd5a26083747..300466285a57 100644
> --- a/src/libcamera/control_serializer.cpp
> +++ b/src/libcamera/control_serializer.cpp
> @@ -12,11 +12,11 @@
>  #include <vector>
>  
>  #include <libcamera/base/log.h>
> +#include <libcamera/base/span.h>
>  
>  #include <libcamera/control_ids.h>
>  #include <libcamera/controls.h>
>  #include <libcamera/ipa/ipa_controls.h>
> -#include <libcamera/span.h>
>  
>  #include "libcamera/internal/byte_stream_buffer.h"
>  
> diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp
> index 984c1fed9bdb..adfb8d407697 100644
> --- a/src/libcamera/ipa_module.cpp
> +++ b/src/libcamera/ipa_module.cpp
> @@ -21,10 +21,9 @@
>  #include <sys/types.h>
>  #include <unistd.h>
>  
> -#include <libcamera/span.h>
> -
>  #include <libcamera/base/file.h>
>  #include <libcamera/base/log.h>
> +#include <libcamera/base/span.h>
>  #include <libcamera/base/utils.h>
>  
>  #include "libcamera/internal/pipeline_handler.h"
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
> index c185ac3992dd..91757600ccdc 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
> @@ -11,11 +11,11 @@
>  #include <vector>
>  
>  #include <libcamera/base/signal.h>
> +#include <libcamera/base/span.h>
>  
>  #include <libcamera/camera.h>
>  #include <libcamera/geometry.h>
>  #include <libcamera/pixel_format.h>
> -#include <libcamera/span.h>
>  
>  #include "libcamera/internal/media_object.h"
>  #include "libcamera/internal/v4l2_videodevice.h"
> diff --git a/test/span.cpp b/test/span.cpp
> index ca037c8f02fa..abf3a5d681bf 100644
> --- a/test/span.cpp
> +++ b/test/span.cpp
> @@ -9,7 +9,7 @@
>   * Include first to ensure the header is self-contained, as there's no span.cpp
>   * in libcamera.
>   */
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>  
>  #include <array>
>  #include <iostream>
> diff --git a/test/utils.cpp b/test/utils.cpp
> index 9cd2cd070cb9..d7f810e95e7a 100644
> --- a/test/utils.cpp
> +++ b/test/utils.cpp
> @@ -11,11 +11,11 @@
>  #include <string>
>  #include <vector>
>  
> -#include <libcamera/geometry.h>
> -#include <libcamera/span.h>
> -
> +#include <libcamera/base/span.h>
>  #include <libcamera/base/utils.h>
>  
> +#include <libcamera/geometry.h>
> +
>  #include "test.h"
>  
>  using namespace std;
> -- 
> 2.30.2
>
Kieran Bingham June 25, 2021, 9:39 a.m. UTC | #3
Hi Hiro,

On 25/06/2021 05:15, Hirokazu Honda wrote:
> Hi Kieran, thank you for the patch.
> 
> On Fri, Jun 25, 2021 at 10:35 AM Kieran Bingham
> <kieran.bingham@ideasonboard.com> wrote:
>>
>> Move span, and adjust the Doxygen exlusion as well.
> 
> s/exlusion/exclusion/

Thanks, hrmm another one I moved last night - I can guess what else is
missing already before I get there. ..


>>
>> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
>> ---
>>  Documentation/Doxyfile.in                       | 2 +-
>>  include/libcamera/base/file.h                   | 3 +--
>>  include/libcamera/base/meson.build              | 1 +
>>  include/libcamera/{ => base}/span.h             | 0
>>  include/libcamera/controls.h                    | 2 +-
>>  include/libcamera/internal/buffer.h             | 2 +-
>>  include/libcamera/internal/byte_stream_buffer.h | 3 +--
>>  include/libcamera/internal/pub_key.h            | 2 +-
>>  include/libcamera/internal/v4l2_device.h        | 2 +-
>>  include/libcamera/meson.build                   | 1 -
>>  src/android/camera_buffer.h                     | 3 +--
>>  src/android/jpeg/encoder.h                      | 3 ++-
>>  src/android/jpeg/exif.h                         | 3 ++-
>>  src/ipa/libipa/histogram.h                      | 2 +-
>>  src/ipa/raspberrypi/cam_helper.hpp              | 3 +--
>>  src/ipa/raspberrypi/md_parser.hpp               | 2 +-
>>  src/ipa/raspberrypi/raspberrypi.cpp             | 2 +-
>>  src/libcamera/control_serializer.cpp            | 2 +-
>>  src/libcamera/ipa_module.cpp                    | 3 +--
>>  src/libcamera/pipeline/rkisp1/rkisp1_path.h     | 2 +-
>>  test/span.cpp                                   | 2 +-
>>  test/utils.cpp                                  | 6 +++---
>>  22 files changed, 24 insertions(+), 27 deletions(-)
>>  rename include/libcamera/{ => base}/span.h (100%)
>>
>> diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in
>> index 8305f56af7a8..a79d37706faf 100644
>> --- a/Documentation/Doxyfile.in
>> +++ b/Documentation/Doxyfile.in
>> @@ -834,7 +834,7 @@ RECURSIVE              = YES
>>  # Note that relative paths are relative to the directory from which doxygen is
>>  # run.
>>
>> -EXCLUDE                = @TOP_SRCDIR@/include/libcamera/span.h \
>> +EXCLUDE                = @TOP_SRCDIR@/include/libcamera/base/span.h \
>>                          @TOP_SRCDIR@/include/libcamera/internal/device_enumerator_sysfs.h \
>>                          @TOP_SRCDIR@/include/libcamera/internal/device_enumerator_udev.h \
>>                          @TOP_SRCDIR@/include/libcamera/internal/ipc_pipe_unixsocket.h \
>> diff --git a/include/libcamera/base/file.h b/include/libcamera/base/file.h
>> index cecbb254591f..c3c7ca6013a8 100644
>> --- a/include/libcamera/base/file.h
>> +++ b/include/libcamera/base/file.h
>> @@ -13,8 +13,7 @@
>>
>>  #include <libcamera/base/class.h>
>>  #include <libcamera/base/private.h>
>> -
>> -#include <libcamera/span.h>
>> +#include <libcamera/base/span.h>
>>
>>  namespace libcamera {
>>
>> diff --git a/include/libcamera/base/meson.build b/include/libcamera/base/meson.build
>> index aaac324d7149..7c499b558fb0 100644
>> --- a/include/libcamera/base/meson.build
>> +++ b/include/libcamera/base/meson.build
>> @@ -15,6 +15,7 @@ libcamera_base_headers = files([
>>      'private.h',
>>      'semaphore.h',
>>      'signal.h',
>> +    'span.h',
>>      'thread.h',
>>      'timer.h',
>>      'utils.h',
>> diff --git a/include/libcamera/span.h b/include/libcamera/base/span.h
>> similarity index 100%
> 
> Shall we change a header guard?

Yes, I completely failed at this last night (this-morning) but at least
I was consistent in my failure :S hehe

> 
> Isn't span not one which should not be exposed to public?

Oh that's interesting - I thought span was used in the public API
somewhere, but now I can't see it - I'll check and move to private if it
can go there.



>> rename from include/libcamera/span.h
>> rename to include/libcamera/base/span.h
>> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
>> index f62b6cf055d6..1bc958a43b22 100644
>> --- a/include/libcamera/controls.h
>> +++ b/include/libcamera/controls.h
>> @@ -15,9 +15,9 @@
>>  #include <vector>
>>
>>  #include <libcamera/base/class.h>
>> +#include <libcamera/base/span.h>
>>
>>  #include <libcamera/geometry.h>
>> -#include <libcamera/span.h>
>>
>>  namespace libcamera {
>>
>> diff --git a/include/libcamera/internal/buffer.h b/include/libcamera/internal/buffer.h
>> index 91dd24969385..beae0cb98544 100644
>> --- a/include/libcamera/internal/buffer.h
>> +++ b/include/libcamera/internal/buffer.h
>> @@ -11,9 +11,9 @@
>>  #include <vector>
>>
>>  #include <libcamera/base/class.h>
>> +#include <libcamera/base/span.h>
>>
>>  #include <libcamera/buffer.h>
>> -#include <libcamera/span.h>
>>
>>  namespace libcamera {
>>
>> diff --git a/include/libcamera/internal/byte_stream_buffer.h b/include/libcamera/internal/byte_stream_buffer.h
>> index 7eefb1a71f07..d0f0df5ee87b 100644
>> --- a/include/libcamera/internal/byte_stream_buffer.h
>> +++ b/include/libcamera/internal/byte_stream_buffer.h
>> @@ -12,8 +12,7 @@
>>  #include <type_traits>
>>
>>  #include <libcamera/base/class.h>
>> -
>> -#include <libcamera/span.h>
>> +#include <libcamera/base/span.h>
>>
>>  namespace libcamera {
>>
>> diff --git a/include/libcamera/internal/pub_key.h b/include/libcamera/internal/pub_key.h
>> index f5f988b58f74..9261c9c2a0ee 100644
>> --- a/include/libcamera/internal/pub_key.h
>> +++ b/include/libcamera/internal/pub_key.h
>> @@ -9,7 +9,7 @@
>>
>>  #include <stdint.h>
>>
>> -#include <libcamera/span.h>
>> +#include <libcamera/base/span.h>
>>
>>  #if HAVE_GNUTLS
>>  struct gnutls_pubkey_st;
>> diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h
>> index 1edd664a9aef..77b835b3cb80 100644
>> --- a/include/libcamera/internal/v4l2_device.h
>> +++ b/include/libcamera/internal/v4l2_device.h
>> @@ -15,9 +15,9 @@
>>
>>  #include <libcamera/base/log.h>
>>  #include <libcamera/base/signal.h>
>> +#include <libcamera/base/span.h>
>>
>>  #include <libcamera/controls.h>
>> -#include <libcamera/span.h>
>>
>>  namespace libcamera {
>>
>> diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build
>> index d08bb3096aff..9a120d13346e 100644
>> --- a/include/libcamera/meson.build
>> +++ b/include/libcamera/meson.build
>> @@ -12,7 +12,6 @@ libcamera_public_headers = files([
>>      'logging.h',
>>      'pixel_format.h',
>>      'request.h',
>> -    'span.h',
>>      'stream.h',
>>      'transform.h',
>>  ])
>> diff --git a/src/android/camera_buffer.h b/src/android/camera_buffer.h
>> index e850c4e36668..2617ff6b11a1 100644
>> --- a/src/android/camera_buffer.h
>> +++ b/src/android/camera_buffer.h
>> @@ -10,8 +10,7 @@
>>  #include <hardware/camera3.h>
>>
>>  #include <libcamera/base/class.h>
>> -
>> -#include <libcamera/span.h>
>> +#include <libcamera/base/span.h>
>>
>>  class CameraBuffer final : public libcamera::Extensible
>>  {
>> diff --git a/src/android/jpeg/encoder.h b/src/android/jpeg/encoder.h
>> index 8d449369869f..28e7f92a3ecb 100644
>> --- a/src/android/jpeg/encoder.h
>> +++ b/src/android/jpeg/encoder.h
>> @@ -7,8 +7,9 @@
>>  #ifndef __ANDROID_JPEG_ENCODER_H__
>>  #define __ANDROID_JPEG_ENCODER_H__
>>
>> +#include <libcamera/base/span.h>
>> +
>>  #include <libcamera/buffer.h>
>> -#include <libcamera/span.h>
>>  #include <libcamera/stream.h>
>>
>>  class Encoder
>> diff --git a/src/android/jpeg/exif.h b/src/android/jpeg/exif.h
>> index 8aa1b123a737..23b0e0974459 100644
>> --- a/src/android/jpeg/exif.h
>> +++ b/src/android/jpeg/exif.h
>> @@ -13,8 +13,9 @@
>>
>>  #include <libexif/exif-data.h>
>>
>> +#include <libcamera/base/span.h>
>> +
>>  #include <libcamera/geometry.h>
>> -#include <libcamera/span.h>
>>
>>  class Exif
>>  {
>> diff --git a/src/ipa/libipa/histogram.h b/src/ipa/libipa/histogram.h
>> index e06f1884395e..c2761cb29e7a 100644
>> --- a/src/ipa/libipa/histogram.h
>> +++ b/src/ipa/libipa/histogram.h
>> @@ -13,7 +13,7 @@
>>
>>  #include <vector>
>>
>> -#include <libcamera/span.h>
>> +#include <libcamera/base/span.h>
>>
>>  namespace libcamera {
>>
>> diff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp
>> index a66648197140..b19c95f67453 100644
>> --- a/src/ipa/raspberrypi/cam_helper.hpp
>> +++ b/src/ipa/raspberrypi/cam_helper.hpp
>> @@ -8,8 +8,7 @@
>>
>>  #include <string>
>>
>> -#include <libcamera/span.h>
>> -
>> +#include <libcamera/base/span.h>
>>  #include <libcamera/base/utils.h>
>>
>>  #include "camera_mode.h"
>> diff --git a/src/ipa/raspberrypi/md_parser.hpp b/src/ipa/raspberrypi/md_parser.hpp
>> index 65aab02d51b6..8497216f8db7 100644
>> --- a/src/ipa/raspberrypi/md_parser.hpp
>> +++ b/src/ipa/raspberrypi/md_parser.hpp
>> @@ -8,7 +8,7 @@
>>
>>  #include <stdint.h>
>>
>> -#include <libcamera/span.h>
>> +#include <libcamera/base/span.h>
>>
>>  /*
>>   * Camera metadata parser class. Usage as shown below.
>> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
>> index a3f014495e80..4d09a84f6532 100644
>> --- a/src/ipa/raspberrypi/raspberrypi.cpp
>> +++ b/src/ipa/raspberrypi/raspberrypi.cpp
>> @@ -16,6 +16,7 @@
>>  #include <linux/bcm2835-isp.h>
>>
>>  #include <libcamera/base/log.h>
>> +#include <libcamera/base/span.h>
>>
>>  #include <libcamera/buffer.h>
>>  #include <libcamera/control_ids.h>
>> @@ -26,7 +27,6 @@
>>  #include <libcamera/ipa/raspberrypi.h>
>>  #include <libcamera/ipa/raspberrypi_ipa_interface.h>
>>  #include <libcamera/request.h>
>> -#include <libcamera/span.h>
>>
>>  #include "libcamera/internal/buffer.h"
>>
>> diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp
>> index dd5a26083747..300466285a57 100644
>> --- a/src/libcamera/control_serializer.cpp
>> +++ b/src/libcamera/control_serializer.cpp
>> @@ -12,11 +12,11 @@
>>  #include <vector>
>>
>>  #include <libcamera/base/log.h>
>> +#include <libcamera/base/span.h>
>>
>>  #include <libcamera/control_ids.h>
>>  #include <libcamera/controls.h>
>>  #include <libcamera/ipa/ipa_controls.h>
>> -#include <libcamera/span.h>
>>
>>  #include "libcamera/internal/byte_stream_buffer.h"
>>
>> diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp
>> index 984c1fed9bdb..adfb8d407697 100644
>> --- a/src/libcamera/ipa_module.cpp
>> +++ b/src/libcamera/ipa_module.cpp
>> @@ -21,10 +21,9 @@
>>  #include <sys/types.h>
>>  #include <unistd.h>
>>
>> -#include <libcamera/span.h>
>> -
>>  #include <libcamera/base/file.h>
>>  #include <libcamera/base/log.h>
>> +#include <libcamera/base/span.h>
>>  #include <libcamera/base/utils.h>
>>
>>  #include "libcamera/internal/pipeline_handler.h"
>> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
>> index c185ac3992dd..91757600ccdc 100644
>> --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h
>> +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
>> @@ -11,11 +11,11 @@
>>  #include <vector>
>>
>>  #include <libcamera/base/signal.h>
>> +#include <libcamera/base/span.h>
>>
>>  #include <libcamera/camera.h>
>>  #include <libcamera/geometry.h>
>>  #include <libcamera/pixel_format.h>
>> -#include <libcamera/span.h>
>>
>>  #include "libcamera/internal/media_object.h"
>>  #include "libcamera/internal/v4l2_videodevice.h"
>> diff --git a/test/span.cpp b/test/span.cpp
>> index ca037c8f02fa..abf3a5d681bf 100644
>> --- a/test/span.cpp
>> +++ b/test/span.cpp
>> @@ -9,7 +9,7 @@
>>   * Include first to ensure the header is self-contained, as there's no span.cpp
>>   * in libcamera.
>>   */
>> -#include <libcamera/span.h>
>> +#include <libcamera/base/span.h>
>>
>>  #include <array>
>>  #include <iostream>
>> diff --git a/test/utils.cpp b/test/utils.cpp
>> index 9cd2cd070cb9..d7f810e95e7a 100644
>> --- a/test/utils.cpp
>> +++ b/test/utils.cpp
>> @@ -11,11 +11,11 @@
>>  #include <string>
>>  #include <vector>
>>
>> -#include <libcamera/geometry.h>
>> -#include <libcamera/span.h>
>> -
>> +#include <libcamera/base/span.h>
>>  #include <libcamera/base/utils.h>
>>
>> +#include <libcamera/geometry.h>
>> +
>>  #include "test.h"
>>
>>  using namespace std;
>> --
>> 2.30.2
>>
Kieran Bingham June 25, 2021, 10:59 a.m. UTC | #4
Hi Hiro,

On 25/06/2021 10:39, Kieran Bingham wrote:
> 
>>
>> Isn't span not one which should not be exposed to public?
> 
> Oh that's interesting - I thought span was used in the public API
> somewhere, but now I can't see it - I'll check and move to private if it
> can go there.

We use spans for controls, which form part of the public-api.

So base/span.h is currently public, and will stay there (until C++20? :D)
Laurent Pinchart June 25, 2021, 12:33 p.m. UTC | #5
On Fri, Jun 25, 2021 at 11:59:38AM +0100, Kieran Bingham wrote:
> On 25/06/2021 10:39, Kieran Bingham wrote:
> >>
> >> Isn't span not one which should not be exposed to public?
> > 
> > Oh that's interesting - I thought span was used in the public API
> > somewhere, but now I can't see it - I'll check and move to private if it
> > can go there.
> 
> We use spans for controls, which form part of the public-api.
> 
> So base/span.h is currently public, and will stay there (until C++20? :D)

Looking forward to that ;-)
Laurent Pinchart June 25, 2021, 12:35 p.m. UTC | #6
Hi Kieran,

Thank you for the patch.

On Fri, Jun 25, 2021 at 02:35:36AM +0100, Kieran Bingham wrote:
> Move span, and adjust the Doxygen exlusion as well.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

With the fixes pointed out by Hiro,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  Documentation/Doxyfile.in                       | 2 +-
>  include/libcamera/base/file.h                   | 3 +--
>  include/libcamera/base/meson.build              | 1 +
>  include/libcamera/{ => base}/span.h             | 0
>  include/libcamera/controls.h                    | 2 +-
>  include/libcamera/internal/buffer.h             | 2 +-
>  include/libcamera/internal/byte_stream_buffer.h | 3 +--
>  include/libcamera/internal/pub_key.h            | 2 +-
>  include/libcamera/internal/v4l2_device.h        | 2 +-
>  include/libcamera/meson.build                   | 1 -
>  src/android/camera_buffer.h                     | 3 +--
>  src/android/jpeg/encoder.h                      | 3 ++-
>  src/android/jpeg/exif.h                         | 3 ++-
>  src/ipa/libipa/histogram.h                      | 2 +-
>  src/ipa/raspberrypi/cam_helper.hpp              | 3 +--
>  src/ipa/raspberrypi/md_parser.hpp               | 2 +-
>  src/ipa/raspberrypi/raspberrypi.cpp             | 2 +-
>  src/libcamera/control_serializer.cpp            | 2 +-
>  src/libcamera/ipa_module.cpp                    | 3 +--
>  src/libcamera/pipeline/rkisp1/rkisp1_path.h     | 2 +-
>  test/span.cpp                                   | 2 +-
>  test/utils.cpp                                  | 6 +++---
>  22 files changed, 24 insertions(+), 27 deletions(-)
>  rename include/libcamera/{ => base}/span.h (100%)
> 
> diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in
> index 8305f56af7a8..a79d37706faf 100644
> --- a/Documentation/Doxyfile.in
> +++ b/Documentation/Doxyfile.in
> @@ -834,7 +834,7 @@ RECURSIVE              = YES
>  # Note that relative paths are relative to the directory from which doxygen is
>  # run.
>  
> -EXCLUDE                = @TOP_SRCDIR@/include/libcamera/span.h \
> +EXCLUDE                = @TOP_SRCDIR@/include/libcamera/base/span.h \
>  			 @TOP_SRCDIR@/include/libcamera/internal/device_enumerator_sysfs.h \
>  			 @TOP_SRCDIR@/include/libcamera/internal/device_enumerator_udev.h \
>  			 @TOP_SRCDIR@/include/libcamera/internal/ipc_pipe_unixsocket.h \
> diff --git a/include/libcamera/base/file.h b/include/libcamera/base/file.h
> index cecbb254591f..c3c7ca6013a8 100644
> --- a/include/libcamera/base/file.h
> +++ b/include/libcamera/base/file.h
> @@ -13,8 +13,7 @@
>  
>  #include <libcamera/base/class.h>
>  #include <libcamera/base/private.h>
> -
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>  
>  namespace libcamera {
>  
> diff --git a/include/libcamera/base/meson.build b/include/libcamera/base/meson.build
> index aaac324d7149..7c499b558fb0 100644
> --- a/include/libcamera/base/meson.build
> +++ b/include/libcamera/base/meson.build
> @@ -15,6 +15,7 @@ libcamera_base_headers = files([
>      'private.h',
>      'semaphore.h',
>      'signal.h',
> +    'span.h',
>      'thread.h',
>      'timer.h',
>      'utils.h',
> diff --git a/include/libcamera/span.h b/include/libcamera/base/span.h
> similarity index 100%
> rename from include/libcamera/span.h
> rename to include/libcamera/base/span.h
> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
> index f62b6cf055d6..1bc958a43b22 100644
> --- a/include/libcamera/controls.h
> +++ b/include/libcamera/controls.h
> @@ -15,9 +15,9 @@
>  #include <vector>
>  
>  #include <libcamera/base/class.h>
> +#include <libcamera/base/span.h>
>  
>  #include <libcamera/geometry.h>
> -#include <libcamera/span.h>
>  
>  namespace libcamera {
>  
> diff --git a/include/libcamera/internal/buffer.h b/include/libcamera/internal/buffer.h
> index 91dd24969385..beae0cb98544 100644
> --- a/include/libcamera/internal/buffer.h
> +++ b/include/libcamera/internal/buffer.h
> @@ -11,9 +11,9 @@
>  #include <vector>
>  
>  #include <libcamera/base/class.h>
> +#include <libcamera/base/span.h>
>  
>  #include <libcamera/buffer.h>
> -#include <libcamera/span.h>
>  
>  namespace libcamera {
>  
> diff --git a/include/libcamera/internal/byte_stream_buffer.h b/include/libcamera/internal/byte_stream_buffer.h
> index 7eefb1a71f07..d0f0df5ee87b 100644
> --- a/include/libcamera/internal/byte_stream_buffer.h
> +++ b/include/libcamera/internal/byte_stream_buffer.h
> @@ -12,8 +12,7 @@
>  #include <type_traits>
>  
>  #include <libcamera/base/class.h>
> -
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>  
>  namespace libcamera {
>  
> diff --git a/include/libcamera/internal/pub_key.h b/include/libcamera/internal/pub_key.h
> index f5f988b58f74..9261c9c2a0ee 100644
> --- a/include/libcamera/internal/pub_key.h
> +++ b/include/libcamera/internal/pub_key.h
> @@ -9,7 +9,7 @@
>  
>  #include <stdint.h>
>  
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>  
>  #if HAVE_GNUTLS
>  struct gnutls_pubkey_st;
> diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h
> index 1edd664a9aef..77b835b3cb80 100644
> --- a/include/libcamera/internal/v4l2_device.h
> +++ b/include/libcamera/internal/v4l2_device.h
> @@ -15,9 +15,9 @@
>  
>  #include <libcamera/base/log.h>
>  #include <libcamera/base/signal.h>
> +#include <libcamera/base/span.h>
>  
>  #include <libcamera/controls.h>
> -#include <libcamera/span.h>
>  
>  namespace libcamera {
>  
> diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build
> index d08bb3096aff..9a120d13346e 100644
> --- a/include/libcamera/meson.build
> +++ b/include/libcamera/meson.build
> @@ -12,7 +12,6 @@ libcamera_public_headers = files([
>      'logging.h',
>      'pixel_format.h',
>      'request.h',
> -    'span.h',
>      'stream.h',
>      'transform.h',
>  ])
> diff --git a/src/android/camera_buffer.h b/src/android/camera_buffer.h
> index e850c4e36668..2617ff6b11a1 100644
> --- a/src/android/camera_buffer.h
> +++ b/src/android/camera_buffer.h
> @@ -10,8 +10,7 @@
>  #include <hardware/camera3.h>
>  
>  #include <libcamera/base/class.h>
> -
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>  
>  class CameraBuffer final : public libcamera::Extensible
>  {
> diff --git a/src/android/jpeg/encoder.h b/src/android/jpeg/encoder.h
> index 8d449369869f..28e7f92a3ecb 100644
> --- a/src/android/jpeg/encoder.h
> +++ b/src/android/jpeg/encoder.h
> @@ -7,8 +7,9 @@
>  #ifndef __ANDROID_JPEG_ENCODER_H__
>  #define __ANDROID_JPEG_ENCODER_H__
>  
> +#include <libcamera/base/span.h>
> +
>  #include <libcamera/buffer.h>
> -#include <libcamera/span.h>
>  #include <libcamera/stream.h>
>  
>  class Encoder
> diff --git a/src/android/jpeg/exif.h b/src/android/jpeg/exif.h
> index 8aa1b123a737..23b0e0974459 100644
> --- a/src/android/jpeg/exif.h
> +++ b/src/android/jpeg/exif.h
> @@ -13,8 +13,9 @@
>  
>  #include <libexif/exif-data.h>
>  
> +#include <libcamera/base/span.h>
> +
>  #include <libcamera/geometry.h>
> -#include <libcamera/span.h>
>  
>  class Exif
>  {
> diff --git a/src/ipa/libipa/histogram.h b/src/ipa/libipa/histogram.h
> index e06f1884395e..c2761cb29e7a 100644
> --- a/src/ipa/libipa/histogram.h
> +++ b/src/ipa/libipa/histogram.h
> @@ -13,7 +13,7 @@
>  
>  #include <vector>
>  
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>  
>  namespace libcamera {
>  
> diff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp
> index a66648197140..b19c95f67453 100644
> --- a/src/ipa/raspberrypi/cam_helper.hpp
> +++ b/src/ipa/raspberrypi/cam_helper.hpp
> @@ -8,8 +8,7 @@
>  
>  #include <string>
>  
> -#include <libcamera/span.h>
> -
> +#include <libcamera/base/span.h>
>  #include <libcamera/base/utils.h>
>  
>  #include "camera_mode.h"
> diff --git a/src/ipa/raspberrypi/md_parser.hpp b/src/ipa/raspberrypi/md_parser.hpp
> index 65aab02d51b6..8497216f8db7 100644
> --- a/src/ipa/raspberrypi/md_parser.hpp
> +++ b/src/ipa/raspberrypi/md_parser.hpp
> @@ -8,7 +8,7 @@
>  
>  #include <stdint.h>
>  
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>  
>  /*
>   * Camera metadata parser class. Usage as shown below.
> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
> index a3f014495e80..4d09a84f6532 100644
> --- a/src/ipa/raspberrypi/raspberrypi.cpp
> +++ b/src/ipa/raspberrypi/raspberrypi.cpp
> @@ -16,6 +16,7 @@
>  #include <linux/bcm2835-isp.h>
>  
>  #include <libcamera/base/log.h>
> +#include <libcamera/base/span.h>
>  
>  #include <libcamera/buffer.h>
>  #include <libcamera/control_ids.h>
> @@ -26,7 +27,6 @@
>  #include <libcamera/ipa/raspberrypi.h>
>  #include <libcamera/ipa/raspberrypi_ipa_interface.h>
>  #include <libcamera/request.h>
> -#include <libcamera/span.h>
>  
>  #include "libcamera/internal/buffer.h"
>  
> diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp
> index dd5a26083747..300466285a57 100644
> --- a/src/libcamera/control_serializer.cpp
> +++ b/src/libcamera/control_serializer.cpp
> @@ -12,11 +12,11 @@
>  #include <vector>
>  
>  #include <libcamera/base/log.h>
> +#include <libcamera/base/span.h>
>  
>  #include <libcamera/control_ids.h>
>  #include <libcamera/controls.h>
>  #include <libcamera/ipa/ipa_controls.h>
> -#include <libcamera/span.h>
>  
>  #include "libcamera/internal/byte_stream_buffer.h"
>  
> diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp
> index 984c1fed9bdb..adfb8d407697 100644
> --- a/src/libcamera/ipa_module.cpp
> +++ b/src/libcamera/ipa_module.cpp
> @@ -21,10 +21,9 @@
>  #include <sys/types.h>
>  #include <unistd.h>
>  
> -#include <libcamera/span.h>
> -
>  #include <libcamera/base/file.h>
>  #include <libcamera/base/log.h>
> +#include <libcamera/base/span.h>
>  #include <libcamera/base/utils.h>
>  
>  #include "libcamera/internal/pipeline_handler.h"
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
> index c185ac3992dd..91757600ccdc 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
> @@ -11,11 +11,11 @@
>  #include <vector>
>  
>  #include <libcamera/base/signal.h>
> +#include <libcamera/base/span.h>
>  
>  #include <libcamera/camera.h>
>  #include <libcamera/geometry.h>
>  #include <libcamera/pixel_format.h>
> -#include <libcamera/span.h>
>  
>  #include "libcamera/internal/media_object.h"
>  #include "libcamera/internal/v4l2_videodevice.h"
> diff --git a/test/span.cpp b/test/span.cpp
> index ca037c8f02fa..abf3a5d681bf 100644
> --- a/test/span.cpp
> +++ b/test/span.cpp
> @@ -9,7 +9,7 @@
>   * Include first to ensure the header is self-contained, as there's no span.cpp
>   * in libcamera.
>   */
> -#include <libcamera/span.h>
> +#include <libcamera/base/span.h>
>  
>  #include <array>
>  #include <iostream>
> diff --git a/test/utils.cpp b/test/utils.cpp
> index 9cd2cd070cb9..d7f810e95e7a 100644
> --- a/test/utils.cpp
> +++ b/test/utils.cpp
> @@ -11,11 +11,11 @@
>  #include <string>
>  #include <vector>
>  
> -#include <libcamera/geometry.h>
> -#include <libcamera/span.h>
> -
> +#include <libcamera/base/span.h>
>  #include <libcamera/base/utils.h>
>  
> +#include <libcamera/geometry.h>
> +
>  #include "test.h"
>  
>  using namespace std;
Hirokazu Honda June 28, 2021, 4:28 a.m. UTC | #7
Hi Kieran,

On Fri, Jun 25, 2021 at 7:59 PM Kieran Bingham
<kieran.bingham@ideasonboard.com> wrote:
>
> Hi Hiro,
>
> On 25/06/2021 10:39, Kieran Bingham wrote:
> >
> >>
> >> Isn't span not one which should not be exposed to public?
> >
> > Oh that's interesting - I thought span was used in the public API
> > somewhere, but now I can't see it - I'll check and move to private if it
> > can go there.
>
> We use spans for controls, which form part of the public-api.

Ah, I see. Acknowledged.

Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
>
> So base/span.h is currently public, and will stay there (until C++20? :D)
>
> --
> Regards
> --
> Kieran

Patch
diff mbox series

diff --git a/Documentation/Doxyfile.in b/Documentation/Doxyfile.in
index 8305f56af7a8..a79d37706faf 100644
--- a/Documentation/Doxyfile.in
+++ b/Documentation/Doxyfile.in
@@ -834,7 +834,7 @@  RECURSIVE              = YES
 # Note that relative paths are relative to the directory from which doxygen is
 # run.
 
-EXCLUDE                = @TOP_SRCDIR@/include/libcamera/span.h \
+EXCLUDE                = @TOP_SRCDIR@/include/libcamera/base/span.h \
 			 @TOP_SRCDIR@/include/libcamera/internal/device_enumerator_sysfs.h \
 			 @TOP_SRCDIR@/include/libcamera/internal/device_enumerator_udev.h \
 			 @TOP_SRCDIR@/include/libcamera/internal/ipc_pipe_unixsocket.h \
diff --git a/include/libcamera/base/file.h b/include/libcamera/base/file.h
index cecbb254591f..c3c7ca6013a8 100644
--- a/include/libcamera/base/file.h
+++ b/include/libcamera/base/file.h
@@ -13,8 +13,7 @@ 
 
 #include <libcamera/base/class.h>
 #include <libcamera/base/private.h>
-
-#include <libcamera/span.h>
+#include <libcamera/base/span.h>
 
 namespace libcamera {
 
diff --git a/include/libcamera/base/meson.build b/include/libcamera/base/meson.build
index aaac324d7149..7c499b558fb0 100644
--- a/include/libcamera/base/meson.build
+++ b/include/libcamera/base/meson.build
@@ -15,6 +15,7 @@  libcamera_base_headers = files([
     'private.h',
     'semaphore.h',
     'signal.h',
+    'span.h',
     'thread.h',
     'timer.h',
     'utils.h',
diff --git a/include/libcamera/span.h b/include/libcamera/base/span.h
similarity index 100%
rename from include/libcamera/span.h
rename to include/libcamera/base/span.h
diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
index f62b6cf055d6..1bc958a43b22 100644
--- a/include/libcamera/controls.h
+++ b/include/libcamera/controls.h
@@ -15,9 +15,9 @@ 
 #include <vector>
 
 #include <libcamera/base/class.h>
+#include <libcamera/base/span.h>
 
 #include <libcamera/geometry.h>
-#include <libcamera/span.h>
 
 namespace libcamera {
 
diff --git a/include/libcamera/internal/buffer.h b/include/libcamera/internal/buffer.h
index 91dd24969385..beae0cb98544 100644
--- a/include/libcamera/internal/buffer.h
+++ b/include/libcamera/internal/buffer.h
@@ -11,9 +11,9 @@ 
 #include <vector>
 
 #include <libcamera/base/class.h>
+#include <libcamera/base/span.h>
 
 #include <libcamera/buffer.h>
-#include <libcamera/span.h>
 
 namespace libcamera {
 
diff --git a/include/libcamera/internal/byte_stream_buffer.h b/include/libcamera/internal/byte_stream_buffer.h
index 7eefb1a71f07..d0f0df5ee87b 100644
--- a/include/libcamera/internal/byte_stream_buffer.h
+++ b/include/libcamera/internal/byte_stream_buffer.h
@@ -12,8 +12,7 @@ 
 #include <type_traits>
 
 #include <libcamera/base/class.h>
-
-#include <libcamera/span.h>
+#include <libcamera/base/span.h>
 
 namespace libcamera {
 
diff --git a/include/libcamera/internal/pub_key.h b/include/libcamera/internal/pub_key.h
index f5f988b58f74..9261c9c2a0ee 100644
--- a/include/libcamera/internal/pub_key.h
+++ b/include/libcamera/internal/pub_key.h
@@ -9,7 +9,7 @@ 
 
 #include <stdint.h>
 
-#include <libcamera/span.h>
+#include <libcamera/base/span.h>
 
 #if HAVE_GNUTLS
 struct gnutls_pubkey_st;
diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h
index 1edd664a9aef..77b835b3cb80 100644
--- a/include/libcamera/internal/v4l2_device.h
+++ b/include/libcamera/internal/v4l2_device.h
@@ -15,9 +15,9 @@ 
 
 #include <libcamera/base/log.h>
 #include <libcamera/base/signal.h>
+#include <libcamera/base/span.h>
 
 #include <libcamera/controls.h>
-#include <libcamera/span.h>
 
 namespace libcamera {
 
diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build
index d08bb3096aff..9a120d13346e 100644
--- a/include/libcamera/meson.build
+++ b/include/libcamera/meson.build
@@ -12,7 +12,6 @@  libcamera_public_headers = files([
     'logging.h',
     'pixel_format.h',
     'request.h',
-    'span.h',
     'stream.h',
     'transform.h',
 ])
diff --git a/src/android/camera_buffer.h b/src/android/camera_buffer.h
index e850c4e36668..2617ff6b11a1 100644
--- a/src/android/camera_buffer.h
+++ b/src/android/camera_buffer.h
@@ -10,8 +10,7 @@ 
 #include <hardware/camera3.h>
 
 #include <libcamera/base/class.h>
-
-#include <libcamera/span.h>
+#include <libcamera/base/span.h>
 
 class CameraBuffer final : public libcamera::Extensible
 {
diff --git a/src/android/jpeg/encoder.h b/src/android/jpeg/encoder.h
index 8d449369869f..28e7f92a3ecb 100644
--- a/src/android/jpeg/encoder.h
+++ b/src/android/jpeg/encoder.h
@@ -7,8 +7,9 @@ 
 #ifndef __ANDROID_JPEG_ENCODER_H__
 #define __ANDROID_JPEG_ENCODER_H__
 
+#include <libcamera/base/span.h>
+
 #include <libcamera/buffer.h>
-#include <libcamera/span.h>
 #include <libcamera/stream.h>
 
 class Encoder
diff --git a/src/android/jpeg/exif.h b/src/android/jpeg/exif.h
index 8aa1b123a737..23b0e0974459 100644
--- a/src/android/jpeg/exif.h
+++ b/src/android/jpeg/exif.h
@@ -13,8 +13,9 @@ 
 
 #include <libexif/exif-data.h>
 
+#include <libcamera/base/span.h>
+
 #include <libcamera/geometry.h>
-#include <libcamera/span.h>
 
 class Exif
 {
diff --git a/src/ipa/libipa/histogram.h b/src/ipa/libipa/histogram.h
index e06f1884395e..c2761cb29e7a 100644
--- a/src/ipa/libipa/histogram.h
+++ b/src/ipa/libipa/histogram.h
@@ -13,7 +13,7 @@ 
 
 #include <vector>
 
-#include <libcamera/span.h>
+#include <libcamera/base/span.h>
 
 namespace libcamera {
 
diff --git a/src/ipa/raspberrypi/cam_helper.hpp b/src/ipa/raspberrypi/cam_helper.hpp
index a66648197140..b19c95f67453 100644
--- a/src/ipa/raspberrypi/cam_helper.hpp
+++ b/src/ipa/raspberrypi/cam_helper.hpp
@@ -8,8 +8,7 @@ 
 
 #include <string>
 
-#include <libcamera/span.h>
-
+#include <libcamera/base/span.h>
 #include <libcamera/base/utils.h>
 
 #include "camera_mode.h"
diff --git a/src/ipa/raspberrypi/md_parser.hpp b/src/ipa/raspberrypi/md_parser.hpp
index 65aab02d51b6..8497216f8db7 100644
--- a/src/ipa/raspberrypi/md_parser.hpp
+++ b/src/ipa/raspberrypi/md_parser.hpp
@@ -8,7 +8,7 @@ 
 
 #include <stdint.h>
 
-#include <libcamera/span.h>
+#include <libcamera/base/span.h>
 
 /*
  * Camera metadata parser class. Usage as shown below.
diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp
index a3f014495e80..4d09a84f6532 100644
--- a/src/ipa/raspberrypi/raspberrypi.cpp
+++ b/src/ipa/raspberrypi/raspberrypi.cpp
@@ -16,6 +16,7 @@ 
 #include <linux/bcm2835-isp.h>
 
 #include <libcamera/base/log.h>
+#include <libcamera/base/span.h>
 
 #include <libcamera/buffer.h>
 #include <libcamera/control_ids.h>
@@ -26,7 +27,6 @@ 
 #include <libcamera/ipa/raspberrypi.h>
 #include <libcamera/ipa/raspberrypi_ipa_interface.h>
 #include <libcamera/request.h>
-#include <libcamera/span.h>
 
 #include "libcamera/internal/buffer.h"
 
diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp
index dd5a26083747..300466285a57 100644
--- a/src/libcamera/control_serializer.cpp
+++ b/src/libcamera/control_serializer.cpp
@@ -12,11 +12,11 @@ 
 #include <vector>
 
 #include <libcamera/base/log.h>
+#include <libcamera/base/span.h>
 
 #include <libcamera/control_ids.h>
 #include <libcamera/controls.h>
 #include <libcamera/ipa/ipa_controls.h>
-#include <libcamera/span.h>
 
 #include "libcamera/internal/byte_stream_buffer.h"
 
diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp
index 984c1fed9bdb..adfb8d407697 100644
--- a/src/libcamera/ipa_module.cpp
+++ b/src/libcamera/ipa_module.cpp
@@ -21,10 +21,9 @@ 
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <libcamera/span.h>
-
 #include <libcamera/base/file.h>
 #include <libcamera/base/log.h>
+#include <libcamera/base/span.h>
 #include <libcamera/base/utils.h>
 
 #include "libcamera/internal/pipeline_handler.h"
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
index c185ac3992dd..91757600ccdc 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h
+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
@@ -11,11 +11,11 @@ 
 #include <vector>
 
 #include <libcamera/base/signal.h>
+#include <libcamera/base/span.h>
 
 #include <libcamera/camera.h>
 #include <libcamera/geometry.h>
 #include <libcamera/pixel_format.h>
-#include <libcamera/span.h>
 
 #include "libcamera/internal/media_object.h"
 #include "libcamera/internal/v4l2_videodevice.h"
diff --git a/test/span.cpp b/test/span.cpp
index ca037c8f02fa..abf3a5d681bf 100644
--- a/test/span.cpp
+++ b/test/span.cpp
@@ -9,7 +9,7 @@ 
  * Include first to ensure the header is self-contained, as there's no span.cpp
  * in libcamera.
  */
-#include <libcamera/span.h>
+#include <libcamera/base/span.h>
 
 #include <array>
 #include <iostream>
diff --git a/test/utils.cpp b/test/utils.cpp
index 9cd2cd070cb9..d7f810e95e7a 100644
--- a/test/utils.cpp
+++ b/test/utils.cpp
@@ -11,11 +11,11 @@ 
 #include <string>
 #include <vector>
 
-#include <libcamera/geometry.h>
-#include <libcamera/span.h>
-
+#include <libcamera/base/span.h>
 #include <libcamera/base/utils.h>
 
+#include <libcamera/geometry.h>
+
 #include "test.h"
 
 using namespace std;