rework psram_mode frame buffer overflow check #781
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Follow-Up for PR #772
Rationale:
In psram_mode we will be called after each memory copy operation is completed, by the CAM_IN_SUC_EOF event. Since we cannot predict at this point, if the camera will copy another dma_half_buffer_size into the fb, we need to abort here, if there's not enough size in the fb for the next copy operation.
This assumption means, we will abort even if this is indeed the last copy operation the camera did, and the next event will be a CAM_VSYNC, notifying us, that the copy operation is completed.
Since we cannot predict this, we need one dma_half_buffer_size more space in the fb in psram_mode to allow images of the same size in psram_mode as in the regular mode.
Related:
Fixes espressif/arduino-esp32#11674
Fixes the same issue observed on jpeg images here
Checklist
Before submitting a Pull Request, please ensure the following: