[libcamera-devel,02/14] libcamera: proxy: Get event dispatcher from current thread

Message ID 20190818011329.14499-3-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • Assorted fixes for Android camera HAL
Related show

Commit Message

Laurent Pinchart Aug. 18, 2019, 1:13 a.m. UTC
Get the event dispatcher from the current thread instead of the camera
manager. This prepares for the removal of CameraManager::instance().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/proxy/worker/ipa_proxy_linux_worker.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jacopo Mondi Aug. 19, 2019, 8:57 a.m. UTC | #1
Hi Laurent,

On Sun, Aug 18, 2019 at 04:13:17AM +0300, Laurent Pinchart wrote:
> Get the event dispatcher from the current thread instead of the camera
> manager. This prepares for the removal of CameraManager::instance().
>

Regardless the outcome of the discussion on the
CameraManager::instance() method, I think this is a good change.

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  src/libcamera/proxy/worker/ipa_proxy_linux_worker.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/libcamera/proxy/worker/ipa_proxy_linux_worker.cpp b/src/libcamera/proxy/worker/ipa_proxy_linux_worker.cpp
> index c43b088ac39c..ffba3ae4de80 100644
> --- a/src/libcamera/proxy/worker/ipa_proxy_linux_worker.cpp
> +++ b/src/libcamera/proxy/worker/ipa_proxy_linux_worker.cpp
> @@ -9,7 +9,6 @@
>  #include <sys/types.h>
>  #include <unistd.h>
>
> -#include <libcamera/camera_manager.h>
>  #include <libcamera/event_dispatcher.h>
>  #include <libcamera/ipa/ipa_interface.h>
>  #include <libcamera/logging.h>
> @@ -17,6 +16,7 @@
>  #include "ipa_module.h"
>  #include "ipc_unixsocket.h"
>  #include "log.h"
> +#include "thread.h"
>  #include "utils.h"
>
>  using namespace libcamera;
> @@ -81,7 +81,7 @@ int main(int argc, char **argv)
>  	LOG(IPAProxyLinuxWorker, Debug) << "Proxy worker successfully started";
>
>  	/* \todo upgrade listening loop */
> -	EventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();
> +	EventDispatcher *dispatcher = Thread::current()->eventDispatcher();
>  	while (1)
>  		dispatcher->processEvents();
>
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/src/libcamera/proxy/worker/ipa_proxy_linux_worker.cpp b/src/libcamera/proxy/worker/ipa_proxy_linux_worker.cpp
index c43b088ac39c..ffba3ae4de80 100644
--- a/src/libcamera/proxy/worker/ipa_proxy_linux_worker.cpp
+++ b/src/libcamera/proxy/worker/ipa_proxy_linux_worker.cpp
@@ -9,7 +9,6 @@ 
 #include <sys/types.h>
 #include <unistd.h>
 
-#include <libcamera/camera_manager.h>
 #include <libcamera/event_dispatcher.h>
 #include <libcamera/ipa/ipa_interface.h>
 #include <libcamera/logging.h>
@@ -17,6 +16,7 @@ 
 #include "ipa_module.h"
 #include "ipc_unixsocket.h"
 #include "log.h"
+#include "thread.h"
 #include "utils.h"
 
 using namespace libcamera;
@@ -81,7 +81,7 @@  int main(int argc, char **argv)
 	LOG(IPAProxyLinuxWorker, Debug) << "Proxy worker successfully started";
 
 	/* \todo upgrade listening loop */
-	EventDispatcher *dispatcher = CameraManager::instance()->eventDispatcher();
+	EventDispatcher *dispatcher = Thread::current()->eventDispatcher();
 	while (1)
 		dispatcher->processEvents();