1
Discussion - EVE / Image corruption
« on: June 23, 2020, 08:36:57 AM »
Hi,
I wrote a small application for tests of an EVE-controlled screen. The result was not too bad till I added a splash screen as a JPEG image. Afterwards all the icons just changed to garbage.
I'm doing something wrong !
Here is the canvas :
1°/ Load the JPEG image for the splash screen
2°/ Display the JPEG image
3°/ Load the icon (compressed ARGB2 image):
4°/ Display the icon:
If the step 2 (display splash) is not executed, the icon is correctly display. If displayed, the icon is changed into garbage.
Could someone explain this behaviour ?
Thanks in advance.
Regards.
I wrote a small application for tests of an EVE-controlled screen. The result was not too bad till I added a splash screen as a JPEG image. Afterwards all the icons just changed to garbage.
I'm doing something wrong !
Here is the canvas :
1°/ Load the JPEG image for the splash screen
Code: [Select]
uint16_t sentSize = 0u, len;
const uint16_t MaxLen = 512u;
cmdOffset = ft_wait4CoproReady()
ft_write32( RAM_CMD + cmdOffset, CMD_LOADIMAGE );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, RAM_G );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, OPT_NODL );
ft_incCmdOffset( 4u );
while ( sentSize < splash.data_size )
{
len = splash.data_size - sentSize;
if ( len > MaxLen ) len = MaxLen;
/* Wait for space to write the next chunk */
while ( !ft_checkFreeSpaceInFifo( len ) );
ft_writeMem( RAM_CMD + cmdOffset, &splash.data[sentSize], len );
ft_incCmdOffset( len );
sentSize += len;
ft_write16( REG_CMD_WRITE, cmdOffset );
}
2°/ Display the JPEG image
Code: [Select]
cmdOffset = ft_wait4CoproReady()
ft_write32( RAM_CMD + cmdOffset, CMD_DLSTART );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, SAVE_CONTEXT() );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, CMD_SETBITMAP );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, RAM_G );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset,
(((uint32_t) splash.width << 16) | ((uint32_t) RGB565 & 0xFFFFU)) );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, (uint32_t) splash.height );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, BEGIN(BITMAPS) );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, VERTEX2II(0, 0, 0, 0) );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, END() );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, RESTORE_CONTEXT() );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, DISPLAY() );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, CMD_SWAP );
ft_incCmdOffset( 4u );
ft_write16( REG_CMD_WRITE, cmdOffset );
3°/ Load the icon (compressed ARGB2 image):
Code: [Select]
address = RAM_G + ( (uint32_t) splash.width * (uint32_t) splash.height * 2U );
cmdOffset = ft_wait4CoproReady()
ft_write32( RAM_CMD + cmdOffset, CMD_INFLATE );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, address );
ft_incCmdOffset( 4u );
while ( sentSize < icon.data_size )
{
len = icon.data_size - sentSize;
if ( len > MaxLen ) len = MaxLen;
/* Wait for space to write the next chunk */
while ( !ft_checkFreeSpaceInFifo( len ) );
ft_writeMem( RAM_CMD + cmdOffset, &icon.data[sentSize], len );
ft_incCmdOffset( len );
sentSize += len;
ft_write16( REG_CMD_WRITE, cmdOffset );
}
ft_wait4CoproReady();
ft_write32( RAM_CMD + cmdOffset, CMD_GETPTR );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, 0U );
ft_incCmdOffset( 4u );
ft_write16( REG_CMD_WRITE, cmdOffset );
ft_read32( RAM_CMD + cmdOffset - 4U, &address);
4°/ Display the icon:
Code: [Select]
ft_wait4CoproReady();
ft_write32( RAM_CMD + cmdOffset, CMD_DLSTART );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, CLEAR_COLOR_RGB(10, 10, 60) );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, CLEAR(1 ,1 ,1) );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, SAVE_CONTEXT() );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, BITMAP_SOURCE( address ) );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, BITMAP_LAYOUT( ARGB2, icon.stride, icon.height ) );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, BITMAP_SIZE( NEAREST, BORDER, BORDER, icon.width, icon.height ) );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, BEGIN( BITMAPS ) );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, VERTEX2F( x * 16, y * 16 ) );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, END() );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, DISPLAY() );
ft_incCmdOffset( 4u );
ft_write32( RAM_CMD + cmdOffset, CMD_SWAP );
ft_incCmdOffset( 4u );
ft_write16( REG_CMD_WRITE, cmdOffset );
If the step 2 (display splash) is not executed, the icon is correctly display. If displayed, the icon is changed into garbage.
Could someone explain this behaviour ?
Thanks in advance.
Regards.