BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Author Topic: Resetting handles  (Read 7936 times)

jrappa137

  • Newbie
  • *
  • Posts: 1
    • View Profile
Resetting handles
« on: January 13, 2020, 04:38:31 PM »

Hello,

Using the BT815, I am trying to dynamically allocate bitmap and font handles for a given display list.  I would like to have many more graphics stored in flash than the 32 handles that are available.  My plan is that before starting a new display list, I will allocate all the handles I need for that display list to the bitmaps and fonts used. 

However, I'm running into an issue.  For example -

1.) In one display list:
Use CMD_SETFONT2 to assign a custom font to handle 0.

Result: Font is accessed and displayed as expected

2.) In the next display list:
Select bitmap handle 0 with BITMAP_HANDLE
Use CMD_SETBITMAP to set the source, format, etc. of a single bitmap in flash - I no longer need the font from step 1.

Result: Bitmap is not properly displayed (The color is not correct). 

If the handle is first used for a bitmap and then a font, the bitmap and font are both displayed correctly.

This leads me to believe that SETFONT2 has permanently assigned handle 0 to a font.
Is it possible to "undo" the setfont2 command? Or to reset all handles? Maybe I'm missing something else... Thank you for any hints you can provide!
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 733
    • View Profile
Re: Resetting handles
« Reply #1 on: January 15, 2020, 11:43:25 AM »

Hello,

Can you provide the code snippets from where you are settings the bitmaps handles?

Best Regards,
BRT Community
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 733
    • View Profile
Re: Resetting handles
« Reply #2 on: January 17, 2020, 04:25:32 PM »

Hello,

The development team looked into this and have found the behaviour is related to EVEs firmware.

Users can add the  BITMAP_SWIZZLE(RED,GREEN,BLUE,ALPHA)  before drawing the bitmap to rectify the issue.

Another finding is that if the bitmap is not in ASTC format, the colour can be shown correctly.

Here is the reference code:

Code: [Select]
void App_task_email_2020jan15() {
       const uint32_t fontNo = 0;
       const uint32_t fontAddr = 0;

       Gpu_CoCmd_FlashHelper_SwitchFullMode(g_phost);

       Common_Text("Testing bitmap issue after Cmd_SetFont2");
       Gpu_CoCmd_FlashRead(g_phost, fontAddr, 20992, 1024);

       uint16_t iw = 508;
       uint16_t ih = 120;
       uint16_t format = COMPRESSED_RGBA_ASTC_4x4_KHR;

       while (1) {
              /// Cmd_SetFont2
              if(1){
                     Common_StartDisplay();
                     
                     App_WrCoCmd_Buffer(g_phost, SAVE_CONTEXT());
                     App_WrCoCmd_Buffer(g_phost, COLOR_RGB(0, 0, 0));
                     Gpu_CoCmd_SetFont2(g_phost, fontNo, fontAddr, 0);
                     Gpu_CoCmd_Text(g_phost, 0, 0, fontNo, 0, "\x002d\x002c\x0039\x0032\x003b\x0035\x0037\x003c\x003d\x001c\x0029\x0036");
                     Gpu_CoCmd_ResetFonts(g_phost);
                     App_WrCoCmd_Buffer(g_phost, RESTORE_CONTEXT());
                     
                     Common_EndDisplay();
                     EVE_sleep(2000);
              }
              Gpu_CoCmd_ColdStart(g_phost);
              /// Draw bitmap with same handle number
              {


                     if (1){
                           Gpu_CoCmd_Dlstart(g_phost);


                           App_WrCoCmd_Buffer(g_phost, CLEAR(1, 1, 1));
                           App_WrCoCmd_Buffer(g_phost, COLOR_RGB(255, 255, 255));
                     }
                     Gpu_CoCmd_ResetFonts(g_phost);

                     App_WrCoCmd_Buffer(g_phost, SAVE_CONTEXT());
                     Gpu_Hal_LoadImageToMemory(g_phost, TEST_DIR "\\car_508x120_COMPRESSED_RGBA_ASTC_4x4_KHR.raw", RAM_G + 1024, LOAD);
                     Gpu_CoCmd_SetBitmap(g_phost, RAM_G + 1024, format, iw, ih);
                     App_WrCoCmd_Buffer(g_phost, BITMAP_SWIZZLE(RED,GREEN,BLUE,ALPHA));
                     App_WrCoCmd_Buffer(g_phost, BITMAP_HANDLE(fontNo));
                     App_WrCoCmd_Buffer(g_phost, BEGIN(BITMAPS));
                     App_WrCoCmd_Buffer(g_phost, VERTEX2II(0, 0, 0, 0));
                     App_WrCoCmd_Buffer(g_phost, END());
                     App_WrCoCmd_Buffer(g_phost, RESTORE_CONTEXT());
                     
                     Common_EndDisplay();
                     EVE_sleep(2000);
              }
       } // loop forever
}

Best Regards,
BRT Community
Logged