-
Notifications
You must be signed in to change notification settings - Fork 8.1k
video: stm32_dcmi: Snapshot mode #98004
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
800dfe7 to
46bf294
Compare
|
Update: I added 2nd mode to snapshot to experiment with starting and stopping the video streams along with Wondering if it might help or hurt on startup speed. That is in Snapshot mode: Also was wondering if it might help reduce tearing when it gets an error. So far It looks like I at times it still Note: I have not yet adding the stop/start in the DMA recovery code will try that as well. Also wondering if maybe something with the DMA buffer should be cleared when error happens. |
Add the ability to run cameras in a logical snapshot mode instead of always running in video mode. In particular, the camera starts when you ask for an image to be dequeued and stops when it receives an image. There are three ways to setup to run in this mode: a) define a max of 1 buffer: CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=1 b) Tell it to do so in the overlay by giving the DCMI object the property: snapshot-mode c) At run time: I added a video control: VIDEO_CID_SNAPSHOT_MODE Which can have the values 0 - normal, 1 - snapshot As mentioned in snapshot mode, the HAL DMA is stopped after each image and restarted when the user asks for another image. I added a timeout default to 1 second, that handles the case where sometimes the HAL is silently not successful in retrieving an image. Signed-off-by: Kurt Eckhardt <[email protected]>
8ab99bc to
8a69c9e
Compare
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.
Mainly minor comments.
drivers/video/video_stm32_dcmi.c
Outdated
| struct dma_config cfg; | ||
| }; | ||
|
|
||
|
|
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.
Could you remove this extra empty line?
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.
done
drivers/video/video_stm32_dcmi.c
Outdated
| return 0; | ||
| } | ||
| data->vbuf = k_fifo_get(&data->fifo_in, K_NO_WAIT); | ||
| LOG_DBG("\tcamera buf: %p\n", data->vbuf); |
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.
Heading tab \t expected?
drivers/video/video_stm32_dcmi.c
Outdated
| return video_init_ctrl(&ctrls->snapshot, dev, VIDEO_CID_SNAPSHOT_MODE, | ||
| (struct video_ctrl_range){.min = 0, .max = 1, .step = 1, | ||
| .def = data->snapshot_mode ? 1 : 0}); |
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.
Requires an extra indentation space char:
| return video_init_ctrl(&ctrls->snapshot, dev, VIDEO_CID_SNAPSHOT_MODE, | |
| (struct video_ctrl_range){.min = 0, .max = 1, .step = 1, | |
| .def = data->snapshot_mode ? 1 : 0}); | |
| return video_init_ctrl(&ctrls->snapshot, dev, VIDEO_CID_SNAPSHOT_MODE, | |
| (struct video_ctrl_range){.min = 0, .max = 1, .step = 1, | |
| .def = data->snapshot_mode ? 1 : 0}); |
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.
done
Experimenting with the optional snapshot_mode=2 With this it calls off to stop the video stream after each frame is returned and restarts it when you ask for a new frame. Testing to see if it helps or hurts the throughput speed. Also testing if it helps/hurts with image tearing after DMA errors. Signed-off-by: Kurt Eckhardt <[email protected]>
8a69c9e to
d5e9c29
Compare
|



Add the ability to run cameras in a logical
snapshot mode instead of always running
in video mode. In particular, the camera
starts when you ask for an image to be dequeued
and stops when it receives an image.
There are three ways to setup to run in this mode:
a) define a max of 1 buffer:
CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=1
b) Tell it to do so in the overlay by giving the DCMI object the property: snapshot-mode
c) At run time: I added a video control: VIDEO_CID_SNAPSHOT_MODE Which can have the values 0 - normal, 1 - snapshot
As mentioned in snapshot mode, the HAL DMA is stopped after each image and restarted when the user asks for another image. I added a timeout default to 1 second, that handles the case where sometimes the HAL is silently not successful in retrieving an image.
Note: This is the second half of what used to be #93797