Description
I want to improve the display speed, so I opened the GPU, I consulted lv_port_stm32f746_disco_sw4stm32 engineering.
After enabling the GPU, demo showed abnormal, but do not use GPU, can display properly.
What MCU/Processor/Board and compiler are you using?
Processor is stm32h743iit6, this is my homemade board.
What do you want to achieve?
I want to improve the display speed
What have you tried so far?
Code to reproduce
static void lv_gpu_dma2d_config(void)
{
/* Configure the DMA2D Mode, Color Mode and output offset */
DMA2D_Handle.Init.Mode = DMA2D_M2M_BLEND;
#if LV_COLOR_DEPTH == 16
DMA2D_Handle.Init.ColorMode = DMA2D_OUTPUT_RGB565;
#elif LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
DMA2D_Handle.Init.ColorMode = LTDC_PIXEL_FORMAT_ARGB8888;
#endif
DMA2D_Handle.Init.OutputOffset = 0;
DMA2D_Handle.Init.RedBlueSwap = DMA2D_RB_REGULAR;
DMA2D_Handle.Init.AlphaInverted = DMA2D_REGULAR_ALPHA;
/* DMA2D Callbacks Configuration */
DMA2D_Handle.XferCpltCallback = DMA2D_TransferComplete;
DMA2D_Handle.XferErrorCallback = DMA2D_TransferError;
/* Foreground Configuration */
DMA2D_Handle.LayerCfg[1].AlphaMode = DMA2D_REPLACE_ALPHA;
DMA2D_Handle.LayerCfg[1].InputAlpha = 0;
DMA2D_Handle.LayerCfg[1].AlphaInverted = DMA2D_REGULAR_ALPHA;
DMA2D_Handle.LayerCfg[1].RedBlueSwap = DMA2D_RB_REGULAR;
#if LV_COLOR_DEPTH == 16
DMA2D_Handle.LayerCfg[1].InputColorMode = DMA2D_INPUT_RGB565;
#elif LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
DMA2D_Handle.LayerCfg[1].InputColorMode = DMA2D_INPUT_ARGB8888;
#endif
DMA2D_Handle.LayerCfg[1].InputOffset = 0x0;
/* Background Configuration */
DMA2D_Handle.LayerCfg[0].AlphaMode = DMA2D_REPLACE_ALPHA;
DMA2D_Handle.LayerCfg[0].InputAlpha = 0;
DMA2D_Handle.LayerCfg[0].AlphaInverted = DMA2D_REGULAR_ALPHA;
DMA2D_Handle.LayerCfg[0].RedBlueSwap = DMA2D_RB_REGULAR;
#if LV_COLOR_DEPTH == 16
DMA2D_Handle.LayerCfg[0].InputColorMode = DMA2D_INPUT_RGB565;
#elif LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
DMA2D_Handle.LayerCfg[0].InputColorMode = DMA2D_INPUT_ARGB8888;
#endif
DMA2D_Handle.LayerCfg[0].InputOffset = 0x0;
DMA2D_Handle.Instance = DMA2D;
/* DMA2D Initialization */
if(HAL_DMA2D_Init(&DMA2D_Handle) != HAL_OK)
{
/* Initialization Error */
Error_Handler(__FILE__, __LINE__);
}
HAL_DMA2D_ConfigLayer(&DMA2D_Handle, 0);
HAL_DMA2D_ConfigLayer(&DMA2D_Handle, 1);
}
static void gpu_mem_blend(lv_disp_drv_t *disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa)
{
/*Wait for the previous operation*/
HAL_DMA2D_PollForTransfer(&DMA2D_Handle, 100);
DMA2D_Handle.Init.Mode = DMA2D_M2M_BLEND;
/* DMA2D Initialization */
if(HAL_DMA2D_Init(&DMA2D_Handle) != HAL_OK)
{
/* Initialization Error */
while(1);
}
DMA2D_Handle.LayerCfg[1].InputAlpha = opa;
HAL_DMA2D_ConfigLayer(&DMA2D_Handle, 1);
HAL_DMA2D_BlendingStart(&DMA2D_Handle, (uint32_t) src, (uint32_t) dest, (uint32_t)dest, length, 1);
}
static void gpu_mem_fill(lv_disp_drv_t *disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width,
const lv_area_t * fill_area, lv_color_t color)
{
/*Wait for the previous operation*/
HAL_DMA2D_PollForTransfer(&DMA2D_Handle, 100);
DMA2D_Handle.Init.Mode = DMA2D_R2M;
/* DMA2D Initialization */
if(HAL_DMA2D_Init(&DMA2D_Handle) != HAL_OK)
{
/* Initialization Error */
while(1);
}
DMA2D_Handle.LayerCfg[1].InputAlpha = 0xff;
HAL_DMA2D_ConfigLayer(&DMA2D_Handle, 1);
lv_color_t * dest_buf_ofs = dest_buf;
dest_buf_ofs += dest_width * fill_area->y1;
dest_buf_ofs += fill_area->x1;
lv_coord_t area_w = lv_area_get_width(fill_area);
uint32_t i;
for(i = fill_area->y1; i <= fill_area->y2; i++) {
/*Wait for the previous operation*/
HAL_DMA2D_PollForTransfer(&DMA2D_Handle, 100);
HAL_DMA2D_BlendingStart(&DMA2D_Handle, (uint32_t) lv_color_to32(color), (uint32_t) dest_buf_ofs, (uint32_t)dest_buf_ofs, area_w, 1);
dest_buf_ofs += dest_width;
}
}
Screenshot and/or video
Could you tell me this how to solve