[X] I have checked latest main branch and the issue still exists.
[X] I did not see it is stated as known-issue in release notes.
[X] No similar GitHub issue is related to this change.
[X] My code follows the commit guidelines of this project.
[X] I have performed a self-review of my own code.
[X] My changes generate no new warnings.
[X] I have added tests that prove my fix is effective or that my feature works.
Describe the pull request
Currently, the camera framerate is divided by two. This is because the driver only puts the full buffer to the queue and calls the callback at half of the interrupt rate (when there are at least 2 active framebuffers).
On bare metal, this issue is not really visible when using more than 2 buffers and the application does not hold the full buffer for too long before submitting it again to the empty buffers queue. But if we use only 2 buffers, the framerate is clearly reduced (by a factor of two).
Especially, when CSI_TransferGetFullBuffer() get called inside the callback function (as in Zephyr RTOS), framerate is always reduced by a factor of two despite of the number of buffers used.
Rework the driver to fix these issues as well as to clean up the logics.
After the fix :
On i.MX RT1170 EVK and i.MX RT1064 EVK, with the csi rgb bare metal example, framerate is not changed if we use more than 2 buffers. However, if we use only 2 buffers, the fix gives the full framerate while the framerate is reduced by a half with the original code.
On Zephyr RTOS, framerate is always improved by 2 on both i.MX RT1064 EVK and i.MX RT1170 EVK.
Fixes # (187)
-->
Type of change
[x] Bug fix (non-breaking change which fixes an issue)
Tests
Test configuration (please complete the following information):
Hardware setting: i.MX RT1170 EVK + OV5640 camera and i.MX RT1064 EVK + MT9M114 camera
Toolchain:
Test Tool preparation: mipi_csi_rgb example on i.MX RT1170 EVK and csi_rgb565 example on i.MX RT1064 EVK
Any other dependencies:
Test executed
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
Prerequisites
Describe the pull request Currently, the camera framerate is divided by two. This is because the driver only puts the full buffer to the queue and calls the callback at half of the interrupt rate (when there are at least 2 active framebuffers).
On bare metal, this issue is not really visible when using more than 2 buffers and the application does not hold the full buffer for too long before submitting it again to the empty buffers queue. But if we use only 2 buffers, the framerate is clearly reduced (by a factor of two).
Especially, when CSI_TransferGetFullBuffer() get called inside the callback function (as in Zephyr RTOS), framerate is always reduced by a factor of two despite of the number of buffers used.
Rework the driver to fix these issues as well as to clean up the logics.
After the fix : On i.MX RT1170 EVK and i.MX RT1064 EVK, with the csi rgb bare metal example, framerate is not changed if we use more than 2 buffers. However, if we use only 2 buffers, the fix gives the full framerate while the framerate is reduced by a half with the original code.
On Zephyr RTOS, framerate is always improved by 2 on both i.MX RT1064 EVK and i.MX RT1170 EVK.
Fixes # (187) -->
Type of change
Tests