Gpu_mem_xxx_cp() functions

Sorry, my bad. You have to use a style:

        static lv_style_t img_style; /* must not be allocated on stack */
        lv_style_copy(&img_style, lv_obj_get_style(img2));
        img_style.image.opa = LV_OPA_20;
        lv_obj_set_style(img2, &img_style);

transparency is working now by using STYLE ! but this is not my really goal …
I want that the second image which is png format , take the bottom image color as a background color !
I don’t know how littlevGL manage this case ! (that’s why I think that DMA2D blending solve this issue)

Can you describe this with a picture made by GIMP or a similar tool? I don’t really understand what you’re trying to do.

You need to call lv_obj_set_opa_scale_enable(img1, true) too. I’ve updateed the comemnt of lv_obj_opa_scale to make it clearer:


/**
 * Set the opa scale of an object.
 * The opacity of this object and all it's children will be scaled down with this factor.
 * `lv_obj_set_opa_scale_enable(obj, true)` needs to be called to enable it.
 * (not for all children just for the parent where to start the opa scaling)
 * @param obj pointer to an object
 * @param opa_scale a factor to scale down opacity [0..255]
 */
void lv_obj_set_opa_scale(lv_obj_t * obj, lv_opa_t opa_scale);

For images gpu_blend_cb is called only here:

You can debug here and see why this branch is not used in your case.

I don’t understand. The color of the image as background? Which color?
Do you mean there are transparent pixels in the top image? If you just convert the image with “True color with alpha” color format.

It’s simply working with converting second image in True color with alpha !

Dma2d treats output buffer as contignous memory with lines one after another… so filling is line by line is done.

I see, thank you for the confirmation.

Hi @embeddedt , I implemented the two functions gpu_mem_fill() and gpu_mem_blend() from F746 driver (using DMA2D) …
this is the result that I had:


What can cause this issue of display?

Check that you are using the same LV_COLOR_DEPTH as the F746 example project.

color_deth used is 32

Try with 16, which is what the F746 project uses.

Same issue !
I will try to add lv_color_depth conditions in DMA2D initialisation ColorMode and layercfg InputColorMode parameters … may be this solve the issue.

I added some Input conditions like this :

    static void my_mem_blend_cb(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(&hdma2d_discovery, 100);
        hdma2d_discovery.Init.Mode         = DMA2D_M2M_BLEND;
    #if LV_COLOR_DEPTH == 8
        hdma2d_discovery.Init.ColorMode = DMA2D_INPUT_A8;
    #elif LV_COLOR_DEPTH == 16
        hdma2d_discovery.Init.ColorMode = DMA2D_INPUT_RGB565;
    #elif LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
        hdma2d_discovery.Init.ColorMode = DMA2D_INPUT_ARGB8888;
    #endif
    			/* DMA2D Initialization */
        if(HAL_DMA2D_Init(&hdma2d_discovery) != HAL_OK)
    	{
    	/* Initialization Error */
    	  while(1);
    	}
        hdma2d_discovery.LayerCfg[1].InputAlpha = 0xff;
    #if LV_COLOR_DEPTH == 8
        hdma2d_discovery.LayerCfg[1].InputColorMode = DMA2D_INPUT_A8;
    #elif LV_COLOR_DEPTH == 16
        hdma2d_discovery.LayerCfg[1].InputColorMode = DMA2D_INPUT_RGB565;
    #elif LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
        hdma2d_discovery.LayerCfg[1].InputColorMode = DMA2D_INPUT_ARGB8888;
    #endif
        hdma2d_discovery.LayerCfg[1].InputOffset = 0x0;
    	hdma2d_discovery.LayerCfg[1].RedBlueSwap = DMA2D_RB_REGULAR;
    	hdma2d_discovery.LayerCfg[1].AlphaInverted = DMA2D_REGULAR_ALPHA;

    	//   Background Configuration
    	hdma2d_discovery.LayerCfg[0].AlphaMode = DMA2D_REGULAR_ALPHA;
    	hdma2d_discovery.LayerCfg[0].InputAlpha = 0x0;
    #if LV_COLOR_DEPTH == 8
        hdma2d_discovery.LayerCfg[0].InputColorMode = DMA2D_INPUT_A8;
    #elif LV_COLOR_DEPTH == 16
        hdma2d_discovery.LayerCfg[0].InputColorMode = DMA2D_INPUT_RGB565;
    #elif LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
        hdma2d_discovery.LayerCfg[0].InputColorMode = DMA2D_INPUT_ARGB8888;
    #endif
    	hdma2d_discovery.LayerCfg[0].InputOffset = 0x0;

    	HAL_DMA2D_ConfigLayer(&hdma2d_discovery, 0);
    	HAL_DMA2D_ConfigLayer(&hdma2d_discovery, 1);
    	HAL_DMA2D_BlendingStart_IT(&hdma2d_discovery, (uint32_t) src, (uint32_t) dest, (uint32_t)dest, length, 1);
    }
    static void my_mem_fill_cb(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(&hdma2d_discovery, 100);
    	hdma2d_discovery.Init.Mode         = DMA2D_R2M;
    #if LV_COLOR_DEPTH == 8
    hdma2d_discovery.Init.ColorMode = DMA2D_INPUT_A8;
    #elif LV_COLOR_DEPTH == 16
    hdma2d_discovery.Init.ColorMode = DMA2D_INPUT_RGB565;
    #elif LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
    hdma2d_discovery.Init.ColorMode = DMA2D_INPUT_ARGB8888;
    #endif
    	/* DMA2D Initialization */
    if(HAL_DMA2D_Init(&hdma2d_discovery) != HAL_OK)
    	   {
    	     /* Initialization Error */
    	     while(1);
    	   }

    hdma2d_discovery.LayerCfg[1].InputAlpha = 0xff;
    #if LV_COLOR_DEPTH == 8
    hdma2d_discovery.LayerCfg[1].InputColorMode = DMA2D_INPUT_A8;
    #elif LV_COLOR_DEPTH == 16
    hdma2d_discovery.LayerCfg[1].InputColorMode = DMA2D_INPUT_RGB565;
    #elif LV_COLOR_DEPTH == 24 || LV_COLOR_DEPTH == 32
    hdma2d_discovery.LayerCfg[1].InputColorMode = DMA2D_INPUT_ARGB8888;
    #endif
    HAL_DMA2D_ConfigLayer(&hdma2d_discovery, 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(&hdma2d_discovery, 100);
    	HAL_DMA2D_BlendingStart(&hdma2d_discovery, (uint32_t) lv_color_to32(color), (uint32_t) dest_buf_ofs, (uint32_t)dest_buf_ofs, area_w, 1);
    	dest_buf_ofs += dest_width;

    	}
    }

So the issue does not seems from color_depth !