[libcamera-devel,v1,1/5] test: Get event dispatcher from current thread
diff mbox series

Message ID 20201113063815.10288-2-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • cam: Move request processing to main thread
Related show

Commit Message

Laurent Pinchart Nov. 13, 2020, 6:38 a.m. UTC
Get the event dispatcher from the current thread instead of the camera
manager. This prepares for the removal of
CameraManager::eventDispatcher().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 test/camera/buffer_import.cpp | 3 ++-
 test/camera/capture.cpp       | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

Comments

Kieran Bingham Nov. 13, 2020, 9:55 a.m. UTC | #1
On 13/11/2020 06:38, Laurent Pinchart wrote:
> Get the event dispatcher from the current thread instead of the camera
> manager. This prepares for the removal of
> CameraManager::eventDispatcher().
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  test/camera/buffer_import.cpp | 3 ++-
>  test/camera/capture.cpp       | 4 +++-
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/test/camera/buffer_import.cpp b/test/camera/buffer_import.cpp
> index 4b626dffa575..ccf532d7b7fc 100644
> --- a/test/camera/buffer_import.cpp
> +++ b/test/camera/buffer_import.cpp
> @@ -17,6 +17,7 @@
>  
>  #include "libcamera/internal/device_enumerator.h"
>  #include "libcamera/internal/media_device.h"
> +#include "libcamera/internal/thread.h"
>  #include "libcamera/internal/v4l2_videodevice.h"
>  
>  #include "buffer_source.h"
> @@ -131,7 +132,7 @@ protected:
>  			}
>  		}
>  
> -		EventDispatcher *dispatcher = cm_->eventDispatcher();
> +		EventDispatcher *dispatcher = Thread::current()->eventDispatcher();
>  
>  		Timer timer;
>  		timer.start(1000);
> diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp
> index f13ca53b8cdf..fd5292b7c8c9 100644
> --- a/test/camera/capture.cpp
> +++ b/test/camera/capture.cpp
> @@ -11,6 +11,8 @@
>  #include <libcamera/framebuffer_allocator.h>
>  #include <libcamera/timer.h>
>  
> +#include "libcamera/internal/thread.h"
> +
>  #include "camera_test.h"
>  #include "test.h"
>  
> @@ -131,7 +133,7 @@ protected:
>  			}
>  		}
>  
> -		EventDispatcher *dispatcher = cm_->eventDispatcher();
> +		EventDispatcher *dispatcher = Thread::current()->eventDispatcher();
>  
>  		Timer timer;
>  		timer.start(1000);
>
Niklas Söderlund Nov. 13, 2020, 10:23 a.m. UTC | #2
Hi Laurent,

Thanks for your patch.

On 2020-11-13 08:38:11 +0200, Laurent Pinchart wrote:
> Get the event dispatcher from the current thread instead of the camera
> manager. This prepares for the removal of
> CameraManager::eventDispatcher().
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  test/camera/buffer_import.cpp | 3 ++-
>  test/camera/capture.cpp       | 4 +++-
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/test/camera/buffer_import.cpp b/test/camera/buffer_import.cpp
> index 4b626dffa575..ccf532d7b7fc 100644
> --- a/test/camera/buffer_import.cpp
> +++ b/test/camera/buffer_import.cpp
> @@ -17,6 +17,7 @@
>  
>  #include "libcamera/internal/device_enumerator.h"
>  #include "libcamera/internal/media_device.h"
> +#include "libcamera/internal/thread.h"
>  #include "libcamera/internal/v4l2_videodevice.h"
>  
>  #include "buffer_source.h"
> @@ -131,7 +132,7 @@ protected:
>  			}
>  		}
>  
> -		EventDispatcher *dispatcher = cm_->eventDispatcher();
> +		EventDispatcher *dispatcher = Thread::current()->eventDispatcher();
>  
>  		Timer timer;
>  		timer.start(1000);
> diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp
> index f13ca53b8cdf..fd5292b7c8c9 100644
> --- a/test/camera/capture.cpp
> +++ b/test/camera/capture.cpp
> @@ -11,6 +11,8 @@
>  #include <libcamera/framebuffer_allocator.h>
>  #include <libcamera/timer.h>
>  
> +#include "libcamera/internal/thread.h"
> +
>  #include "camera_test.h"
>  #include "test.h"
>  
> @@ -131,7 +133,7 @@ protected:
>  			}
>  		}
>  
> -		EventDispatcher *dispatcher = cm_->eventDispatcher();
> +		EventDispatcher *dispatcher = Thread::current()->eventDispatcher();
>  
>  		Timer timer;
>  		timer.start(1000);
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch
diff mbox series

diff --git a/test/camera/buffer_import.cpp b/test/camera/buffer_import.cpp
index 4b626dffa575..ccf532d7b7fc 100644
--- a/test/camera/buffer_import.cpp
+++ b/test/camera/buffer_import.cpp
@@ -17,6 +17,7 @@ 
 
 #include "libcamera/internal/device_enumerator.h"
 #include "libcamera/internal/media_device.h"
+#include "libcamera/internal/thread.h"
 #include "libcamera/internal/v4l2_videodevice.h"
 
 #include "buffer_source.h"
@@ -131,7 +132,7 @@  protected:
 			}
 		}
 
-		EventDispatcher *dispatcher = cm_->eventDispatcher();
+		EventDispatcher *dispatcher = Thread::current()->eventDispatcher();
 
 		Timer timer;
 		timer.start(1000);
diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp
index f13ca53b8cdf..fd5292b7c8c9 100644
--- a/test/camera/capture.cpp
+++ b/test/camera/capture.cpp
@@ -11,6 +11,8 @@ 
 #include <libcamera/framebuffer_allocator.h>
 #include <libcamera/timer.h>
 
+#include "libcamera/internal/thread.h"
+
 #include "camera_test.h"
 #include "test.h"
 
@@ -131,7 +133,7 @@  protected:
 			}
 		}
 
-		EventDispatcher *dispatcher = cm_->eventDispatcher();
+		EventDispatcher *dispatcher = Thread::current()->eventDispatcher();
 
 		Timer timer;
 		timer.start(1000);