-
Notifications
You must be signed in to change notification settings - Fork 8k
drivers: video: stm32_dcmipp: Initialize ISP only once #96799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@ABESTM CI failed due to a SonarCloud issue, nothing related to your PR, but I'm not able to launch it again. Would you mind rebasing your PR to hopefully get it right next time ? |
I have tested the patch with a modified video capture example (can not attach here) - which does change the zoom level every second - and it does work well. |
62636ce
to
777cf30
Compare
drivers/video/video_stm32_dcmipp.c
Outdated
* initiialized | ||
*/ | ||
if (atomic_cas(&isp_init_once, 0, 1) && | ||
if (atomic_cas(&pipe->isp_init_once, 0, 1) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that mean caller for this function may return with success while another thread has still not yet completed the pipe initialization through stm32_dcmipp_stream_enable()
? Maybe a mutex would be preferable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, this could be a problem, and I will rewrite this.
There is already a mutex on the pipe I can probably reuse. Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ABESTM for this fix.
This isp initialization has to be done only once for the whole device instead of once per pipe, so I think it should be held within the struct stm32_dcmipp_data instead of within the pipe structure in order to avoid having it initialized everytime a pipe is used (in a multi-pipe use case).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the mutex part.
I noticed that in stm32_dcmipp_get_fmt
the stm32_dcmipp_isp_init
is called only for DCMIPP_PIPE1
and DCMIPP_PIPE2
, but in stm32_dcmipp_stream_enable
it is called always.
Maybe in the stm32_dcmipp_stream_enable
it should be also called only for DCMIPP_PIPE1
and DCMIPP_PIPE2
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes indeed, it might better be part of the previous if statement right after the set_yuv_conversion.
However in fact, considering that the isp_init is done within the get_fmt function, I am no more sure it is really necessary within the stream_enable function. In most / all (current) cases, it will never do anything in fact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the optimal solution would be to call it inside stm32_dcmipp_init
, but this would require that the camera sensor (config->source_dev
) is initialized before. This way we could get rid of the mutex.
This would probably require defining additional priority level in Kconfig.
777cf30
to
ca7d9e1
Compare
ca7d9e1
to
80a1426
Compare
I reworked the PR, to initialized ISP during dcmipp initialization. This is similar approach to what is done in |
This fixes bug where stm32_dcmipp_isp_init is called multiple times. Signed-off-by: Adam BERLINGER <[email protected]>
80a1426
to
09be14d
Compare
|
This fixes bug where stm32_dcmipp_isp_init is called multiple times.