feat(drivers): account for the frame buffer virtual resolution deviating from the visible resolution. #5988
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.
The Linux frame buffer flush_cb method now accounts for the virtual resolution deviating from the visible resolution. The offset into the paint buffer is calculated based on the visible resolution, and the offset into the frame buffer is calculated using the line_length, i.e. stride. The x offset and y offset are only used to calculate the position into the frame buffer, not the position into the paint buffer.
Description of the feature or fix
On Linux devices where the virtual resolution of the frame buffer deviate from the visible resolution, the flush_cb method would fail. In such a configuration, the line_length (stride) differs from the xres of the device. The line_length was used to calculate the offset into the paint buffer, causing issues.
I've also made a change to how the xoffset and yoffset are used. I've removed usage of these parameters to calculate the offset into the paint buffer. xoffset was used, and is not anymore. yoffset wasn't used in the first place. Since these parameters are offsets of the visible resolution into the virtual resolution, they couldn't have been needed for the paint buffer. That being said, I wasn't able to test this as I'm not sure how to configure them using fbset.
I've tested this with different resolutions, and both the direct and partial rendering modes.
Notes
lv_conf_template.h
run lv_conf_internal_gen.py and update Kconfig.scripts/code-format.py
(astyle version v3.4.12 needs to be installed) and follow the Code Conventions.