Hi all,
I have a question about drawing in GUI tasks.
I am using Renesas Starter Kit+ for RZ/A1M, Guiliani Version: 2.2.5336.
There are multiple tasks with time sharing enabled, and I am drawing the GUI on layer 2 with the GUI task, but when I repeat touch operations,The screen display may become abnormal.I have confirmed that this does not occur when the GUI task is given the highest priority, but it occurs when all tasks are given the same priority.Judging from what I have confirmed, I believe that while drawing with a GUI task, if a task switch occurs and the processing shifts to another task, the screen display becomes abnormal. Is this correct?If this is correct, I would appreciate it if you could tell me how to deal with it.
Best Regards
Hello Mochi,
Yes, it is possible that the screen displays abnormal artifacts if a task switch occurs during the update of the display.
Please be aware, concurrent access to hardware resources like the display can lead to unexpected behaviour.
The buffer flip (done by function "R_RVAPI_GraphChangeSurfaceVDC") is not threadsafe.
Therefore, concurrent access is possible when accessing e.g. hardware registers also needed by the flip.
If giving the GUI task the highest priority works for you, use this option.
If not guard the access to the display hardware (e.g. all functions with VDC) for example with semaphores.
The buffer flip done by Guiliani happens in the function "GrpDrv_SetFrameBuffer" within the file Common/Source/Platform/FreeRTOS/StreamRuntime_GreaphicRZA.cpp.
Best regards
Guiliani Support
Hello Guiliani Support,
Only the GUI task (prvGuilianiTask) has access to functions that use VDC.
("prvGuilianiTask" in the file Source/Platform/FreeRTOS/StreamRuntime_FreeRTOS10_main.c)
Also, the function "R_RVAPI_GraphChangeSurfaceVDC" is only called within the function "GrpDrv_SetFrameBuffer" and there is no other access to the framebuffer.
Therefore, there is no possibility of simultaneous accesses to hardware registers, etc.
I believe that if a task switch occurs while the GUI task is redrawing the frame buffer, the screen display will become abnormal.
I would appreciate it if you could tell me how to deal with this other than setting the GUI task to the highest priority.
unfortunately it seems that your problem is very unique and we do not have enough information to do a deep analysis.
Since your Guiliani version is over five years old, it is not supported anymore and we would encourage you to update to the latest version.
As a last recommendation you should guard the flip of the framebuffers in function "GrpDrv_SetFramebuffer".
By using the macros taskENTER_CRITICAL / taskEXIT_CRITICAL you can stop FreeRTOS from switching to other tasks until the critical section is left.
It should like this:
---
/* Set / switch framebuffer */
void* GrpDrv_SetFrameBuffer(void* ptr, unsigned long uiWidth, unsigned long uiHeight) {
if (draw_buffer_index == 1) {
draw_buffer_index = 0;
} else {
draw_buffer_index = 1;
}
--->taskENTER_CRITICAL();
#if defined(PLATFORM_RENESAS_DISPLAYIT_V2) ||
defined(PLATFORM_RENESAS_GRPEACH)
v7_flush_kern_dcache_area((void*)framebuffer[draw_buffer_index],
FRAMEBUFFER_STRIDE * FRAMEBUFFER_HEIGHT); #endif
vdc_error_t error = R_RVAPI_GraphChangeSurfaceVDC(VDC_CHANNEL_0,
VDC_LAYER_ID_0_RD, (void*)framebuffer[draw_buffer_index]);
if (VDC_OK == error)
{
Wait_Vsync(1);
--->taskEXIT_CRITICAL();
return (void*)framebuffer[draw_buffer_index];
For further support on Guiliani you will need a seperate support-contract, please write an email to guiliani_support(at)tes-dst(dot)com
Thank you for the support. Try to update to the latest version.
I have updated to the latest version(Guiliani Ver2.6), but the problem has not been resolved.
Will a separate support contract be required for problem investigation even in the latest version?
If a support contract is necessary, will it be chargeable or free of charge?
Hello Mochi,Yes, a support contact will be necessary nonetheless.Please contact guiliani_support(at)tes-dst(dot)com for further questions regarding the support contract.Best regardsGuiliani Support