Ok, that this is supposed to actually display an Image surprised me:
Gpu_CoCmd_LoadImage(phost, 0, OPT_FLASH );
//Start drawing bitmap
App_WrCoCmd_Buffer(phost, BEGIN(BITMAPS));
App_WrCoCmd_Buffer(phost, VERTEX2II(0, 0, 0, 0));
App_WrCoCmd_Buffer(phost, END());
This made me wonder if Riverdi implemented the command with some extra lines.
But I found this in the BRT_AN_033_BT81X_Series_Programming_Guide V2.4:
cmd_loadimage(0, 0);
... // JPEG file data follows
cmd(BEGIN(BITMAPS));
cmd(VERTEX2II(10, 20, 0, 0)); // draw bitmap at (10,20)
cmd(VERTEX2II(100, 20, 0, 0));
This suggests that this is somehow supposed to work like this.
Next I did this in EVE Screen Editor:
CLEAR(1, 1, 1)
CMD_LOADIMAGE(0, 0, "someimage.png")
BEGIN(BITMAPS)
VERTEX2F(0)
END
And ESE was indeed displaying the image.
The generated display list is:
Offset
(decimal) Raw Text
0 0x26000007 CLEAR(1, 1, 1)
1 0x01000000 BITMAP_SOURCE(0)
2 0x28000000 BITMAP_LAYOUT_H(0, 0)
3 0x07310040 BITMAP_LAYOUT(ARGB4, 128, 64)
4 0x29000000 BITMAP_SIZE_H(0, 0)
5 0x08008040 BITMAP_SIZE(NEAREST, BORDER, BORDER, 64, 64)
6 0x1f000001 BEGIN(BITMAPS)
7 0x40000000 VERTEX2F(0, 0)
8 0x21000000 END()
9 0x00000000 DISPLAY()
Wait a second, CMD_LOADIMAGE is not supposed to have that effect.
But at least in ESE this works for FT81x, BT81x and BT88x.
I downloaded the sources from
https://github.com/riverdi/riverdi-eve/tree/master and CoPro_Cmds.c has the implementation:
void Gpu_CoCmd_LoadImage(Gpu_Hal_Context_t *phost,uint32_t ptr, uint32_t options)
{
Gpu_CoCmd_StartFunc(phost,CMD_SIZE*3);
Gpu_Copro_SendCmd(phost, CMD_LOADIMAGE);
Gpu_Copro_SendCmd(phost, ptr);
Gpu_Copro_SendCmd(phost, options);
Gpu_CoCmd_EndFunc(phost,(CMD_SIZE*3));
}
Nothing extra, just the command.
But somehow this still displays images? How?
So I tried to reproduce this on a display with BT817 with my library.
And I can not reprocuce this behaviour.
REG_CMD_DL does not change when I am issuing a CMD_LOADIMAGE.
And reading 20 bytes anyways from where REG_CMD_DL is pointing does not return BITMAP_SOURCE and so on.
Manually writing a different offset to REG_CMD_DL and reading it back afterwards shows no change either.
My last test code is this:
EVE_memWrite16(REG_CMD_DL, 0);
EVE_cmd_dl(0xdeadbeef);
EVE_cmd_loadimage(MEM_PIC1, EVE_OPT_NODL, pic, sizeof(pic));
EVE_cmd_dl(0xcafecafe);
EVE_execute_cmd();
for(uint8_t index = 0; index < 5; index++)
{
array_test[index] = EVE_memRead32(EVE_RAM_DL + (4 * index));
}
array_test[5] = EVE_memRead16(REG_CMD_DL);
The EVE_cmd_loadimage() is working just fine, that image is loaded into memory and displayed with my regular display list.
But displaying the values from the array on screen only shows this:
DEADBEEF
CAFECAFE
30000000
30000000
27000000
8
And seeing that there is nothing in the CMD_LOADIMAGE doku that suggests that display list commands are generated, this result is to be expected.
What is going on then with ESE and especially the Riverdi / Bridgtek library?