Message ID | 20240820195016.16028-2-hdegoede@redhat.com |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
Hi, On 8/20/24 9:50 PM, Hans de Goede wrote: > PipelineHandler::acquire() only locks the media devices when the first > camera is acquired. If a second camera of a pipeline is acquired only > useCount_ is increased and nothing else is done. > > When releasing cameras PipelineHandler::release() should only unlock > the media devices when the last camera is released. But the old code > unlocked on every release(). > > Fix PipelineHandler::release() to only release the media devices when > the last camera is released. > > Signed-off-by: Hans de Goede <hdegoede@redhat.com> Note this is a resend of the standalone fix which I send out earlier since the rest of the series depends on this. The standalone posting already has a: Reviewed-by: Harvey Yang <chenghaoyang@chromium.org> which I forgot to add here. Regards, Hans > --- > src/libcamera/pipeline_handler.cpp | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp > index 5a6de685..a20cd27d 100644 > --- a/src/libcamera/pipeline_handler.cpp > +++ b/src/libcamera/pipeline_handler.cpp > @@ -205,7 +205,8 @@ void PipelineHandler::release(Camera *camera) > > ASSERT(useCount_); > > - unlockMediaDevices(); > + if (useCount_ == 1) > + unlockMediaDevices(); > > releaseDevice(camera); >
diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 5a6de685..a20cd27d 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -205,7 +205,8 @@ void PipelineHandler::release(Camera *camera) ASSERT(useCount_); - unlockMediaDevices(); + if (useCount_ == 1) + unlockMediaDevices(); releaseDevice(camera);
PipelineHandler::acquire() only locks the media devices when the first camera is acquired. If a second camera of a pipeline is acquired only useCount_ is increased and nothing else is done. When releasing cameras PipelineHandler::release() should only unlock the media devices when the last camera is released. But the old code unlocked on every release(). Fix PipelineHandler::release() to only release the media devices when the last camera is released. Signed-off-by: Hans de Goede <hdegoede@redhat.com> --- src/libcamera/pipeline_handler.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)