-
Notifications
You must be signed in to change notification settings - Fork 7.3k
drivers: display: stm32_ltdc: Add SMH attribute for LTDC buffer. #89246
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
drivers: display: stm32_ltdc: Add SMH attribute for LTDC buffer. #89246
Conversation
The LTDC driver was using the video buffer SMH attribute. Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
23308ff
to
bac84bb
Compare
@@ -56,6 +56,17 @@ config STM32_LTDC_FB_NUM | |||
config STM32_LTDC_FB_USE_SHARED_MULTI_HEAP | |||
bool "Use shared multi heap for the display buffer" | |||
|
|||
config STM32_LTDC_FB_SMH_ATTRIBUTE |
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.
Why not create a generic symbol in drivers/display/Kconfig instead?
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.
Because no other display drivers use SMH as far as I know.
This allows all samples to work out of the box without requiring SMH initialization. If DCMI (video) is used simultaneously and more video buffers are needed, the application should enable SMH for both the video and display subsystems and initialize it. Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
Fix the board name. Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
bac84bb
to
9cdd596
Compare
Maybe I missed something but in order to be able to use the SHARED_MULTI_HEAP, I would expect this to be first initialized via the function shared_multi_heap_pool_init and then an area added via the call to the function shared_multi_heap_add. Only then shared_multi_heap_aligned_alloc call would be done. |
Discussion ongoing on #89233 seems to highlight that actually this doesn't work with SHM enabled, is that right ? |
Considering that finally the SHM usage is disabled, if it is not functionnal (to be confirmed), maybe the addition of the new option to mention the attribute is not really needed, at least for the time being. |
Indeed. |
No, the LTDC driver definitely works with SMH, and we already use it in the Arduino core to share SDRAM with the video subsystem. The attribute is needed to control the display’s SMH allocations and to decouple it from the video’s SMH attribute (in fact, I believe using the video’s SMH attribute here was a copy&paste mistake). The reason SMH isn’t enabled for the display by default is that it really depends on the application. If the user app uses video with SMH (to support more, bigger, buffers) , it definitely needs to enable SMH for both display too, otherwise, LTDC will just grab a chunk of SDRAM that could overlap with the heap. As for SMH initialization, I believe it can be handled in the user app. Alternatively, we could add the initialization code to |
Thanks for the clarification. So are you saying that currently even without initialization (aka calls to the shared_multi_heap_pool_init and shared_multi_heap_add) done prior to start actually using SMH (either from LTDC or DCMI), this is working ? Indeed, performing initialization within the board code sounds like a good place. Knowing where we intend to make memory accessible via SMH is really board specific. As a side note, while currently LTDC / DCMI (more generally video FW) are based on SMH usage, I am actually considering addition of the memory attribute heap API usage, I tend to find it more flexible than SMH since this is based on memory-attribute done in the DT. But that's another topic for which I will post a PR. |
No, currently, if you enable SMH you need to initialize it in your app. For example, we do so in the Arduino core: if you build an Arduino sketch for Zephyr, that uses display and/or video, the SMH gets initialized.
I can add this code to |
Ok that make sense then.
Ok thank you, and yes it should be kept disabled by default considering that most of boards do not initialize the SMH as it wouldn't work anymore. |
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.
The shield name seems to be wrong. The shield looks to be named "giga_display_shield" and not "arduino_giga_display_shield"?
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 for the comment, but this is unrelated to the content of this PR. Feel free to raise a dedicated issue so this can be discussed and not "defocus" discussions on current PR.
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 am sorry. I do not mean to defocus anything. The contributor said it fixes #89233 as well in one comment above. So I incorrectly assumed he was trying to fix that as well which is why I added the comment. Thank you for your correction. Maybe the contributor can update his comment to say it addresses portions of that issue?
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 fixed the board's name, but in the case of the shield, I believe the documentation is correct: the shield should be called arduino_giga_display_shield, not only to match the board's naming convention, but also because other vendors use similar patterns. I can rename the file in this PR or in a separate one, either way works for me.
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.
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.
@erwango my original bug report also highlighted the problem with the shield name in the example command line as @moosery is indicating.
I just checked and @iabdalkader addressed this by changing the name of the shield overlay file so now the reference command line does build correctly.
Rename shield to arduino_giga_display_shield.overlay to match the shield and board naming conventions. Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
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.
sample command line now builds correctly, which was the original issue I submitted. I'll let others with actual hardware confirm that it works.
Add a config option for the LTDC FB SMH attribute, and fix/update the board config.
Fixes #89233.