BRT Community

General Category => Discussion - EVE => Topic started by: elektor18 on June 12, 2019, 09:35:22 AM

Title: BT815 loading two bitmap file at the same display list
Post by: elektor18 on June 12, 2019, 09:35:22 AM
Hi All,

I'm trying to load two converted png file from mcu flash but something is not right. How to know where to load next one image (display RAMG address) avoiding overwriting previous image?

Code: [Select]
     API_LIB_BeginCoProList();                                                   // Begin new co-processor list
    API_CMD_LOADIMAGE(StartAddress,0);                                          // Load image command. Extract data to RAM_G + 0, options = 0
    API_LIB_EndCoProList();                                                     // Finish the co-processor list
    API_LIB_WriteDataToCMD(EVE_PNG, sizeof(EVE_PNG));                           // Send data immediately after the command (since we don't select MEDIAFIFO as source in Options))
    API_LIB_AwaitCoProEmpty();                                                  // Await completion of the Load Image. Image will now be in RAM_G
 
        // ###### Check parameters of decompressed image ########
    API_LIB_BeginCoProList();                                                   // Begin co-pro list
    API_CMD_GETPROPS(0, 0, 0);                                                  // GetProps command with three dummy 32-bit values
    API_LIB_EndCoProList();                                                     // Finish the co-processor list
    API_LIB_AwaitCoProEmpty();                                                  // Await the command completion


This code is for one image. Shall I duplicate that for another one or there is different way of doing it? And should be StartAddress of second img?
Title: Re: BT815 loading two bitmap file at the same display list
Post by: BRT Community on June 13, 2019, 10:31:08 AM
Hello,

You can have a look at the example in section 7.3 of the following application note, this makes use of the GET_PROPS command which can be used to establish the starting point for the next image in RAM_G.
https://brtchip.com/wp-content/uploads/Support/Documentation/Application_Notes/ICs/EVE/BRT_AN_014_FT81X_Simple_PIC_Library_Examples.pdf (https://brtchip.com/wp-content/uploads/Support/Documentation/Application_Notes/ICs/EVE/BRT_AN_014_FT81X_Simple_PIC_Library_Examples.pdf)

Best Regards,
FTDI Community
Title: Re: BT815 loading two bitmap file at the same display list
Post by: elektor18 on June 20, 2019, 02:11:48 PM
Have you got maybe an example how to load more images/icons? I tried few ways but non worked. By example I mean steps how to do that, I'm not expecting ready code, that's not the point :)
Probably I'm missing something somewhere and I need guidance.
Title: Re: BT815 loading two bitmap file at the same display list
Post by: BRT Community on June 21, 2019, 10:45:31 AM
Hello,

The previously linked example is the example for loading PNG images, for your second image you would just repeat the process loading the next image into RAM_G and the location obtained from the GET_PROPS command.

Best Regards,
BRT Community
Title: Re: BT815 loading two bitmap file at the same display list
Post by: Rudolph on June 21, 2019, 04:34:39 PM
I'm trying to load two converted png file from mcu flash but something is not right. How to know where to load next one image (display RAMG address) avoiding overwriting previous image?

How can you not know the properties of the images that you converted to be loaded from flash? :-)

Loading some random image from a sd-card could be a challenge.
But even then you better make sure that they fit into the space you reserve for them before unpacking these to RAM_G.


this makes use of the GET_PROPS command

That is a good example for a function which is described not so good in the user-manual.
The C prototype "void cmd_getprops( uint32_t ptr, uint32_t width, uint32_t height);" implies that you are feeding
parameters into it, not that you can use it to retrieve parameters.
The way how this works and how the data could be acessed is described a little for cmd_getptr.
Title: Re: BT815 loading two bitmap file at the same display list
Post by: pauljiao on July 02, 2019, 10:26:24 AM
"cmd_loadimage" decodes PNG into various image formats based on the PNG image properties.  It might be in
Paletted4444, or L8 or RGB565.   So user may need use cmd_getprops to retrieve the decoded size to calculate the next available address.

To use cmd_getprops, please see the example in "cmd_regread". It is common practice to read the output parameter from EVE coprocessor buffer.
Title: Re: BT815 loading two bitmap file at the same display list
Post by: AT38 on July 17, 2019, 11:11:45 AM
CMD_GETPROPS is returning {0,0,0} for me.

CMD_LOADIMAGE completes successfully.

I've checked that I'm reading out correctly from the CMD buffer by including the command when reading out, and checking its value is correct.

The only error condition in the documentation is CMD_READ == 0xfff.
It says nothing about zero return params, so far as I can see.

Any clues what might be wrong?
Title: Re: BT815 loading two bitmap file at the same display list
Post by: pauljiao on August 01, 2019, 04:04:20 AM
Code: [Select]
uint16_t cmd_buff_write = Gpu_Hal_Rd16(g_phost, REG_CMD_WRITE); //Get the write pointer of command buffer
Gpu_CoCmd_GetProps(g_phost, 0, 0,0); //Send the command cmd_getprops
App_Flush_Co_Buffer(g_phost);     
Gpu_Hal_WaitCmdfifo_empty(g_phost);  //wait till the command is executed (cmd_read==cmd_write)

printf("write point of cmd is %d\n", cmd_buff_write);
printf("coCmd_GetProps = 0x%x\n", Gpu_Hal_Rd32(g_phost,   RAM_CMD + cmd_buff_write));
printf("coCmd_GetProps+4 = 0x%x\n", Gpu_Hal_Rd32(g_phost, RAM_CMD + cmd_buff_write+4));
printf("coCmd_GetProps+8 = 0x%x\n", Gpu_Hal_Rd32(g_phost, RAM_CMD + cmd_buff_write + 8));
printf("coCmd_GetProps+12 = 0x%x\n", Gpu_Hal_Rd32(g_phost,RAM_CMD + cmd_buff_write + 12));

Here is my code immediately following the cmd_loadimage. It works well and get the expected result.
Hope it is helpful.