summaryrefslogtreecommitdiff
path: root/include/libcamera/internal
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham@ideasonboard.com>2021-06-15 16:15:12 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2021-06-25 16:11:08 +0100
commit27aff949fbc1b9aabfc594bbfd6f94be55a086ec (patch)
tree9ddbc2462a685a6db3ed33f09ed7a493376439d6 /include/libcamera/internal
parent6410d1d37c1ea9d1d168840a7ba063facb0bc9d6 (diff)
libcamera/base: Move extended base functionality
Move the functionality for the following components to the new base support library: - BoundMethod - EventDispatcher - EventDispatcherPoll - Log - Message - Object - Signal - Semaphore - Thread - Timer While it would be preferable to see these split to move one component per commit, these components are all interdependent upon each other, which leaves us with one big change performing the move for all of them. Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'include/libcamera/internal')
-rw-r--r--include/libcamera/internal/camera_sensor.h2
-rw-r--r--include/libcamera/internal/device_enumerator.h2
-rw-r--r--include/libcamera/internal/event_dispatcher.h35
-rw-r--r--include/libcamera/internal/event_dispatcher_poll.h58
-rw-r--r--include/libcamera/internal/event_notifier.h4
-rw-r--r--include/libcamera/internal/ipa_data_serializer.h3
-rw-r--r--include/libcamera/internal/ipa_manager.h3
-rw-r--r--include/libcamera/internal/ipa_module.h3
-rw-r--r--include/libcamera/internal/ipc_pipe.h4
-rw-r--r--include/libcamera/internal/ipc_unixsocket.h2
-rw-r--r--include/libcamera/internal/log.h130
-rw-r--r--include/libcamera/internal/media_device.h4
-rw-r--r--include/libcamera/internal/meson.build7
-rw-r--r--include/libcamera/internal/message.h71
-rw-r--r--include/libcamera/internal/pipeline_handler.h2
-rw-r--r--include/libcamera/internal/process.h2
-rw-r--r--include/libcamera/internal/semaphore.h34
-rw-r--r--include/libcamera/internal/thread.h78
-rw-r--r--include/libcamera/internal/timer.h49
-rw-r--r--include/libcamera/internal/v4l2_device.h6
-rw-r--r--include/libcamera/internal/v4l2_subdevice.h2
-rw-r--r--include/libcamera/internal/v4l2_videodevice.h4
22 files changed, 23 insertions, 482 deletions
diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
index 7bc54061..db12b07e 100644
--- a/include/libcamera/internal/camera_sensor.h
+++ b/include/libcamera/internal/camera_sensor.h
@@ -12,13 +12,13 @@
#include <vector>
#include <libcamera/base/class.h>
+#include <libcamera/base/log.h>
#include <libcamera/controls.h>
#include <libcamera/geometry.h>
#include <libcamera/ipa/core_ipa_interface.h>
#include "libcamera/internal/formats.h"
-#include "libcamera/internal/log.h"
#include "libcamera/internal/v4l2_subdevice.h"
namespace libcamera {
diff --git a/include/libcamera/internal/device_enumerator.h b/include/libcamera/internal/device_enumerator.h
index 707cfe8f..222caf75 100644
--- a/include/libcamera/internal/device_enumerator.h
+++ b/include/libcamera/internal/device_enumerator.h
@@ -13,7 +13,7 @@
#include <linux/media.h>
-#include <libcamera/signal.h>
+#include <libcamera/base/signal.h>
namespace libcamera {
diff --git a/include/libcamera/internal/event_dispatcher.h b/include/libcamera/internal/event_dispatcher.h
deleted file mode 100644
index e6a8ad65..00000000
--- a/include/libcamera/internal/event_dispatcher.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* SPDX-License-Identifier: LGPL-2.1-or-later */
-/*
- * Copyright (C) 2019, Google Inc.
- *
- * event_dispatcher.h - Event dispatcher
- */
-#ifndef __LIBCAMERA_INTERNAL_EVENT_DISPATCHER_H__
-#define __LIBCAMERA_INTERNAL_EVENT_DISPATCHER_H__
-
-#include <vector>
-
-namespace libcamera {
-
-class EventNotifier;
-class Timer;
-
-class EventDispatcher
-{
-public:
- virtual ~EventDispatcher();
-
- virtual void registerEventNotifier(EventNotifier *notifier) = 0;
- virtual void unregisterEventNotifier(EventNotifier *notifier) = 0;
-
- virtual void registerTimer(Timer *timer) = 0;
- virtual void unregisterTimer(Timer *timer) = 0;
-
- virtual void processEvents() = 0;
-
- virtual void interrupt() = 0;
-};
-
-} /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_EVENT_DISPATCHER_H__ */
diff --git a/include/libcamera/internal/event_dispatcher_poll.h b/include/libcamera/internal/event_dispatcher_poll.h
deleted file mode 100644
index 33de051d..00000000
--- a/include/libcamera/internal/event_dispatcher_poll.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* SPDX-License-Identifier: LGPL-2.1-or-later */
-/*
- * Copyright (C) 2019, Google Inc.
- *
- * event_dispatcher_poll.h - Poll-based event dispatcher
- */
-#ifndef __LIBCAMERA_INTERNAL_EVENT_DISPATCHER_POLL_H__
-#define __LIBCAMERA_INTERNAL_EVENT_DISPATCHER_POLL_H__
-
-#include <list>
-#include <map>
-#include <vector>
-
-#include "libcamera/internal/event_dispatcher.h"
-
-struct pollfd;
-
-namespace libcamera {
-
-class EventNotifier;
-class Timer;
-
-class EventDispatcherPoll final : public EventDispatcher
-{
-public:
- EventDispatcherPoll();
- ~EventDispatcherPoll();
-
- void registerEventNotifier(EventNotifier *notifier);
- void unregisterEventNotifier(EventNotifier *notifier);
-
- void registerTimer(Timer *timer);
- void unregisterTimer(Timer *timer);
-
- void processEvents();
- void interrupt();
-
-private:
- struct EventNotifierSetPoll {
- short events() const;
- EventNotifier *notifiers[3];
- };
-
- int poll(std::vector<struct pollfd> *pollfds);
- void processInterrupt(const struct pollfd &pfd);
- void processNotifiers(const std::vector<struct pollfd> &pollfds);
- void processTimers();
-
- std::map<int, EventNotifierSetPoll> notifiers_;
- std::list<Timer *> timers_;
- int eventfd_;
-
- bool processingEvents_;
-};
-
-} /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_EVENT_DISPATCHER_POLL_H__ */
diff --git a/include/libcamera/internal/event_notifier.h b/include/libcamera/internal/event_notifier.h
index cc3495c0..8a6419f2 100644
--- a/include/libcamera/internal/event_notifier.h
+++ b/include/libcamera/internal/event_notifier.h
@@ -7,8 +7,8 @@
#ifndef __LIBCAMERA_INTERNAL_EVENT_NOTIFIER_H__
#define __LIBCAMERA_INTERNAL_EVENT_NOTIFIER_H__
-#include <libcamera/object.h>
-#include <libcamera/signal.h>
+#include <libcamera/base/object.h>
+#include <libcamera/base/signal.h>
namespace libcamera {
diff --git a/include/libcamera/internal/ipa_data_serializer.h b/include/libcamera/internal/ipa_data_serializer.h
index 70168acc..76325b1d 100644
--- a/include/libcamera/internal/ipa_data_serializer.h
+++ b/include/libcamera/internal/ipa_data_serializer.h
@@ -14,6 +14,8 @@
#include <type_traits>
#include <vector>
+#include <libcamera/base/log.h>
+
#include <libcamera/buffer.h>
#include <libcamera/control_ids.h>
#include <libcamera/geometry.h>
@@ -22,7 +24,6 @@
#include "libcamera/internal/byte_stream_buffer.h"
#include "libcamera/internal/camera_sensor.h"
#include "libcamera/internal/control_serializer.h"
-#include "libcamera/internal/log.h"
namespace libcamera {
diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h
index e904a2be..34224e33 100644
--- a/include/libcamera/internal/ipa_manager.h
+++ b/include/libcamera/internal/ipa_manager.h
@@ -10,11 +10,12 @@
#include <stdint.h>
#include <vector>
+#include <libcamera/base/log.h>
+
#include <libcamera/ipa/ipa_interface.h>
#include <libcamera/ipa/ipa_module_info.h>
#include "libcamera/internal/ipa_module.h"
-#include "libcamera/internal/log.h"
#include "libcamera/internal/pipeline_handler.h"
#include "libcamera/internal/pub_key.h"
diff --git a/include/libcamera/internal/ipa_module.h b/include/libcamera/internal/ipa_module.h
index 19fc5827..a87f5650 100644
--- a/include/libcamera/internal/ipa_module.h
+++ b/include/libcamera/internal/ipa_module.h
@@ -11,10 +11,11 @@
#include <string>
#include <vector>
+#include <libcamera/base/log.h>
+
#include <libcamera/ipa/ipa_interface.h>
#include <libcamera/ipa/ipa_module_info.h>
-#include "libcamera/internal/log.h"
#include "libcamera/internal/pipeline_handler.h"
namespace libcamera {
diff --git a/include/libcamera/internal/ipc_pipe.h b/include/libcamera/internal/ipc_pipe.h
index c9a84b78..e58de340 100644
--- a/include/libcamera/internal/ipc_pipe.h
+++ b/include/libcamera/internal/ipc_pipe.h
@@ -9,9 +9,9 @@
#include <vector>
-#include "libcamera/internal/ipc_unixsocket.h"
+#include <libcamera/base/signal.h>
-#include <libcamera/signal.h>
+#include "libcamera/internal/ipc_unixsocket.h"
namespace libcamera {
diff --git a/include/libcamera/internal/ipc_unixsocket.h b/include/libcamera/internal/ipc_unixsocket.h
index e871b650..9f5b0677 100644
--- a/include/libcamera/internal/ipc_unixsocket.h
+++ b/include/libcamera/internal/ipc_unixsocket.h
@@ -12,7 +12,7 @@
#include <sys/types.h>
#include <vector>
-#include <libcamera/signal.h>
+#include <libcamera/base/signal.h>
namespace libcamera {
diff --git a/include/libcamera/internal/log.h b/include/libcamera/internal/log.h
deleted file mode 100644
index 82e55a62..00000000
--- a/include/libcamera/internal/log.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/* SPDX-License-Identifier: LGPL-2.1-or-later */
-/*
- * Copyright (C) 2018, Google Inc.
- *
- * log.h - Logging infrastructure
- */
-#ifndef __LIBCAMERA_INTERNAL_LOG_H__
-#define __LIBCAMERA_INTERNAL_LOG_H__
-
-#include <chrono>
-#include <sstream>
-
-#include <libcamera/base/class.h>
-#include <libcamera/base/utils.h>
-
-namespace libcamera {
-
-enum LogSeverity {
- LogInvalid = -1,
- LogDebug = 0,
- LogInfo,
- LogWarning,
- LogError,
- LogFatal,
-};
-
-class LogCategory
-{
-public:
- explicit LogCategory(const char *name);
-
- const char *name() const { return name_; }
- LogSeverity severity() const { return severity_; }
- void setSeverity(LogSeverity severity);
-
- static const LogCategory &defaultCategory();
-
-private:
- const char *name_;
- LogSeverity severity_;
-};
-
-#define LOG_DECLARE_CATEGORY(name) \
-extern const LogCategory &_LOG_CATEGORY(name)();
-
-#define LOG_DEFINE_CATEGORY(name) \
-const LogCategory &_LOG_CATEGORY(name)() \
-{ \
- /* The instance will be deleted by the Logger destructor. */ \
- static LogCategory *category = new LogCategory(#name); \
- return *category; \
-}
-
-class LogMessage
-{
-public:
- LogMessage(const char *fileName, unsigned int line,
- const LogCategory &category, LogSeverity severity);
-
- LogMessage(LogMessage &&);
- ~LogMessage();
-
- std::ostream &stream() { return msgStream_; }
-
- const utils::time_point &timestamp() const { return timestamp_; }
- LogSeverity severity() const { return severity_; }
- const LogCategory &category() const { return category_; }
- const std::string &fileInfo() const { return fileInfo_; }
- const std::string msg() const { return msgStream_.str(); }
-
-private:
- LIBCAMERA_DISABLE_COPY(LogMessage)
-
- void init(const char *fileName, unsigned int line);
-
- std::ostringstream msgStream_;
- const LogCategory &category_;
- LogSeverity severity_;
- utils::time_point timestamp_;
- std::string fileInfo_;
-};
-
-class Loggable
-{
-public:
- virtual ~Loggable();
-
-protected:
- virtual std::string logPrefix() const = 0;
-
- LogMessage _log(const LogCategory *category, LogSeverity severity,
- const char *fileName = __builtin_FILE(),
- unsigned int line = __builtin_LINE()) const;
-};
-
-LogMessage _log(const LogCategory *category, LogSeverity severity,
- const char *fileName = __builtin_FILE(),
- unsigned int line = __builtin_LINE());
-
-#ifndef __DOXYGEN__
-#define _LOG_CATEGORY(name) logCategory##name
-
-#define _LOG1(severity) \
- _log(nullptr, Log##severity).stream()
-#define _LOG2(category, severity) \
- _log(&_LOG_CATEGORY(category)(), Log##severity).stream()
-
-/*
- * Expand the LOG() macro to _LOG1() or _LOG2() based on the number of
- * arguments.
- */
-#define _LOG_MACRO(_1, _2, NAME, ...) NAME
-#define LOG(...) _LOG_MACRO(__VA_ARGS__, _LOG2, _LOG1)(__VA_ARGS__)
-#else /* __DOXYGEN___ */
-#define LOG(category, severity)
-#endif /* __DOXYGEN__ */
-
-#ifndef NDEBUG
-#define ASSERT(condition) static_cast<void>(({ \
- if (!(condition)) \
- LOG(Fatal) << "assertion \"" #condition "\" failed in " \
- << __func__ << "()"; \
-}))
-#else
-#define ASSERT(condition) static_cast<void>(false && (condition))
-#endif
-
-} /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_LOG_H__ */
diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h
index c3292508..8424611d 100644
--- a/include/libcamera/internal/media_device.h
+++ b/include/libcamera/internal/media_device.h
@@ -14,9 +14,9 @@
#include <linux/media.h>
-#include <libcamera/signal.h>
+#include <libcamera/base/log.h>
+#include <libcamera/base/signal.h>
-#include "libcamera/internal/log.h"
#include "libcamera/internal/media_object.h"
namespace libcamera {
diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build
index 1348e926..cf664fc9 100644
--- a/include/libcamera/internal/meson.build
+++ b/include/libcamera/internal/meson.build
@@ -22,8 +22,6 @@ libcamera_internal_headers = files([
'device_enumerator.h',
'device_enumerator_sysfs.h',
'device_enumerator_udev.h',
- 'event_dispatcher.h',
- 'event_dispatcher_poll.h',
'event_notifier.h',
'file.h',
'formats.h',
@@ -31,18 +29,13 @@ libcamera_internal_headers = files([
'ipa_module.h',
'ipa_proxy.h',
'ipc_unixsocket.h',
- 'log.h',
'media_device.h',
'media_object.h',
- 'message.h',
'pipeline_handler.h',
'process.h',
'pub_key.h',
- 'semaphore.h',
'source_paths.h',
'sysfs.h',
- 'thread.h',
- 'timer.h',
'v4l2_device.h',
'v4l2_pixelformat.h',
'v4l2_subdevice.h',
diff --git a/include/libcamera/internal/message.h b/include/libcamera/internal/message.h
deleted file mode 100644
index f1b133bf..00000000
--- a/include/libcamera/internal/message.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* SPDX-License-Identifier: LGPL-2.1-or-later */
-/*
- * Copyright (C) 2019, Google Inc.
- *
- * message.h - Message queue support
- */
-#ifndef __LIBCAMERA_INTERNAL_MESSAGE_H__
-#define __LIBCAMERA_INTERNAL_MESSAGE_H__
-
-#include <atomic>
-
-#include <libcamera/bound_method.h>
-
-namespace libcamera {
-
-class BoundMethodBase;
-class Object;
-class Semaphore;
-class Thread;
-
-class Message
-{
-public:
- enum Type {
- None = 0,
- InvokeMessage = 1,
- ThreadMoveMessage = 2,
- DeferredDelete = 3,
- UserMessage = 1000,
- };
-
- Message(Type type);
- virtual ~Message();
-
- Type type() const { return type_; }
- Object *receiver() const { return receiver_; }
-
- static Type registerMessageType();
-
-private:
- friend class Thread;
-
- Type type_;
- Object *receiver_;
-
- static std::atomic_uint nextUserType_;
-};
-
-class InvokeMessage : public Message
-{
-public:
- InvokeMessage(BoundMethodBase *method,
- std::shared_ptr<BoundMethodPackBase> pack,
- Semaphore *semaphore = nullptr,
- bool deleteMethod = false);
- ~InvokeMessage();
-
- Semaphore *semaphore() const { return semaphore_; }
-
- void invoke();
-
-private:
- BoundMethodBase *method_;
- std::shared_ptr<BoundMethodPackBase> pack_;
- Semaphore *semaphore_;
- bool deleteMethod_;
-};
-
-} /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_MESSAGE_H__ */
diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h
index 8beb6b76..9e2d65d6 100644
--- a/include/libcamera/internal/pipeline_handler.h
+++ b/include/libcamera/internal/pipeline_handler.h
@@ -16,9 +16,9 @@
#include <vector>
#include <libcamera/base/class.h>
+#include <libcamera/base/object.h>
#include <libcamera/controls.h>
-#include <libcamera/object.h>
#include <libcamera/stream.h>
#include "libcamera/internal/ipa_proxy.h"
diff --git a/include/libcamera/internal/process.h b/include/libcamera/internal/process.h
index 254cda85..c4d5d9c1 100644
--- a/include/libcamera/internal/process.h
+++ b/include/libcamera/internal/process.h
@@ -11,7 +11,7 @@
#include <string>
#include <vector>
-#include <libcamera/signal.h>
+#include <libcamera/base/signal.h>
namespace libcamera {
diff --git a/include/libcamera/internal/semaphore.h b/include/libcamera/internal/semaphore.h
deleted file mode 100644
index 9dc65d29..00000000
--- a/include/libcamera/internal/semaphore.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* SPDX-License-Identifier: LGPL-2.1-or-later */
-/*
- * Copyright (C) 2019, Google Inc.
- *
- * semaphore.h - General-purpose counting semaphore
- */
-#ifndef __LIBCAMERA_INTERNAL_SEMAPHORE_H__
-#define __LIBCAMERA_INTERNAL_SEMAPHORE_H__
-
-#include <condition_variable>
-
-#include "libcamera/internal/thread.h"
-
-namespace libcamera {
-
-class Semaphore
-{
-public:
- Semaphore(unsigned int n = 0);
-
- unsigned int available();
- void acquire(unsigned int n = 1);
- bool tryAcquire(unsigned int n = 1);
- void release(unsigned int n = 1);
-
-private:
- Mutex mutex_;
- std::condition_variable cv_;
- unsigned int available_;
-};
-
-} /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_SEMAPHORE_H__ */
diff --git a/include/libcamera/internal/thread.h b/include/libcamera/internal/thread.h
deleted file mode 100644
index 9662e28b..00000000
--- a/include/libcamera/internal/thread.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* SPDX-License-Identifier: LGPL-2.1-or-later */
-/*
- * Copyright (C) 2019, Google Inc.
- *
- * thread.h - Thread support
- */
-#ifndef __LIBCAMERA_INTERNAL_THREAD_H__
-#define __LIBCAMERA_INTERNAL_THREAD_H__
-
-#include <memory>
-#include <mutex>
-#include <sys/types.h>
-#include <thread>
-
-#include <libcamera/signal.h>
-
-#include <libcamera/base/utils.h>
-
-#include "libcamera/internal/message.h"
-
-namespace libcamera {
-
-class EventDispatcher;
-class Message;
-class Object;
-class ThreadData;
-class ThreadMain;
-
-using Mutex = std::mutex;
-using MutexLocker = std::unique_lock<std::mutex>;
-
-class Thread
-{
-public:
- Thread();
- virtual ~Thread();
-
- void start();
- void exit(int code = 0);
- bool wait(utils::duration duration = utils::duration::max());
-
- bool isRunning();
-
- Signal<Thread *> finished;
-
- static Thread *current();
- static pid_t currentId();
-
- EventDispatcher *eventDispatcher();
-
- void dispatchMessages(Message::Type type = Message::Type::None);
-
-protected:
- int exec();
- virtual void run();
-
-private:
- void startThread();
- void finishThread();
-
- void postMessage(std::unique_ptr<Message> msg, Object *receiver);
- void removeMessages(Object *receiver);
-
- friend class Object;
- friend class ThreadData;
- friend class ThreadMain;
-
- void moveObject(Object *object);
- void moveObject(Object *object, ThreadData *currentData,
- ThreadData *targetData);
-
- std::thread thread_;
- ThreadData *data_;
-};
-
-} /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_THREAD_H__ */
diff --git a/include/libcamera/internal/timer.h b/include/libcamera/internal/timer.h
deleted file mode 100644
index 013e93c0..00000000
--- a/include/libcamera/internal/timer.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* SPDX-License-Identifier: LGPL-2.1-or-later */
-/*
- * Copyright (C) 2019, Google Inc.
- *
- * timer.h - Generic timer
- */
-#ifndef __LIBCAMERA_INTERNAL_TIMER_H__
-#define __LIBCAMERA_INTERNAL_TIMER_H__
-
-#include <chrono>
-#include <stdint.h>
-
-#include <libcamera/object.h>
-#include <libcamera/signal.h>
-
-namespace libcamera {
-
-class Message;
-
-class Timer : public Object
-{
-public:
- Timer(Object *parent = nullptr);
- ~Timer();
-
- void start(unsigned int msec) { start(std::chrono::milliseconds(msec)); }
- void start(std::chrono::milliseconds duration);
- void start(std::chrono::steady_clock::time_point deadline);
- void stop();
- bool isRunning() const;
-
- std::chrono::steady_clock::time_point deadline() const { return deadline_; }
-
- Signal<Timer *> timeout;
-
-protected:
- void message(Message *msg) override;
-
-private:
- void registerTimer();
- void unregisterTimer();
-
- bool running_;
- std::chrono::steady_clock::time_point deadline_;
-};
-
-} /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_TIMER_H__ */
diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h
index c318e976..1edd664a 100644
--- a/include/libcamera/internal/v4l2_device.h
+++ b/include/libcamera/internal/v4l2_device.h
@@ -13,12 +13,12 @@
#include <linux/videodev2.h>
+#include <libcamera/base/log.h>
+#include <libcamera/base/signal.h>
+
#include <libcamera/controls.h>
-#include <libcamera/signal.h>
#include <libcamera/span.h>
-#include "libcamera/internal/log.h"
-
namespace libcamera {
class EventNotifier;
diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h
index d07dd6b4..97b89fb9 100644
--- a/include/libcamera/internal/v4l2_subdevice.h
+++ b/include/libcamera/internal/v4l2_subdevice.h
@@ -12,11 +12,11 @@
#include <vector>
#include <libcamera/base/class.h>
+#include <libcamera/base/log.h>
#include <libcamera/geometry.h>
#include "libcamera/internal/formats.h"
-#include "libcamera/internal/log.h"
#include "libcamera/internal/media_object.h"
#include "libcamera/internal/v4l2_device.h"
diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h
index 227d015e..a7c3d529 100644
--- a/include/libcamera/internal/v4l2_videodevice.h
+++ b/include/libcamera/internal/v4l2_videodevice.h
@@ -17,14 +17,14 @@
#include <linux/videodev2.h>
#include <libcamera/base/class.h>
+#include <libcamera/base/log.h>
+#include <libcamera/base/signal.h>
#include <libcamera/buffer.h>
#include <libcamera/geometry.h>
#include <libcamera/pixel_format.h>
-#include <libcamera/signal.h>
#include "libcamera/internal/formats.h"
-#include "libcamera/internal/log.h"
#include "libcamera/internal/v4l2_device.h"
#include "libcamera/internal/v4l2_pixelformat.h"