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

Pages: 1 [2]

Author Topic: ASTC Custom Font from Flash  (Read 15909 times)

Rudolph

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
Re: ASTC Custom Font from Flash
« Reply #15 on: November 23, 2022, 07:32:43 PM »

But that is just a theory for the moment, I am not entirely sure that the 40x40 pixels the font
converter outputs is really the size of the glyph.

The font convertor will take into account all character sizes in the input character set but doesn't not alter the glyph size for each individual character. For example, some characters may extend below the normal font baseline, and some may extend above the average character height, this is taken into account when setting the overall glyph width and height for all characters, so each glyph may be 40*40 but the given character within this glyph may not utilise the full 40*40 pixel size.

Well, that wasn't the question.
The question is if the width and heigth the font converter is reporting is actually the size of the bitmaps
as this looks like this is not necessarily the case:

Generated Folder: NotoSansSC-Regular_36_Extend
Format:           COMPRESSED_RGBA_ASTC_8x8_KHR
Compressed:       thorough
Layout Width:     80
Layout Height:    8
Pixel Width:      40
Pixel Height:     64

Generated Folder: NotoSansSC-Regular_36_Extend
Format:           COMPRESSED_RGBA_ASTC_10x5_KHR
Compressed:       thorough
Layout Width:     64
Layout Height:    8
Pixel Width:      40
Pixel Height:     40

The same font converted to the same target size should not have a height of 64 for ASTC 8x8 and
a height of 40 for ASTC 10x5.

Using a smaller size I get this:
Generated Folder: NotoSansSC-Regular_32_Extend
Format:           COMPRESSED_RGBA_ASTC_8x8_KHR
Compressed:       thorough
Layout Width:     64
Layout Height:    5
Pixel Width:      32
Pixel Height:     40

And the only reason I am asking is that knowing the sizes of the glyphs in bytes helps with setting up the fontcache.
Well, maybe that is something that the font converter could output in addition, bytes per glyph.

Quote
As a side note, I wish we had more than 32 bitmap-handles and could setup/query more than one font cache. ;)

I believe this is being looked at for future EVE revisions.

Best Regards,
BRT Community

Not that I am unhappy with BT817 but nice.  :)
If I were asked, I would have a few more ideas to add. :D
Logged

vdc

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: ASTC Custom Font from Flash
« Reply #16 on: November 29, 2022, 06:20:46 PM »

After using FontCache, I was able to display more custom chinese font, but the problem is the display keep flickering.

Quote
Font Conversion completed!

Generated Folder: FZShuSong_36_Extend
Format:           COMPRESSED_RGBA_ASTC_8x8_KHR
Compressed:       thorough
Layout Width:     80
Layout Height:    8
Pixel Width:      40
Pixel Height:     64
Number of characters in xfont file:      65408
Number of characters in user input file: 292
   Success: 287
   Fail:    5
   Fail code point: 0x5f00, 0x8a00, 0x9600, 0x9000, 0x9700
There are non-graphic characters filtered out.
FZShuSong_36_ASTC.xfont and FZShuSong_36_ASTC.glyph are generated successfully.

----------------------------------------------------------------------

    Gpu_CoCmd_SetFont2(phost, FONT_M_HANDLE, RAM_G + 1000000, 0);
    Gpu_CoCmd_FontCache(phost, FONT_M_HANDLE, 0xC000, 512000);

40*60*2 = 5120
5120 * 100 ( chars) = 512000 bytes (the value I use in FontCache command). 0xC000 is address in RAM_G ?

Gpu_Hal_Wr16(host, REG_AH_HCYCLE_MAX, DispHCycle + 700); is in the setup.

Display now can show more chinese characters but the screen keep flickering. Any suggestion?
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 734
    • View Profile
Re: ASTC Custom Font from Flash
« Reply #17 on: November 30, 2022, 02:20:42 PM »

Hello,

Yes 0xC000 is the RAM_G address for the font cache.

I note you are using the same display settings that Riverdi implement in their example code for this display.
Are you seeing a deterministic flicker, i.e. does it happen when a certain screen is displayed in your application, or is this a 'random' flicker that is indetermnisitc?

Best Regards,
BRT Community
Logged

vdc

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: ASTC Custom Font from Flash
« Reply #18 on: November 30, 2022, 03:32:53 PM »

Yes, I based on the datasheet from Riverdi for display setting.

The flicker only happen if I display more Custom Font Characters. If I only display like 20 characters then it works fine. However, when I try to run more. The flicker happen.

If only these line, then it works fine.
Quote
    Gpu_CoCmd_Text(phost, 30, 133/2, FONT_M_HANDLE, OPT_CENTERY, "设置流速");
    Gpu_CoCmd_Text(phost, 230, 133/2, FONT_M_HANDLE, OPT_CENTERY, "= 10 ml/min");



    Gpu_CoCmd_Text(phost, 30, 133/2 + 133, FONT_M_HANDLE, OPT_CENTERY, "实际流速");
    Gpu_CoCmd_Text(phost, 230, 133/2 + 133, FONT_M_HANDLE, OPT_CENTERY, "= 10 ml/min");

When I add more, then flicker happens

Quote
    Gpu_CoCmd_Text(phost, 30, 133/2 + 266, FONT_M_HANDLE, OPT_CENTERY, "输注量");
    Gpu_CoCmd_Text(phost, 230, 133/2 + 266, FONT_M_HANDLE, OPT_CENTERY, "= 0 ml");



    Gpu_CoCmd_Text(phost, 550, 133/2 + 133, FONT_M_HANDLE, OPT_CENTERY, "T = 33.8 °C");

    Gpu_CoCmd_Text(phost, 550, 133/2 + 266, FONT_M_HANDLE, OPT_CENTERY, "P = 130 mmHg");


    //Gpu_CoCmd_FillWidth(phost, 50);
    Gpu_CoCmd_Text(phost, 50, 400, FONT_M_HANDLE, OPT_CENTERY, "重新启动系统");

    Gpu_CoCmd_Text(phost, 50, 450, FONT_M_HANDLE, OPT_CENTERY, "更换新的一次");

    Gpu_CoCmd_Text(phost, 50, 500, FONT_M_HANDLE, OPT_CENTERY, "性使用输血通用管路");
    // End

This is just example.
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 389
    • View Profile
Re: ASTC Custom Font from Flash
« Reply #19 on: November 30, 2022, 03:47:49 PM »

Have you checked with CMD_FONTCACHEQUERY how many glyphs are actually used?
In my experience it does not flicker though, using more characters than there is room for in the cache did result in crashes for me.

And I just checked the timings, I am using these as well.
Except for the magic cookie "0xD12" as my library configures the display clock by Hz.
"0xD12" is 51MHz though according to table 4-11 of the datasheet and I am using 51MHz.

How fast do you update the display?
There is flickering when you try to update the display list faster than EVE can display it.
With the given timing parameters the frame rate is 59,76 Hz so the pause between two updates should be
longer than 16.73 ms.
Logged

vdc

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: ASTC Custom Font from Flash
« Reply #20 on: December 01, 2022, 03:34:57 PM »

Hi Rudolph,

Here is my sample code

Quote
int main(void)
{
   BT81X_Setup();
   
   while(1){
      uint32_t totalBefore;
      uint32_t totalAfter;
      int32_t usedBefore;
      int32_t usedAfter;


      // Screen PreCode
      Gpu_CoCmd_Dlstart(phost);
      App_WrCoCmd_Buffer(phost, CLEAR_COLOR_RGB(0, 0, 0));
      App_WrCoCmd_Buffer(phost,CLEAR(1,1,1));

      // Start
      // Set Font Handle
      //Gpu_CoCmd_SetFont2(phost, FONT_S_HANDLE, RAM_G + 1000000, 0);
      Gpu_CoCmd_SetFont2(phost, FONT_M_HANDLE, RAM_G + 1000000, 0);
      Gpu_CoCmd_FontCache(phost, FONT_M_HANDLE, 0xC000, 512000);
      App_Flush_Co_Buffer(phost);

      Gpu_CoCmd_SetBitmap(phost, RAM_G + 1000000, COMPRESSED_RGBA_ASTC_8x8_KHR, 40, 64);

      Gpu_CoCmd_FontCacheQuery(phost, &totalBefore, &usedBefore);
      UARTprintf("totalBefore: %d, usedBefore: %d\r\n", totalBefore, usedBefore);


      App_WrCoCmd_Buffer(phost, COLOR_RGB(0xFF,0xCA,0x18));

      Gpu_CoCmd_Text(phost, 30, 133/2, FONT_M_HANDLE, OPT_CENTERY, "设置流速");
      Gpu_CoCmd_Text(phost, 230, 133/2, FONT_M_HANDLE, OPT_CENTERY, "= 10 ml/min");

      Gpu_CoCmd_Text(phost, 30, 133/2 + 133, FONT_M_HANDLE, OPT_CENTERY, "实际流速");
      Gpu_CoCmd_Text(phost, 230, 133/2 + 133, FONT_M_HANDLE, OPT_CENTERY, "= 10 ml/min");

      Gpu_CoCmd_Text(phost, 30, 133/2 + 266, FONT_M_HANDLE, OPT_CENTERY, "输注量");
      Gpu_CoCmd_Text(phost, 230, 133/2 + 266, FONT_M_HANDLE, OPT_CENTERY, "= 0 ml");

      Gpu_CoCmd_Text(phost, 550, 133/2 + 133, FONT_M_HANDLE, OPT_CENTERY, "T = 33.8 °C");
      Gpu_CoCmd_Text(phost, 550, 133/2 + 266, FONT_M_HANDLE, OPT_CENTERY, "P = 130 mmHg");

      //Gpu_CoCmd_FillWidth(phost, 50);
      Gpu_CoCmd_Text(phost, 50, 400, FONT_M_HANDLE, OPT_CENTERY, "重新启动系统");

      Gpu_CoCmd_Text(phost, 50, 450, FONT_M_HANDLE, OPT_CENTERY, "更换新的一次");

      Gpu_CoCmd_Text(phost, 50, 500, FONT_M_HANDLE, OPT_CENTERY, "性使用输血通用管路");
      // End

      Gpu_CoCmd_FontCacheQuery(phost, &totalAfter, &usedAfter);
      UARTprintf("totalAfter: %d, usedAfter: %d\r\n\r\n", totalAfter, usedAfter);

      // Screen PostCode
      App_WrCoCmd_Buffer(phost, DISPLAY());
      Gpu_CoCmd_Swap(phost);
      App_Flush_Co_Buffer(phost); //Download the commands into fifo
      while(EVE_busy()); // Gpu_Hal_WaitCmdfifo_empty(phost); //Wait till coprocessor completes the operation
      
      delay_ms(100);
   }
   
}


And print out:

Quote
totalBefore: 789, usedBefore: 0
totalAfter: 789, usedAfter: 45

I changed the size in fontcache to difference value like 256000 (394 total) or 128000 (197 in total). I also try the delay_ms up to 1000ms. The screen still flickering but not much as 100ms/10ms delay time.

My application requires update at least one every 1 second (for RTC) and update when display variable changed like 10 ml/min to 11ml/min or more...

Do I need to change the display setup and how to know I'm setup correctly?

Best regards,

Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 734
    • View Profile
Re: ASTC Custom Font from Flash
« Reply #21 on: December 05, 2022, 10:24:57 AM »

Hello,

Could you try moving the font cache setup outside of the while loop you are running? You are running this for every screen update which is not necessary.

You may also want to check the value of REG_UNDERRUN after a swap operation to see if any underrun is being detected by EVE.

Best Regards,
BRT Community
Logged

vdc

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: ASTC Custom Font from Flash
« Reply #22 on: December 08, 2022, 02:33:18 PM »

yeah, remove font cache every screen help alot too. No more flickering. I will keep update if there are any problem.

Thank you so much.
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 734
    • View Profile
Re: ASTC Custom Font from Flash
« Reply #23 on: December 09, 2022, 09:39:29 AM »

Hello,

Glad to hear you have mitigated the issue, please do let us know if you run into any more problems.

Best Regards,
BRT Community
Logged
Pages: 1 [2]