AnsweredAssumed Answered

stm32f429 DMA2D copy to framebuffer with alpha blending

Question asked by passe.victor.001 on May 23, 2015
Hi, I have a framebuffer at addr "FB" and a image at addr "IM", I want to add the image to the framebuffer with alpha blending, eg, FB=FB+IM.
All images is in ARGB8888
I currenyly do this:
DMA2D_BG_InitTypeDef dma2d_bg_structure_init;
DMA2D_BG_StructInit(&dma2d_bg_structure_init);
dma2d_bg_structure_init.DMA2D_BGCM=CM_ARGB8888;
dma2d_bg_structure_init.DMA2D_BGCMAR=0;
dma2d_bg_structure_init.DMA2D_BGMA=FB;
dma2d_bg_structure_init.DMA2D_BGO=0;
dma2d_bg_structure_init.DMA2D_BGPFC_ALPHA_MODE=NO_MODIF_ALPHA_VALUE;
dma2d_bg_structure_init.DMA2D_BGPFC_ALPHA_VALUE=127;
DMA2D_BGConfig(&dma2d_bg_structure_init);
 
DMA2D_InitTypeDef dma2d_init_structure;
DMA2D_StructInit(&dma2d_init_structure);
dma2d_init_structure.DMA2D_Mode=DMA2D_M2M_BLEND;
dma2d_init_structure.DMA2D_CMode=DMA2D_ARGB8888;
dma2d_init_structure.DMA2D_NumberOfLine=image->height;
dma2d_init_structure.DMA2D_OutputMemoryAdd=FB;
dma2d_init_structure.DMA2D_OutputOffset=LCD_PIXEL_WIDTH-image->width;
dma2d_init_structure.DMA2D_PixelPerLine=image->width;
DMA2D_Init(&dma2d_init_structure);
 
DMA2D_FG_InitTypeDef dma2d_fg_structure_init;
DMA2D_FG_StructInit(&dma2d_fg_structure_init);
dma2d_fg_structure_init.DMA2D_FGCM=CM_ARGB8888;
dma2d_fg_structure_init.DMA2D_FGCMAR=0;
dma2d_fg_structure_init.DMA2D_FGMA=IM;
dma2d_fg_structure_init.DMA2D_FGO=0;
dma2d_fg_structure_init.DMA2D_FGPFC_ALPHA_MODE=REPLACE_ALPHA_VALUE;
dma2d_fg_structure_init.DMA2D_FGPFC_ALPHA_VALUE=127;
DMA2D_FGConfig(&dma2d_fg_structure_init);
 
DMA2D_StartTransfer();
while(!DMA2D_GetFlagStatus(DMA2D_FLAG_TC));
DMA2D_ClearFlag(DMA2D_FLAG_TC);
This does not work, I assume that the problem is that FB is both read and written to
I have tried several variants of settings, the settings above is probably incorrect.
Is it possible to do this and how to do it? 

Outcomes